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::WaitUntilSurfaceReplaced()
70 void WaitUntilSurfaceReplaced() override;
73 * @copydoc Dali::NativeRenderSurface::GetNativeRenderable()
75 virtual Any GetNativeRenderable() override;
77 public: // from Dali::RenderSurfaceInterface
79 * @copydoc Dali::RenderSurfaceInterface::GetPositionSize()
81 PositionSize GetPositionSize() const override;
84 * @copydoc Dali::RenderSurfaceInterface::GetDpi()
86 void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
89 * @copydoc Dali::RenderSurfaceInterface::GetOrientation()
91 int GetOrientation() const override;
94 * @copydoc Dali::RenderSurfaceInterface::InitializeGraphics()
96 void InitializeGraphics() override;
99 * @copydoc Dali::RenderSurfaceInterface::CreateSurface()
101 void CreateSurface() override;
104 * @copydoc Dali::RenderSurfaceInterface::DestroySurface()
106 void DestroySurface() override;
109 * @copydoc Dali::RenderSurfaceInterface::ReplaceGraphicsSurface()
111 bool ReplaceGraphicsSurface() override;
114 * @copydoc Dali::RenderSurfaceInterface::MoveResize()
116 void MoveResize(Dali::PositionSize positionSize) override;
119 * @copydoc Dali::RenderSurfaceInterface::StartRender()
121 void StartRender() override;
124 * @copydoc Dali::RenderSurfaceInterface::PreRender()
126 bool PreRender(bool resizingSurface, const std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect) override;
129 * @copydoc Dali::RenderSurfaceInterface::PostRender()
131 void PostRender(bool renderToFbo, bool replacingSurface, bool resizingSurface, const std::vector<Rect<int>>& damagedRects) override;
134 * @copydoc Dali::RenderSurfaceInterface::StopRender()
136 void StopRender() override;
139 * @copydoc Dali::RenderSurfaceInterface::SetThreadSynchronization
141 void SetThreadSynchronization(ThreadSynchronizationInterface& threadSynchronization) override;
144 * @copydoc Dali::RenderSurfaceInterface::GetSurfaceType()
146 Dali::RenderSurfaceInterface::Type GetSurfaceType() override;
149 * @copydoc Dali::RenderSurfaceInterface::MakeContextCurrent()
151 void MakeContextCurrent() override;
154 * @copydoc Dali::RenderSurfaceInterface::GetDepthBufferRequired()
156 Integration::DepthBufferAvailable GetDepthBufferRequired() override;
159 * @copydoc Dali::RenderSurfaceInterface::GetStencilBufferRequired()
161 Integration::StencilBufferAvailable GetStencilBufferRequired() override;
165 * @copydoc Dali::RenderSurfaceInterface::ReleaseLock()
167 void ReleaseLock() override;
170 * @copydoc Dali::NativeRenderSurface::CreateNativeRenderable()
172 void CreateNativeRenderable() override;
175 * @copydoc Dali::NativeRenderSurface::ReleaseDrawable()
177 void ReleaseDrawable() override;
180 SurfaceSize mSurfaceSize;
181 TriggerEventInterface* mRenderNotification;
182 Internal::Adaptor::GraphicsInterface* mGraphics; ///< The graphics interface
184 EGLSurface mEGLSurface;
185 EGLContext mEGLContext;
186 ColorDepth mColorDepth;
187 tbm_format mTbmFormat;
189 bool mDrawableCompleted;
191 tbm_surface_queue_h mTbmQueue;
192 tbm_surface_h mConsumeSurface;
193 ThreadSynchronizationInterface* mThreadSynchronization; ///< A pointer to the thread-synchronization
194 ConditionalWait mTbmSurfaceCondition;
199 #endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_SURFACE_ECORE_WL_H