#include <dali/integration-api/gl-abstraction.h>
#include <dali/integration-api/debug.h>
+#ifdef ECORE_WAYLAND2
+#include <Ecore_Wl2.h>
+#else
#include <Ecore_Wayland.h>
+#endif
+
#include <tbm_bufmgr.h>
#include <tbm_surface_internal.h>
// INTERNAL INCLUDES
#include <dali/internal/system/common/trigger-event.h>
-#include <dali/internal/graphics/gles20/egl-implementation.h>
+#include <dali/internal/graphics/gles/egl-implementation.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
#include <dali/internal/window-system/common/display-connection.h>
+#include <dali/internal/window-system/common/window-system.h>
#include <dali/integration-api/thread-synchronization-interface.h>
namespace Dali
} // 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 ),
mConsumeSurface( NULL ),
mThreadSynchronization( NULL )
{
- ecore_wl_init( NULL );
+ Dali::Internal::Adaptor::WindowSystem::Initialize();
+
CreateNativeRenderable();
setenv( "EGL_PLATFORM", "tbm", 1 );
}
DALI_LOG_INFO( gNativeSurfaceLogFilter, Debug::General, "Own tbm surface queue destroy\n" );
}
- ecore_wl_shutdown();
+ Dali::Internal::Adaptor::WindowSystem::Shutdown();
}
Any NativeRenderSurfaceEcoreWl::GetDrawable()
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::InitializeEgl( EglInterface& egl )
+void NativeRenderSurfaceEcoreWl::InitializeGraphics( Internal::Adaptor::GraphicsInterface& graphics, DisplayConnection& displayConnection )
{
DALI_LOG_TRACE_METHOD( gNativeSurfaceLogFilter );
unsetenv( "EGL_PLATFORM" );
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+ mGraphics = &graphics;
+
+ auto eglGraphics = static_cast<Internal::Adaptor::EglGraphics *>(mGraphics);
+
+ EglInterface* mEGL = eglGraphics->Create();
- eglImpl.ChooseConfig( true, mColorDepth );
+ // Initialize EGL & OpenGL
+ displayConnection.Initialize();
+
+ Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>(*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<Internal::Adaptor::EglImplementation&>( egl );
+ auto eglGraphics = static_cast<Internal::Adaptor::EglGraphics *>(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<Internal::Adaptor::EglImplementation&>( egl );
+ auto eglGraphics = static_cast<Internal::Adaptor::EglGraphics *>(mGraphics);
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
+
eglImpl.DestroySurface();
}
-bool NativeRenderSurfaceEcoreWl::ReplaceEGLSurface( EglInterface& egl )
+bool NativeRenderSurfaceEcoreWl::ReplaceGraphicsSurface()
{
DALI_LOG_TRACE_METHOD( gNativeSurfaceLogFilter );
return false;
}
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+ auto eglGraphics = static_cast<Internal::Adaptor::EglGraphics *>(mGraphics);
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
return eglImpl.ReplaceSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( mTbmQueue ) );
}
{
}
-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<Internal::Adaptor::EglImplementation&>( egl );
+ auto eglGraphics = static_cast<Internal::Adaptor::EglGraphics *>(mGraphics);
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
+
eglImpl.SwapBuffers();
if( mThreadSynchronization )
{
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;
}
}