1 #ifndef __DALI_INTERNAL_ECORE_WL_WINDOW_RENDER_SURFACE_H__
2 #define __DALI_INTERNAL_ECORE_WL_WINDOW_RENDER_SURFACE_H__
5 * Copyright (c) 2018 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 <Ecore_Wayland.h>
23 #include <wayland-egl.h>
24 #include <dali/public-api/common/dali-common.h>
27 #include <dali/integration-api/egl-interface.h>
28 #include <dali/integration-api/thread-synchronization-interface.h>
29 #include <dali/internal/window-system/common/window-render-surface.h>
40 * Ecore Wayland Window implementation of render surface.
42 class WindowRenderSurfaceEcoreWl : public WindowRenderSurface
47 * Uses an Wayland surface to render to.
48 * @param [in] positionSize the position and size of the surface
49 * @param [in] surface can be a Wayland-window or Wayland-pixmap (type must be unsigned int).
50 * @param [in] name optional name of surface passed in
51 * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
53 WindowRenderSurfaceEcoreWl( Dali::PositionSize positionSize,
55 const std::string& name,
56 bool isTransparent = false );
61 virtual ~WindowRenderSurfaceEcoreWl();
66 * @brief Get window handle
67 * @return the Ecore Waylnad window handle
69 Ecore_Wl_Window* GetWlWindow();
72 * Notify output is transformed.
74 void OutputTransformed();
76 public: // from WindowRenderSurface
79 * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::GetWindow()
81 virtual Any GetWindow() override;
84 * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::Map()
86 virtual void Map() override;
89 * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::SetRenderNotification()
91 virtual void SetRenderNotification( TriggerEventInterface* renderNotification ) override;
94 * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::SetTransparency()
96 virtual void SetTransparency( bool transparent ) override;
99 * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::RequestRotation()
101 virtual void RequestRotation( int angle, int width, int height ) override;
103 public: // from Dali::RenderSurface
106 * @copydoc Dali::RenderSurface::GetPositionSize()
108 virtual PositionSize GetPositionSize() const;
111 * @copydoc Dali::RenderSurface::InitializeEgl()
113 virtual void InitializeEgl( EglInterface& egl );
116 * @copydoc Dali::RenderSurface::CreateEglSurface()
118 virtual void CreateEglSurface( EglInterface& egl );
121 * @copydoc Dali::RenderSurface::DestroyEglSurface()
123 virtual void DestroyEglSurface( EglInterface& egl );
126 * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
128 virtual bool ReplaceEGLSurface( EglInterface& egl );
131 * @copydoc Dali::RenderSurface::MoveResize()
133 virtual void MoveResize( Dali::PositionSize positionSize);
136 * @copydoc Dali::RenderSurface::SetViewMode()
138 void SetViewMode( ViewMode viewMode );
141 * @copydoc Dali::RenderSurface::StartRender()
143 virtual void StartRender();
146 * @copydoc Dali::RenderSurface::PreRender()
148 virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface );
151 * @copydoc Dali::RenderSurface::PostRender()
153 virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface );
156 * @copydoc Dali::RenderSurface::StopRender()
158 virtual void StopRender();
161 * @copydoc Dali::RenderSurface::SetThreadSynchronization
163 virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization );
166 * @copydoc Dali::RenderSurface::ReleaseLock()
168 virtual void ReleaseLock();
171 * @copydoc Dali::RenderSurface::GetSurfaceType()
173 virtual RenderSurface::Type GetSurfaceType();
175 private: // from WindowRenderSurface
178 * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::Initialize()
180 void Initialize( Any surface ) override;
183 * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::CreateRenderable()
185 void CreateRenderable() override;
188 * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::UseExistingRenderable()
190 void UseExistingRenderable( unsigned int surfaceId ) override;
195 * Get the surface id if the surface parameter is not empty
196 * @param surface Any containing a surface id, or can be empty
197 * @return surface id, or zero if surface is empty
199 unsigned int GetSurfaceId( Any surface ) const;
202 * Used as the callback for the rotation-trigger.
204 void ProcessRotationRequest();
208 std::string mTitle; ///< Title of window which shows from "xinfo -topvwins" command
209 PositionSize mPositionSize; ///< Position
210 Ecore_Wl_Window* mWlWindow; ///< Wayland-Window
211 wl_surface* mWlSurface;
212 wl_egl_window* mEglWindow;
213 ThreadSynchronizationInterface* mThreadSynchronization;
214 TriggerEventInterface* mRenderNotification; ///< Render notification trigger
215 TriggerEventInterface* mRotationTrigger;
216 ColorDepth mColorDepth; ///< Color depth of surface (32 bit or 24 bit)
218 int mScreenRotationAngle;
219 bool mOwnSurface; ///< Whether we own the surface (responsible for deleting it)
220 bool mRotationSupported;
221 bool mRotationFinished;
222 bool mScreenRotationFinished;
223 bool mResizeFinished;
225 }; // class WindowRenderSurfaceEcoreWl
227 } // namespace Adaptor
229 } // namespace internal
233 #endif // __DALI_INTERNAL_ECORE_WL_WINDOW_RENDER_SURFACE_H__