X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fwindow-system%2Fcommon%2Fwindow-render-surface.h;h=e0ef0ec5582db5555d8cd3fa86a8518112901c83;hb=62480e7eb3bb946a5e41d118aaf58e4596bed5fc;hp=a72707ead1982248a81ffb9ff39d8666b057e777;hpb=e1cd5273071896ce2a0fde47ab793e3cad2ffeac;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 a72707e..e0ef0ec 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) 2019 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,24 +19,26 @@ */ // EXTERNAL INCLUDES +#include +#include #include #include +#include // INTERNAL INCLUDES #include #include #include +#include namespace Dali { - class TriggerEventInterface; namespace Internal { namespace Adaptor { - class WindowBase; class AdaptorInternalServices; @@ -46,8 +48,8 @@ class AdaptorInternalServices; class WindowRenderSurface : public Dali::RenderSurfaceInterface, public ConnectionTracker { public: - - typedef Signal< void ( ) > OutputSignalType; + using OutputSignalType = Signal; + using DamagedRectsContainer = std::list>>; /** * Uses an window surface to render to. @@ -55,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 @@ -63,7 +65,6 @@ public: virtual ~WindowRenderSurface(); public: // API - /** * @brief Get the native window handle * @return The native window handle @@ -85,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 @@ -99,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 @@ -108,102 +109,126 @@ 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 This signal is emitted when the output is transformed. */ OutputSignalType& OutputTransformedSignal(); -public: // from Dali::Integration::RenderSurface +public: // from Dali::RenderSurfaceInterface + /** + * @copydoc Dali::RenderSurfaceInterface::GetPositionSize() + */ + PositionSize GetPositionSize() const override; /** - * @copydoc Dali::Integration::RenderSurface::GetPositionSize() */ - virtual PositionSize GetPositionSize() const override; + void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override; /** + * @copydoc Dali::RenderSurfaceInterface::GetOrientation() */ - virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override; + int GetOrientation() const override; /** - * @copydoc Dali::Integration::RenderSurface::InitializeGraphics() + * @copydoc Dali::RenderSurfaceInterface::InitializeGraphics() */ - virtual void InitializeGraphics() override; + void InitializeGraphics() override; /** - * @copydoc Dali::Integration::RenderSurface::CreateSurface() + * @copydoc Dali::RenderSurfaceInterface::CreateSurface() */ - virtual void CreateSurface() override; + void CreateSurface() override; /** - * @copydoc Dali::Integration::RenderSurface::DestroySurface() + * @copydoc Dali::RenderSurfaceInterface::DestroySurface() */ - virtual void DestroySurface() override; + void DestroySurface() override; /** - * @copydoc Dali::Integration::RenderSurface::ReplaceGraphicsSurface() + * @copydoc Dali::RenderSurfaceInterface::ReplaceGraphicsSurface() */ - virtual bool ReplaceGraphicsSurface() override; + bool ReplaceGraphicsSurface() override; /** - * @copydoc Dali::Integration::RenderSurface::MoveResize() + * @copydoc Dali::RenderSurfaceInterface::MoveResize() */ - virtual void MoveResize( Dali::PositionSize positionSize) override; + void MoveResize(Dali::PositionSize positionSize) override; /** - * @copydoc Dali::Integration::RenderSurface::StartRender() + * @copydoc Dali::RenderSurfaceInterface::StartRender() */ - virtual void StartRender() override; + void StartRender() override; /** - * @copydoc Dali::Integration::RenderSurface::PreRender() + * @copydoc Dali::RenderSurfaceInterface::PreRender() */ - virtual bool PreRender( bool resizingSurface ) override; + bool PreRender(bool resizingSurface, const std::vector>& damagedRects, Rect& clippingRect) override; /** - * @copydoc Dali::Integration::RenderSurface::PostRender() + * @copydoc Dali::RenderSurfaceInterface::PostRender() */ - virtual void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface ); + void PostRender() override; /** - * @copydoc Dali::Integration::RenderSurface::StopRender() + * @copydoc Dali::RenderSurfaceInterface::StopRender() */ - virtual void StopRender() override; + void StopRender() override; /** - * @copydoc Dali::Integration::RenderSurface::SetThreadSynchronization + * @copydoc Dali::RenderSurfaceInterface::SetThreadSynchronization */ - virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) override; + void SetThreadSynchronization(ThreadSynchronizationInterface& threadSynchronization) override; /** - * @copydoc Dali::Integration::RenderSurface::ReleaseLock() + * @copydoc Dali::RenderSurfaceInterface::ReleaseLock() */ - virtual void ReleaseLock() override; + void ReleaseLock() override; /** - * @copydoc Dali::Integration::RenderSurface::GetSurfaceType() + * @copydoc Dali::RenderSurfaceInterface::GetSurfaceType() */ - virtual Integration::RenderSurface::Type GetSurfaceType() override; + Dali::RenderSurfaceInterface::Type GetSurfaceType() override; /** - * @copydoc Dali::Integration::RenderSurface::MakeContextCurrent() + * @copydoc Dali::RenderSurfaceInterface::MakeContextCurrent() */ - virtual void MakeContextCurrent() override; + void MakeContextCurrent() override; /** - * @copydoc Dali::Integration::RenderSurface::GetDepthBufferRequired() + * @copydoc Dali::RenderSurfaceInterface::GetDepthBufferRequired() */ - virtual Integration::DepthBufferAvailable GetDepthBufferRequired() override; + Integration::DepthBufferAvailable GetDepthBufferRequired() override; /** - * @copydoc Dali::Integration::RenderSurface::GetStencilBufferRequired() + * @copydoc Dali::RenderSurfaceInterface::GetStencilBufferRequired() */ - virtual Integration::StencilBufferAvailable GetStencilBufferRequired() override; + Integration::StencilBufferAvailable GetStencilBufferRequired() override; private: - /** * @brief Second stage construction */ - void Initialize( Any surface ); + void Initialize(Any surface); /** * Notify output is transformed. @@ -211,48 +236,107 @@ 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(); -protected: + /** + * @brief Used as the callback for the frame rendered / presented. + */ + void ProcessFrameCallback(); + + /** + * @brief Called when our event file descriptor has been written to. + * @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); + + /** + * @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>& damagedRects, Rect& clippingRect); + /** + * @brief Swap buffers. + * @param[in] damagedRects List of damaged rects + */ + void SwapBuffers(const std::vector>& damagedRects); + +protected: // Undefined WindowRenderSurface(const WindowRenderSurface&) = delete; // Undefined WindowRenderSurface& operator=(const WindowRenderSurface& rhs) = delete; -private: // Data +private: + struct FrameCallbackInfo + { + FrameCallbackInfo(Dali::Integration::Scene::FrameCallbackContainer& callbackList, int fd) + : callbacks(), + fileDescriptorMonitor(), + fileDescriptor(fd) + { + // Transfer owership of the CallbackBase + for(auto&& iter : callbackList) + { + callbacks.push_back(std::make_pair(std::move(iter.first), iter.second)); + } + } + + ~FrameCallbackInfo() + { + // Delete FileDescriptorMonitor before close fd. + fileDescriptorMonitor.release(); + close(fileDescriptor); + } + + Dali::Integration::Scene::FrameCallbackContainer callbacks; + std::unique_ptr fileDescriptorMonitor; + int fileDescriptor; + }; + + using FrameCallbackInfoContainer = std::vector>; - EglInterface* mEGL; - Dali::DisplayConnection* mDisplayConnection; - PositionSize mPositionSize; ///< Position - std::unique_ptr< WindowBase > mWindowBase; - ThreadSynchronizationInterface* mThreadSynchronization; - TriggerEventInterface* mRenderNotification; ///< Render notification trigger - TriggerEventInterface* mRotationTrigger; - GraphicsInterface* mGraphics; ///< Graphics interface - EGLSurface mEGLSurface; - EGLContext mEGLContext; - ColorDepth mColorDepth; ///< Color depth of surface (32 bit or 24 bit) - OutputSignalType mOutputTransformedSignal; - int mRotationAngle; - int mScreenRotationAngle; - bool mOwnSurface; ///< Whether we own the surface (responsible for deleting it) - bool mRotationSupported; - bool mRotationFinished; - bool mScreenRotationFinished; - bool mResizeFinished; - - uint32_t mDpiHorizontal; - uint32_t mDpiVertical; +private: // Data + 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