[Tizen] Implement partial update
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / native-render-surface-ecore-wl.h
1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_SURFACE_ECORE_WL_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_SURFACE_ECORE_WL_H
3
4 /*
5  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <tbm_surface.h>
23 #include <tbm_surface_queue.h>
24 #include <dali/devel-api/threading/conditional-wait.h>
25
26 // INTERNAL INCLUDES
27 #include <dali/public-api/dali-adaptor-common.h>
28 #include <dali/integration-api/egl-interface.h>
29 #include <dali/integration-api/native-render-surface.h>
30 #include <dali/internal/graphics/common/graphics-interface.h>
31
32 namespace Dali
33 {
34
35 class DisplayConnection;
36 class EglInterface;
37
38 /**
39  * Ecore Wayland Native implementation of render surface.
40  */
41 class NativeRenderSurfaceEcoreWl : public Dali::NativeRenderSurface
42 {
43 public:
44
45   /**
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
49     */
50   NativeRenderSurfaceEcoreWl( Dali::PositionSize positionSize, bool isTransparent = false );
51
52   /**
53    * @brief Destructor
54    */
55   virtual ~NativeRenderSurfaceEcoreWl();
56
57 public: // from WindowRenderSurface
58
59   /**
60    * @copydoc Dali::NativeRenderSurface::GetSurface()
61    */
62   virtual Any GetDrawable() override;
63
64   /**
65    * @copydoc Dali::NativeRenderSurface::SetRenderNotification()
66    */
67   virtual void SetRenderNotification( TriggerEventInterface* renderNotification ) override;
68
69   /**
70    * @copydoc Dali::NativeRenderSurface::WaitUntilSurfaceReplaced()
71    */
72   virtual void WaitUntilSurfaceReplaced() override;
73
74 public: // from Dali::Integration::RenderSurface
75
76   /**
77    * @copydoc Dali::Integration::RenderSurface::GetPositionSize()
78    */
79   virtual PositionSize GetPositionSize() const override;
80
81   /**
82    * @copydoc Dali::Integration::RenderSurface::GetDpi()
83    */
84   virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
85
86   /**
87    * @brief Return the orientation of the surface.
88    * @return The orientation
89    */
90   virtual int GetOrientation() const override;
91
92   /**
93    * @copydoc Dali::Integration::RenderSurface::InitializeGraphics()
94    */
95   virtual void InitializeGraphics() override;
96
97   /**
98    * @copydoc Dali::Integration::RenderSurface::CreateSurface()
99    */
100   virtual void CreateSurface() override;
101
102   /**
103    * @copydoc Dali::Integration::RenderSurface::DestroySurface()
104    */
105   virtual void DestroySurface() override;
106
107   /**
108    * @copydoc Dali::Integration::RenderSurface::ReplaceGraphicsSurface()
109    */
110   virtual bool ReplaceGraphicsSurface() override;
111
112   /**
113    * @copydoc Dali::Integration::RenderSurface::MoveResize()
114    */
115   virtual void MoveResize( Dali::PositionSize positionSize) override;
116
117   /**
118    * @copydoc Dali::Integration::RenderSurface::StartRender()
119    */
120   virtual void StartRender() override;
121
122   /**
123    * @copydoc Dali::Integration::RenderSurface::PreRender()
124    */
125   virtual bool PreRender( bool resizingSurface ) override;
126
127   /**
128    * @copydoc Dali::Integration::RenderSurface::PostRender()
129    */
130   virtual void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface );
131
132   /**
133    * @copydoc Dali::Integration::RenderSurface::StopRender()
134    */
135   virtual void StopRender() override;
136
137   /**
138    * @copydoc Dali::Integration::RenderSurface::SetThreadSynchronization
139    */
140   virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization )override;
141
142   /**
143    * @copydoc Dali::Integration::RenderSurface::GetSurfaceType()
144    */
145   virtual Integration::RenderSurface::Type GetSurfaceType() override;
146
147   /**
148    * @copydoc Dali::Integration::RenderSurface::MakeContextCurrent()
149    */
150   virtual void MakeContextCurrent() override;
151
152   /**
153    * @copydoc Dali::Integration::RenderSurface::GetDepthBufferRequired()
154    */
155   virtual Integration::DepthBufferAvailable GetDepthBufferRequired() override;
156
157   /**
158    * @copydoc Dali::Integration::RenderSurface::GetStencilBufferRequired()
159    */
160   virtual Integration::StencilBufferAvailable GetStencilBufferRequired() override;
161
162   /**
163    * @copydoc Dali::Integration::RenderSurface::SetDamagedRect()
164    */
165   virtual void SetDamagedRect( const Dali::DamagedRect& damagedRect, Dali::DamagedRect& mergedRect ) override;
166
167   /**
168    * @copydoc Dali::Integration::RenderSurface::GetBufferAge()
169    */
170   virtual int32_t GetBufferAge() override;
171
172
173
174 private:
175
176   /**
177    * @copydoc Dali::Integration::RenderSurface::ReleaseLock()
178    */
179   virtual void ReleaseLock() override;
180
181   /**
182    * @copydoc Dali::NativeRenderSurface::CreateNativeRenderable()
183    */
184   virtual void CreateNativeRenderable() override;
185
186   /**
187    * @copydoc Dali::NativeRenderSurface::ReleaseDrawable()
188    */
189   virtual void ReleaseDrawable() override;
190
191 private: // Data
192
193   PositionSize                           mPosition;
194   TriggerEventInterface*                 mRenderNotification;
195   Internal::Adaptor::GraphicsInterface*  mGraphics;                  ///< The graphics interface
196   EglInterface*                          mEGL;
197   EGLSurface                             mEGLSurface;
198   EGLContext                             mEGLContext;
199   ColorDepth                             mColorDepth;
200   tbm_format                             mTbmFormat;
201   bool                                   mOwnSurface;
202   bool                                   mDrawableCompleted;
203
204   tbm_surface_queue_h                    mTbmQueue;
205   tbm_surface_h                          mConsumeSurface;
206   ThreadSynchronizationInterface*        mThreadSynchronization;     ///< A pointer to the thread-synchronization
207   ConditionalWait                        mTbmSurfaceCondition;
208
209 };
210
211 } // namespace Dali
212
213 #endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_SURFACE_ECORE_WL_H