2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/window-system/tizen-wayland/display-connection-impl-ecore-wl.h>
20 #include <dali/internal/graphics/gles/egl-graphics.h>
23 #include <tbm_dummy_display.h>
24 #include <dali/integration-api/debug.h>
27 #include <Ecore_Wl2.h>
29 #include <Ecore_Wayland.h>
41 DisplayConnection* DisplayConnectionEcoreWl::New()
43 DisplayConnection* pDisplayConnection(new DisplayConnectionEcoreWl());
45 return pDisplayConnection;
48 DisplayConnectionEcoreWl::DisplayConnectionEcoreWl()
50 mSurfaceType( Integration::RenderSurface::WINDOW_RENDER_SURFACE ),
55 DisplayConnectionEcoreWl::~DisplayConnectionEcoreWl()
57 if( mSurfaceType == Integration::RenderSurface::NATIVE_RENDER_SURFACE )
59 ReleaseNativeDisplay();
63 Any DisplayConnectionEcoreWl::GetDisplay()
65 return Any( mDisplay );
68 void DisplayConnectionEcoreWl::ConsumeEvents()
72 bool DisplayConnectionEcoreWl::InitializeGraphics()
74 auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
75 EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
77 if( !eglImpl.InitializeGles( mDisplay ) )
79 DALI_LOG_ERROR("Failed to initialize GLES.\n");
86 void DisplayConnectionEcoreWl::SetSurfaceType( Integration::RenderSurface::Type type )
90 if( mSurfaceType == Integration::RenderSurface::NATIVE_RENDER_SURFACE )
92 mDisplay = GetNativeDisplay();
97 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get( NULL );
98 mDisplay = reinterpret_cast< EGLNativeDisplayType >( ecore_wl2_display_get( display ) );
100 mDisplay = reinterpret_cast< EGLNativeDisplayType >( ecore_wl_display_get() );
105 void DisplayConnectionEcoreWl::SetGraphicsInterface( GraphicsInterface& graphics )
107 mGraphics = &graphics;
110 EGLNativeDisplayType DisplayConnectionEcoreWl::GetNativeDisplay()
112 return reinterpret_cast< EGLNativeDisplayType >( tbm_dummy_display_create() );
115 void DisplayConnectionEcoreWl::ReleaseNativeDisplay()
119 tbm_dummy_display_destroy( reinterpret_cast< tbm_dummy_display* >( mDisplay ) );
123 } // namespace Adaptor
125 } // namespace Internal