X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fwindow-system%2Fubuntu-x11%2Fpixmap-render-surface-ecore-x.cpp;h=c8e049c7132366a30fa5efa9fa7e5d8f2e466a99;hb=263ec21432f3d7c9f9be5b463748fdce8f6942e4;hp=ce91867a0f065d63f9bbaa45d2c9f5f50891ad21;hpb=981d50a117e6830786e8e45708a3f2cd816c1693;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/window-system/ubuntu-x11/pixmap-render-surface-ecore-x.cpp b/dali/internal/window-system/ubuntu-x11/pixmap-render-surface-ecore-x.cpp index ce91867..c8e049c 100644 --- a/dali/internal/window-system/ubuntu-x11/pixmap-render-surface-ecore-x.cpp +++ b/dali/internal/window-system/ubuntu-x11/pixmap-render-surface-ecore-x.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -34,6 +34,10 @@ #include #include #include +#include +#include +#include + namespace Dali { @@ -52,18 +56,19 @@ static const int INITIAL_PRODUCE_BUFFER_INDEX = 0; static const int INITIAL_CONSUME_BUFFER_INDEX = 1; } -PixmapRenderSurfaceEcoreX::PixmapRenderSurfaceEcoreX(Dali::PositionSize positionSize, - Any surface, - const std::string& name, - bool isTransparent) -: mPosition( positionSize ), - mTitle( name ), +PixmapRenderSurfaceEcoreX::PixmapRenderSurfaceEcoreX( Dali::PositionSize positionSize, Any surface, bool isTransparent ) +: mGraphics( nullptr ), + mDisplayConnection( nullptr ), + mPosition( positionSize ), mRenderNotification( NULL ), mColorDepth( isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24 ), mOwnSurface( false ), mProduceBufferIndex( INITIAL_PRODUCE_BUFFER_INDEX ), mConsumeBufferIndex( INITIAL_CONSUME_BUFFER_INDEX ), - mThreadSynchronization(NULL) + mX11Pixmaps(), + mEglSurfaces(), + mThreadSynchronization( nullptr ), + mPixmapCondition() { for( int i = 0; i != BUFFER_COUNT; ++i ) { @@ -143,20 +148,23 @@ void PixmapRenderSurfaceEcoreX::GetDpi( unsigned int& dpiHorizontal, unsigned in dpiVertical = int( yres + 0.5f ); } -void PixmapRenderSurfaceEcoreX::InitializeEgl( EglInterface& egl ) +void PixmapRenderSurfaceEcoreX::InitializeGraphics() { - DALI_LOG_TRACE_METHOD( gPixmapRenderSurfaceLogFilter ); + mGraphics = &mAdaptor->GetGraphicsInterface(); + mDisplayConnection = &mAdaptor->GetDisplayConnectionInterface(); - Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + auto eglGraphics = static_cast(mGraphics); + Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); eglImpl.ChooseConfig(false, mColorDepth); } -void PixmapRenderSurfaceEcoreX::CreateEglSurface( EglInterface& egl ) +void PixmapRenderSurfaceEcoreX::CreateSurface() { DALI_LOG_TRACE_METHOD( gPixmapRenderSurfaceLogFilter ); - Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + auto eglGraphics = static_cast(mGraphics); + Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); for (int i = 0; i < BUFFER_COUNT; ++i) { @@ -167,28 +175,32 @@ void PixmapRenderSurfaceEcoreX::CreateEglSurface( EglInterface& egl ) } } -void PixmapRenderSurfaceEcoreX::DestroyEglSurface( EglInterface& egl ) +void PixmapRenderSurfaceEcoreX::DestroySurface() { DALI_LOG_TRACE_METHOD( gPixmapRenderSurfaceLogFilter ); - Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + auto eglGraphics = static_cast(mGraphics); + + Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); for (int i = 0; i < BUFFER_COUNT; ++i) { // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit XPixmap pixmap = static_cast( mX11Pixmaps[i] ); eglImpl.MakeCurrent( EGLNativePixmapType( pixmap ), mEglSurfaces[i] ); - eglImpl.DestroySurface(); + eglImpl.DestroySurface( mEglSurfaces[i] ); } } -bool PixmapRenderSurfaceEcoreX::ReplaceEGLSurface( EglInterface& egl ) +bool PixmapRenderSurfaceEcoreX::ReplaceGraphicsSurface() { DALI_LOG_TRACE_METHOD( gPixmapRenderSurfaceLogFilter ); bool contextLost = false; - Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + auto eglGraphics = static_cast(mGraphics); + + Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); for (int i = 0; i < BUFFER_COUNT; ++i) { @@ -209,15 +221,18 @@ void PixmapRenderSurfaceEcoreX::StartRender() { } -bool PixmapRenderSurfaceEcoreX::PreRender( EglInterface& egl, Integration::GlAbstraction&, bool ) +bool PixmapRenderSurfaceEcoreX::PreRender( bool ) { // Nothing to do for pixmaps return true; } -void PixmapRenderSurfaceEcoreX::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, Dali::DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface ) +void PixmapRenderSurfaceEcoreX::PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface ) { + auto eglGraphics = static_cast(mGraphics); + // flush gl instruction queue + Integration::GlAbstraction& glAbstraction = eglGraphics->GetGlAbstraction(); glAbstraction.Flush(); if( mThreadSynchronization ) @@ -229,7 +244,7 @@ void PixmapRenderSurfaceEcoreX::PostRender( EglInterface& egl, Integration::GlAb ConditionalWait::ScopedLock lock( mPixmapCondition ); mConsumeBufferIndex = __sync_fetch_and_xor( &mProduceBufferIndex, 1 ); // Swap buffer indexes. - Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit XPixmap pixmap = static_cast( mX11Pixmaps[mProduceBufferIndex] ); @@ -258,7 +273,7 @@ void PixmapRenderSurfaceEcoreX::PostRender( EglInterface& egl, Integration::GlAb rect.width = mPosition.width; rect.height = mPosition.height; - XDisplay* display = AnyCast(displayConnection->GetDisplay()); + XDisplay* display = AnyCast(mDisplayConnection->GetDisplay()); // make a fixes region as updated area region = XFixesCreateRegion( display, &rect, 1 ); @@ -295,9 +310,13 @@ void PixmapRenderSurfaceEcoreX::ReleaseLock() } } -RenderSurface::Type PixmapRenderSurfaceEcoreX::GetSurfaceType() +Integration::RenderSurface::Type PixmapRenderSurfaceEcoreX::GetSurfaceType() +{ + return Integration::RenderSurface::PIXMAP_RENDER_SURFACE; +} + +void PixmapRenderSurfaceEcoreX::MakeContextCurrent() { - return RenderSurface::PIXMAP_RENDER_SURFACE; } void PixmapRenderSurfaceEcoreX::CreateRenderable()