From 6d14ddef39343365bcc97b402cfa8ebf6432f3fa Mon Sep 17 00:00:00 2001 From: xxb-wzy Date: Thu, 13 Jun 2024 21:40:05 +0800 Subject: [PATCH] Signed-off-by: xxb-wzy Change-Id: I175d73c111d1e3e7472a488ef0bd4302e175a7ae --- .../drawable/rs_display_render_node_drawable.cpp | 2 -- .../core/pipeline/rs_main_thread.cpp | 15 +++++++++++++++ .../render_service/core/pipeline/rs_main_thread.h | 1 + .../core/pipeline/rs_uni_render_thread.cpp | 12 ------------ .../core/pipeline/rs_uni_render_thread.h | 2 -- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/rosen/modules/render_service/core/drawable/rs_display_render_node_drawable.cpp b/rosen/modules/render_service/core/drawable/rs_display_render_node_drawable.cpp index fad68005d2..e7bde0830c 100644 --- a/rosen/modules/render_service/core/drawable/rs_display_render_node_drawable.cpp +++ b/rosen/modules/render_service/core/drawable/rs_display_render_node_drawable.cpp @@ -546,13 +546,11 @@ void RSDisplayRenderNodeDrawable::OnDraw(Drawing::Canvas& canvas) if (uniParam->IsOpDropped() && CheckDisplayNodeSkip(displayNodeSp, params, processor)) { RSMainThread::Instance()->SetFrameIsRender(false); - RSUniRenderThread::Instance().DvsyncRequestNextVsync(); SetDisplayNodeSkipFlag(*uniParam, true); return; } SetDisplayNodeSkipFlag(*uniParam, false); RSMainThread::Instance()->SetFrameIsRender(true); - RSUniRenderThread::Instance().DvsyncRequestNextVsync(); bool isHdrOn = params->GetHDRPresent(); RS_LOGD("SetHDRPresent: %{public}d OnDraw", isHdrOn); diff --git a/rosen/modules/render_service/core/pipeline/rs_main_thread.cpp b/rosen/modules/render_service/core/pipeline/rs_main_thread.cpp index c9e6d5f5b8..ade18d52e2 100644 --- a/rosen/modules/render_service/core/pipeline/rs_main_thread.cpp +++ b/rosen/modules/render_service/core/pipeline/rs_main_thread.cpp @@ -327,6 +327,20 @@ RSMainThread::~RSMainThread() noexcept } } +void RSMainThread::DvsyncCheckRequestNextVsync() +{ + bool needAnimate = false; + if (needRequestNextVsyncAnimate_) { + rsVSyncDistributor_->MarkRSAnimate(); + needAnimate = true; + } else { + rsVSyncDistributor_->UnmarkRSAnimate(); + } + if (needAnimate || rsVSyncDistributor_->HasPendingUIRNV()) { + RequestNextVSync("animate", timestamp_); + } +} + void RSMainThread::Init() { mainLoop_ = [&]() { @@ -346,6 +360,7 @@ void RSMainThread::Init() WaitUntilUnmarshallingTaskFinished(); ProcessCommand(); Animate(timestamp_); + DvsyncCheckRequestNextVsync(); CollectInfoForHardwareComposer(); RSUifirstManager::Instance().PrepareCurrentFrameEvent(); ProcessHgmFrameRate(timestamp_); diff --git a/rosen/modules/render_service/core/pipeline/rs_main_thread.h b/rosen/modules/render_service/core/pipeline/rs_main_thread.h index 322154ab53..7861a95232 100644 --- a/rosen/modules/render_service/core/pipeline/rs_main_thread.h +++ b/rosen/modules/render_service/core/pipeline/rs_main_thread.h @@ -444,6 +444,7 @@ private: float GetCurrentSteadyTimeMsFloat() const; void RequestNextVsyncForCachedCommand(std::string& transactionFlags, pid_t pid, uint64_t curIndex); void UpdateLuminance(); + void DvsyncCheckRequestNextVsync(); std::shared_ptr runner_ = nullptr; std::shared_ptr handler_ = nullptr; diff --git a/rosen/modules/render_service/core/pipeline/rs_uni_render_thread.cpp b/rosen/modules/render_service/core/pipeline/rs_uni_render_thread.cpp index ba8fbf9ae9..fd537062ef 100644 --- a/rosen/modules/render_service/core/pipeline/rs_uni_render_thread.cpp +++ b/rosen/modules/render_service/core/pipeline/rs_uni_render_thread.cpp @@ -260,7 +260,6 @@ void RSUniRenderThread::Render() if (RSMainThread::Instance()->GetMarkRenderFlag() == false) { RSMainThread::Instance()->SetFrameIsRender(true); - DvsyncRequestNextVsync(); } RSMainThread::Instance()->ResetMarkRenderFlag(); } @@ -619,17 +618,6 @@ void RSUniRenderThread::RenderServiceTreeDump(std::string& dumpString) const rootNodeDrawable_->DumpDrawableTree(0, dumpString); } -void RSUniRenderThread::DvsyncRequestNextVsync() -{ - if ((renderThreadParams_ && renderThreadParams_->GetRequestNextVsyncFlag()) || - RSMainThread::Instance()->rsVSyncDistributor_->HasPendingUIRNV()) { - RSMainThread::Instance()->rsVSyncDistributor_->MarkRSAnimate(); - RSMainThread::Instance()->RequestNextVSync("animate", renderThreadParams_->GetCurrentTimestamp()); - } else { - RSMainThread::Instance()->rsVSyncDistributor_->UnmarkRSAnimate(); - } -} - void RSUniRenderThread::UpdateDisplayNodeScreenId() { const std::shared_ptr rootNode = diff --git a/rosen/modules/render_service/core/pipeline/rs_uni_render_thread.h b/rosen/modules/render_service/core/pipeline/rs_uni_render_thread.h index 883e22f649..e997619e7f 100644 --- a/rosen/modules/render_service/core/pipeline/rs_uni_render_thread.h +++ b/rosen/modules/render_service/core/pipeline/rs_uni_render_thread.h @@ -106,8 +106,6 @@ public: void ReleaseSurface(); void AddToReleaseQueue(std::shared_ptr&& surface); - void DvsyncRequestNextVsync(); - bool IsMainLooping() const { return mainLooping_.load();