From: Eunki, Hong Date: Tue, 12 Dec 2023 04:20:11 +0000 (+0900) Subject: Fix rendering occured unlimited if window size changed multiple X-Git-Tag: dali_2.3.3~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2c7606ff25b3386009eb91ab08b6b7a3fa792651;hp=916d7a84373a0ec04c352eb5c2504eb8b37c4890;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git 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 --- diff --git a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp index 474cf73..5b82cc7 100644 --- a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp +++ b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp @@ -264,6 +264,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 6001eb6..a3592eb 100644 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -1109,6 +1109,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 98d1dbc..20b93a8 100644 --- a/dali/internal/adaptor/common/adaptor-impl.h +++ b/dali/internal/adaptor/common/adaptor-impl.h @@ -428,6 +428,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 a6ffa3b..b9598cc 100644 --- a/dali/internal/adaptor/common/combined-update-render-controller.cpp +++ b/dali/internal/adaptor/common/combined-update-render-controller.cpp @@ -607,7 +607,7 @@ void CombinedUpdateRenderController::UpdateRenderThread() auto numberOfPrecompiledShader = precompiledShader->shaderCount; for(int i = 0; i < numberOfPrecompiledShader; ++i) { - auto vertexShader = graphics.GetController().GetGlAbstraction().GetVertexShaderPrefix() + std::string(precompiledShader->vertexPrefix[i].data()) + std::string(precompiledShader->vertexShader.data()); + auto vertexShader = graphics.GetController().GetGlAbstraction().GetVertexShaderPrefix() + std::string(precompiledShader->vertexPrefix[i].data()) + std::string(precompiledShader->vertexShader.data()); auto fragmentShader = graphics.GetController().GetGlAbstraction().GetFragmentShaderPrefix() + std::string(precompiledShader->fragmentPrefix[i].data()) + std::string(precompiledShader->fragmentShader.data()); PreCompileShader(std::move(vertexShader), std::move(fragmentShader)); } @@ -798,7 +798,7 @@ void CombinedUpdateRenderController::UpdateRenderThread() TRACE_UPDATE_RENDER_SCOPE("DALI_RENDER_SCENE"); 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(); @@ -812,7 +812,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); @@ -820,9 +820,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); } } } @@ -1030,12 +1030,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 8ca10f8..8c7bea3 100644 --- a/dali/internal/adaptor/common/combined-update-render-controller.h +++ b/dali/internal/adaptor/common/combined-update-render-controller.h @@ -43,7 +43,6 @@ class TriggerEventInterface; namespace Internal { - namespace Adaptor { class AdaptorInternalServices; @@ -271,8 +270,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); /** * PreCompile shaders for launching time @@ -391,7 +391,7 @@ private: ///< Ensures we do not go to sleep if we have not processed the most recent update-request. volatile unsigned int mUseElapsedTimeAfterWait; ///< Whether we should use the elapsed time after waiting (set by the event-thread, read by the update-render-thread). - volatile unsigned int mIsPreCompileCancelled; ///< Whether we need to do precompile shader. + volatile unsigned int mIsPreCompileCancelled; ///< Whether we need to do precompile shader. Dali::RenderSurfaceInterface* volatile mNewSurface; ///< Will be set to the new-surface if requested (set by the event-thread, read & cleared by the update-render thread). Dali::RenderSurfaceInterface* volatile mDeletedSurface; ///< Will be set to the deleted surface if requested (set by the event-thread, read & cleared by the update-render thread).