SF: Add ability to get basic geometry
For computing the layer visibility, CompositionEngine will need to get
basic geometry state for every layer, without getting everything. Add a
new request type for the basic geometry state, and modify the existing
code in computeVisibleRegions to use it rather than accessing directly
through the front-end layer pointer.
Test: atest libsurfaceflinger_unittest libcompositionengine_test
Test: go/wm-smoke
Bug: 121291683
Change-Id: Ie286fe1986a4c383ee390c1f646c7a8a5b8c14f4
diff --git a/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp b/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp
index 2276dc3..65691ff 100644
--- a/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp
+++ b/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp
@@ -124,7 +124,7 @@
// set one specific value to something different.
mLayerState.frontEnd.geomUsesSourceCrop = true;
mLayerState.frontEnd.geomContentCrop = Rect{0, 0, 1920, 1080};
- mLayerState.frontEnd.geomActiveTransparentRegion = Region{};
+ mLayerState.frontEnd.transparentRegionHint = Region{};
mLayerState.frontEnd.geomLayerBounds = FloatRect{0.f, 0.f, 1920.f, 1080.f};
mLayerState.frontEnd.geomLayerTransform = ui::Transform{TR_IDENT};
mLayerState.frontEnd.geomBufferSize = Rect{0, 0, 1920, 1080};
@@ -231,7 +231,7 @@
// Set reasonable default values for a simple case. Each test will
// set one specific value to something different.
- mLayerState.frontEnd.geomActiveTransparentRegion = Region{};
+ mLayerState.frontEnd.transparentRegionHint = Region{};
mLayerState.frontEnd.geomLayerTransform = ui::Transform{TR_IDENT};
mLayerState.frontEnd.geomBufferSize = Rect{0, 0, 1920, 1080};
mLayerState.frontEnd.geomBufferUsesDisplayInverseTransform = false;
@@ -256,7 +256,7 @@
}
TEST_F(OutputLayerDisplayFrameTest, fullActiveTransparentRegionReturnsEmptyFrame) {
- mLayerState.frontEnd.geomActiveTransparentRegion = Region{Rect{0, 0, 1920, 1080}};
+ mLayerState.frontEnd.transparentRegionHint = Region{Rect{0, 0, 1920, 1080}};
const Rect expected{0, 0, 0, 0};
EXPECT_THAT(calculateOutputDisplayFrame(), RectEq(expected));
}
diff --git a/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp b/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp
index b0e8e36..70d9871 100644
--- a/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp
+++ b/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp
@@ -356,6 +356,10 @@
// If the output accepts layerStack1 and internal-only layers....
mOutput.setLayerStackFilter(layerStack1, true);
+ // A layer with no layerStack does not belong to it, internal-only or not.
+ EXPECT_FALSE(mOutput.belongsInOutput(std::nullopt, false));
+ EXPECT_FALSE(mOutput.belongsInOutput(std::nullopt, true));
+
// Any layer with layerStack1 belongs to it, internal-only or not.
EXPECT_TRUE(mOutput.belongsInOutput(layerStack1, false));
EXPECT_TRUE(mOutput.belongsInOutput(layerStack1, true));