From d665cfb6777d7fb24cadb0e7309d30e2945945c2 Mon Sep 17 00:00:00 2001 From: seungho Date: Mon, 18 Apr 2022 16:06:21 +0900 Subject: [PATCH] [Tizen] Fix to do not update state of render task in case of uploadOnly - And removed unused uploadOnly parameter in the render-manager Change-Id: I18e1e403cedf58d6e7c5c510bda123ef8b4fe149 Signed-off-by: seungho --- .../dali-test-suite-utils/test-application.cpp | 27 +++++++------ .../dali/dali-test-suite-utils/test-application.h | 4 +- automated-tests/src/dali/utc-Dali-RenderTask.cpp | 45 +++++++++++++++++++++ dali/integration-api/core.cpp | 12 +++--- dali/integration-api/core.h | 10 ++--- dali/internal/common/core-impl.cpp | 13 +++--- dali/internal/common/core-impl.h | 6 +-- dali/internal/render/common/render-manager.cpp | 4 +- dali/internal/render/common/render-manager.h | 6 +-- dali/internal/update/manager/update-manager.cpp | 46 ++++++++++++---------- dali/internal/update/manager/update-manager.h | 4 +- 11 files changed, 115 insertions(+), 62 deletions(-) diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp index e71166b..e04807b 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp @@ -178,7 +178,7 @@ void TestApplication::SendNotification() mCore->ProcessEvents(); } -void TestApplication::DoUpdate(uint32_t intervalMilliseconds, const char* location) +void TestApplication::DoUpdate(uint32_t intervalMilliseconds, const char* location, bool uploadOnly) { if(GetUpdateStatus() == 0 && mRenderStatus.NeedsUpdate() == false && @@ -190,25 +190,28 @@ void TestApplication::DoUpdate(uint32_t intervalMilliseconds, const char* locati uint32_t nextVSyncTime = mLastVSyncTime + intervalMilliseconds; float elapsedSeconds = static_cast(intervalMilliseconds) * 0.001f; - mCore->Update(elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus, false, false); + mCore->Update(elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus, false, false, uploadOnly); GetRenderController().Initialize(); mLastVSyncTime = nextVSyncTime; } -bool TestApplication::Render(uint32_t intervalMilliseconds, const char* location) +bool TestApplication::Render(uint32_t intervalMilliseconds, const char* location, bool uploadOnly) { - DoUpdate(intervalMilliseconds, location); + DoUpdate(intervalMilliseconds, location, uploadOnly); // Reset the status mRenderStatus.SetNeedsUpdate(false); mRenderStatus.SetNeedsPostRender(false); - mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/); - mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/); - mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/); - mCore->PostRender(false /*do not skip rendering*/); + mCore->PreRender(mRenderStatus, false /*do not force clear*/); + if(!uploadOnly) + { + mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/); + mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/); + } + mCore->PostRender(); mFrame++; @@ -219,7 +222,7 @@ bool TestApplication::PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, { DoUpdate(intervalMilliseconds, location); - mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/); + mCore->PreRender(mRenderStatus, false /*do not force clear*/); mCore->PreRender(mRenderStatus, mScene, damagedRects); return mStatus.KeepUpdating() || mRenderStatus.NeedsUpdate(); @@ -229,7 +232,7 @@ bool TestApplication::RenderWithPartialUpdate(std::vector>& damagedRec { mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/); mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/, clippingRect); - mCore->PostRender(false /*do not skip rendering*/); + mCore->PostRender(); mFrame++; @@ -260,10 +263,10 @@ bool TestApplication::GetRenderNeedsPostRender() bool TestApplication::RenderOnly() { // Update Time values - mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/); + mCore->PreRender(mRenderStatus, false /*do not force clear*/); mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/); mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/); - mCore->PostRender(false /*do not skip rendering*/); + mCore->PostRender(); mFrame++; diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-application.h b/automated-tests/src/dali/dali-test-suite-utils/test-application.h index 02143a7..1b101c5 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-application.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-application.h @@ -72,7 +72,7 @@ public: void ProcessEvent(const Integration::Event& event); void SendNotification(); - bool Render(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location = NULL); + bool Render(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location = NULL, bool uploadOnly = false); bool PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector>& damagedRects); bool RenderWithPartialUpdate(std::vector>& damagedRects, Rect& clippingRect); uint32_t GetUpdateStatus(); @@ -93,7 +93,7 @@ public: } private: - void DoUpdate(uint32_t intervalMilliseconds, const char* location = NULL); + void DoUpdate(uint32_t intervalMilliseconds, const char* location = NULL, bool uploadOnly = false); protected: TestPlatformAbstraction mPlatformAbstraction; diff --git a/automated-tests/src/dali/utc-Dali-RenderTask.cpp b/automated-tests/src/dali/utc-Dali-RenderTask.cpp index 4909fe3..9b5e9de 100644 --- a/automated-tests/src/dali/utc-Dali-RenderTask.cpp +++ b/automated-tests/src/dali/utc-Dali-RenderTask.cpp @@ -3480,3 +3480,48 @@ int UtcDaliRenderTaskClippingMode02(void) END_TEST; } + +int UtcDaliRenderTaskUploadOnly(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask Render Once GlSync, using loaded image"); + + // SETUP AN OFFSCREEN RENDER TASK + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); + auto& sync = application.GetGraphicsSyncImpl(); + TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); + drawTrace.Enable(true); + + Actor rootActor = Actor::New(); + application.GetScene().Add(rootActor); + + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + application.GetScene().Add(offscreenCameraActor); + Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); + + application.GetScene().Add(secondRootActor); + + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, true); + bool finished = false; + RenderTaskFinished renderTaskFinished(finished); + newTask.FinishedSignal().Connect(&application, renderTaskFinished); + application.SendNotification(); + + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); + + Integration::GraphicsSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + DALI_TEST_CHECK(lastSyncObj != NULL); + sync.SetObjectSynced(lastSyncObj, true); + + application.SendNotification(); + application.Render(16, nullptr, true); + + DALI_TEST_CHECK(!finished); + + application.Render(16, nullptr, true); + application.SendNotification(); + + DALI_TEST_CHECK(!finished); + END_TEST; +} \ No newline at end of file diff --git a/dali/integration-api/core.cpp b/dali/integration-api/core.cpp index 36b6319..02aac72 100644 --- a/dali/integration-api/core.cpp +++ b/dali/integration-api/core.cpp @@ -100,14 +100,14 @@ uint32_t Core::GetMaximumUpdateCount() const return mImpl->GetMaximumUpdateCount(); } -void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo) +void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo, bool uploadOnly) { - mImpl->Update(elapsedSeconds, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, status, renderToFboEnabled, isRenderingToFbo); + mImpl->Update(elapsedSeconds, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, status, renderToFboEnabled, isRenderingToFbo, uploadOnly); } -void Core::PreRender(RenderStatus& status, bool forceClear, bool uploadOnly) +void Core::PreRender(RenderStatus& status, bool forceClear) { - mImpl->PreRender(status, forceClear, uploadOnly); + mImpl->PreRender(status, forceClear); } void Core::PreRender(RenderStatus& status, Integration::Scene& scene, std::vector>& damagedRects) @@ -125,9 +125,9 @@ void Core::RenderScene(RenderStatus& status, Integration::Scene& scene, bool ren mImpl->RenderScene(status, scene, renderToFbo, clippingRect); } -void Core::PostRender(bool uploadOnly) +void Core::PostRender() { - mImpl->PostRender(uploadOnly); + mImpl->PostRender(); } void Core::RegisterProcessor(Processor& processor, bool postProcessor) diff --git a/dali/integration-api/core.h b/dali/integration-api/core.h index a5051e5..83cf9ba 100644 --- a/dali/integration-api/core.h +++ b/dali/integration-api/core.h @@ -324,13 +324,15 @@ public: * whether a Notification event should be sent, regardless of whether the multi-threading is used. * @param[in] renderToFboEnabled Whether rendering into the Frame Buffer Object is enabled. * @param[in] isRenderingToFbo Whether this frame is being rendered into the Frame Buffer Object. + * @param[in] uploadOnly uploadOnly Upload the resource only without rendering. */ void Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, UpdateStatus& status, bool renderToFboEnabled, - bool isRenderingToFbo); + bool isRenderingToFbo, + bool uploadOnly); /** * This is called before rendering any scene in the next frame. This method should be preceded @@ -339,9 +341,8 @@ public: * @pre The GL context must have been created, and made current. * @param[out] status showing whether update is required to run. * @param[in] forceClear force the Clear on the framebuffer even if nothing is rendered. - * @param[in] uploadOnly uploadOnly Upload the resource only without rendering. */ - void PreRender(RenderStatus& status, bool forceClear, bool uploadOnly); + void PreRender(RenderStatus& status, bool forceClear); /** * This is called before rendering any scene in the next frame. This method should be preceded @@ -383,9 +384,8 @@ public: * followed by a call up RenderScene. * Multi-threading note: this method should be called from a dedicated rendering thread. * @pre The GL context must have been created, and made current. - * @param[in] uploadOnly uploadOnly Upload the resource only without rendering. */ - void PostRender(bool uploadOnly); + void PostRender(); /** * @brief Register a processor diff --git a/dali/internal/common/core-impl.cpp b/dali/internal/common/core-impl.cpp index 8402dd6..98247ea 100644 --- a/dali/internal/common/core-impl.cpp +++ b/dali/internal/common/core-impl.cpp @@ -185,7 +185,7 @@ void Core::ContextDestroyed() { } -void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo) +void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo, bool uploadOnly) { // set the time delta so adaptor can easily print FPS with a release build with 0 as // it is cached by frametime @@ -197,7 +197,8 @@ void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, renderToFboEnabled, - isRenderingToFbo); + isRenderingToFbo, + uploadOnly); // Check the Notification Manager message queue to set needsNotification status.needsNotification = mNotificationManager->MessagesToProcess(); @@ -206,9 +207,9 @@ void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint // Any message to update will wake it up anyways } -void Core::PreRender(RenderStatus& status, bool forceClear, bool uploadOnly) +void Core::PreRender(RenderStatus& status, bool forceClear) { - mRenderManager->PreRender(status, forceClear, uploadOnly); + mRenderManager->PreRender(status, forceClear); } void Core::PreRender(RenderStatus& status, Integration::Scene& scene, std::vector>& damagedRects) @@ -226,9 +227,9 @@ void Core::RenderScene(RenderStatus& status, Integration::Scene& scene, bool ren mRenderManager->RenderScene(status, scene, renderToFbo, clippingRect); } -void Core::PostRender(bool uploadOnly) +void Core::PostRender() { - mRenderManager->PostRender(uploadOnly); + mRenderManager->PostRender(); } void Core::SceneCreated() diff --git a/dali/internal/common/core-impl.h b/dali/internal/common/core-impl.h index 7c6cb29..6516e51 100644 --- a/dali/internal/common/core-impl.h +++ b/dali/internal/common/core-impl.h @@ -125,12 +125,12 @@ public: /** * @copydoc Dali::Integration::Core::Update() */ - void Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo); + void Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo, bool uploadOnly); /** * @copydoc Dali::Integration::Core::PreRender() */ - void PreRender(Integration::RenderStatus& status, bool forceClear, bool uploadOnly); + void PreRender(Integration::RenderStatus& status, bool forceClear); /** * @copydoc Dali::Integration::Core::PreRender() @@ -150,7 +150,7 @@ public: /** * @copydoc Dali::Integration::Core::Render() */ - void PostRender(bool uploadOnly); + void PostRender(); /** * @copydoc Dali::Integration::Core::SceneCreated() diff --git a/dali/internal/render/common/render-manager.cpp b/dali/internal/render/common/render-manager.cpp index ed601b0..4b63766 100644 --- a/dali/internal/render/common/render-manager.cpp +++ b/dali/internal/render/common/render-manager.cpp @@ -430,7 +430,7 @@ void RenderManager::RemoveRenderTracker(Render::RenderTracker* renderTracker) mImpl->RemoveRenderTracker(renderTracker); } -void RenderManager::PreRender(Integration::RenderStatus& status, bool forceClear, bool uploadOnly) +void RenderManager::PreRender(Integration::RenderStatus& status, bool forceClear) { DALI_PRINT_RENDER_START(mImpl->renderBufferIndex); @@ -969,7 +969,7 @@ void RenderManager::RenderScene(Integration::RenderStatus& status, Integration:: } } -void RenderManager::PostRender(bool uploadOnly) +void RenderManager::PostRender() { // Notify RenderGeometries that rendering has finished for(auto&& iter : mImpl->geometryContainer) diff --git a/dali/internal/render/common/render-manager.h b/dali/internal/render/common/render-manager.h index 54ed12d..ddbd8e7 100644 --- a/dali/internal/render/common/render-manager.h +++ b/dali/internal/render/common/render-manager.h @@ -323,9 +323,8 @@ public: * @pre The graphics implementation must be initialized * @param[out] status showing whether update is required to run. * @param[in] forceClear force the Clear on the framebuffer even if nothing is rendered. - * @param[in] uploadOnly uploadOnly Upload the resource only without rendering. */ - void PreRender(Integration::RenderStatus& status, bool forceClear, bool uploadOnly); + void PreRender(Integration::RenderStatus& status, bool forceClear); // This method should be called from Core::PreRender() @@ -373,9 +372,8 @@ public: * followed by a call up RenderScene. * Multi-threading note: this method should be called from a dedicated rendering thread. * @pre The graphics implementation must be initialized - * @param[in] uploadOnly uploadOnly Upload the resource only without rendering. */ - void PostRender(bool uploadOnly); + void PostRender(); private: /** diff --git a/dali/internal/update/manager/update-manager.cpp b/dali/internal/update/manager/update-manager.cpp index 80e8be3..f8e8146 100644 --- a/dali/internal/update/manager/update-manager.cpp +++ b/dali/internal/update/manager/update-manager.cpp @@ -898,7 +898,8 @@ uint32_t UpdateManager::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, bool renderToFboEnabled, - bool isRenderingToFbo) + bool isRenderingToFbo, + bool uploadOnly) { const BufferIndex bufferIndex = mSceneGraphBuffers.GetUpdateBufferIndex(); @@ -1046,36 +1047,39 @@ uint32_t UpdateManager::Update(float elapsedSeconds, } } - for(auto&& scene : mImpl->scenes) + if(!uploadOnly) { - if(scene && scene->root && scene->taskList) + for(auto&& scene : mImpl->scenes) { - RenderTaskList::RenderTaskContainer& tasks = scene->taskList->GetTasks(); - - // check the countdown and notify - bool doRenderOnceNotify = false; - mImpl->renderTaskWaiting = false; - for(auto&& renderTask : tasks) + if(scene && scene->root && scene->taskList) { - renderTask->UpdateState(); + RenderTaskList::RenderTaskContainer& tasks = scene->taskList->GetTasks(); - if(renderTask->IsWaitingToRender() && - renderTask->ReadyToRender(bufferIndex) /*avoid updating forever when source actor is off-stage*/) + // check the countdown and notify + bool doRenderOnceNotify = false; + mImpl->renderTaskWaiting = false; + for(auto&& renderTask : tasks) { - mImpl->renderTaskWaiting = true; // keep update/render threads alive + renderTask->UpdateState(); + + if(renderTask->IsWaitingToRender() && + renderTask->ReadyToRender(bufferIndex) /*avoid updating forever when source actor is off-stage*/) + { + mImpl->renderTaskWaiting = true; // keep update/render threads alive + } + + if(renderTask->HasRendered()) + { + doRenderOnceNotify = true; + } } - if(renderTask->HasRendered()) + if(doRenderOnceNotify) { - doRenderOnceNotify = true; + DALI_LOG_INFO(gRenderTaskLogFilter, Debug::General, "Notify a render task has finished\n"); + mImpl->notificationManager.QueueCompleteNotification(scene->taskList->GetCompleteNotificationInterface()); } } - - if(doRenderOnceNotify) - { - DALI_LOG_INFO(gRenderTaskLogFilter, Debug::General, "Notify a render task has finished\n"); - mImpl->notificationManager.QueueCompleteNotification(scene->taskList->GetCompleteNotificationInterface()); - } } } diff --git a/dali/internal/update/manager/update-manager.h b/dali/internal/update/manager/update-manager.h index 23c5143..9a4a0e6 100644 --- a/dali/internal/update/manager/update-manager.h +++ b/dali/internal/update/manager/update-manager.h @@ -606,13 +606,15 @@ public: * @param[in] nextVSyncTimeMilliseconds The estimated time, in milliseconds, of the next VSync. * @param[in] renderToFboEnabled Whether rendering into the Frame Buffer Object is enabled. * @param[in] isRenderingToFbo Whether this frame is being rendered into the Frame Buffer Object. + * @param[in] uploadOnly uploadOnly Upload the resource only without rendering. * @return True if further updates are required e.g. during animations. */ uint32_t Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, bool renderToFboEnabled, - bool isRenderingToFbo); + bool isRenderingToFbo, + bool uploadOnly); /** * @copydoc Dali::Stage::KeepRendering() -- 2.7.4