From 3b94b19dce5604b0511f6d57cc3843523fac3060 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Tue, 12 Dec 2023 13:20:11 +0900 Subject: [PATCH] [Tizen] Fix rendering occured unlimited if window size changed multiple 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: Ic19ede6ba5095af74ae2db33d37403285cf28a19 Signed-off-by: Eunki, Hong --- .../adaptor-framework/scene-holder-impl.cpp | 3 +++ dali/internal/adaptor/common/adaptor-impl.cpp | 9 +++++++++ dali/internal/adaptor/common/adaptor-impl.h | 6 ++++++ .../common/combined-update-render-controller.cpp | 19 ++++++++++++------- .../common/combined-update-render-controller.h | 3 ++- 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp index 32749aa..3950b57 100644 --- a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp +++ b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp @@ -249,6 +249,9 @@ void SceneHolder::SetAdaptor(Dali::Adaptor& adaptor) CreateRenderTarget(); OnAdaptorSet(adaptor); + + // Scene is newly created. Let we increase resize counter + mAdaptor->IncreaseSurfaceResizeCounter(); } void SceneHolder::CreateRenderTarget() diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index fc21e39..eb54486 100644 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -1066,6 +1066,15 @@ void Adaptor::SurfaceResizeComplete(Dali::RenderSurfaceInterface* surface, Surfa ProcessCoreEvents(); } +void Adaptor::IncreaseSurfaceResizeCounter() +{ + // Nofify surface resizing before flushing event queue + if(mThreadController) + { + mThreadController->ResizeSurface(); + } +} + void Adaptor::NotifySceneCreated() { GetCore().SceneCreated(); diff --git a/dali/internal/adaptor/common/adaptor-impl.h b/dali/internal/adaptor/common/adaptor-impl.h index 844888d..4dc79d5 100644 --- a/dali/internal/adaptor/common/adaptor-impl.h +++ b/dali/internal/adaptor/common/adaptor-impl.h @@ -425,6 +425,12 @@ public: void SurfaceResizeComplete(Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize); /** + * @brief Increase surface resize completed counter. + * This API will be ignored if thread controller is not exist. + */ + void IncreaseSurfaceResizeCounter(); + + /** * Sets layout direction of root by system language * @param[in] locale System locale */ diff --git a/dali/internal/adaptor/common/combined-update-render-controller.cpp b/dali/internal/adaptor/common/combined-update-render-controller.cpp index 8d73e51..5bc0449 100644 --- a/dali/internal/adaptor/common/combined-update-render-controller.cpp +++ b/dali/internal/adaptor/common/combined-update-render-controller.cpp @@ -699,7 +699,7 @@ void CombinedUpdateRenderController::UpdateRenderThread() { Integration::RenderStatus windowRenderStatus; - const bool sceneSurfaceResized = scene.IsSurfaceRectChanged(); + const uint32_t sceneSurfaceResized = scene.GetSurfaceRectChangedCount(); // clear previous frame damaged render items rects, buffer history is tracked on surface level mDamagedRects.clear(); @@ -713,7 +713,7 @@ void CombinedUpdateRenderController::UpdateRenderThread() Rect clippingRect; // Empty for fbo rendering // Switch to the context of the surface, merge damaged areas for previous frames - windowSurface->PreRender(sceneSurfaceResized, mDamagedRects, clippingRect); // Switch GL context + windowSurface->PreRender(sceneSurfaceResized > 0u, mDamagedRects, clippingRect); // Switch GL context // Render the surface mCore.RenderScene(windowRenderStatus, scene, false, clippingRect); @@ -721,9 +721,9 @@ void CombinedUpdateRenderController::UpdateRenderThread() // Buffer swapping now happens when the surface render target is presented. // If surface is resized, the surface resized count is decreased. - if(DALI_UNLIKELY(sceneSurfaceResized)) + if(DALI_UNLIKELY(sceneSurfaceResized > 0u)) { - SurfaceResized(); + SurfaceResized(sceneSurfaceResized); } } } @@ -916,12 +916,17 @@ void CombinedUpdateRenderController::SurfaceDeleted() mSurfaceSemaphore.Release(1); } -void CombinedUpdateRenderController::SurfaceResized() +void CombinedUpdateRenderController::SurfaceResized(uint32_t resizedCount) { ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition); - if(mSurfaceResized) + + if(mSurfaceResized >= resizedCount) + { + mSurfaceResized -= resizedCount; + } + else { - mSurfaceResized--; + mSurfaceResized = 0u; } } diff --git a/dali/internal/adaptor/common/combined-update-render-controller.h b/dali/internal/adaptor/common/combined-update-render-controller.h index d0e0f07..931c775 100644 --- a/dali/internal/adaptor/common/combined-update-render-controller.h +++ b/dali/internal/adaptor/common/combined-update-render-controller.h @@ -269,8 +269,9 @@ private: * Called by the Update/Render thread after a surface has been resized. * * This will lock the mutex in mEventThreadWaitCondition + * @param[in] resizedCount The number of resized count for given surface. */ - void SurfaceResized(); + void SurfaceResized(uint32_t resizedCount); /** * Helper for the thread calling the entry function -- 2.7.4