summaryrefslogtreecommitdiff
path: root/power-libperfmgr/aidl/Power.cpp
diff options
context:
space:
mode:
authorWei Wang <wvw@google.com>2021-06-16 21:20:44 -0700
committerWei Wang <wvw@google.com>2021-06-17 17:22:22 -0700
commit90e7ad4492dec7804fb1c1c5a127065bc9c623b3 (patch)
tree0aef73874187ba37248977c7dab97421e8243691 /power-libperfmgr/aidl/Power.cpp
parent2dcd078c5a04867d56f619260d87791429034e80 (diff)
downloadpixel-90e7ad4492dec7804fb1c1c5a127065bc9c623b3.tar.gz
power-libperfmgr: improve adpf logic
Cache active state and reduce log spam Add value tracing into libperfmgr Use adaptive stale timeout based on rate limit Bug: 191331719 Bug: 191296994 Bug: 177493042 Test: boot Signed-off-by: Wei Wang <wvw@google.com> Change-Id: I1c1484c9277209bf68bd287ceae83e2b37684c62
Diffstat (limited to 'power-libperfmgr/aidl/Power.cpp')
-rw-r--r--power-libperfmgr/aidl/Power.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/power-libperfmgr/aidl/Power.cpp b/power-libperfmgr/aidl/Power.cpp
index 329f0570..f232ff4d 100644
--- a/power-libperfmgr/aidl/Power.cpp
+++ b/power-libperfmgr/aidl/Power.cpp
@@ -56,7 +56,8 @@ Power::Power(std::shared_ptr<HintManager> hm, std::shared_ptr<DisplayLowPower> d
mInteractionHandler(nullptr),
mVRModeOn(false),
mSustainedPerfModeOn(false),
- mAdpfRate(::android::base::GetIntProperty(kPowerHalAdpfRateProp, kPowerHalAdpfRateDefault)) {
+ mAdpfRateNs(
+ ::android::base::GetIntProperty(kPowerHalAdpfRateProp, kPowerHalAdpfRateDefault)) {
mInteractionHandler = std::make_unique<InteractionHandler>(mHintManager);
mInteractionHandler->Init();
@@ -91,7 +92,7 @@ Power::Power(std::shared_ptr<HintManager> hm, std::shared_ptr<DisplayLowPower> d
}
// Now start to take powerhint
- LOG(INFO) << "PowerHAL ready to take hints, Adpf update rate: " << mAdpfRate;
+ LOG(INFO) << "PowerHAL ready to take hints, Adpf update rate: " << mAdpfRateNs;
}
ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
@@ -253,7 +254,6 @@ binder_status_t Power::dump(int fd, const char **, uint32_t) {
if (!::android::base::WriteStringToFd(buf, fd)) {
PLOG(ERROR) << "Failed to dump state to fd";
}
- // TODO(jimmyshiu@): dump weak_ptr of PowerHintSession
fsync(fd);
return STATUS_OK;
}
@@ -262,7 +262,7 @@ ndk::ScopedAStatus Power::createHintSession(int32_t tgid, int32_t uid,
const std::vector<int32_t> &threadIds,
int64_t durationNanos,
std::shared_ptr<IPowerHintSession> *_aidl_return) {
- if (mAdpfRate == -1) {
+ if (mAdpfRateNs <= 0) {
*_aidl_return = nullptr;
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
@@ -271,15 +271,15 @@ ndk::ScopedAStatus Power::createHintSession(int32_t tgid, int32_t uid,
*_aidl_return = nullptr;
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
}
- std::shared_ptr<IPowerHintSession> session =
- ndk::SharedRefBase::make<PowerHintSession>(tgid, uid, threadIds, durationNanos);
+ std::shared_ptr<IPowerHintSession> session = ndk::SharedRefBase::make<PowerHintSession>(
+ tgid, uid, threadIds, durationNanos, nanoseconds(mAdpfRateNs));
*_aidl_return = session;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Power::getHintSessionPreferredRate(int64_t *outNanoseconds) {
- *outNanoseconds = mAdpfRate;
- if (mAdpfRate == -1) {
+ *outNanoseconds = mAdpfRateNs;
+ if (mAdpfRateNs <= 0) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}