2 * Copyright (c) 2021 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/graphics/gles/egl-graphics.h>
20 #include <dali/internal/window-system/tizen-wayland/display-connection-impl-ecore-wl.h>
23 #include <dali/integration-api/debug.h>
24 #include <tbm_dummy_display.h>
27 #include <Ecore_Wl2.h>
29 #include <Ecore_Wayland.h>
38 DisplayConnection* DisplayConnectionEcoreWl::New()
40 DisplayConnection* pDisplayConnection(new DisplayConnectionEcoreWl());
42 return pDisplayConnection;
45 DisplayConnectionEcoreWl::DisplayConnectionEcoreWl()
47 mSurfaceType(RenderSurfaceInterface::WINDOW_RENDER_SURFACE),
52 DisplayConnectionEcoreWl::~DisplayConnectionEcoreWl()
54 if(mSurfaceType == RenderSurfaceInterface::NATIVE_RENDER_SURFACE)
56 ReleaseNativeDisplay();
60 Any DisplayConnectionEcoreWl::GetDisplay()
65 void DisplayConnectionEcoreWl::ConsumeEvents()
69 bool DisplayConnectionEcoreWl::InitializeGraphics()
71 auto eglGraphics = static_cast<EglGraphics*>(mGraphics);
72 EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
74 if(!eglImpl.InitializeGles(mDisplay))
76 DALI_LOG_ERROR("Failed to initialize GLES.\n");
83 void DisplayConnectionEcoreWl::SetSurfaceType(Dali::RenderSurfaceInterface::Type type)
87 if(mSurfaceType == Dali::RenderSurfaceInterface::NATIVE_RENDER_SURFACE)
89 mDisplay = GetNativeDisplay();
94 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
95 mDisplay = reinterpret_cast<EGLNativeDisplayType>(ecore_wl2_display_get(display));
97 mDisplay = reinterpret_cast<EGLNativeDisplayType>(ecore_wl_display_get());
102 void DisplayConnectionEcoreWl::SetGraphicsInterface(GraphicsInterface& graphics)
104 mGraphics = &graphics;
107 EGLNativeDisplayType DisplayConnectionEcoreWl::GetNativeDisplay()
109 return reinterpret_cast<EGLNativeDisplayType>(tbm_dummy_display_create());
112 void DisplayConnectionEcoreWl::ReleaseNativeDisplay()
116 tbm_dummy_display_destroy(reinterpret_cast<tbm_dummy_display*>(mDisplay));
120 } // namespace Adaptor
122 } // namespace Internal