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::SetRenderNotification()
60 void SetRenderNotification(TriggerEventInterface* renderNotification) override;
63 * @copydoc Dali::NativeRenderSurface::GetNativeRenderable()
65 virtual Any GetNativeRenderable() override;
67 public: // from Dali::RenderSurfaceInterface
69 * @copydoc Dali::RenderSurfaceInterface::GetPositionSize()
71 PositionSize GetPositionSize() const override;
74 * @copydoc Dali::RenderSurfaceInterface::GetDpi()
76 void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
79 * @copydoc Dali::RenderSurfaceInterface::GetOrientation()
81 int GetOrientation() const override;
84 * @copydoc Dali::RenderSurfaceInterface::InitializeGraphics()
86 void InitializeGraphics() override;
89 * @copydoc Dali::RenderSurfaceInterface::CreateSurface()
91 void CreateSurface() override;
94 * @copydoc Dali::RenderSurfaceInterface::DestroySurface()
96 void DestroySurface() override;
99 * @copydoc Dali::RenderSurfaceInterface::ReplaceGraphicsSurface()
101 bool ReplaceGraphicsSurface() override;
104 * @copydoc Dali::RenderSurfaceInterface::MoveResize()
106 void MoveResize(Dali::PositionSize positionSize) override;
109 * @copydoc Dali::RenderSurfaceInterface::StartRender()
111 void StartRender() override;
114 * @copydoc Dali::RenderSurfaceInterface::PreRender()
116 bool PreRender(bool resizingSurface, const std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect) override;
119 * @copydoc Dali::RenderSurfaceInterface::PostRender()
121 void PostRender() override;
124 * @copydoc Dali::RenderSurfaceInterface::StopRender()
126 void StopRender() override;
129 * @copydoc Dali::RenderSurfaceInterface::SetThreadSynchronization
131 void SetThreadSynchronization(ThreadSynchronizationInterface& threadSynchronization) override;
134 * @copydoc Dali::RenderSurfaceInterface::GetSurfaceType()
136 Dali::RenderSurfaceInterface::Type GetSurfaceType() override;
139 * @copydoc Dali::RenderSurfaceInterface::MakeContextCurrent()
141 void MakeContextCurrent() override;
144 * @copydoc Dali::RenderSurfaceInterface::GetDepthBufferRequired()
146 Integration::DepthBufferAvailable GetDepthBufferRequired() override;
149 * @copydoc Dali::RenderSurfaceInterface::GetStencilBufferRequired()
151 Integration::StencilBufferAvailable GetStencilBufferRequired() override;
155 * @copydoc Dali::RenderSurfaceInterface::ReleaseLock()
157 void ReleaseLock() override;
160 * @copydoc Dali::NativeRenderSurface::CreateNativeRenderable()
162 void CreateNativeRenderable() override;
165 SurfaceSize mSurfaceSize;
166 TriggerEventInterface* mRenderNotification;
167 Internal::Adaptor::GraphicsInterface* mGraphics; ///< The graphics interface
169 EGLSurface mEGLSurface;
170 EGLContext mEGLContext;
171 ColorDepth mColorDepth;
172 tbm_format mTbmFormat;
174 std::vector<Rect<int>> mDamagedRects{}; ///< Keeps collected damaged render items rects for one render pass
176 tbm_surface_queue_h mTbmQueue;
177 ThreadSynchronizationInterface* mThreadSynchronization; ///< A pointer to the thread-synchronization
182 #endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_SURFACE_ECORE_WL_H