Ensure that a re-draw happens immediately after resuming.
authorDavid Steele <david.steele@samsung.com>
Wed, 19 Dec 2018 17:24:41 +0000 (17:24 +0000)
committerDavid Steele <david.steele@samsung.com>
Wed, 19 Dec 2018 17:24:41 +0000 (17:24 +0000)
Change-Id: I3e763e3c45e616fdda25c0d0fb0f7638d9530c11
Signed-off-by: David Steele <david.steele@samsung.com>
dali/graphics-api/graphics-api-controller.h
dali/graphics/vulkan/api/vulkan-api-controller.cpp
dali/graphics/vulkan/api/vulkan-api-controller.h
dali/internal/update/manager/update-manager.cpp

index 0a51f9eadd968aa5496fbf63ffdf3079bd37c32a..964b78a99050276415587ea8e669b5149a1052d6 100644 (file)
@@ -178,6 +178,13 @@ public:
    */
   virtual bool IsDiscardQueueEmpty() = 0;
 
+  /**
+   * @brief Test if the graphics subsystem has resumed & should force a draw
+   *
+   * @return true if the graphics subsystem requires a re-draw
+   */
+  virtual bool IsDrawOnResumeRequired() = 0;
+
   /**
    * @brief Waits until all previously submitted commands have been fully
    * executed.
index 08870d0261c505de8c2f35f8f3aa8ef2a4eb885f..2a804de8381a6db26cd98a68e94fc2d0a08a5c4f 100644 (file)
@@ -47,6 +47,7 @@
 #include <dali/graphics/vulkan/api/internal/vulkan-api-descriptor-set-allocator.h>
 
 #include <dali/graphics/thread-pool.h>
+#include <iostream>
 
 namespace Dali
 {
@@ -787,6 +788,7 @@ struct Controller::Impl
   std::vector<DescriptorSetList> mDescriptorSetsFreeList;
 
   uint32_t mBufferIndex{0u};
+  bool mDrawOnResume{ false };
 };
 
 // TODO: @todo temporarily ignore missing return type, will be fixed later
@@ -851,6 +853,7 @@ Controller& Controller::operator=( Controller&& ) noexcept = default;
 
 void Controller::BeginFrame()
 {
+  mImpl->mDrawOnResume = false;
   mStats.samplerTextureBindings = 0;
   mStats.uniformBufferBindings = 0;
 
@@ -916,10 +919,15 @@ void Controller::PrintStats()
 
 void Controller::Pause()
 {
+  std::cout << "VulkanAPIController::Pause()" << std::endl;
 }
 
 void Controller::Resume()
 {
+  std::cout << "VulkanAPIController::Resume()" << std::endl;
+
+  // Ensure we re-draw at least once:
+  mImpl->mDrawOnResume = true;
 }
 
 API::TextureFactory& Controller::GetTextureFactory() const
@@ -1011,6 +1019,11 @@ bool Controller::IsDiscardQueueEmpty()
   return mImpl->IsDiscardQueueEmpty();
 }
 
+bool Controller::IsDrawOnResumeRequired()
+{
+  return mImpl->mDrawOnResume;
+}
+
 void Controller::WaitIdle()
 {
   mImpl->mGraphics.GetGraphicsQueue(0u).GetVkHandle().waitIdle();
index 399bbef6146bae632567e24f7156d85ba6be3c84..a6f17cad49a01c76954d9242bdd8199dbc6cae19 100644 (file)
@@ -193,6 +193,8 @@ public:
 
   bool IsDiscardQueueEmpty() override;
 
+  bool IsDrawOnResumeRequired() override;
+
   void WaitIdle() override;
 
   void SwapBuffers() override;
index 791793cbc54fa51d14c636f6354b63a67dd6b6b3..959e353a17a4ffb1ff31fe80ea22a88a4a5bb2c0 100644 (file)
@@ -64,6 +64,7 @@
 #include <dali/graphics-api/graphics-api-buffer-factory.h>
 #include <dali/graphics-api/graphics-api-buffer.h>
 
+#include <iostream>
 
 // Un-comment to enable node tree debug logging
 //#define NODE_TREE_LOGGING 1
@@ -801,12 +802,13 @@ uint32_t UpdateManager::Update( float elapsedSeconds,
 
   //Process Touches & Gestures
   const bool gestureUpdated = ProcessGestures( bufferIndex, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds );
+  const bool resumed = mImpl->graphics.GetController().IsDrawOnResumeRequired();
 
-  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
-      gestureUpdated;                                       // ..a gesture property was updated
+  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
+    gestureUpdated;                                    // ..a gesture property was updated OR
 
   // Although the scene-graph may not require an update, we still need to synchronize double-buffered
   // values if the scene was updated in the previous frame.
@@ -822,6 +824,11 @@ uint32_t UpdateManager::Update( float elapsedSeconds,
   // be set again
   updateScene |= mImpl->messageQueue.ProcessMessages( bufferIndex );
 
+  std::cout << "Update: updateScene:" << updateScene << std::endl;
+  std::cout << "        resumed:" << resumed << std::endl;
+
+  updateScene |= resumed;
+
   // Although the scene-graph may not require an update, we still need to synchronize double-buffered
   // renderer lists if the scene was updated in the previous frame.
   // We should not start skipping update steps or reusing lists until there has been two frames where nothing changes