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) 2019 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] positionSize the position and size of the surface
48 * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
50 NativeRenderSurfaceEcoreWl( Dali::PositionSize positionSize, bool isTransparent = false );
55 virtual ~NativeRenderSurfaceEcoreWl();
57 public: // from WindowRenderSurface
60 * @copydoc Dali::NativeRenderSurface::GetSurface()
62 virtual Any GetDrawable() override;
65 * @copydoc Dali::NativeRenderSurface::SetRenderNotification()
67 virtual void SetRenderNotification( TriggerEventInterface* renderNotification ) override;
70 * @copydoc Dali::NativeRenderSurface::WaitUntilSurfaceReplaced()
72 virtual void WaitUntilSurfaceReplaced() override;
74 public: // from Dali::Integration::RenderSurface
77 * @copydoc Dali::Integration::RenderSurface::GetPositionSize()
79 virtual PositionSize GetPositionSize() const override;
82 * @copydoc Dali::Integration::RenderSurface::GetDpi()
84 virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
87 * @brief Return the orientation of the surface.
88 * @return The orientation
90 virtual int GetOrientation() const override;
93 * @copydoc Dali::Integration::RenderSurface::InitializeGraphics()
95 virtual void InitializeGraphics() override;
98 * @copydoc Dali::Integration::RenderSurface::CreateSurface()
100 virtual void CreateSurface() override;
103 * @copydoc Dali::Integration::RenderSurface::DestroySurface()
105 virtual void DestroySurface() override;
108 * @copydoc Dali::Integration::RenderSurface::ReplaceGraphicsSurface()
110 virtual bool ReplaceGraphicsSurface() override;
113 * @copydoc Dali::Integration::RenderSurface::MoveResize()
115 virtual void MoveResize( Dali::PositionSize positionSize) override;
118 * @copydoc Dali::Integration::RenderSurface::StartRender()
120 virtual void StartRender() override;
123 * @copydoc Dali::Integration::RenderSurface::PreRender()
125 virtual bool PreRender( bool resizingSurface ) override;
128 * @copydoc Dali::Integration::RenderSurface::PostRender()
130 virtual void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface );
133 * @copydoc Dali::Integration::RenderSurface::StopRender()
135 virtual void StopRender() override;
138 * @copydoc Dali::Integration::RenderSurface::SetThreadSynchronization
140 virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization )override;
143 * @copydoc Dali::Integration::RenderSurface::GetSurfaceType()
145 virtual Integration::RenderSurface::Type GetSurfaceType() override;
148 * @copydoc Dali::Integration::RenderSurface::MakeContextCurrent()
150 virtual void MakeContextCurrent() override;
153 * @copydoc Dali::Integration::RenderSurface::GetDepthBufferRequired()
155 virtual Integration::DepthBufferAvailable GetDepthBufferRequired() override;
158 * @copydoc Dali::Integration::RenderSurface::GetStencilBufferRequired()
160 virtual Integration::StencilBufferAvailable GetStencilBufferRequired() override;
165 * @copydoc Dali::Integration::RenderSurface::ReleaseLock()
167 virtual void ReleaseLock() override;
170 * @copydoc Dali::NativeRenderSurface::CreateNativeRenderable()
172 virtual void CreateNativeRenderable() override;
175 * @copydoc Dali::NativeRenderSurface::ReleaseDrawable()
177 virtual void ReleaseDrawable() override;
181 PositionSize mPosition;
182 TriggerEventInterface* mRenderNotification;
183 Internal::Adaptor::GraphicsInterface* mGraphics; ///< The graphics interface
185 EGLSurface mEGLSurface;
186 EGLContext mEGLContext;
187 ColorDepth mColorDepth;
188 tbm_format mTbmFormat;
190 bool mDrawableCompleted;
192 tbm_surface_queue_h mTbmQueue;
193 tbm_surface_h mConsumeSurface;
194 ThreadSynchronizationInterface* mThreadSynchronization; ///< A pointer to the thread-synchronization
195 ConditionalWait mTbmSurfaceCondition;
201 #endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_SURFACE_ECORE_WL_H