Add sysprop for refresh rate threshold.
When the sysprop is enabled, layers asking for heuristic or multiple
will not vote for multiples >= $threshold amount. For example, 24 fps
would normally vote 120 hz because it is a multiple. Instead, it should
use the scoring calculation to determine a refresh rate < 120 Hz.
This addresses 24 fps videos for 60Hz and 120 Hz displays. The request
wants the refresh rate vote to be 60 Hz. (see bug)
BUG: 190815773
Test: atest libsurfaceflinger_tests
Change-Id: If2619258b93fb9c30e09253266d3d65e1a732047
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index f346465..e2f3ebb 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3118,10 +3118,15 @@
return;
}
const auto displayId = displayState.physical->id;
- mRefreshRateConfigs = std::make_unique<
- scheduler::RefreshRateConfigs>(displayState.physical->supportedModes,
- displayState.physical->activeMode->getId(),
- android::sysprop::enable_frame_rate_override(false));
+ scheduler::RefreshRateConfigs::Config config =
+ {.enableFrameRateOverride = android::sysprop::enable_frame_rate_override(false),
+ .frameRateMultipleThreshold =
+ base::GetIntProperty("debug.sf.frame_rate_multiple_threshold", 0)};
+ mRefreshRateConfigs =
+ std::make_unique<scheduler::RefreshRateConfigs>(displayState.physical->supportedModes,
+ displayState.physical->activeMode
+ ->getId(),
+ config);
const auto currRefreshRate = displayState.physical->activeMode->getFps();
mRefreshRateStats = std::make_unique<scheduler::RefreshRateStats>(*mTimeStats, currRefreshRate,
hal::PowerMode::OFF);