[Tizen] Fix rendering occured unlimited if window size changed multiple 13/305213/1 accepted/tizen/7.0/unified/20240130.230250 accepted/tizen/7.0/unified/20240130.230331
authorEunki, Hong <eunkiki.hong@samsung.com>
Tue, 12 Dec 2023 04:13:19 +0000 (13:13 +0900)
committersunghyun kim <scholb.kim@samsung.com>
Tue, 30 Jan 2024 05:45:06 +0000 (14:45 +0900)
To support multi window cases, dali-adaptor count how many times
the window resize event occured.

But in dali-core scene has only bool flag.

So if scene changed multiple times during 1 render time,
surface resized count never be reduced as zero.
So it will keep rendering unlimited.

This patch make we return the number of surface rect changed,
so dali-adaptor can control the scene changed count well.

Change-Id: I35d0bcef3ff33c67f106b276848a2b5a26ccc67c
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
automated-tests/src/dali/utc-Dali-Scene.cpp
dali/integration-api/scene.cpp
dali/integration-api/scene.h
dali/internal/event/common/scene-impl.cpp
dali/internal/event/common/scene-impl.h
dali/internal/update/common/scene-graph-scene.cpp
dali/internal/update/common/scene-graph-scene.h

index 959e5ee..b353486 100644 (file)
@@ -980,7 +980,7 @@ int UtcDaliSceneSurfaceResizedDefaultSceneViewport(void)
   DALI_TEST_CHECK(defaultScene);
 
   // consume the resize flag by first rendering
-  defaultScene.IsSurfaceRectChanged();
+  defaultScene.GetSurfaceRectChangedCount();
 
   // Ensure stage size matches the scene size
   auto stage = Stage::GetCurrent();
@@ -988,10 +988,10 @@ int UtcDaliSceneSurfaceResizedDefaultSceneViewport(void)
 
   Rect<int32_t> surfaceRect = defaultScene.GetCurrentSurfaceRect();
 
-  bool surfaceResized;
+  uint32_t surfaceResized;
   // check resized flag before surface is resized.
-  surfaceResized = defaultScene.IsSurfaceRectChanged();
-  DALI_TEST_EQUALS(surfaceResized, false, TEST_LOCATION);
+  surfaceResized = defaultScene.GetSurfaceRectChangedCount();
+  DALI_TEST_EQUALS(surfaceResized, 0u, TEST_LOCATION);
 
   // Resize the scene
   Vector2     newSize(1000.0f, 2000.0f);
@@ -1012,8 +1012,8 @@ int UtcDaliSceneSurfaceResizedDefaultSceneViewport(void)
   application.SendNotification();
   application.Render(0);
 
-  surfaceResized = defaultScene.IsSurfaceRectChanged();
-  DALI_TEST_EQUALS(surfaceResized, true, TEST_LOCATION);
+  surfaceResized = defaultScene.GetSurfaceRectChangedCount();
+  DALI_TEST_EQUALS(surfaceResized, 1u, TEST_LOCATION);
 
   // Check that the viewport is handled properly
   DALI_TEST_CHECK(callStack.FindIndexFromMethodAndParams("Viewport", viewportParams) >= 0);
@@ -1027,6 +1027,45 @@ int UtcDaliSceneSurfaceResizedDefaultSceneViewport(void)
   DALI_TEST_EQUALS(newSurfaceRect.width, 1000, TEST_LOCATION);
   DALI_TEST_EQUALS(newSurfaceRect.height, 2000, TEST_LOCATION);
 
+  // SurfaceRect should be changed.
+  surfaceRect = newSurfaceRect;
+
+  // Resize the scene multiple times
+  uint32_t resizeCount = 10u;
+
+  for(uint32_t i = 0u; i < resizeCount; ++i)
+  {
+    Vector2 newSize(1000.0f, 2100.0f + i);
+    DALI_TEST_CHECK(stage.GetSize() != newSize);
+    defaultScene.SurfaceResized(newSize.width, newSize.height);
+
+    DALI_TEST_EQUALS(stage.GetSize(), newSize, TEST_LOCATION);
+    DALI_TEST_EQUALS(defaultScene.GetSize(), newSize, TEST_LOCATION);
+
+    // Check current surface rect
+    Rect<int32_t> newSurfaceRect = defaultScene.GetCurrentSurfaceRect();
+
+    // It should not be changed yet.
+    DALI_TEST_CHECK(surfaceRect == newSurfaceRect);
+  }
+
+  // Render after resizing surface
+  application.SendNotification();
+  application.Render(0);
+
+  // Check whether the number of surface resized count get well.
+  surfaceResized = defaultScene.GetSurfaceRectChangedCount();
+  DALI_TEST_EQUALS(surfaceResized, resizeCount, TEST_LOCATION);
+
+  // Check current surface rect
+  newSurfaceRect = defaultScene.GetCurrentSurfaceRect();
+
+  // It should be changed
+  DALI_TEST_EQUALS(newSurfaceRect.x, 0, TEST_LOCATION);
+  DALI_TEST_EQUALS(newSurfaceRect.y, 0, TEST_LOCATION);
+  DALI_TEST_EQUALS(newSurfaceRect.width, 1000, TEST_LOCATION);
+  DALI_TEST_EQUALS(newSurfaceRect.height, 2100 + (resizeCount - 1), TEST_LOCATION);
+
   END_TEST;
 }
 
index b1781a9..dc47c6e 100644 (file)
@@ -194,9 +194,9 @@ const Rect<int32_t>& Scene::GetCurrentSurfaceRect() const
   return GetImplementation(*this).GetCurrentSurfaceRect();
 }
 
-bool Scene::IsSurfaceRectChanged() const
+uint32_t Scene::GetSurfaceRectChangedCount() const
 {
-  return GetImplementation(*this).IsSurfaceRectChanged();
+  return GetImplementation(*this).GetSurfaceRectChangedCount();
 }
 
 void Scene::SetRotationCompletedAcknowledgement()
index 5e4a3e4..26f85c8 100644 (file)
@@ -345,10 +345,11 @@ public:
   const Rect<int32_t>& GetCurrentSurfaceRect() const;
 
   /**
-   * Query wheter the surface rect is changed or not.
-   * @return true if the surface rect is changed.
+   * Query how many times the surface rect changed.
+   * @note It will reset surface rect changed count.
+   * @return The count of the surface rect changed.
    */
-  bool IsSurfaceRectChanged() const;
+  uint32_t GetSurfaceRectChangedCount() const;
 
   /**
    * @brief Send message to acknowledge for completing window rotation with current window orientation.
index d60e48b..f0af146 100644 (file)
@@ -375,9 +375,9 @@ void Scene::ChangedSurface(float width, float height, int32_t windowOrientation,
   }
 }
 
-bool Scene::IsSurfaceRectChanged() const
+uint32_t Scene::GetSurfaceRectChangedCount() const
 {
-  return mSceneObject ? mSceneObject->IsSurfaceRectChanged() : false;
+  return mSceneObject ? mSceneObject->GetSurfaceRectChangedCount() : 0u;
 }
 
 bool Scene::IsRotationCompletedAcknowledgementSet() const
index c431fee..f181a3c 100644 (file)
@@ -227,9 +227,9 @@ public:
   const Rect<int32_t>& GetCurrentSurfaceRect() const;
 
   /**
-   * @copydoc Dali::Integration::Scene::IsSurfaceRectChanged
+   * @copydoc Dali::Integration::Scene::GetSurfaceRectChangedCount
    */
-  bool IsSurfaceRectChanged() const;
+  uint32_t GetSurfaceRectChangedCount() const;
 
   /**
    * @copydoc Dali::Integration::Scene::SetSurfaceRenderTarget
index 198299a..6f6510f 100644 (file)
@@ -34,8 +34,7 @@ Scene::Scene()
   mSurfaceRect(),
   mSurfaceOrientation(0),
   mScreenOrientation(0),
-  mSurfaceRectChanged(false),
-  mRotationCompletedAcknowledgement(false)
+  mSurfaceRectChangedCount(0u)
 {
 }
 
@@ -149,10 +148,10 @@ bool Scene::IsRenderingSkipped() const
 
 void Scene::SetSurfaceRect(const Rect<int32_t>& rect)
 {
-  mSurfaceRect        = rect;
-  mSurfaceRectChanged = true;
+  DALI_LOG_RELEASE_INFO("update surfce rect in scene-graph, from width[%d], height[%d], to width[%d], height[%d]. Changed count [%d]\n", mSurfaceRect.width, mSurfaceRect.height, rect.width, rect.height, mSurfaceRectChangedCount + 1u);
 
-  DALI_LOG_RELEASE_INFO("update surfce rect in scene-graph, width[%d], height[%d]\n", mSurfaceRect.width, mSurfaceRect.height);
+  mSurfaceRect = rect;
+  ++mSurfaceRectChangedCount;
 
   if(mRoot)
   {
@@ -165,16 +164,18 @@ const Rect<int32_t>& Scene::GetSurfaceRect() const
   return mSurfaceRect;
 }
 
-bool Scene::IsSurfaceRectChanged()
+uint32_t Scene::GetSurfaceRectChangedCount()
 {
-  bool surfaceRectChanged = mSurfaceRectChanged;
-  mSurfaceRectChanged     = false;
+  uint32_t surfaceRectChangedCount = mSurfaceRectChangedCount;
+  mSurfaceRectChangedCount         = 0u;
 
-  return surfaceRectChanged;
+  return surfaceRectChangedCount;
 }
 
 void Scene::SetSurfaceOrientations(int32_t windowOrientation, int32_t screenOrienation)
 {
+  DALI_LOG_RELEASE_INFO("update orientation in scene-graph, from surface [%d], screen[%d], to surface [%d], screen[%d]\n", mSurfaceOrientation, mScreenOrientation, windowOrientation, screenOrienation);
+
   mSurfaceOrientation = windowOrientation;
   mScreenOrientation = screenOrienation;
 
@@ -182,8 +183,6 @@ void Scene::SetSurfaceOrientations(int32_t windowOrientation, int32_t screenOrie
   {
     mRoot->SetUpdated(true);
   }
-
-  DALI_LOG_RELEASE_INFO("update orientation in scene-graph, surface [%d], screen[%d]\n", mSurfaceOrientation, mScreenOrientation);
 }
 
 int32_t Scene::GetSurfaceOrientation() const
index 278d3f8..9cde999 100644 (file)
@@ -195,10 +195,11 @@ public:
   int32_t GetScreenOrientation() const;
 
   /**
-   * Query wheter the surface rect is changed or not.
-   * @return true if the surface rect is changed.
+   * Query how many times the surface rect changed.
+   * @note It will reset surface rect changed count.
+   * @return The count of the surface rect changed.
    */
-  bool IsSurfaceRectChanged();
+  uint32_t GetSurfaceRectChangedCount();
 
   /**
    * @brief Set the internal flag to acknowledge surface rotation.
@@ -306,8 +307,8 @@ private:
   Rect<int32_t> mSurfaceRect;                      ///< The rectangle of surface which is related ot this scene.
   int32_t       mSurfaceOrientation;               ///< The orientation of surface which is related of this scene
   int32_t       mScreenOrientation;                ///< The orientation of screen
-  bool          mSurfaceRectChanged;               ///< The flag of surface's rectangle is changed when is resized or moved.
   bool          mRotationCompletedAcknowledgement; ///< The flag of sending the acknowledgement to complete window rotation.
+  uint32_t mSurfaceRectChangedCount; ///< The numbero of surface's rectangle is changed when is resized or moved.
 
   // Render pass and render target