X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fupdate%2Fcommon%2Fscene-graph-scene.h;h=eba4c0fb05d11c00eb8b8ad98604b3fd45b0d50d;hb=refs%2Fchanges%2F83%2F267183%2F4;hp=0aaf50e1f724d66af0eac0ffddadc9e9b7a83dc8;hpb=716d916ef3929bbf21238c341f83817354386c22;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/update/common/scene-graph-scene.h b/dali/internal/update/common/scene-graph-scene.h index 0aaf50e..eba4c0f 100644 --- a/dali/internal/update/common/scene-graph-scene.h +++ b/dali/internal/update/common/scene-graph-scene.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_SCENE_GRAPH_SCENE_H /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -24,15 +24,61 @@ #include #include #include +#include #include namespace Dali { namespace Internal { +namespace Render +{ +class Renderer; +} + namespace SceneGraph { class RenderInstructionContainer; +class Node; + +struct DirtyRect +{ + DirtyRect(Node* node, Render::Renderer* renderer, int32_t frame, Rect& rect) + : node(node), + renderer(renderer), + frame(frame), + rect(rect), + visited(true) + { + } + + DirtyRect() = default; + + bool operator<(const DirtyRect& rhs) const + { + if(node == rhs.node) + { + if(renderer == rhs.renderer) + { + return frame > rhs.frame; // Most recent rects come first + } + else + { + return renderer < rhs.renderer; + } + } + else + { + return node < rhs.node; + } + } + + Node* node{nullptr}; + Render::Renderer* renderer{nullptr}; + int32_t frame{0}; + Rect rect{}; + bool visited{true}; +}; class Scene { @@ -138,7 +184,6 @@ public: /** * Set the surface orientation when surface is rotated. * - * @param[in] scene The rotated scene. * @param[in] orientation The orientation value representing the surface. */ void SetSurfaceOrientation(int32_t orientation); @@ -157,14 +202,22 @@ public: bool IsSurfaceRectChanged(); /** + * @brief Set the internal flag to acknowledge surface rotation. + */ + void SetRotationCompletedAcknowledgement(); + + /** + * @brief Query wheter is set to acknowledge for completing surface rotation. + * @return true it should be acknowledged. + */ + bool IsRotationCompletedAcknowledgementSet(); + + /** * Set the render target of the surface * * @param[in] renderTarget The render target. */ - void SetSurfaceRenderTarget(Graphics::RenderTarget* renderTarget) - { - mRenderTarget = renderTarget; - } + void SetSurfaceRenderTargetCreateInfo(const Graphics::RenderTargetCreateInfo& renderTargetCreateInfo); /** * Get the render target created for the scene @@ -173,7 +226,7 @@ public: */ [[nodiscard]] Graphics::RenderTarget* GetSurfaceRenderTarget() const { - return mRenderTarget; + return mRenderTarget.get(); } /** @@ -203,34 +256,68 @@ public: return mClearValues; } + /** + * @brief Set a root of the Scene + * + * @param layer The root layer + */ + void SetRoot(SceneGraph::Layer* layer) + { + mRoot = layer; + } + + /** + * @brief Get a root of the Scene + * + * @return The root layer + */ + SceneGraph::Layer* GetRoot() const + { + return mRoot; + } + + /** + * @brief Get ItemsDirtyRects + * + * @return the ItemsDirtyRects + */ + std::vector& GetItemsDirtyRects(); + private: // Render instructions describe what should be rendered during RenderManager::RenderScene() // Update manager updates instructions for the next frame while we render the current one RenderInstructionContainer mInstructions; ///< Render instructions for the scene + Graphics::Controller* mGraphicsController; ///< Graphics controller + Dali::Integration::Scene::FrameCallbackContainer mFrameRenderedCallbacks; ///< Frame rendered callbacks Dali::Integration::Scene::FrameCallbackContainer mFramePresentedCallbacks; ///< Frame presented callbacks bool mSkipRendering; ///< A flag to skip rendering - Rect mSurfaceRect; ///< The rectangle of surface which is related ot this scene. - int32_t mSurfaceOrientation; ///< The orientation of surface which is related of this scene - bool mSurfaceRectChanged; ///< The flag of surface's rectangle is changed when is resized, moved or rotated. + Rect mSurfaceRect; ///< The rectangle of surface which is related ot this scene. + int32_t mSurfaceOrientation; ///< The orientation of surface which is related of this scene + bool mSurfaceRectChanged; ///< The flag of surface's rectangle is changed when is resized, moved or rotated. + bool mRotationCompletedAcknowledgement; ///< The flag of sending the acknowledgement to complete window rotation. // Render pass and render target + Graphics::RenderTargetCreateInfo mRenderTargetCreateInfo; // Passed in by message before 2nd stage Initialization happens. + /** * Render pass is created on fly depending on Load and Store operations * The default render pass (most likely to be used) is the load = CLEAR * and store = STORE for color attachment. */ - Graphics::UniquePtr mRenderPass{nullptr}; ///< The render pass created to render the surface - Graphics::UniquePtr mRenderPassNoClear{nullptr}; ///< The render pass created to render the surface without clearing color - Graphics::RenderTarget* mRenderTarget{nullptr}; ///< This is created in the event thread when surface is created/resized/replaced + Graphics::UniquePtr mRenderPass{nullptr}; ///< The render pass created to render the surface + Graphics::UniquePtr mRenderPassNoClear{nullptr}; ///< The render pass created to render the surface without clearing color + Graphics::UniquePtr mRenderTarget{nullptr}; ///< This is created in Update/Render thread when surface is created/resized/replaced - // clear colors - std::vector mClearValues{}; + SceneGraph::Layer* mRoot{nullptr}; ///< Root node + + std::vector mClearValues{}; ///< Clear colors + std::vector mItemsDirtyRects{}; ///< Dirty rect list }; /// Messages @@ -278,15 +365,26 @@ inline void SetSurfaceOrientationMessage(EventThreadServices& eventThreadService new(slot) LocalType(&scene, &Scene::SetSurfaceOrientation, orientation); } -inline void SetSurfaceRenderTargetMessage(EventThreadServices& eventThreadServices, const Scene& scene, Graphics::RenderTarget* renderTarget) +inline void SetRotationCompletedAcknowledgementMessage(EventThreadServices& eventThreadServices, const Scene& scene) +{ + using LocalType = Message; + + // Reserve some memory inside the message queue + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new(slot) LocalType(&scene, &Scene::SetRotationCompletedAcknowledgement); +} + +inline void SetSurfaceRenderTargetCreateInfoMessage(EventThreadServices& eventThreadServices, const Scene& scene, const Graphics::RenderTargetCreateInfo& renderTargetCreateInfo) { - using LocalType = MessageValue1; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); // Construct message in the message queue memory; note that delete should not be called on the return value - new(slot) LocalType(&scene, &Scene::SetSurfaceRenderTarget, renderTarget); + new(slot) LocalType(&scene, &Scene::SetSurfaceRenderTargetCreateInfo, renderTargetCreateInfo); } } // namespace SceneGraph