/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
#include <dali/integration-api/thread-synchronization-interface.h>
#include <dali/internal/system/common/trigger-event.h>
#include <dali/internal/window-system/common/display-connection.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
+#include <dali/internal/adaptor/common/adaptor-impl.h>
+#include <dali/internal/adaptor/common/adaptor-internal-services.h>
+
namespace Dali
{
}
PixmapRenderSurfaceEcoreX::PixmapRenderSurfaceEcoreX( Dali::PositionSize positionSize, Any surface, bool isTransparent )
-: mPosition( positionSize ),
+: 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 )
{
PixmapRenderSurfaceEcoreX::~PixmapRenderSurfaceEcoreX()
{
+ DestroySurface();
+
// release the surface if we own one
if( mOwnSurface )
{
dpiVertical = int( yres + 0.5f );
}
-void PixmapRenderSurfaceEcoreX::InitializeEgl( EglInterface& egl )
+int PixmapRenderSurfaceEcoreX::GetOrientation() const
{
- DALI_LOG_TRACE_METHOD( gPixmapRenderSurfaceLogFilter );
+ return 0;
+}
+
+void PixmapRenderSurfaceEcoreX::InitializeGraphics()
+{
+ mGraphics = &mAdaptor->GetGraphicsInterface();
+ mDisplayConnection = &mAdaptor->GetDisplayConnectionInterface();
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+ auto eglGraphics = static_cast<EglGraphics *>(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<Internal::Adaptor::EglImplementation&>( egl );
+ auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
for (int i = 0; i < BUFFER_COUNT; ++i)
{
}
}
-void PixmapRenderSurfaceEcoreX::DestroyEglSurface( EglInterface& egl )
+void PixmapRenderSurfaceEcoreX::DestroySurface()
{
DALI_LOG_TRACE_METHOD( gPixmapRenderSurfaceLogFilter );
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+ auto eglGraphics = static_cast<EglGraphics *>(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<XPixmap>( 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<Internal::Adaptor::EglImplementation&>( egl );
+ auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
for (int i = 0; i < BUFFER_COUNT; ++i)
{
{
}
-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<EglGraphics *>(mGraphics);
+
// flush gl instruction queue
+ Integration::GlAbstraction& glAbstraction = eglGraphics->GetGlAbstraction();
glAbstraction.Flush();
if( mThreadSynchronization )
ConditionalWait::ScopedLock lock( mPixmapCondition );
mConsumeBufferIndex = __sync_fetch_and_xor( &mProduceBufferIndex, 1 ); // Swap buffer indexes.
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( 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<XPixmap>( mX11Pixmaps[mProduceBufferIndex] );
rect.width = mPosition.width;
rect.height = mPosition.height;
- XDisplay* display = AnyCast<XDisplay*>(displayConnection->GetDisplay());
+ XDisplay* display = AnyCast<XDisplay*>(mDisplayConnection->GetDisplay());
// make a fixes region as updated area
region = XFixesCreateRegion( display, &rect, 1 );
}
}
-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()