/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
// CLASS HEADER
#include <dali/internal/window-system/tizen-wayland/display-connection-impl-ecore-wl.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
// EXTERNAL_HEADERS
-#include <Ecore_Wayland.h>
+#include <tbm_dummy_display.h>
#include <dali/integration-api/debug.h>
-// INTERNAL HEADERS
-#include <dali/integration-api/wayland/native-render-surface.h>
+#ifdef ECORE_WAYLAND2
+#include <Ecore_Wl2.h>
+#else
+#include <Ecore_Wayland.h>
+#endif
namespace Dali
{
DisplayConnectionEcoreWl::DisplayConnectionEcoreWl()
: mDisplay( NULL ),
- mSurfaceType( RenderSurface::ECORE_RENDER_SURFACE )
+ mSurfaceType( RenderSurfaceInterface::WINDOW_RENDER_SURFACE ),
+ mGraphics( nullptr )
{
}
DisplayConnectionEcoreWl::~DisplayConnectionEcoreWl()
{
- if( mSurfaceType == RenderSurface::NATIVE_RENDER_SURFACE )
+ if( mSurfaceType == RenderSurfaceInterface::NATIVE_RENDER_SURFACE )
{
ReleaseNativeDisplay();
}
{
}
-bool DisplayConnectionEcoreWl::InitializeEgl(EglInterface& egl)
+bool DisplayConnectionEcoreWl::InitializeGraphics()
{
- EglImplementation& eglImpl = static_cast<EglImplementation&>(egl);
+ auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+ EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
if( !eglImpl.InitializeGles( mDisplay ) )
{
return true;
}
-void DisplayConnectionEcoreWl::SetSurfaceType( RenderSurface::Type type )
+void DisplayConnectionEcoreWl::SetSurfaceType( Dali::RenderSurfaceInterface::Type type )
{
mSurfaceType = type;
- if( mSurfaceType == RenderSurface::NATIVE_RENDER_SURFACE )
+ if( mSurfaceType == Dali::RenderSurfaceInterface::NATIVE_RENDER_SURFACE )
{
mDisplay = GetNativeDisplay();
}
else
{
+#ifdef ECORE_WAYLAND2
+ Ecore_Wl2_Display* display = ecore_wl2_connected_display_get( NULL );
+ mDisplay = reinterpret_cast< EGLNativeDisplayType >( ecore_wl2_display_get( display ) );
+#else
mDisplay = reinterpret_cast< EGLNativeDisplayType >( ecore_wl_display_get() );
+#endif
}
}
-void DisplayConnectionEcoreWl::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
+void DisplayConnectionEcoreWl::SetGraphicsInterface( GraphicsInterface& graphics )
{
- // calculate DPI
- float xres, yres;
-
- // 1 inch = 25.4 millimeters
- xres = ecore_wl_dpi_get();
- yres = ecore_wl_dpi_get();
-
- dpiHorizontal = int(xres + 0.5f); // rounding
- dpiVertical = int(yres + 0.5f);
+ mGraphics = &graphics;
}
EGLNativeDisplayType DisplayConnectionEcoreWl::GetNativeDisplay()
{
- return EGLNativeDisplayType();
+ return reinterpret_cast< EGLNativeDisplayType >( tbm_dummy_display_create() );
}
void DisplayConnectionEcoreWl::ReleaseNativeDisplay()
{
-
+ if( mDisplay )
+ {
+ tbm_dummy_display_destroy( reinterpret_cast< tbm_dummy_display* >( mDisplay ) );
+ }
}
} // namespace Adaptor