From 01666ae10905a42b047772bae764be74767cd475 Mon Sep 17 00:00:00 2001 From: Wonsik Jung Date: Mon, 10 Aug 2020 14:27:43 +0900 Subject: [PATCH] Revert "[Tizen] Modify dirtyRects to have scene for multi window support." This reverts commit ad7454e24869b9f110330d13f626ed3e3b8b2701. --- dali/internal/event/common/scene-impl.cpp | 5 -- dali/internal/event/common/scene-impl.h | 57 ----------------- dali/internal/render/common/render-manager.cpp | 84 ++++++++++++++++++++------ 3 files changed, 65 insertions(+), 81 deletions(-) mode change 100755 => 100644 dali/internal/event/common/scene-impl.cpp mode change 100755 => 100644 dali/internal/event/common/scene-impl.h diff --git a/dali/internal/event/common/scene-impl.cpp b/dali/internal/event/common/scene-impl.cpp old mode 100755 new mode 100644 index 936b4ff..b2516d8 --- a/dali/internal/event/common/scene-impl.cpp +++ b/dali/internal/event/common/scene-impl.cpp @@ -394,11 +394,6 @@ Integration::Scene::WheelEventSignalType& Scene::WheelEventSignal() return mWheelEventSignal; } -std::vector& Scene::GetItemsDirtyRects() -{ - return mItemsDirtyRects; -} - } // Internal } // Dali diff --git a/dali/internal/event/common/scene-impl.h b/dali/internal/event/common/scene-impl.h old mode 100755 new mode 100644 index 021cd2e..007a18a --- a/dali/internal/event/common/scene-impl.h +++ b/dali/internal/event/common/scene-impl.h @@ -44,54 +44,6 @@ namespace Internal namespace SceneGraph { class Scene; - -struct DirtyRect -{ - DirtyRect(Node* node, Render::Renderer* renderer, int frame, Rect& rect) - : node(node), - renderer(renderer), - frame(frame), - rect(rect), - visited(true) - { - } - - DirtyRect() - : node(nullptr), - renderer(nullptr), - frame(0), - rect(), - visited(true) - { - } - - 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; - Render::Renderer* renderer; - int frame; - - Rect rect; - bool visited; -}; - } class EventProcessor; @@ -319,13 +271,6 @@ public: */ Integration::Scene::WheelEventSignalType& WheelEventSignal(); - /** - * @brief Get ItemsDirtyRects - * - * @return the ItemsDirtyRects - */ - std::vector& GetItemsDirtyRects(); - public: /** @@ -399,8 +344,6 @@ private: // The wheel event signal Integration::Scene::WheelEventSignalType mWheelEventSignal; - - std::vector mItemsDirtyRects; }; } // Internal diff --git a/dali/internal/render/common/render-manager.cpp b/dali/internal/render/common/render-manager.cpp index 3151a42..6143824 100755 --- a/dali/internal/render/common/render-manager.cpp +++ b/dali/internal/render/common/render-manager.cpp @@ -48,6 +48,53 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_REN } // unnamed namespace #endif +struct DirtyRect +{ + DirtyRect(Node* node, Render::Renderer* renderer, int frame, Rect& rect) + : node(node), + renderer(renderer), + frame(frame), + rect(rect), + visited(true) + { + } + + DirtyRect() + : node(nullptr), + renderer(nullptr), + frame(0), + rect(), + visited(true) + { + } + + 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; + Render::Renderer* renderer; + int frame; + + Rect rect; + bool visited; +}; + /** * Structure to contain internal data */ @@ -78,6 +125,7 @@ struct RenderManager::Impl depthBufferAvailable( depthBufferAvailableParam ), stencilBufferAvailable( stencilBufferAvailableParam ), partialUpdateAvailable( partialUpdateAvailableParam ), + itemsCheckSum(0), defaultSurfaceOrientation( 0 ) { // Create thread pool with just one thread ( there may be a need to create more threads in the future ). @@ -181,6 +229,8 @@ struct RenderManager::Impl std::unique_ptr threadPool; ///< The thread pool Vector boundTextures; ///< The textures bound for rendering Vector textureDependencyList; ///< The dependency list of binded textures + std::size_t itemsCheckSum; ///< The damaged render items checksum from previous prerender phase. + std::vector itemsDirtyRects; int defaultSurfaceOrientation; ///< defaultSurfaceOrientation for the default surface we are rendering to }; @@ -617,19 +667,15 @@ void RenderManager::PreRender( Integration::Scene& scene, std::vector> // Clean collected dirty/damaged rects on exit if 3d layer or 3d node or other conditions. DamagedRectsCleaner damagedRectCleaner(damagedRects); - - - Internal::Scene& sceneInternal = GetImplementation(scene); - SceneGraph::Scene* sceneObject = sceneInternal.GetSceneObject(); - // Mark previous dirty rects in the sorted array. The array is already sorted by node and renderer, frame number. - // so you don't need to sort: std::stable_sort(itemsDirtyRects.begin(), itemsDirtyRects.end()); - std::vector& itemsDirtyRects = sceneInternal.GetItemsDirtyRects(); - for (DirtyRect& dirtyRect : itemsDirtyRects) + // so you don't need to sort: std::stable_sort(mImpl->itemsDirtyRects.begin(), mImpl->itemsDirtyRects.end()); + for (DirtyRect& dirtyRect : mImpl->itemsDirtyRects) { dirtyRect.visited = false; } + Internal::Scene& sceneInternal = GetImplementation(scene); + SceneGraph::Scene* sceneObject = sceneInternal.GetSceneObject(); uint32_t count = sceneObject->GetRenderInstructions().Count( mImpl->renderBufferIndex ); for (uint32_t i = 0; i < count; ++i) { @@ -732,11 +778,11 @@ void RenderManager::PreRender( Integration::Scene& scene, std::vector> // 2. Mark the related dirty rects as visited so they will not be removed below. // 3. Keep only last 3 dirty rects for the same node and renderer (Tizen uses 3 back buffers, Ubuntu 1). dirtyRect.rect = rect; - auto dirtyRectPos = std::lower_bound(itemsDirtyRects.begin(), itemsDirtyRects.end(), dirtyRect); - dirtyRectPos = itemsDirtyRects.insert(dirtyRectPos, dirtyRect); + auto dirtyRectPos = std::lower_bound(mImpl->itemsDirtyRects.begin(), mImpl->itemsDirtyRects.end(), dirtyRect); + dirtyRectPos = mImpl->itemsDirtyRects.insert(dirtyRectPos, dirtyRect); int c = 1; - while (++dirtyRectPos != itemsDirtyRects.end()) + while (++dirtyRectPos != mImpl->itemsDirtyRects.end()) { if (dirtyRectPos->node != item.mNode || dirtyRectPos->renderer != item.mRenderer) { @@ -750,7 +796,7 @@ void RenderManager::PreRender( Integration::Scene& scene, std::vector> c++; if (c > 3) // no more then 3 previous rects { - itemsDirtyRects.erase(dirtyRectPos); + mImpl->itemsDirtyRects.erase(dirtyRectPos); break; } } @@ -762,8 +808,8 @@ void RenderManager::PreRender( Integration::Scene& scene, std::vector> { // 1. The item is not dirty, the node and renderer referenced by the item are still exist. // 2. Mark the related dirty rects as visited so they will not be removed below. - auto dirtyRectPos = std::lower_bound(itemsDirtyRects.begin(), itemsDirtyRects.end(), dirtyRect); - while (dirtyRectPos != itemsDirtyRects.end()) + auto dirtyRectPos = std::lower_bound(mImpl->itemsDirtyRects.begin(), mImpl->itemsDirtyRects.end(), dirtyRect); + while (dirtyRectPos != mImpl->itemsDirtyRects.end()) { if (dirtyRectPos->node != item.mNode || dirtyRectPos->renderer != item.mRenderer) { @@ -781,9 +827,9 @@ void RenderManager::PreRender( Integration::Scene& scene, std::vector> } // Check removed nodes or removed renderers dirty rects - auto i = itemsDirtyRects.begin(); - auto j = itemsDirtyRects.begin(); - while (i != itemsDirtyRects.end()) + auto i = mImpl->itemsDirtyRects.begin(); + auto j = mImpl->itemsDirtyRects.begin(); + while (i != mImpl->itemsDirtyRects.end()) { if (i->visited) { @@ -797,9 +843,9 @@ void RenderManager::PreRender( Integration::Scene& scene, std::vector> i++; } - if( j != itemsDirtyRects.begin() ) + if( j != mImpl->itemsDirtyRects.begin() ) { - itemsDirtyRects.resize(j - itemsDirtyRects.begin()); + mImpl->itemsDirtyRects.resize(j - mImpl->itemsDirtyRects.begin()); } damagedRectCleaner.SetCleanOnReturn(false); } -- 2.7.4