sm6375-common: power-libperfmgr: ADPF: support sending power hint

Send a hint only when the system can support the hint.

Bug: 243025173
Test: PtsUiBench & CUJ
Change-Id: If56d0c22f8dd61f5fe27ba79f08f2963269abe41
Merged-In: If56d0c22f8dd61f5fe27ba79f08f2963269abe41
This commit is contained in:
Jimmy Shiu 2024-07-18 20:16:00 +05:30 committed by Anand S
parent c4d4353fdd
commit f4fd4bcd5c
No known key found for this signature in database
GPG key ID: 3B2983FA448B3D61
2 changed files with 13 additions and 0 deletions

View file

@ -189,6 +189,15 @@ void PowerHintSession::updateUniveralBoostMode() {
}
}
void PowerHintSession::tryToSendPowerHint(std::string hint) {
if (!mSupportedHints[hint].has_value()) {
mSupportedHints[hint] = HintManager::GetInstance()->IsHintSupported(hint);
}
if (mSupportedHints[hint].value()) {
HintManager::GetInstance()->DoHint(hint);
}
}
int PowerHintSession::setSessionUclampMin(int32_t min) {
{
std::lock_guard<std::mutex> guard(mSessionLock);

View file

@ -130,6 +130,7 @@ class PowerHintSession : public BnPowerHintSession {
private:
void updateUniveralBoostMode();
int setSessionUclampMin(int32_t min);
void tryToSendPowerHint(std::string hint);
std::string getIdString() const;
AppHintDesc *mDescriptor = nullptr;
sp<StaleTimerHandler> mStaleTimerHandler;
@ -142,6 +143,9 @@ class PowerHintSession : public BnPowerHintSession {
int64_t mLastStartedTimeNs;
int64_t mLastDurationNs;
int64_t mWorkPeriodNs;
// To cache the status of whether ADPF hints are supported.
std::unordered_map<std::string, std::optional<bool>> mSupportedHints;
};
} // namespace pixel