From: David Steele Date: Thu, 13 Apr 2017 13:21:22 +0000 (+0100) Subject: [3.0] Ensured consistency of scene graph and render items X-Git-Tag: accepted/tizen/3.0/common/20170531.142806~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=4c8af0dfb14efdf61ab9eaf507dca05d13b36d0c;p=platform%2Fcore%2Fuifw%2Fdali-core.git [3.0] Ensured consistency of scene graph and render items There was a timing issue where UpdateManager's updateScene could be false, but the messageQueue flushed messages to the process queue just prior to ProcessSMessages being called which updated the scene graph. Have ensured that ProcessMessages returns true if there were updates to the scene graph, and changed UpdateManager to process the scene appropriately. Change-Id: I773f5eae2820ad1d93a78d0f3c784a7592ea320a Signed-off-by: David Steele --- diff --git a/dali/internal/update/manager/update-manager.cpp b/dali/internal/update/manager/update-manager.cpp index 1df67d3..0c6f697 100644 --- a/dali/internal/update/manager/update-manager.cpp +++ b/dali/internal/update/manager/update-manager.cpp @@ -917,7 +917,7 @@ unsigned int UpdateManager::Update( float elapsedSeconds, //Process Touches & Gestures const bool gestureUpdated = ProcessGestures( bufferIndex, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds ); - const bool updateScene = // The scene-graph requires an update if.. + bool updateScene = // The scene-graph requires an update if.. (mImpl->nodeDirtyFlags & RenderableUpdateFlags) || // ..nodes were dirty in previous frame OR IsAnimationRunning() || // ..at least one animation is running OR mImpl->messageQueue.IsSceneUpdateRequired() || // ..a message that modifies the scene graph node tree is queued OR @@ -934,8 +934,10 @@ unsigned int UpdateManager::Update( float elapsedSeconds, mImpl->transformManager.ResetToBaseValue(); } - //Process the queued scene messages - mImpl->messageQueue.ProcessMessages( bufferIndex ); + // Process the queued scene messages. Note, MessageQueue::FlushQueue may be called + // between calling IsSceneUpdateRequired() above and here, so updateScene should + // be set again + updateScene |= mImpl->messageQueue.ProcessMessages( bufferIndex ); //Post Process Ids of resources updated by renderer mImpl->resourceManager.PostProcessResources( bufferIndex ); diff --git a/dali/internal/update/queue/update-message-queue.cpp b/dali/internal/update/queue/update-message-queue.cpp index f6f7193..29b32ba 100644 --- a/dali/internal/update/queue/update-message-queue.cpp +++ b/dali/internal/update/queue/update-message-queue.cpp @@ -149,9 +149,10 @@ MessageQueue::~MessageQueue() void MessageQueue::EventProcessingStarted() { - mImpl->processingEvents = true; + mImpl->processingEvents = true; // called from event thread } +// Called from event thread unsigned int* MessageQueue::ReserveMessageSlot( unsigned int requestedSize, bool updateScene ) { DALI_ASSERT_DEBUG( 0 != requestedSize ); @@ -198,6 +199,7 @@ unsigned int* MessageQueue::ReserveMessageSlot( unsigned int requestedSize, bool return mImpl->currentMessageBuffer->ReserveMessageSlot( requestedSize ); } +// Called from event thread bool MessageQueue::FlushQueue() { const bool messagesToProcess = ( NULL != mImpl->currentMessageBuffer ); @@ -241,7 +243,7 @@ bool MessageQueue::FlushQueue() return messagesToProcess; } -void MessageQueue::ProcessMessages( BufferIndex updateBufferIndex ) +bool MessageQueue::ProcessMessages( BufferIndex updateBufferIndex ) { PERF_MONITOR_START(PerformanceMonitor::PROCESS_MESSAGES); @@ -275,6 +277,8 @@ void MessageQueue::ProcessMessages( BufferIndex updateBufferIndex ) mImpl->processQueue.clear(); PERF_MONITOR_END(PerformanceMonitor::PROCESS_MESSAGES); + + return ( mImpl->sceneUpdate & 0x01 ); // if it was previously 2, scene graph was updated. } bool MessageQueue::WasEmpty() const diff --git a/dali/internal/update/queue/update-message-queue.h b/dali/internal/update/queue/update-message-queue.h index c873967..e03d3f2 100644 --- a/dali/internal/update/queue/update-message-queue.h +++ b/dali/internal/update/queue/update-message-queue.h @@ -87,8 +87,9 @@ public: /** * Called once per update; process the previously flushed messages. * @param updateBufferIndex to use + * @return true if the scene graph node tree is updated */ - void ProcessMessages( BufferIndex updateBufferIndex ); + bool ProcessMessages( BufferIndex updateBufferIndex ); /** * Query whether the queue was empty this frame.