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) 2021 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/threading/conditional-wait.h>
23 #include <tbm_surface.h>
24 #include <tbm_surface_queue.h>
27 #include <dali/integration-api/adaptor-framework/egl-interface.h>
28 #include <dali/integration-api/adaptor-framework/native-render-surface.h>
29 #include <dali/internal/graphics/common/graphics-interface.h>
30 #include <dali/public-api/dali-adaptor-common.h>
34 class DisplayConnection;
38 * Ecore Wayland Native implementation of render surface.
40 class NativeRenderSurfaceEcoreWl : public Dali::NativeRenderSurface
44 * Uses an Wayland surface to render to.
45 * @param [in] surfaceSize the size of the surface
46 * @param [in] surface the native surface handle
47 * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
49 NativeRenderSurfaceEcoreWl(SurfaceSize surfaceSize, Any surface, bool isTransparent = false);
54 virtual ~NativeRenderSurfaceEcoreWl();
56 public: // from WindowRenderSurface
58 * @copydoc Dali::NativeRenderSurface::GetSurface()
60 Any GetDrawable() override;
63 * @copydoc Dali::NativeRenderSurface::SetRenderNotification()
65 void SetRenderNotification(TriggerEventInterface* renderNotification) override;
68 * @copydoc Dali::NativeRenderSurface::GetNativeRenderable()
70 virtual Any GetNativeRenderable() override;
72 public: // from Dali::RenderSurfaceInterface
74 * @copydoc Dali::RenderSurfaceInterface::GetPositionSize()
76 PositionSize GetPositionSize() const override;
79 * @copydoc Dali::RenderSurfaceInterface::GetDpi()
81 void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
84 * @copydoc Dali::RenderSurfaceInterface::GetOrientation()
86 int GetOrientation() const override;
89 * @copydoc Dali::RenderSurfaceInterface::InitializeGraphics()
91 void InitializeGraphics() override;
94 * @copydoc Dali::RenderSurfaceInterface::CreateSurface()
96 void CreateSurface() override;
99 * @copydoc Dali::RenderSurfaceInterface::DestroySurface()
101 void DestroySurface() override;
104 * @copydoc Dali::RenderSurfaceInterface::ReplaceGraphicsSurface()
106 bool ReplaceGraphicsSurface() override;
109 * @copydoc Dali::RenderSurfaceInterface::MoveResize()
111 void MoveResize(Dali::PositionSize positionSize) override;
114 * @copydoc Dali::RenderSurfaceInterface::StartRender()
116 void StartRender() override;
119 * @copydoc Dali::RenderSurfaceInterface::PreRender()
121 bool PreRender(bool resizingSurface, const std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect) override;
124 * @copydoc Dali::RenderSurfaceInterface::PostRender()
126 void PostRender(bool renderToFbo, bool replacingSurface, bool resizingSurface, const std::vector<Rect<int>>& damagedRects) override;
129 * @copydoc Dali::RenderSurfaceInterface::StopRender()
131 void StopRender() override;
134 * @copydoc Dali::RenderSurfaceInterface::SetThreadSynchronization
136 void SetThreadSynchronization(ThreadSynchronizationInterface& threadSynchronization) override;
139 * @copydoc Dali::RenderSurfaceInterface::GetSurfaceType()
141 Dali::RenderSurfaceInterface::Type GetSurfaceType() override;
144 * @copydoc Dali::RenderSurfaceInterface::MakeContextCurrent()
146 void MakeContextCurrent() override;
149 * @copydoc Dali::RenderSurfaceInterface::GetDepthBufferRequired()
151 Integration::DepthBufferAvailable GetDepthBufferRequired() override;
154 * @copydoc Dali::RenderSurfaceInterface::GetStencilBufferRequired()
156 Integration::StencilBufferAvailable GetStencilBufferRequired() override;
160 * @copydoc Dali::RenderSurfaceInterface::ReleaseLock()
162 void ReleaseLock() override;
165 * @copydoc Dali::NativeRenderSurface::CreateNativeRenderable()
167 void CreateNativeRenderable() override;
170 * @copydoc Dali::NativeRenderSurface::ReleaseDrawable()
172 void ReleaseDrawable() override;
175 SurfaceSize mSurfaceSize;
176 TriggerEventInterface* mRenderNotification;
177 Internal::Adaptor::GraphicsInterface* mGraphics; ///< The graphics interface
179 EGLSurface mEGLSurface;
180 EGLContext mEGLContext;
181 ColorDepth mColorDepth;
182 tbm_format mTbmFormat;
185 tbm_surface_queue_h mTbmQueue;
186 tbm_surface_h mConsumeSurface;
187 ThreadSynchronizationInterface* mThreadSynchronization; ///< A pointer to the thread-synchronization
192 #endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_SURFACE_ECORE_WL_H