From: rubric Date: Mon, 31 Oct 2016 09:23:36 +0000 (+0900) Subject: [3.0] Modified the location of ReleaseSurface in NativeRenderSurface X-Git-Tag: accepted/tizen/3.0/common/20161114.081635^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=20a8aee944c95f6d626ade73cd8ba1ea7e7e2404 [3.0] Modified the location of ReleaseSurface in NativeRenderSurface [Model] Tizen 3.0 [Problem] Sometimes aquired ConsumeSurface is NULL [Cause & Measure] surface release timing between render thread and event thread [Checking Method] Run gallery application which uses EvasPlugin if it works fine [Developer] SinJae Lee Change-Id: I89a3b8f1adfb4091078d299ce290c0b484498a4f --- diff --git a/adaptors/integration-api/wayland/native-render-surface.h b/adaptors/integration-api/wayland/native-render-surface.h index 44caaa2..23a3120 100644 --- a/adaptors/integration-api/wayland/native-render-surface.h +++ b/adaptors/integration-api/wayland/native-render-surface.h @@ -79,11 +79,6 @@ public: // API */ virtual Any GetSurface(); - /** - * @brief Release the surface - */ - virtual void ReleaseSurface(); - public: // from Dali::RenderSurface /** diff --git a/adaptors/tizen/native-render-surface-tizen.cpp b/adaptors/tizen/native-render-surface-tizen.cpp index 0c94474..ecca85d 100644 --- a/adaptors/tizen/native-render-surface-tizen.cpp +++ b/adaptors/tizen/native-render-surface-tizen.cpp @@ -82,7 +82,6 @@ NativeRenderSurface::~NativeRenderSurface() // release the surface if we own one if( mImpl->mOwnSurface ) { - if( mImpl->mConsumeSurface ) { tbm_surface_queue_release( mImpl->mTbmQueue, mImpl->mConsumeSurface ); @@ -191,16 +190,12 @@ void NativeRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract mImpl->mThreadSynchronization->PostRenderStarted(); } + if( tbm_surface_queue_can_acquire( mImpl->mTbmQueue, 1 ) ) { - ConditionalWait::ScopedLock lock( mImpl->mTbmSurfaceCondition ); - - if( tbm_surface_queue_can_acquire( mImpl->mTbmQueue, 1 ) ) + if( tbm_surface_queue_acquire( mImpl->mTbmQueue, &mImpl->mConsumeSurface ) != TBM_SURFACE_QUEUE_ERROR_NONE ) { - if( tbm_surface_queue_acquire( mImpl->mTbmQueue, &mImpl->mConsumeSurface ) != TBM_SURFACE_QUEUE_ERROR_NONE ) - { - DALI_LOG_ERROR( "Failed aquire consume tbm_surface\n" ); - return; - } + DALI_LOG_ERROR( "Failed to aquire a tbm_surface\n" ); + return; } } @@ -214,8 +209,16 @@ void NativeRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract if( mImpl->mThreadSynchronization ) { + // wait until the event-thread completed to use the tbm_surface mImpl->mThreadSynchronization->PostRenderWaitForCompletion(); } + + // release the consumed surface after post render was completed + if( mImpl->mConsumeSurface ) + { + tbm_surface_queue_release( mImpl->mTbmQueue, mImpl->mConsumeSurface ); + mImpl->mConsumeSurface = NULL; + } } void NativeRenderSurface::StopRender() @@ -263,16 +266,6 @@ void NativeRenderSurface::CreateNativeRenderable() } } -void NativeRenderSurface::ReleaseSurface() -{ - ConditionalWait::ScopedLock lock( mImpl->mTbmSurfaceCondition ); - if( mImpl->mConsumeSurface ) - { - tbm_surface_queue_release( mImpl->mTbmQueue, mImpl->mConsumeSurface ); - mImpl->mConsumeSurface = NULL; - } -} - void NativeRenderSurface::ReleaseLock() { if( mImpl->mThreadSynchronization )