summaryrefslogtreecommitdiff
path: root/libs/gui/LayerState.cpp
diff options
context:
space:
mode:
author Ady Abraham <adyabr@google.com> 2021-01-07 17:56:08 -0800
committer Ady Abraham <adyabr@google.com> 2021-01-27 23:01:53 +0000
commitdd5bfa93b0c6633b7372c87fc8d7a83a73a5cd1c (patch)
tree660587622f4a72248b1fdec8419c4bf83d775986 /libs/gui/LayerState.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 'libs/gui/LayerState.cpp')
-rw-r--r--libs/gui/LayerState.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index 63be3edf94..e5e10a0014 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -16,6 +16,7 @@
#define LOG_TAG "LayerState"
+#include <apex/window.h>
#include <inttypes.h>
#include <binder/Parcel.h>
@@ -620,7 +621,8 @@ status_t InputWindowCommands::read(const Parcel& input) {
return NO_ERROR;
}
-bool ValidateFrameRate(float frameRate, int8_t compatibility, const char* inFunctionName) {
+bool ValidateFrameRate(float frameRate, int8_t compatibility, const char* inFunctionName,
+ bool privileged) {
const char* functionName = inFunctionName != nullptr ? inFunctionName : "call";
int floatClassification = std::fpclassify(frameRate);
if (frameRate < 0 || floatClassification == FP_INFINITE || floatClassification == FP_NAN) {
@@ -629,8 +631,10 @@ bool ValidateFrameRate(float frameRate, int8_t compatibility, const char* inFunc
}
if (compatibility != ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT &&
- compatibility != ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE) {
- ALOGE("%s failed - invalid compatibility value %d", functionName, compatibility);
+ compatibility != ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE &&
+ (!privileged || compatibility != ANATIVEWINDOW_FRAME_RATE_EXACT)) {
+ ALOGE("%s failed - invalid compatibility value %d privileged: %s", functionName,
+ compatibility, privileged ? "yes" : "no");
return false;
}