SF: use frame rate override even when the physical range is single
When the physical range is a single rate (e.g. 120Hz), render rates
where discarded if they could be run at a lower physical rate
(e.g. 30fps of 60Hz). This CL enables these frame rates to be able to
save power by running on a slower rate.
Bug: 296079213
Test: play 30fps video while the device policy has a
single physical refresh rate
Test: atest libsurfaceflinger_unittest
Change-Id: I4d6d6ddffd6004022d02329148709204ff9d57db
diff --git a/services/surfaceflinger/Scheduler/RefreshRateSelector.h b/services/surfaceflinger/Scheduler/RefreshRateSelector.h
index 7af8d03..b25919e 100644
--- a/services/surfaceflinger/Scheduler/RefreshRateSelector.h
+++ b/services/surfaceflinger/Scheduler/RefreshRateSelector.h
@@ -101,6 +101,11 @@
}
bool operator!=(const Policy& other) const { return !(*this == other); }
+
+ bool primaryRangeIsSingleRate() const {
+ return isApproxEqual(primaryRanges.physical.min, primaryRanges.physical.max);
+ }
+
std::string toString() const;
};
@@ -468,8 +473,8 @@
}
std::vector<FrameRateMode> createFrameRateModes(
- std::function<bool(const DisplayMode&)>&& filterModes, const FpsRange&) const
- REQUIRES(mLock);
+ const Policy&, std::function<bool(const DisplayMode&)>&& filterModes,
+ const FpsRange&) const REQUIRES(mLock);
// The display modes of the active display. The DisplayModeIterators below are pointers into
// this container, so must be invalidated whenever the DisplayModes change. The Policy below