diff options
| author | 2023-05-12 19:30:07 +0000 | |
|---|---|---|
| committer | 2023-05-12 19:30:07 +0000 | |
| commit | acf0d150697c65ccb3e8deb38c2e5dc55bd9e89d (patch) | |
| tree | 1c9e56955b038132fa2657216c0196f491947228 | |
| parent | b1d5bac3c43046cf1d6786916584de0db38473e7 (diff) | |
| parent | 814f9fc4e4bafe154da21d5e0989886ad14cc9a6 (diff) | |
Merge "Prevent LOAD_RESET signal after too many false positives" into udc-dev
| -rw-r--r-- | libs/hwui/renderthread/HintSessionWrapper.cpp | 6 | ||||
| -rw-r--r-- | libs/hwui/renderthread/HintSessionWrapper.h | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/libs/hwui/renderthread/HintSessionWrapper.cpp b/libs/hwui/renderthread/HintSessionWrapper.cpp index 597cbf732d82..814ac4d90028 100644 --- a/libs/hwui/renderthread/HintSessionWrapper.cpp +++ b/libs/hwui/renderthread/HintSessionWrapper.cpp @@ -156,6 +156,7 @@ void HintSessionWrapper::updateTargetWorkDuration(long targetWorkDurationNanos) void HintSessionWrapper::reportActualWorkDuration(long actualDurationNanos) { if (!init()) return; + mResetsSinceLastReport = 0; if (actualDurationNanos > kSanityCheckLowerBound && actualDurationNanos < kSanityCheckUpperBound) { gAPH_reportActualWorkDurationFn(mHintSession, actualDurationNanos); @@ -163,9 +164,12 @@ void HintSessionWrapper::reportActualWorkDuration(long actualDurationNanos) { } void HintSessionWrapper::sendLoadResetHint() { + static constexpr int kMaxResetsSinceLastReport = 2; if (!init()) return; nsecs_t now = systemTime(); - if (now - mLastFrameNotification > kResetHintTimeout) { + if (now - mLastFrameNotification > kResetHintTimeout && + mResetsSinceLastReport <= kMaxResetsSinceLastReport) { + ++mResetsSinceLastReport; gAPH_sendHintFn(mHintSession, static_cast<int>(SessionHint::CPU_LOAD_RESET)); } mLastFrameNotification = now; diff --git a/libs/hwui/renderthread/HintSessionWrapper.h b/libs/hwui/renderthread/HintSessionWrapper.h index b7a433fb4eae..24b8150dd489 100644 --- a/libs/hwui/renderthread/HintSessionWrapper.h +++ b/libs/hwui/renderthread/HintSessionWrapper.h @@ -42,6 +42,7 @@ private: APerformanceHintSession* mHintSession = nullptr; std::future<APerformanceHintSession*> mHintSessionFuture; + int mResetsSinceLastReport = 0; nsecs_t mLastFrameNotification = 0; nsecs_t mLastTargetWorkDuration = 0; |