/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
mTbmFormat( isTransparent ? TBM_FORMAT_ARGB8888 : TBM_FORMAT_RGB888 ),
mOwnSurface( false ),
mDrawableCompleted( false ),
+ mTbmQueue( NULL ),
mConsumeSurface( NULL ),
mThreadSynchronization( NULL )
{
Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
- eglImpl.CreateSurfaceWindow( (EGLNativeWindowType)mImpl->mTbmQueue, mImpl->mColorDepth );
+ eglImpl.CreateSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( mImpl->mTbmQueue ), mImpl->mColorDepth );
}
void NativeRenderSurface::DestroyEglSurface( EglInterface& egl )
Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
- return eglImpl.ReplaceSurfaceWindow( (EGLNativeWindowType)mImpl->mTbmQueue ); // reinterpret_cast does not compile
+ return eglImpl.ReplaceSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( mImpl->mTbmQueue ) );
}
void NativeRenderSurface::StartRender()
Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
eglImpl.SwapBuffers();
+ if( mImpl->mThreadSynchronization )
+ {
+ mImpl->mThreadSynchronization->PostRenderStarted();
+ }
+
if( tbm_surface_queue_can_acquire( mImpl->mTbmQueue, 1 ) )
{
if( tbm_surface_queue_acquire( mImpl->mTbmQueue, &mImpl->mConsumeSurface ) != TBM_SURFACE_QUEUE_ERROR_NONE )
mImpl->mRenderNotification->Trigger();
}
+ 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
ReleaseDrawable();
}
void NativeRenderSurface::ReleaseLock()
{
- ConditionalWait::ScopedLock lock( mImpl->mTbmSurfaceCondition );
- if( mImpl->mConsumeSurface )
+ if( mImpl->mThreadSynchronization )
{
mImpl->mThreadSynchronization->PostRenderComplete();
}