X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fwindow-system%2Fcommon%2Fwindow-render-surface.h;h=4c0ff2fab3ecd9b3203f219c8c48d755f5aa75a0;hb=refs%2Fchanges%2F44%2F269544%2F1;hp=373e1316fb7645dea65d1f8dc34e5d04355ccdfe;hpb=8e8c805266bd6817ce0c86fe10a6e4ba93f8127f;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/window-system/common/window-render-surface.h b/dali/internal/window-system/common/window-render-surface.h index 373e1316..4c0ff2f 100644 --- a/dali/internal/window-system/common/window-render-surface.h +++ b/dali/internal/window-system/common/window-render-surface.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_RENDER_SURFACE_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,10 +19,10 @@ */ // EXTERNAL INCLUDES -#include -#include #include #include +#include +#include #include // INTERNAL INCLUDES @@ -33,14 +33,12 @@ namespace Dali { - class TriggerEventInterface; namespace Internal { namespace Adaptor { - class WindowBase; class AdaptorInternalServices; @@ -50,9 +48,8 @@ class AdaptorInternalServices; class WindowRenderSurface : public Dali::RenderSurfaceInterface, public ConnectionTracker { public: - - using OutputSignalType = Signal< void ( ) >; - using DamagedRectsContainer = std::list< std::vector< Rect< int > > >; + using OutputSignalType = Signal; + using DamagedRectsContainer = std::list>>; /** * Uses an window surface to render to. @@ -60,7 +57,7 @@ public: * @param [in] surface can be a window or pixmap. * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit */ - WindowRenderSurface( Dali::PositionSize positionSize, Any surface, bool isTransparent = false ); + WindowRenderSurface(Dali::PositionSize positionSize, Any surface, bool isTransparent = false); /** * @brief Destructor @@ -68,7 +65,6 @@ public: virtual ~WindowRenderSurface(); public: // API - /** * @brief Get the native window handle * @return The native window handle @@ -90,13 +86,13 @@ public: // API * @brief Sets the render notification trigger to call when render thread is completed a frame * @param renderNotification to use */ - void SetRenderNotification( TriggerEventInterface* renderNotification ); + void SetRenderNotification(TriggerEventInterface* renderNotification); /** * @brief Sets whether the surface is transparent or not. * @param[in] transparent Whether the surface is transparent */ - void SetTransparency( bool transparent ); + void SetTransparency(bool transparent); /** * Request surface rotation @@ -104,7 +100,7 @@ public: // API * @param[in] width A new width of the surface * @param[in] height A new height of the surface */ - void RequestRotation( int angle, int width, int height ); + void RequestRotation(int angle, int width, int height); /** * @brief Gets the window base object @@ -113,12 +109,39 @@ public: // API WindowBase* GetWindowBase(); /** + * @brief Intiailize Ime Surface for Ime window rendering. + * + * It sets one flag and callback function for Ime window rendering + * This callback function calls one special native window function for ready to commit buffer. + * The special function notify to display server. + * It is only used for Ime window. + */ + void InitializeImeSurface(); + + /** + * @brief Sets the necessary for window rotation acknowledge. + * After this function called, SendRotationCompletedAcknowledgement() should be called to complete window rotation. + * + * More detail description is written in DevelWindow::SetNeedsRotationCompletedAcknowledgement(). + * + * @param[in] window The window instance. + * @param[in] needAcknowledgement the flag is true if window rotation acknowledgement is sent. + */ + void SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement); + + /** + * @brief Query whether window is rotating or not. + * + * @return true if window is rotating, false otherwise. + */ + bool IsWindowRotating() const; + + /** * @brief This signal is emitted when the output is transformed. */ OutputSignalType& OutputTransformedSignal(); public: // from Dali::RenderSurfaceInterface - /** * @copydoc Dali::RenderSurfaceInterface::GetPositionSize() */ @@ -126,13 +149,12 @@ public: // from Dali::RenderSurfaceInterface /** */ - void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override; + void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override; /** - * @brief Return the orientation of the surface. - * @return The orientation + * @copydoc Dali::RenderSurfaceInterface::GetOrientation() */ - virtual int GetOrientation() const override; + int GetOrientation() const override; /** * @copydoc Dali::RenderSurfaceInterface::InitializeGraphics() @@ -157,7 +179,7 @@ public: // from Dali::RenderSurfaceInterface /** * @copydoc Dali::RenderSurfaceInterface::MoveResize() */ - void MoveResize( Dali::PositionSize positionSize) override; + void MoveResize(Dali::PositionSize positionSize) override; /** * @copydoc Dali::RenderSurfaceInterface::StartRender() @@ -167,12 +189,12 @@ public: // from Dali::RenderSurfaceInterface /** * @copydoc Dali::RenderSurfaceInterface::PreRender() */ - bool PreRender( bool resizingSurface, const std::vector>& damagedRects, Rect& clippingRect ) override; + bool PreRender(bool resizingSurface, const std::vector>& damagedRects, Rect& clippingRect) override; /** * @copydoc Dali::RenderSurfaceInterface::PostRender() */ - void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface, const std::vector>& damagedRects ) override; + void PostRender() override; /** * @copydoc Dali::RenderSurfaceInterface::StopRender() @@ -182,7 +204,7 @@ public: // from Dali::RenderSurfaceInterface /** * @copydoc Dali::RenderSurfaceInterface::SetThreadSynchronization */ - void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) override; + void SetThreadSynchronization(ThreadSynchronizationInterface& threadSynchronization) override; /** * @copydoc Dali::RenderSurfaceInterface::ReleaseLock() @@ -210,11 +232,10 @@ public: // from Dali::RenderSurfaceInterface Integration::StencilBufferAvailable GetStencilBufferRequired() override; private: - /** * @brief Second stage construction */ - void Initialize( Any surface ); + void Initialize(Any surface); /** * Notify output is transformed. @@ -222,9 +243,10 @@ private: void OutputTransformed(); /** - * @brief Used as the callback for the rotation-trigger. + * @brief Used as the callback for the post render. + * It is used both window rotation and supporting Ime window */ - void ProcessRotationRequest(); + void ProcessPostRender(); /** * @brief Used as the callback for the frame rendered / presented. @@ -236,23 +258,22 @@ private: * @param[in] eventBitMask bit mask of events that occured on the file descriptor * @param[in] fileDescriptor The file descriptor */ - void OnFileDescriptorEventDispatched( FileDescriptorMonitor::EventType eventBitMask, int fileDescriptor ); + void OnFileDescriptorEventDispatched(FileDescriptorMonitor::EventType eventBitMask, int fileDescriptor); /** * @brief Set the buffer damage rects. * @param[in] damagedRects List of damaged rects * @param[in] clippingRect The rect to clip rendered scene */ - void SetBufferDamagedRects( const std::vector< Rect< int > >& damagedRects, Rect< int >& clippingRect ); + void SetBufferDamagedRects(const std::vector>& damagedRects, Rect& clippingRect); /** * @brief Swap buffers. * @param[in] damagedRects List of damaged rects */ - void SwapBuffers( const std::vector>& damagedRects ); + void SwapBuffers(const std::vector>& damagedRects); protected: - // Undefined WindowRenderSurface(const WindowRenderSurface&) = delete; @@ -260,18 +281,17 @@ protected: WindowRenderSurface& operator=(const WindowRenderSurface& rhs) = delete; private: - struct FrameCallbackInfo { - FrameCallbackInfo( Dali::Integration::Scene::FrameCallbackContainer& callbackList, int fd ) + FrameCallbackInfo(Dali::Integration::Scene::FrameCallbackContainer& callbackList, int fd) : callbacks(), fileDescriptorMonitor(), - fileDescriptor( fd ) + fileDescriptor(fd) { // Transfer owership of the CallbackBase - for( auto&& iter : callbackList ) + for(auto&& iter : callbackList) { - callbacks.push_back( std::make_pair( std::move( iter.first ), iter.second ) ); + callbacks.push_back(std::make_pair(std::move(iter.first), iter.second)); } } @@ -279,50 +299,51 @@ private: { // Delete FileDescriptorMonitor before close fd. fileDescriptorMonitor.release(); - close( fileDescriptor ); + close(fileDescriptor); } Dali::Integration::Scene::FrameCallbackContainer callbacks; - std::unique_ptr< FileDescriptorMonitor > fileDescriptorMonitor; - int fileDescriptor; + std::unique_ptr fileDescriptorMonitor; + int fileDescriptor; }; - using FrameCallbackInfoContainer = std::vector< std::unique_ptr< FrameCallbackInfo > >; + using FrameCallbackInfoContainer = std::vector>; private: // Data - - EglInterface* mEGL; - Dali::DisplayConnection* mDisplayConnection; - PositionSize mPositionSize; ///< Position - std::unique_ptr< WindowBase > mWindowBase; - ThreadSynchronizationInterface* mThreadSynchronization; - TriggerEventInterface* mRenderNotification; ///< Render notification trigger - TriggerEventInterface* mRotationTrigger; - std::unique_ptr< TriggerEventInterface > mFrameRenderedTrigger; - GraphicsInterface* mGraphics; ///< Graphics interface - EGLSurface mEGLSurface; - EGLContext mEGLContext; - ColorDepth mColorDepth; ///< Color depth of surface (32 bit or 24 bit) - OutputSignalType mOutputTransformedSignal; - FrameCallbackInfoContainer mFrameCallbackInfoContainer; - DamagedRectsContainer mBufferDamagedRects; - Dali::Mutex mMutex; - int mRotationAngle; - int mScreenRotationAngle; - uint32_t mDpiHorizontal; - uint32_t mDpiVertical; - bool mOwnSurface; ///< Whether we own the surface (responsible for deleting it) - bool mRotationSupported; - bool mRotationFinished; - bool mScreenRotationFinished; - bool mResizeFinished; - bool mDefaultScreenRotationAvailable; + EglInterface* mEGL; + Dali::DisplayConnection* mDisplayConnection; + PositionSize mPositionSize; ///< Position + std::unique_ptr mWindowBase; + ThreadSynchronizationInterface* mThreadSynchronization; + TriggerEventInterface* mRenderNotification; ///< Render notification trigger + std::unique_ptr mPostRenderTrigger; ///< Post render callback function + std::unique_ptr mFrameRenderedTrigger; + GraphicsInterface* mGraphics; ///< Graphics interface + EGLSurface mEGLSurface; + EGLContext mEGLContext; + ColorDepth mColorDepth; ///< Color depth of surface (32 bit or 24 bit) + OutputSignalType mOutputTransformedSignal; + FrameCallbackInfoContainer mFrameCallbackInfoContainer; + DamagedRectsContainer mBufferDamagedRects; + Dali::Mutex mMutex; + int mWindowRotationAngle; + int mScreenRotationAngle; + uint32_t mDpiHorizontal; + uint32_t mDpiVertical; + std::vector> mDamagedRects{}; ///< Keeps collected damaged render items rects for one render pass + bool mOwnSurface; ///< Whether we own the surface (responsible for deleting it) + bool mWindowRotationFinished; + bool mScreenRotationFinished; + bool mResizeFinished; + bool mDefaultScreenRotationAvailable; + bool mIsImeWindowSurface; + bool mNeedWindowRotationAcknowledgement; }; // class WindowRenderSurface } // namespace Adaptor -} // namespace internal +} // namespace Internal } // namespace Dali