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=dd454f4020fb7973cfdeec791ce54f078e691517;hb=a38310eae5990fae285513f81a552c6e3e6cb7b5;hp=76acd2b22f33f80d2366f0316c8102d2edf3aa70;hpb=468bcd391562f2c303a4183a8cf6b3e9269ded8c;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 76acd2b..dd454f4 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 @@ -22,14 +22,21 @@ #include #include +#ifdef ECORE_WAYLAND2 +#include +#else #include +#endif + #include #include // INTERNAL INCLUDES #include -#include +#include +#include #include +#include #include namespace Dali @@ -44,9 +51,8 @@ Debug::Filter* gNativeSurfaceLogFilter = Debug::Filter::New(Debug::Verbose, fals } // unnamed namespace -NativeRenderSurfaceEcoreWl::NativeRenderSurfaceEcoreWl( Dali::PositionSize positionSize, const std::string& name, bool isTransparent ) +NativeRenderSurfaceEcoreWl::NativeRenderSurfaceEcoreWl( Dali::PositionSize positionSize, bool isTransparent ) : mPosition( positionSize ), - mTitle( name ), mRenderNotification( NULL ), mColorDepth( isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24 ), mTbmFormat( isTransparent ? TBM_FORMAT_ARGB8888 : TBM_FORMAT_RGB888 ), @@ -56,7 +62,8 @@ NativeRenderSurfaceEcoreWl::NativeRenderSurfaceEcoreWl( Dali::PositionSize posit mConsumeSurface( NULL ), mThreadSynchronization( NULL ) { - ecore_wl_init( NULL ); + Dali::Internal::Adaptor::WindowSystem::Initialize(); + CreateNativeRenderable(); setenv( "EGL_PLATFORM", "tbm", 1 ); } @@ -76,7 +83,7 @@ NativeRenderSurfaceEcoreWl::~NativeRenderSurfaceEcoreWl() DALI_LOG_INFO( gNativeSurfaceLogFilter, Debug::General, "Own tbm surface queue destroy\n" ); } - ecore_wl_shutdown(); + Dali::Internal::Adaptor::WindowSystem::Shutdown(); } Any NativeRenderSurfaceEcoreWl::GetDrawable() @@ -105,34 +112,73 @@ PositionSize NativeRenderSurfaceEcoreWl::GetPositionSize() const return mPosition; } -void NativeRenderSurfaceEcoreWl::InitializeEgl( EglInterface& egl ) +void NativeRenderSurfaceEcoreWl::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) +{ + // calculate DPI + float xres, yres; + + // 1 inch = 25.4 millimeters +#ifdef ECORE_WAYLAND2 + // TODO: Application should set dpi value in wayland2 + xres = 96; + yres = 96; +#else + xres = ecore_wl_dpi_get(); + yres = ecore_wl_dpi_get(); +#endif + + dpiHorizontal = int( xres + 0.5f ); // rounding + dpiVertical = int( yres + 0.5f ); +} + +void NativeRenderSurfaceEcoreWl::InitializeGraphics( Internal::Adaptor::GraphicsInterface& graphics, DisplayConnection& displayConnection ) { DALI_LOG_TRACE_METHOD( gNativeSurfaceLogFilter ); unsetenv( "EGL_PLATFORM" ); - Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + mGraphics = &graphics; + + auto eglGraphics = static_cast(mGraphics); + + EglInterface* mEGL = eglGraphics->Create(); - eglImpl.ChooseConfig( true, mColorDepth ); + // Initialize EGL & OpenGL + displayConnection.Initialize(); + + Internal::Adaptor::EglImplementation& eglImpl = static_cast(*mEGL); + eglImpl.ChooseConfig(true, mColorDepth); + + // Create the OpenGL context + mEGL->CreateContext(); + + // Create the OpenGL surface + CreateSurface(); + + // Make it current + mEGL->MakeContextCurrent(); } -void NativeRenderSurfaceEcoreWl::CreateEglSurface( EglInterface& egl ) +void NativeRenderSurfaceEcoreWl::CreateSurface() { DALI_LOG_TRACE_METHOD( gNativeSurfaceLogFilter ); - Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + auto eglGraphics = static_cast(mGraphics); + Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); eglImpl.CreateSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( mTbmQueue ), mColorDepth ); } -void NativeRenderSurfaceEcoreWl::DestroyEglSurface( EglInterface& egl ) +void NativeRenderSurfaceEcoreWl::DestroySurface() { DALI_LOG_TRACE_METHOD( gNativeSurfaceLogFilter ); - Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + auto eglGraphics = static_cast(mGraphics); + Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); + eglImpl.DestroySurface(); } -bool NativeRenderSurfaceEcoreWl::ReplaceEGLSurface( EglInterface& egl ) +bool NativeRenderSurfaceEcoreWl::ReplaceGraphicsSurface() { DALI_LOG_TRACE_METHOD( gNativeSurfaceLogFilter ); @@ -141,7 +187,8 @@ bool NativeRenderSurfaceEcoreWl::ReplaceEGLSurface( EglInterface& egl ) return false; } - Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + auto eglGraphics = static_cast(mGraphics); + Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); return eglImpl.ReplaceSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( mTbmQueue ) ); } @@ -150,23 +197,21 @@ void NativeRenderSurfaceEcoreWl::MoveResize( Dali::PositionSize positionSize ) { } -void NativeRenderSurfaceEcoreWl::SetViewMode( ViewMode viewMode ) -{ -} - void NativeRenderSurfaceEcoreWl::StartRender() { } -bool NativeRenderSurfaceEcoreWl::PreRender( EglInterface&, Integration::GlAbstraction&, bool ) +bool NativeRenderSurfaceEcoreWl::PreRender( bool ) { // nothing to do for pixmaps return true; } -void NativeRenderSurfaceEcoreWl::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface ) +void NativeRenderSurfaceEcoreWl::PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface ) { - Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + auto eglGraphics = static_cast(mGraphics); + Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); + eglImpl.SwapBuffers(); if( mThreadSynchronization ) @@ -178,7 +223,7 @@ void NativeRenderSurfaceEcoreWl::PostRender( EglInterface& egl, Integration::GlA { if( tbm_surface_queue_acquire( mTbmQueue, &mConsumeSurface ) != TBM_SURFACE_QUEUE_ERROR_NONE ) { - DALI_LOG_ERROR( "Failed to aquire a tbm_surface\n" ); + DALI_LOG_ERROR( "Failed to acquire a tbm_surface\n" ); return; } }