Use separated semaphore in CombinedUpdateRenderController 27/245827/1
authorHeeyong Song <heeyong.song@samsung.com>
Fri, 16 Oct 2020 07:38:10 +0000 (16:38 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Fri, 16 Oct 2020 07:38:16 +0000 (16:38 +0900)
Change-Id: I2f611e1e62b9c3b69949c25fc25d41f241e6a67b

dali/internal/adaptor/common/combined-update-render-controller.cpp
dali/internal/adaptor/common/combined-update-render-controller.h

index 205c959..eb28975 100644 (file)
@@ -94,6 +94,7 @@ CombinedUpdateRenderController::CombinedUpdateRenderController( AdaptorInternalS
   mUpdateStatusLogger( environmentOptions ),
   mEventThreadSemaphore(),
   mGraphicsInitializeSemaphore(),
+  mSurfaceSemaphore(),
   mUpdateRenderThreadWaitCondition(),
   mAdaptorInterfaces( adaptorInterfaces ),
   mPerformanceInterface( adaptorInterfaces.GetPerformanceInterface() ),
@@ -140,6 +141,7 @@ CombinedUpdateRenderController::CombinedUpdateRenderController( AdaptorInternalS
   // Initialize to 0 so that it just waits if sem_post has not been called
   sem_init( &mEventThreadSemaphore, 0, 0 );
   sem_init( &mGraphicsInitializeSemaphore, 0, 0 );
+  sem_init( &mSurfaceSemaphore, 0, 0 );
 }
 
 CombinedUpdateRenderController::~CombinedUpdateRenderController()
@@ -319,7 +321,7 @@ void CombinedUpdateRenderController::ReplaceSurface( Dali::RenderSurfaceInterfac
     }
 
     // Wait until the surface has been replaced
-    sem_wait( &mEventThreadSemaphore );
+    sem_wait( &mSurfaceSemaphore );
 
     LOG_EVENT( "Surface replaced, event-thread continuing" );
   }
@@ -342,7 +344,7 @@ void CombinedUpdateRenderController::DeleteSurface( Dali::RenderSurfaceInterface
     }
 
     // Wait until the surface has been deleted
-    sem_wait( &mEventThreadSemaphore );
+    sem_wait( &mSurfaceSemaphore );
 
     LOG_EVENT( "Surface deleted, event-thread continuing" );
   }
@@ -940,7 +942,7 @@ Dali::RenderSurfaceInterface* CombinedUpdateRenderController::ShouldSurfaceBeRep
 void CombinedUpdateRenderController::SurfaceReplaced()
 {
   // Just increment the semaphore
-  sem_post( &mEventThreadSemaphore );
+  sem_post( &mSurfaceSemaphore );
 }
 
 Dali::RenderSurfaceInterface* CombinedUpdateRenderController::ShouldSurfaceBeDeleted()
@@ -956,7 +958,7 @@ Dali::RenderSurfaceInterface* CombinedUpdateRenderController::ShouldSurfaceBeDel
 void CombinedUpdateRenderController::SurfaceDeleted()
 {
   // Just increment the semaphore
-  sem_post( &mEventThreadSemaphore );
+  sem_post( &mSurfaceSemaphore );
 }
 
 bool CombinedUpdateRenderController::ShouldSurfaceBeResized()
index 6d0cb37..c87a1a6 100644 (file)
@@ -343,8 +343,9 @@ private:
   FpsTracker                        mFpsTracker;                       ///< Object that tracks the FPS
   UpdateStatusLogger                mUpdateStatusLogger;               ///< Object that logs the update-status as required.
 
-  sem_t                             mEventThreadSemaphore;             ///< Used by the event thread to ensure all threads have been initialised, and when replacing the surface.
+  sem_t                             mEventThreadSemaphore;             ///< Used by the event thread to ensure all threads have been initialised.
   sem_t                             mGraphicsInitializeSemaphore;      ///< Used by the render thread to ensure the graphics has been initialised.
+  sem_t                             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.