SF Generalization of Refresh Rates: Adding layer priority hint
Test: Device boots. Observe logs for errors.
Test: Open Swappy and Chrome in split screen, tap between apps,
SF prints the correct priority.
Test: Open Chrome, play video. SF prints correct priority.
Test: SF prints the correct priority received.
Bug: 142507166
Change-Id: I5fa8a857c950db01f42a380a72d098039badc289
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 65d02ad..46cfb21 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1747,12 +1747,6 @@
mGpuFrameMissedCount++;
}
- mScheduler->chooseRefreshRateForContent();
-
- if (performSetActiveConfig()) {
- break;
- }
-
if (frameMissed && mPropagateBackpressure) {
if ((hwcFrameMissed && !gpuFrameMissed) ||
mPropagateBackpressureClientComposition) {
@@ -1769,6 +1763,13 @@
bool refreshNeeded = handleMessageTransaction();
refreshNeeded |= handleMessageInvalidate();
+ // Layers need to get updated (in the previous line) before we can use them for
+ // choosing the refresh rate.
+ mScheduler->chooseRefreshRateForContent();
+ if (performSetActiveConfig()) {
+ break;
+ }
+
updateCursorAsync();
updateInputFlinger();
@@ -3474,6 +3475,11 @@
if (what & layer_state_t::eShadowRadiusChanged) {
if (layer->setShadowRadius(s.shadowRadius)) flags |= eTraversalNeeded;
}
+ if (what & layer_state_t::eFrameRateSelectionPriority) {
+ if (privileged && layer->setFrameRateSelectionPriority(s.frameRateSelectionPriority)) {
+ flags |= eTraversalNeeded;
+ }
+ }
// This has to happen after we reparent children because when we reparent to null we remove
// child layers from current state and remove its relative z. If the children are reparented in
// the same transaction, then we have to make sure we reparent the children first so we do not