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 override;
111 * @copydoc Dali::RenderSurface::GetDpi()
113 virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
116 * @copydoc Dali::RenderSurface::InitializeEgl()
118 virtual void InitializeEgl( EglInterface& egl ) override;
121 * @copydoc Dali::RenderSurface::CreateEglSurface()
123 virtual void CreateEglSurface( EglInterface& egl ) override;
126 * @copydoc Dali::RenderSurface::DestroyEglSurface()
128 virtual void DestroyEglSurface( EglInterface& egl ) override;
131 * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
133 virtual bool ReplaceEGLSurface( EglInterface& egl ) override;
136 * @copydoc Dali::RenderSurface::MoveResize()
138 virtual void MoveResize( Dali::PositionSize positionSize) override;
141 * @copydoc Dali::RenderSurface::SetViewMode()
143 virtual void SetViewMode( ViewMode viewMode ) override;
146 * @copydoc Dali::RenderSurface::StartRender()
148 virtual void StartRender() override;
151 * @copydoc Dali::RenderSurface::PreRender()
153 virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface ) override;
156 * @copydoc Dali::RenderSurface::PostRender()
158 virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface ) override;
161 * @copydoc Dali::RenderSurface::StopRender()
163 virtual void StopRender() override;
166 * @copydoc Dali::RenderSurface::SetThreadSynchronization
168 virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) override;
171 * @copydoc Dali::RenderSurface::ReleaseLock()
173 virtual void ReleaseLock() override;
176 * @copydoc Dali::RenderSurface::GetSurfaceType()
178 virtual RenderSurface::Type GetSurfaceType() override;
180 private: // from WindowRenderSurface
183 * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::Initialize()
185 void Initialize( Any surface ) override;
188 * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::CreateRenderable()
190 void CreateRenderable() override;
193 * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::UseExistingRenderable()
195 void UseExistingRenderable( unsigned int surfaceId ) override;
200 * Get the surface id if the surface parameter is not empty
201 * @param surface Any containing a surface id, or can be empty
202 * @return surface id, or zero if surface is empty
204 unsigned int GetSurfaceId( Any surface ) const;
207 * Used as the callback for the rotation-trigger.
209 void ProcessRotationRequest();
213 std::string mTitle; ///< Title of window which shows from "xinfo -topvwins" command
214 PositionSize mPositionSize; ///< Position
215 Ecore_Wl_Window* mWlWindow; ///< Wayland-Window
216 wl_surface* mWlSurface;
217 wl_egl_window* mEglWindow;
218 ThreadSynchronizationInterface* mThreadSynchronization;
219 TriggerEventInterface* mRenderNotification; ///< Render notification trigger
220 TriggerEventInterface* mRotationTrigger;
221 ColorDepth mColorDepth; ///< Color depth of surface (32 bit or 24 bit)
223 int mScreenRotationAngle;
224 bool mOwnSurface; ///< Whether we own the surface (responsible for deleting it)
225 bool mRotationSupported;
226 bool mRotationFinished;
227 bool mScreenRotationFinished;
228 bool mResizeFinished;
230 }; // class WindowRenderSurfaceEcoreWl
232 } // namespace Adaptor
234 } // namespace internal
238 #endif // __DALI_INTERNAL_ECORE_WL_WINDOW_RENDER_SURFACE_H__