Plumb new frameRateSelectionStrategy value
This new value will allow a parent layer to override the frame
rate specifications of all its descendants. This CL only plumbs the
value from Transaction to Layer.
Bug: 297418260
Test: atest CtsSurfaceControlTestsStaging
Test: atest libsurfaceflinger_unittest
Change-Id: Ibbda6ff6c143e931240178d89306822b4cce9669
diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
index da84e44..4c9fb06 100644
--- a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
+++ b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
@@ -813,11 +813,23 @@
RequestedLayerState::Changes::Hierarchy) ||
snapshot.changes.any(RequestedLayerState::Changes::FrameRate |
RequestedLayerState::Changes::Hierarchy)) {
- snapshot.frameRate = requested.requestedFrameRate.isValid() ? requested.requestedFrameRate
- : parentSnapshot.frameRate;
+ bool shouldOverrideChildren = parentSnapshot.frameRateSelectionStrategy ==
+ scheduler::LayerInfo::FrameRateSelectionStrategy::OverrideChildren;
+ snapshot.frameRate = !requested.requestedFrameRate.isValid() || shouldOverrideChildren
+ ? parentSnapshot.frameRate
+ : requested.requestedFrameRate;
snapshot.changes |= RequestedLayerState::Changes::FrameRate;
}
+ if (forceUpdate || snapshot.clientChanges & layer_state_t::eFrameRateSelectionStrategyChanged) {
+ const auto strategy = scheduler::LayerInfo::convertFrameRateSelectionStrategy(
+ requested.frameRateSelectionStrategy);
+ snapshot.frameRateSelectionStrategy =
+ strategy == scheduler::LayerInfo::FrameRateSelectionStrategy::Self
+ ? parentSnapshot.frameRateSelectionStrategy
+ : strategy;
+ }
+
if (forceUpdate || snapshot.clientChanges & layer_state_t::eFrameRateSelectionPriority) {
snapshot.frameRateSelectionPriority =
(requested.frameRateSelectionPriority == Layer::PRIORITY_UNSET)