remove deadlock from pixmap render surface, mutex lock is being held while waiting... 86/43086/3
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Tue, 7 Jul 2015 15:20:48 +0000 (16:20 +0100)
committerKimmo Hoikka <kimmo.hoikka@samsung.com>
Thu, 9 Jul 2015 17:27:23 +0000 (18:27 +0100)
Change-Id: Idcabfee4a7dc2dabf1f9a8f86d8960f9ae8f8187

adaptors/integration-api/wayland/pixmap-render-surface.h
adaptors/integration-api/x11/pixmap-render-surface.h
adaptors/wayland/pixmap-render-surface-wl.cpp
adaptors/x11/pixmap-render-surface-x.cpp

index ede6450..bb7a0e4 100644 (file)
@@ -124,9 +124,8 @@ private:
    * If sync mode is WAIT, then acquire a lock. This prevents render thread from
    * continuing until the pixmap has been drawn by the compositor.
    * It must be released for rendering to continue.
-   * @param[in] syncMode The current sync mode
    */
-  void AcquireLock( SyncMode syncMode );
+  void AcquireLock();
 
   /**
    * Release any locks.
index 06c8903..cd9b5ce 100644 (file)
@@ -124,9 +124,8 @@ private:
    * If sync mode is WAIT, then acquire a lock. This prevents render thread from
    * continuing until the pixmap has been drawn by the compositor.
    * It must be released for rendering to continue.
-   * @param[in] syncMode The current sync mode
    */
-  void AcquireLock( SyncMode syncMode );
+  void AcquireLock();
 
   /**
    * Release any locks.
index 4d4db90..6d7a716 100644 (file)
@@ -158,7 +158,7 @@ void PixmapRenderSurface::SetSyncMode( SyncMode syncMode )
   // FIXME
 }
 
-void PixmapRenderSurface::AcquireLock( SyncMode syncMode )
+void PixmapRenderSurface::AcquireLock()
 {
   // FIXME
 }
index cfdf34c..02f25e7 100644 (file)
@@ -152,6 +152,8 @@ void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract
   // flush gl instruction queue
   glAbstraction.Flush();
 
+  mImpl->mSyncReceived = false;
+
   // create damage for client applications which wish to know the update timing
   if( mRenderNotification )
   {
@@ -186,7 +188,10 @@ void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract
     }
   }
 
-  AcquireLock( replacingSurface ? SYNC_MODE_NONE : SYNC_MODE_WAIT );
+  if( !replacingSurface && mImpl->mSyncMode != SYNC_MODE_NONE )
+  {
+    AcquireLock();
+  }
 }
 
 void PixmapRenderSurface::StopRender()
@@ -233,26 +238,18 @@ void PixmapRenderSurface::SetSyncMode( SyncMode syncMode )
   mImpl->mSyncMode = syncMode;
 }
 
-void PixmapRenderSurface::AcquireLock( SyncMode syncMode )
+void PixmapRenderSurface::AcquireLock()
 {
-  Dali::Mutex::ScopedLock lock( mImpl->mSyncMutex );
-
-  // wait for sync
-  if( syncMode != SYNC_MODE_NONE &&
-      mImpl->mSyncMode != SYNC_MODE_NONE &&
-      !mImpl->mSyncReceived )
+  if( !mImpl->mSyncReceived )
   {
-    mImpl->mSyncNotify.Wait( );
+    mImpl->mSyncNotify.Wait();
   }
   mImpl->mSyncReceived = false;
 }
 
 void PixmapRenderSurface::ReleaseLock()
 {
-  {
-    Dali::Mutex::ScopedLock lock( mImpl->mSyncMutex );
-    mImpl->mSyncReceived = true;
-  }
+  mImpl->mSyncReceived = true;
 
   // wake render thread if it was waiting for the notify
   mImpl->mSyncNotify.Notify();