summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
author Rachel Lee <rnlee@google.com> 2023-09-08 13:34:34 -0700
committer Rachel Lee <rnlee@google.com> 2023-09-18 16:22:01 -0700
commit0faad6c29ae2e62abd8b18e3438d891961c15150 (patch)
tree5cebef9cc319652b8d5e8d3734e95f0b7041da4c /services/surfaceflinger/Layer.cpp
parent58cc90d352b71bd1be16d4a89053350bbeada0af (diff)
Logic for setFrameRateSelectionStrategy.
Use the frameRateSelectionStrategy value stored in Layer to inform the frame rate propagation in the hierarchy. Bug: 297418260 Test: atest CtsSurfaceControlTestsStaging Test: atest libsurfaceflinger_unittest Change-Id: I05a6a7effd17cefb01421bff10c9ff9dbcadf98a
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
-rw-r--r--services/surfaceflinger/Layer.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 31b5e28e4e..e780a1e8f7 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1252,9 +1252,14 @@ const half4& Layer::getBorderColor() {
return mBorderColor;
}
-bool Layer::propagateFrameRateForLayerTree(FrameRate parentFrameRate, bool* transactionNeeded) {
- // The frame rate for layer tree is this layer's frame rate if present, or the parent frame rate
+bool Layer::propagateFrameRateForLayerTree(FrameRate parentFrameRate, bool overrideChildren,
+ bool* transactionNeeded) {
+ // Gets the frame rate to propagate to children.
const auto frameRate = [&] {
+ if (overrideChildren && parentFrameRate.isValid()) {
+ return parentFrameRate;
+ }
+
if (mDrawingState.frameRate.isValid()) {
return mDrawingState.frameRate;
}
@@ -1268,7 +1273,10 @@ bool Layer::propagateFrameRateForLayerTree(FrameRate parentFrameRate, bool* tran
bool childrenHaveFrameRate = false;
for (const sp<Layer>& child : mCurrentChildren) {
childrenHaveFrameRate |=
- child->propagateFrameRateForLayerTree(frameRate, transactionNeeded);
+ child->propagateFrameRateForLayerTree(frameRate,
+ overrideChildren ||
+ shouldOverrideChildrenFrameRate(),
+ transactionNeeded);
}
// If we don't have a valid frame rate specification, but the children do, we set this
@@ -1301,7 +1309,7 @@ void Layer::updateTreeHasFrameRateVote() {
}();
bool transactionNeeded = false;
- root->propagateFrameRateForLayerTree({}, &transactionNeeded);
+ root->propagateFrameRateForLayerTree({}, false, &transactionNeeded);
// TODO(b/195668952): we probably don't need eTraversalNeeded here
if (transactionNeeded) {