diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-03-09 00:21:45 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-03-09 00:21:45 +0000 |
commit | 57f67d6315ec21c5a2f3f57c708585360d8fa133 (patch) | |
tree | b59d44a557ee74fa81464a76b120eea29f15bdc0 | |
parent | d6b694db85f32e706bb948b4dd4198c93859b555 (diff) | |
parent | 292ee1512472018c49f479a964e080c98b888bf0 (diff) | |
download | pixel-57f67d6315ec21c5a2f3f57c708585360d8fa133.tar.gz |
Snap for 9712227 from 292ee1512472018c49f479a964e080c98b888bf0 to tm-qpr3-release
Change-Id: If317b636816fcfc4a6afb7cde12713f864d5dc60
-rw-r--r-- | power-libperfmgr/aidl/PowerHintSession.cpp | 12 | ||||
-rw-r--r-- | power-libperfmgr/aidl/PowerHintSession.h | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/power-libperfmgr/aidl/PowerHintSession.cpp b/power-libperfmgr/aidl/PowerHintSession.cpp index 14cbf014..5de37ba9 100644 --- a/power-libperfmgr/aidl/PowerHintSession.cpp +++ b/power-libperfmgr/aidl/PowerHintSession.cpp @@ -191,6 +191,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); @@ -334,6 +343,9 @@ ndk::ScopedAStatus PowerHintSession::reportActualWorkDuration( mLastUpdatedTime.store(std::chrono::steady_clock::now()); if (isFirstFrame) { + if (isAppSession()) { + tryToSendPowerHint("ADPF_FIRST_FRAME"); + } updateUniveralBoostMode(); } diff --git a/power-libperfmgr/aidl/PowerHintSession.h b/power-libperfmgr/aidl/PowerHintSession.h index 9bd9a2ca..604f6e27 100644 --- a/power-libperfmgr/aidl/PowerHintSession.h +++ b/power-libperfmgr/aidl/PowerHintSession.h @@ -132,6 +132,7 @@ class PowerHintSession : public BnPowerHintSession { private: void updateUniveralBoostMode(); int setSessionUclampMin(int32_t min); + void tryToSendPowerHint(std::string hint); std::string getIdString() const; const std::shared_ptr<AdaptiveCpu> mAdaptiveCpu; AppHintDesc *mDescriptor = nullptr; @@ -145,6 +146,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 |