SurfaceFlinger: do not choose POWER_SAVING as refresh rate
Skip POWER_SAVING when looking for a content based refresh rate
as it is not a real config.
Test: Play 29fps video
Bug: 140374873
Change-Id: Ia1be8b849e4ad3c59fdff084f2394e52bdb3828c
diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp
index eb52d3f..e2a880a 100644
--- a/services/surfaceflinger/Scheduler/Scheduler.cpp
+++ b/services/surfaceflinger/Scheduler/Scheduler.cpp
@@ -514,8 +514,13 @@
// Content detection is on, find the appropriate refresh rate with minimal error
// TODO(b/139751853): Scan allowed refresh rates only (SurfaceFlinger::mAllowedDisplayConfigs)
const float rate = static_cast<float>(mFeatures.contentRefreshRate);
- auto iter = min_element(mRefreshRateConfigs.getRefreshRates().cbegin(),
- mRefreshRateConfigs.getRefreshRates().cend(),
+ auto begin = mRefreshRateConfigs.getRefreshRates().cbegin();
+
+ // Skip POWER_SAVING config as it is not a real config
+ if (begin->first == RefreshRateType::POWER_SAVING) {
+ ++begin;
+ }
+ auto iter = min_element(begin, mRefreshRateConfigs.getRefreshRates().cend(),
[rate](const auto& lhs, const auto& rhs) -> bool {
return std::abs(lhs.second->fps - rate) <
std::abs(rhs.second->fps - rate);