summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/tests/unittests/SetFrameRateTest.cpp
diff options
context:
space:
mode:
authorAdy Abraham <adyabr@google.com>2021-01-07 17:56:08 -0800
committerAdy Abraham <adyabr@google.com>2021-01-27 23:01:53 +0000
commitdd5bfa93b0c6633b7372c87fc8d7a83a73a5cd1c (patch)
tree660587622f4a72248b1fdec8419c4bf83d775986 /services/surfaceflinger/tests/unittests/SetFrameRateTest.cpp
parentf467f898f42eccda1207a90d54e0b7d18b762a1b (diff)
SurfaceFlinger: handle high refresh rate deny list
Add visibility to SurfaceFlinger into the high refresh rate deny list and let SurfaceFlinger handle it. Previously WM was setting the preferredDisplayModeId on the denied app's window. The old way prevented SurfaceFlinger to use the frame rate override feature as it didn't know that a specific app is causing the refresh rate spec to be limited. With this change, SurfaceFlinger will limit the display refresh rate based on the high refresh rate deny list, and if possible, will use the frame rate override feature to change the display rate to a multiple, allowing other animations to be smooth while the denied app remains in the low refresh rate. Bug: 170502573 Test: SF unit tests Change-Id: Idc8a5fe6bc12dbd949ad5e09ff50e339ffaeac36 Merged-In: Idc8a5fe6bc12dbd949ad5e09ff50e339ffaeac36
Diffstat (limited to 'services/surfaceflinger/tests/unittests/SetFrameRateTest.cpp')
-rw-r--r--services/surfaceflinger/tests/unittests/SetFrameRateTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/services/surfaceflinger/tests/unittests/SetFrameRateTest.cpp b/services/surfaceflinger/tests/unittests/SetFrameRateTest.cpp
index c8f4cb4c19..e060df2420 100644
--- a/services/surfaceflinger/tests/unittests/SetFrameRateTest.cpp
+++ b/services/surfaceflinger/tests/unittests/SetFrameRateTest.cpp
@@ -473,5 +473,20 @@ INSTANTIATE_TEST_SUITE_P(PerLayerType, SetFrameRateTest,
std::make_shared<EffectLayerFactory>()),
PrintToStringParamName);
+TEST_F(SetFrameRateTest, ValidateFrameRate) {
+ EXPECT_TRUE(ValidateFrameRate(60.0f, ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT, ""));
+ EXPECT_TRUE(ValidateFrameRate(60.0f, ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT, ""));
+ EXPECT_TRUE(ValidateFrameRate(60.0f, ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE, ""));
+ EXPECT_TRUE(ValidateFrameRate(60.0f, ANATIVEWINDOW_FRAME_RATE_EXACT, "", /*privileged=*/true));
+
+ EXPECT_FALSE(ValidateFrameRate(-1, ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT, ""));
+ EXPECT_FALSE(
+ ValidateFrameRate(1.0f / 0.0f, ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT, ""));
+ EXPECT_FALSE(
+ ValidateFrameRate(0.0f / 0.0f, ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT, ""));
+
+ EXPECT_FALSE(ValidateFrameRate(60.0f, ANATIVEWINDOW_FRAME_RATE_EXACT, ""));
+}
+
} // namespace
} // namespace android