sdm660-common; power-libperfmgr: Properly handle sustained performance mode

* when tested with [1], even after exiting the app, spm was
   still active in powerhal thereby keeping max freqs limited
   and blocking boosts

 * enable/disable it properly and end all other hints before
   enabling, to fix this issue

[1] https://android.googlesource.com/platform/cts/+/refs/heads/master/hostsidetests/sustainedperf

Change-Id: I672195fc6f7aba91928e2ab6147a6a7cac51f459
Signed-off-by: chiru2000 <chiranth@m.ms.evolution-x.org>
Signed-off-by: clarencelol <clarencekuiek@icloud.com>
Signed-off-by: pix106 <sbordenave@gmail.com>
This commit is contained in:
Adithya 2022-02-13 22:56:13 +08:00 committed by pix106
parent 3f57e8df24
commit c99c3228cf

View file

@ -119,14 +119,14 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
break; break;
case Mode::SUSTAINED_PERFORMANCE: case Mode::SUSTAINED_PERFORMANCE:
if (enabled) { if (enabled) {
endAllHints(mHintManager);
mHintManager->DoHint("SUSTAINED_PERFORMANCE"); mHintManager->DoHint("SUSTAINED_PERFORMANCE");
} else {
mHintManager->EndHint("SUSTAINED_PERFORMANCE");
} }
mSustainedPerfModeOn = true; mSustainedPerfModeOn = enabled;
break; break;
case Mode::LAUNCH: case Mode::LAUNCH:
if (mSustainedPerfModeOn) {
break;
}
[[fallthrough]]; [[fallthrough]];
case Mode::FIXED_PERFORMANCE: case Mode::FIXED_PERFORMANCE:
[[fallthrough]]; [[fallthrough]];
@ -141,7 +141,9 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
case Mode::AUDIO_STREAMING_LOW_LATENCY: case Mode::AUDIO_STREAMING_LOW_LATENCY:
[[fallthrough]]; [[fallthrough]];
default: default:
if (mBatterySaverOn) break; if (mBatterySaverOn || mSustainedPerfModeOn) {
break;
}
if (enabled) { if (enabled) {
mHintManager->DoHint(toString(type)); mHintManager->DoHint(toString(type));
} else { } else {