X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fwindow-system%2Ftizen-wayland%2Fnative-render-surface-ecore-wl.cpp;h=118b020adb6590ed68effe57bb368fb529a829a7;hb=bbe28a40f7970715cf707511b5749f193b698f74;hp=d5b586937ffdcd928e7ba4c2b35669ce64521eb8;hpb=98c88fe230906d4538cd2beb0388cb76bfdf8693;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.cpp b/dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.cpp index d5b5869..118b020 100644 --- a/dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.cpp +++ b/dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.cpp @@ -54,14 +54,11 @@ Debug::Filter* gNativeSurfaceLogFilter = Debug::Filter::New(Debug::Verbose, fals } // unnamed namespace NativeRenderSurfaceEcoreWl::NativeRenderSurfaceEcoreWl( SurfaceSize surfaceSize, Any surface, bool isTransparent ) -: mSurfaceSize( surfaceSize ), - mRenderNotification( NULL ), +: mRenderNotification( NULL ), mGraphics( NULL ), mEGL( nullptr ), mEGLSurface( nullptr ), mEGLContext( nullptr ), - mColorDepth( isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24 ), - mTbmFormat( isTransparent ? TBM_FORMAT_ARGB8888 : TBM_FORMAT_RGB888 ), mOwnSurface( false ), mDrawableCompleted( false ), mTbmQueue( NULL ), @@ -72,16 +69,23 @@ NativeRenderSurfaceEcoreWl::NativeRenderSurfaceEcoreWl( SurfaceSize surfaceSize, if( surface.Empty() ) { + mSurfaceSize = surfaceSize; + mColorDepth = isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24; + mTbmFormat = isTransparent ? TBM_FORMAT_ARGB8888 : TBM_FORMAT_RGB888; CreateNativeRenderable(); } else { - // check we have a valid type - DALI_ASSERT_ALWAYS( ( surface.GetType() == typeid (tbm_surface_queue_h) ) && "Surface type is invalid" ); mTbmQueue = AnyCast< tbm_surface_queue_h >( surface ); - } - setenv( "EGL_PLATFORM", "tbm", 1 ); + uint16_t width = static_cast( tbm_surface_queue_get_width( mTbmQueue ) ); + uint16_t height = static_cast( tbm_surface_queue_get_height( mTbmQueue ) ); + mSurfaceSize = SurfaceSize( width, height ); + + mTbmFormat = tbm_surface_queue_get_format( mTbmQueue ); + + mColorDepth = ( mTbmFormat == TBM_FORMAT_ARGB8888 ) ? COLOR_DEPTH_32 : COLOR_DEPTH_24; + } } NativeRenderSurfaceEcoreWl::~NativeRenderSurfaceEcoreWl() @@ -128,6 +132,11 @@ void NativeRenderSurfaceEcoreWl::WaitUntilSurfaceReplaced() mDrawableCompleted = false; } +Any NativeRenderSurfaceEcoreWl::GetNativeRenderable() +{ + return mTbmQueue; +} + PositionSize NativeRenderSurfaceEcoreWl::GetPositionSize() const { return PositionSize( 0, 0, static_cast( mSurfaceSize.GetWidth() ), static_cast( mSurfaceSize.GetHeight() ) ); @@ -152,10 +161,14 @@ void NativeRenderSurfaceEcoreWl::GetDpi( unsigned int& dpiHorizontal, unsigned i dpiVertical = int( yres + 0.5f ); } +int NativeRenderSurfaceEcoreWl::GetOrientation() const +{ + return 0; +} + void NativeRenderSurfaceEcoreWl::InitializeGraphics() { DALI_LOG_TRACE_METHOD( gNativeSurfaceLogFilter ); - unsetenv( "EGL_PLATFORM" ); mGraphics = &mAdaptor->GetGraphicsInterface(); auto eglGraphics = static_cast(mGraphics); @@ -229,18 +242,7 @@ void NativeRenderSurfaceEcoreWl::StartRender() bool NativeRenderSurfaceEcoreWl::PreRender( bool resizingSurface, const std::vector>& damagedRects, Rect& clippingRect ) { - auto eglGraphics = static_cast(mGraphics); - if (eglGraphics) - { - Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); - if (resizingSurface) - { - eglImpl.SetFullSwapNextFrame(); - } - - eglImpl.SetDamage(mEGLSurface, damagedRects, clippingRect); - } - + //TODO: Need to support partial update return true; } @@ -253,45 +255,62 @@ void NativeRenderSurfaceEcoreWl::PostRender( bool renderToFbo, bool replacingSur eglImpl.SwapBuffers( mEGLSurface, damagedRects ); } - if( mThreadSynchronization ) + //TODO: Move calling tbm_surface_queue_acruie to OffscreenWindow and Scene in EvasPlugin + if ( mOwnSurface ) { - mThreadSynchronization->PostRenderStarted(); - } + if( mThreadSynchronization ) + { + mThreadSynchronization->PostRenderStarted(); + } - if( tbm_surface_queue_can_acquire( mTbmQueue, 1 ) ) - { - if( tbm_surface_queue_acquire( mTbmQueue, &mConsumeSurface ) != TBM_SURFACE_QUEUE_ERROR_NONE ) + if( tbm_surface_queue_can_acquire( mTbmQueue, 1 ) ) { - DALI_LOG_ERROR( "Failed to acquire a tbm_surface\n" ); - return; + if( tbm_surface_queue_acquire( mTbmQueue, &mConsumeSurface ) != TBM_SURFACE_QUEUE_ERROR_NONE ) + { + DALI_LOG_ERROR( "Failed to acquire a tbm_surface\n" ); + return; + } } - } - tbm_surface_internal_ref( mConsumeSurface ); + if ( mConsumeSurface ) + { + tbm_surface_internal_ref( mConsumeSurface ); + } - if( replacingSurface ) - { - ConditionalWait::ScopedLock lock( mTbmSurfaceCondition ); - mDrawableCompleted = true; - mTbmSurfaceCondition.Notify( lock ); - } + if( replacingSurface ) + { + ConditionalWait::ScopedLock lock( mTbmSurfaceCondition ); + mDrawableCompleted = true; + mTbmSurfaceCondition.Notify( lock ); + } - // create damage for client applications which wish to know the update timing - if( !replacingSurface && mRenderNotification ) - { - // use notification trigger - // Tell the event-thread to render the tbm_surface - mRenderNotification->Trigger(); - } + // create damage for client applications which wish to know the update timing + if( !replacingSurface && mRenderNotification ) + { + // use notification trigger + // Tell the event-thread to render the tbm_surface + mRenderNotification->Trigger(); + } - if( mThreadSynchronization ) + if( mThreadSynchronization ) + { + // wait until the event-thread completed to use the tbm_surface + mThreadSynchronization->PostRenderWaitForCompletion(); + } + + // release the consumed surface after post render was completed + ReleaseDrawable(); + } + else { - // wait until the event-thread completed to use the tbm_surface - mThreadSynchronization->PostRenderWaitForCompletion(); + // create damage for client applications which wish to know the update timing + if( !replacingSurface && mRenderNotification ) + { + // use notification trigger + // Tell the event-thread to render the tbm_surface + mRenderNotification->Trigger(); + } } - - // release the consumed surface after post render was completed - ReleaseDrawable(); } void NativeRenderSurfaceEcoreWl::StopRender()