1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_SURFACE_ECORE_WL_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_SURFACE_ECORE_WL_H
5 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/devel-api/adaptor-framework/event-thread-callback.h>
23 #include <dali/devel-api/threading/conditional-wait.h>
24 #include <tbm_surface.h>
25 #include <tbm_surface_queue.h>
28 #include <dali/integration-api/adaptor-framework/egl-interface.h>
29 #include <dali/integration-api/adaptor-framework/native-render-surface.h>
30 #include <dali/internal/graphics/common/graphics-interface.h>
31 #include <dali/public-api/dali-adaptor-common.h>
35 class DisplayConnection;
39 * Ecore Wayland Native implementation of render surface.
41 class NativeRenderSurfaceEcoreWl : public Dali::NativeRenderSurface
45 * Uses an Wayland surface to render to.
46 * @param [in] surfaceSize the size of the surface
47 * @param [in] surface the native surface handle
48 * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
50 NativeRenderSurfaceEcoreWl(SurfaceSize surfaceSize, Any surface, bool isTransparent = false);
55 virtual ~NativeRenderSurfaceEcoreWl();
59 * @brief Triggers the FrameRenderedCallback
61 void TriggerFrameRenderedCallback();
63 public: // from NativeRenderSurface
65 * @copydoc Dali::NativeRenderSurface::SetRenderNotification()
67 void SetRenderNotification(TriggerEventInterface* renderNotification) override;
70 * @copydoc Dali::NativeRenderSurface::GetNativeRenderable()
72 virtual Any GetNativeRenderable() override;
75 * @copydoc Dali::NativeRenderSurface::SetFrameRenderedCallback()
77 void SetFrameRenderedCallback(CallbackBase* callback) override;
79 public: // from Dali::RenderSurfaceInterface
81 * @copydoc Dali::RenderSurfaceInterface::GetPositionSize()
83 PositionSize GetPositionSize() const override;
86 * @copydoc Dali::RenderSurfaceInterface::GetDpi()
88 void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
91 * @copydoc Dali::RenderSurfaceInterface::GetSurfaceOrientation()
93 int GetSurfaceOrientation() const override;
96 * @copydoc Dali::RenderSurfaceInterface::GetScreenOrientation()
98 int GetScreenOrientation() const override;
101 * @copydoc Dali::RenderSurfaceInterface::InitializeGraphics()
103 void InitializeGraphics() override;
106 * @copydoc Dali::RenderSurfaceInterface::CreateSurface()
108 void CreateSurface() override;
111 * @copydoc Dali::RenderSurfaceInterface::DestroySurface()
113 void DestroySurface() override;
116 * @copydoc Dali::RenderSurfaceInterface::ReplaceGraphicsSurface()
118 bool ReplaceGraphicsSurface() override;
121 * @copydoc Dali::RenderSurfaceInterface::MoveResize()
123 void MoveResize(Dali::PositionSize positionSize) override;
126 * @copydoc Dali::RenderSurfaceInterface::StartRender()
128 void StartRender() override;
131 * @copydoc Dali::RenderSurfaceInterface::PreRender()
133 bool PreRender(bool resizingSurface, const std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect) override;
136 * @copydoc Dali::RenderSurfaceInterface::PostRender()
138 void PostRender() override;
141 * @copydoc Dali::RenderSurfaceInterface::StopRender()
143 void StopRender() override;
146 * @copydoc Dali::RenderSurfaceInterface::SetThreadSynchronization
148 void SetThreadSynchronization(ThreadSynchronizationInterface& threadSynchronization) override;
151 * @copydoc Dali::RenderSurfaceInterface::GetSurfaceType()
153 Dali::RenderSurfaceInterface::Type GetSurfaceType() override;
156 * @copydoc Dali::RenderSurfaceInterface::MakeContextCurrent()
158 void MakeContextCurrent() override;
161 * @copydoc Dali::RenderSurfaceInterface::GetDepthBufferRequired()
163 Integration::DepthBufferAvailable GetDepthBufferRequired() override;
166 * @copydoc Dali::RenderSurfaceInterface::GetStencilBufferRequired()
168 Integration::StencilBufferAvailable GetStencilBufferRequired() override;
172 * @copydoc Dali::RenderSurfaceInterface::ReleaseLock()
174 void ReleaseLock() override;
177 * @copydoc Dali::NativeRenderSurface::CreateNativeRenderable()
179 void CreateNativeRenderable() override;
182 SurfaceSize mSurfaceSize;
183 TriggerEventInterface* mRenderNotification;
184 Internal::Adaptor::GraphicsInterface* mGraphics; ///< The graphics interface
186 EGLSurface mEGLSurface;
187 EGLContext mEGLContext;
188 ColorDepth mColorDepth;
189 tbm_format mTbmFormat;
192 tbm_surface_queue_h mTbmQueue;
193 ThreadSynchronizationInterface* mThreadSynchronization; ///< A pointer to the thread-synchronization
194 std::unique_ptr<EventThreadCallback> mFrameRenderedCallback; ///< The FrameRendredCallback called from graphics driver
199 #endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_SURFACE_ECORE_WL_H