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) 2020 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 <tbm_surface.h>
23 #include <tbm_surface_queue.h>
24 #include <dali/devel-api/threading/conditional-wait.h>
27 #include <dali/public-api/dali-adaptor-common.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>
35 class DisplayConnection;
39 * Ecore Wayland Native implementation of render surface.
41 class NativeRenderSurfaceEcoreWl : public Dali::NativeRenderSurface
46 * Uses an Wayland surface to render to.
47 * @param [in] surfaceSize the size of the surface
48 * @param [in] surface the native surface handle
49 * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
51 NativeRenderSurfaceEcoreWl( SurfaceSize surfaceSize, Any surface, bool isTransparent = false );
56 virtual ~NativeRenderSurfaceEcoreWl();
58 public: // from WindowRenderSurface
61 * @copydoc Dali::NativeRenderSurface::GetSurface()
63 virtual Any GetDrawable() override;
66 * @copydoc Dali::NativeRenderSurface::SetRenderNotification()
68 virtual void SetRenderNotification( TriggerEventInterface* renderNotification ) override;
71 * @copydoc Dali::NativeRenderSurface::WaitUntilSurfaceReplaced()
73 virtual void WaitUntilSurfaceReplaced() override;
75 public: // from Dali::RenderSurfaceInterface
78 * @copydoc Dali::RenderSurfaceInterface::GetPositionSize()
80 virtual PositionSize GetPositionSize() const override;
83 * @copydoc Dali::RenderSurfaceInterface::GetDpi()
85 virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
88 * @brief Return the orientation of the surface.
89 * @return The orientation
91 virtual int GetOrientation() const override;
94 * @copydoc Dali::RenderSurfaceInterface::InitializeGraphics()
96 virtual void InitializeGraphics() override;
99 * @copydoc Dali::RenderSurfaceInterface::CreateSurface()
101 virtual void CreateSurface() override;
104 * @copydoc Dali::RenderSurfaceInterface::DestroySurface()
106 virtual void DestroySurface() override;
109 * @copydoc Dali::RenderSurfaceInterface::ReplaceGraphicsSurface()
111 virtual bool ReplaceGraphicsSurface() override;
114 * @copydoc Dali::RenderSurfaceInterface::MoveResize()
116 virtual void MoveResize( Dali::PositionSize positionSize) override;
119 * @copydoc Dali::RenderSurfaceInterface::StartRender()
121 virtual void StartRender() override;
124 * @copydoc Dali::RenderSurfaceInterface::PreRender()
126 virtual bool PreRender( bool resizingSurface, const std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect ) override;
129 * @copydoc Dali::RenderSurfaceInterface::PostRender()
131 virtual void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface, const std::vector<Rect<int>>& damagedRects ) override;
134 * @copydoc Dali::RenderSurfaceInterface::StopRender()
136 virtual void StopRender() override;
139 * @copydoc Dali::RenderSurfaceInterface::SetThreadSynchronization
141 virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization )override;
144 * @copydoc Dali::RenderSurfaceInterface::GetSurfaceType()
146 virtual Dali::RenderSurfaceInterface::Type GetSurfaceType() override;
149 * @copydoc Dali::RenderSurfaceInterface::MakeContextCurrent()
151 virtual void MakeContextCurrent() override;
154 * @copydoc Dali::RenderSurfaceInterface::GetDepthBufferRequired()
156 virtual Integration::DepthBufferAvailable GetDepthBufferRequired() override;
159 * @copydoc Dali::RenderSurfaceInterface::GetStencilBufferRequired()
161 virtual Integration::StencilBufferAvailable GetStencilBufferRequired() override;
166 * @copydoc Dali::RenderSurfaceInterface::ReleaseLock()
168 virtual void ReleaseLock() override;
171 * @copydoc Dali::NativeRenderSurface::CreateNativeRenderable()
173 virtual void CreateNativeRenderable() override;
176 * @copydoc Dali::NativeRenderSurface::ReleaseDrawable()
178 virtual void ReleaseDrawable() 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;
191 bool mDrawableCompleted;
193 tbm_surface_queue_h mTbmQueue;
194 tbm_surface_h mConsumeSurface;
195 ThreadSynchronizationInterface* mThreadSynchronization; ///< A pointer to the thread-synchronization
196 ConditionalWait mTbmSurfaceCondition;
202 #endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_SURFACE_ECORE_WL_H