sdm660-common: power-libperfmgr: Remove wakeup behavior from PowerHintSession and PowerSessionManager

Currently, all sessions get boosted any time DISPLAY_UPDATE_IMMINENT is
sent from SurfaceFlinger which can lead to large, unnecessary boosts.
This patch aims to change that by removing the wakeup behavior, relying
instead on sessions to boost themselves with new load change hints.

 * Remove wakeup() from PowerHintSession
 * Remove wakeSessions from PowerSessionManager
 * Remove related timers and message handlers
 * Remove DISPLAY_UPDATE_IMMINENT behavior entirely

Test: manual
Bug: b/260136431
Change-Id: I4610edfefe8fcbef7d4cdbf5768830a9392a54f7
This commit is contained in:
Matt Buckley 2022-11-22 22:20:25 +00:00 committed by CakesTwix
parent 255babc340
commit d059d7bbe1
Signed by: CakesTwix
GPG key ID: 7B11051D5CE19825
4 changed files with 1 additions and 51 deletions

View file

@ -399,30 +399,6 @@ void PowerHintSession::setStale() {
}
}
void PowerHintSession::wakeup() {
std::lock_guard<std::mutex> guard(mSessionLock);
// We only wake up non-paused and stale sessions
if (mSessionClosed || !isActive() || !isTimeout())
return;
if (ATRACE_ENABLED()) {
std::string tag = StringPrintf("wakeup.%s(a:%d,s:%d)", getIdString().c_str(), isActive(),
isTimeout());
ATRACE_NAME(tag.c_str());
}
std::shared_ptr<AdpfConfig> adpfConfig = HintManager::GetInstance()->GetAdpfProfile();
int min = std::max(mDescriptor->current_min, static_cast<int>(adpfConfig->mUclampMinInit));
mDescriptor->current_min = min;
PowerSessionManager::getInstance()->setUclampMinLocked(this, min);
mStaleTimerHandler->updateTimer();
if (ATRACE_ENABLED()) {
const std::string idstr = getIdString();
std::string sz = StringPrintf("adpf.%s-min", idstr.c_str());
ATRACE_INT(sz.c_str(), min);
}
}
time_point<steady_clock> PowerHintSession::getStaleTime() {
return mLastUpdatedTime.load() +
nanoseconds(static_cast<int64_t>(

View file

@ -81,7 +81,6 @@ class PowerHintSession : public BnPowerHintSession {
const std::vector<WorkDuration> &actualDurations) override;
bool isActive();
bool isTimeout();
void wakeup();
void setStale();
// Is this hint session for a user application
bool isAppSession();

View file

@ -96,16 +96,6 @@ void PowerSessionManager::updateHintBoost(const std::string &boost, int32_t dura
ATRACE_CALL();
ALOGV("PowerSessionManager::updateHintBoost: boost: %s, durationMs: %d", boost.c_str(),
durationMs);
if (boost.compare("DISPLAY_UPDATE_IMMINENT") == 0) {
PowerHintMonitor::getInstance()->getLooper()->sendMessage(mWakeupHandler, NULL);
}
}
void PowerSessionManager::wakeSessions() {
std::lock_guard<std::mutex> guard(mLock);
for (PowerHintSession *s : mSessions) {
s->wakeup();
}
}
int PowerSessionManager::getDisplayRefreshRate() {
@ -201,10 +191,6 @@ void PowerSessionManager::handleMessage(const Message &) {
}
}
void PowerSessionManager::WakeupHandler::handleMessage(const Message &) {
PowerSessionManager::getInstance()->wakeSessions();
}
void PowerSessionManager::dumpToFd(int fd) {
std::ostringstream dump_buf;
std::lock_guard<std::mutex> guard(mLock);

View file

@ -62,14 +62,6 @@ class PowerSessionManager : public MessageHandler {
}
private:
class WakeupHandler : public MessageHandler {
public:
WakeupHandler() {}
void handleMessage(const Message &message) override;
};
private:
void wakeSessions();
std::optional<bool> isAnyAppSessionActive();
void disableSystemTopAppBoost();
void enableSystemTopAppBoost();
@ -78,7 +70,6 @@ class PowerSessionManager : public MessageHandler {
std::unordered_set<PowerHintSession *> mSessions; // protected by mLock
std::unordered_map<int, int> mTidRefCountMap; // protected by mLock
std::unordered_map<int, std::unordered_set<PowerHintSession *>> mTidSessionListMap;
sp<WakeupHandler> mWakeupHandler;
bool mActive; // protected by mLock
/**
* mLock to pretect the above data objects opertions.
@ -90,9 +81,7 @@ class PowerSessionManager : public MessageHandler {
: kDisableBoostHintName(::android::base::GetProperty(kPowerHalAdpfDisableTopAppBoost,
"ADPF_DISABLE_TA_BOOST")),
mActive(false),
mDisplayRefreshRate(60) {
mWakeupHandler = sp<WakeupHandler>(new WakeupHandler());
}
mDisplayRefreshRate(60) {}
PowerSessionManager(PowerSessionManager const &) = delete;
void operator=(PowerSessionManager const &) = delete;
};