From 1f6fc70ab0c6efdaa1c60dd2ced32fb6833c92e2 Mon Sep 17 00:00:00 2001 From: Dominik Laskowski Date: Mon, 21 Mar 2022 08:34:50 -0700 Subject: SF: Fix feedback loop with refresh rate overlay RefreshRateOverlay was refactored to use transactions instead of APIs internal to SF. A side effect is that the overlay layer feeds back into the frame rate detection and idle heuristics, which causes oscillation that trends to the high refresh rate. The transaction to setFrameRate failed to apply, as the NoVote argument was invalid. Make it valid, such that LayerHistory::summarize skips the overlay layer. Do not reset the idle timer for solely NO_VOTE transactions. Bug: 221081400 Test: flame is not stuck at 90 Hz when overlay is enabled. Test: Same with sf.debug.show_refresh_rate_overlay_spinner Test: SetFrameRateTest Change-Id: I6322c1c487672b602a0f974e8ecf445633dcc3a1 --- libs/gui/LayerState.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'libs/gui/LayerState.cpp') diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index f7cd5c4f71..502031c8d8 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -16,8 +16,8 @@ #define LOG_TAG "LayerState" -#include -#include +#include +#include #include #include @@ -25,10 +25,9 @@ #include #include #include +#include #include -#include - namespace android { using gui::FocusRequest; @@ -679,7 +678,9 @@ bool ValidateFrameRate(float frameRate, int8_t compatibility, int8_t changeFrame if (compatibility != ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT && compatibility != ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE && - (!privileged || compatibility != ANATIVEWINDOW_FRAME_RATE_EXACT)) { + (!privileged || + (compatibility != ANATIVEWINDOW_FRAME_RATE_EXACT && + compatibility != ANATIVEWINDOW_FRAME_RATE_NO_VOTE))) { ALOGE("%s failed - invalid compatibility value %d privileged: %s", functionName, compatibility, privileged ? "yes" : "no"); return false; -- cgit v1.2.3-59-g8ed1b