From dada1040afd0416a74710a4c2e91e1aba4b3efa4 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Sat, 6 Aug 2022 00:31:07 -0700 Subject: [PATCH] power-libperfmgr: ADPF: extend non-stale session timer in wakeup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For DISPLAY_UPDATE_IMMINENT wakeup signal, non-stale session's timer should be also extended. This resolves the performance issue caused those sessions to go stale     prematurely. Bug: 241621485 Test: Build Signed-off-by: Wei Wang Change-Id: I06330e064060248bb556ae35e0cb8fd302cef231 --- aidl/power-libperfmgr/PowerHintSession.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/aidl/power-libperfmgr/PowerHintSession.cpp b/aidl/power-libperfmgr/PowerHintSession.cpp index 2eea100..0ac0b4a 100644 --- a/aidl/power-libperfmgr/PowerHintSession.cpp +++ b/aidl/power-libperfmgr/PowerHintSession.cpp @@ -410,9 +410,16 @@ void PowerHintSession::setStale() { void PowerHintSession::wakeup() { std::lock_guard guard(mSessionLock); - // We only wake up non-paused and stale sessions - if (mSessionClosed || !isActive() || !isTimeout()) + // We only wake up non-paused session + if (mSessionClosed || !isActive()) { return; + } + // Update session's timer + mStaleTimerHandler->updateTimer(); + // Skip uclamp update for stale session + if (!isTimeout()) { + return; + } if (ATRACE_ENABLED()) { std::string tag = StringPrintf("wakeup.%s(a:%d,s:%d)", getIdString().c_str(), isActive(), isTimeout()); @@ -422,7 +429,6 @@ void PowerHintSession::wakeup() { int min = std::max(mDescriptor->current_min, static_cast(adpfConfig->mUclampMinInit)); mDescriptor->current_min = min; PowerSessionManager::getInstance()->setUclampMinLocked(this, min); - mStaleTimerHandler->updateTimer(); if (ATRACE_ENABLED()) { const std::string idstr = getIdString();