From 19f6c83097f756220fecd4f7ec543df10d9095d9 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Tue, 7 Feb 2023 15:10:21 +0900 Subject: [PATCH] [Tizen] Make another ConditionalWait for post-rendearing The mUpdateRenderThreadWaitCondition was also used for post-rendering. But it can be notified by other method - ResizeSurface() etc. The PostRenderWaitForCompletion() should wait for the PostRenderComplete() of the main thread. So use another ConditionalWait. Change-Id: I890abcf95045e2d9701208cbe18ac8082219457b --- .../common/combined-update-render-controller.cpp | 18 ++++++++---------- .../adaptor/common/combined-update-render-controller.h | 3 ++- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/dali/internal/adaptor/common/combined-update-render-controller.cpp b/dali/internal/adaptor/common/combined-update-render-controller.cpp index 78431a6..086ecdf 100644 --- a/dali/internal/adaptor/common/combined-update-render-controller.cpp +++ b/dali/internal/adaptor/common/combined-update-render-controller.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -92,6 +92,7 @@ CombinedUpdateRenderController::CombinedUpdateRenderController(AdaptorInternalSe mEventThreadSemaphore(0), mSurfaceSemaphore(0), mUpdateRenderThreadWaitCondition(), + mPostRenderWaitCondition(), mAdaptorInterfaces(adaptorInterfaces), mPerformanceInterface(adaptorInterfaces.GetPerformanceInterface()), mCore(adaptorInterfaces.GetCore()), @@ -308,8 +309,7 @@ void CombinedUpdateRenderController::ReplaceSurface(Dali::RenderSurfaceInterface // Start replacing the surface. { ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition); - mPostRendering = FALSE; // Clear the post-rendering flag as Update/Render thread will replace the surface now - mNewSurface = newSurface; + mNewSurface = newSurface; mUpdateRenderThreadWaitCondition.Notify(lock); } @@ -331,7 +331,6 @@ void CombinedUpdateRenderController::DeleteSurface(Dali::RenderSurfaceInterface* // Start replacing the surface. { ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition); - mPostRendering = FALSE; // Clear the post-rendering flag as Update/Render thread will delete the surface now mDeletedSurface = surface; mUpdateRenderThreadWaitCondition.Notify(lock); } @@ -367,7 +366,6 @@ void CombinedUpdateRenderController::ResizeSurface() { ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition); - mPostRendering = FALSE; // Clear the post-rendering flag as Update/Render thread will resize the surface now // Surface is resized and the surface resized count is increased. mSurfaceResized++; mUpdateRenderThreadWaitCondition.Notify(lock); @@ -956,9 +954,9 @@ void CombinedUpdateRenderController::AddPerformanceMarker(PerformanceInterface:: void CombinedUpdateRenderController::PostRenderComplete() { - ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition); + ConditionalWait::ScopedLock lock(mPostRenderWaitCondition); mPostRendering = FALSE; - mUpdateRenderThreadWaitCondition.Notify(lock); + mPostRenderWaitCondition.Notify(lock); } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -967,19 +965,19 @@ void CombinedUpdateRenderController::PostRenderComplete() void CombinedUpdateRenderController::PostRenderStarted() { - ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition); + ConditionalWait::ScopedLock lock(mPostRenderWaitCondition); mPostRendering = TRUE; } void CombinedUpdateRenderController::PostRenderWaitForCompletion() { - ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition); + ConditionalWait::ScopedLock lock(mPostRenderWaitCondition); while(mPostRendering && !mNewSurface && // We should NOT wait if we're replacing the surface !mDeletedSurface && // We should NOT wait if we're deleting the surface !mDestroyUpdateRenderThread) { - mUpdateRenderThreadWaitCondition.Wait(lock); + mPostRenderWaitCondition.Wait(lock); } } diff --git a/dali/internal/adaptor/common/combined-update-render-controller.h b/dali/internal/adaptor/common/combined-update-render-controller.h index 8902875..3c4f29b 100644 --- a/dali/internal/adaptor/common/combined-update-render-controller.h +++ b/dali/internal/adaptor/common/combined-update-render-controller.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_H /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -340,6 +340,7 @@ private: Semaphore<> mSurfaceSemaphore; ///< Used by the event thread to ensure the surface has been deleted or replaced. ConditionalWait mUpdateRenderThreadWaitCondition; ///< The wait condition for the update-render-thread. + ConditionalWait mPostRenderWaitCondition; ///< The wait condition for the post render. AdaptorInternalServices& mAdaptorInterfaces; ///< The adaptor internal interface PerformanceInterface* mPerformanceInterface; ///< The performance logging interface -- 2.7.4