SF rounded corners: include geometry when reordering
Bug: 184729207
Bug: 163076219
Test: TODO
In Id721cd451209ab50e5cd8badf5f3e0917506e728, we started updating
geometry if we had an override buffer, or if the last frame did. Also do
so for a peekThroughLayer, since its blend mode changes. In addition,
the z has changed for layers starting with the peekThroughLayer, so
update geometry for those, too.
Move isPeekingThrough to a local variable and parameter. It does not
need the lifetime of overrideInfo. Add it and zIsOverridden to
writeStateToHWC to ensure we restore the order in HWC when the
peekThroughLayer is no longer needed.
Change-Id: I4b2dda504dc52ec06795a2d2b6236b0472702880
diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
index 444ac46..d3e2c25 100644
--- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
@@ -313,7 +313,8 @@
}
}
-void OutputLayer::writeStateToHWC(bool includeGeometry, bool skipLayer, uint32_t z) {
+void OutputLayer::writeStateToHWC(bool includeGeometry, bool skipLayer, uint32_t z,
+ bool zIsOverridden, bool isPeekingThrough) {
const auto& state = getState();
// Skip doing this if there is no HWC interface
if (!state.hwc) {
@@ -336,7 +337,8 @@
// TODO(b/181172795): We now update geometry for all flattened layers. We should update it
// only when the geometry actually changes
- const bool isOverridden = state.overrideInfo.buffer != nullptr;
+ const bool isOverridden =
+ state.overrideInfo.buffer != nullptr || isPeekingThrough || zIsOverridden;
const bool prevOverridden = state.hwc->stateOverridden;
if (isOverridden || prevOverridden || skipLayer || includeGeometry) {
writeOutputDependentGeometryStateToHWC(hwcLayer.get(), requestedCompositionType, z);
@@ -347,7 +349,7 @@
writeOutputDependentPerFrameStateToHWC(hwcLayer.get());
writeOutputIndependentPerFrameStateToHWC(hwcLayer.get(), *outputIndependentState);
- writeCompositionTypeToHWC(hwcLayer.get(), requestedCompositionType);
+ writeCompositionTypeToHWC(hwcLayer.get(), requestedCompositionType, isPeekingThrough);
// Always set the layer color after setting the composition type.
writeSolidColorStateToHWC(hwcLayer.get(), *outputIndependentState);
@@ -563,12 +565,13 @@
}
void OutputLayer::writeCompositionTypeToHWC(HWC2::Layer* hwcLayer,
- hal::Composition requestedCompositionType) {
+ hal::Composition requestedCompositionType,
+ bool isPeekingThrough) {
auto& outputDependentState = editState();
// If we are forcing client composition, we need to tell the HWC
if (outputDependentState.forceClientComposition ||
- (!getState().overrideInfo.isPeekingThrough && getLayerFE().hasRoundedCorners())) {
+ (!isPeekingThrough && getLayerFE().hasRoundedCorners())) {
requestedCompositionType = hal::Composition::CLIENT;
}