Revert "[Tizen] Add screen and client rotation itself function"
[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) 2020 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/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>
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] 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
50     */
51   NativeRenderSurfaceEcoreWl( SurfaceSize surfaceSize, Any surface, bool isTransparent = false );
52
53   /**
54    * @brief Destructor
55    */
56   virtual ~NativeRenderSurfaceEcoreWl();
57
58 public: // from WindowRenderSurface
59
60   /**
61    * @copydoc Dali::NativeRenderSurface::GetSurface()
62    */
63   Any GetDrawable() override;
64
65   /**
66    * @copydoc Dali::NativeRenderSurface::SetRenderNotification()
67    */
68   void SetRenderNotification( TriggerEventInterface* renderNotification ) override;
69
70   /**
71    * @copydoc Dali::NativeRenderSurface::WaitUntilSurfaceReplaced()
72    */
73   void WaitUntilSurfaceReplaced() override;
74
75 public: // from Dali::RenderSurfaceInterface
76
77   /**
78    * @copydoc Dali::RenderSurfaceInterface::GetPositionSize()
79    */
80   PositionSize GetPositionSize() const override;
81
82   /**
83    * @copydoc Dali::RenderSurfaceInterface::GetDpi()
84    */
85   void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
86
87   /**
88    * @copydoc Dali::RenderSurfaceInterface::InitializeGraphics()
89    */
90   void InitializeGraphics() override;
91
92   /**
93    * @copydoc Dali::RenderSurfaceInterface::CreateSurface()
94    */
95   void CreateSurface() override;
96
97   /**
98    * @copydoc Dali::RenderSurfaceInterface::DestroySurface()
99    */
100   void DestroySurface() override;
101
102   /**
103    * @copydoc Dali::RenderSurfaceInterface::ReplaceGraphicsSurface()
104    */
105   bool ReplaceGraphicsSurface() override;
106
107   /**
108    * @copydoc Dali::RenderSurfaceInterface::MoveResize()
109    */
110   void MoveResize( Dali::PositionSize positionSize) override;
111
112   /**
113    * @copydoc Dali::RenderSurfaceInterface::StartRender()
114    */
115   void StartRender() override;
116
117   /**
118    * @copydoc Dali::RenderSurfaceInterface::PreRender()
119    */
120   bool PreRender( bool resizingSurface, const std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect ) override;
121
122   /**
123    * @copydoc Dali::RenderSurfaceInterface::PostRender()
124    */
125   void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface, const std::vector<Rect<int>>& damagedRects ) override;
126
127   /**
128    * @copydoc Dali::RenderSurfaceInterface::StopRender()
129    */
130   void StopRender() override;
131
132   /**
133    * @copydoc Dali::RenderSurfaceInterface::SetThreadSynchronization
134    */
135   void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization )override;
136
137   /**
138    * @copydoc Dali::RenderSurfaceInterface::GetSurfaceType()
139    */
140   Dali::RenderSurfaceInterface::Type GetSurfaceType() override;
141
142   /**
143    * @copydoc Dali::RenderSurfaceInterface::MakeContextCurrent()
144    */
145   void MakeContextCurrent() override;
146
147   /**
148    * @copydoc Dali::RenderSurfaceInterface::GetDepthBufferRequired()
149    */
150   Integration::DepthBufferAvailable GetDepthBufferRequired() override;
151
152   /**
153    * @copydoc Dali::RenderSurfaceInterface::GetStencilBufferRequired()
154    */
155   Integration::StencilBufferAvailable GetStencilBufferRequired() override;
156
157 private:
158
159   /**
160    * @copydoc Dali::RenderSurfaceInterface::ReleaseLock()
161    */
162   void ReleaseLock() override;
163
164   /**
165    * @copydoc Dali::NativeRenderSurface::CreateNativeRenderable()
166    */
167   void CreateNativeRenderable() override;
168
169   /**
170    * @copydoc Dali::NativeRenderSurface::ReleaseDrawable()
171    */
172   void ReleaseDrawable() override;
173
174 private: // Data
175
176   SurfaceSize                            mSurfaceSize;
177   TriggerEventInterface*                 mRenderNotification;
178   Internal::Adaptor::GraphicsInterface*  mGraphics;                  ///< The graphics interface
179   EglInterface*                          mEGL;
180   EGLSurface                             mEGLSurface;
181   EGLContext                             mEGLContext;
182   ColorDepth                             mColorDepth;
183   tbm_format                             mTbmFormat;
184   bool                                   mOwnSurface;
185   bool                                   mDrawableCompleted;
186
187   tbm_surface_queue_h                    mTbmQueue;
188   tbm_surface_h                          mConsumeSurface;
189   ThreadSynchronizationInterface*        mThreadSynchronization;     ///< A pointer to the thread-synchronization
190   ConditionalWait                        mTbmSurfaceCondition;
191
192 };
193
194 } // namespace Dali
195
196 #endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_SURFACE_ECORE_WL_H