SF: Move layer visibility state to CompositionEngine
The layer visibility/coverage state was the last bit of
display-dependent data that had not yet been moved to
OutputLayerCompositionState. This moves it, and fixes up all references
to the data to get it in a display-dependent way.
Test: atest libsurfaceflinger_unittest libcompositionengine_test
Bug: 121291683
Change-Id: Id9f314f05b743212dba3a113df2baeb38fd19eb8
diff --git a/services/surfaceflinger/tests/unittests/CompositionTest.cpp b/services/surfaceflinger/tests/unittests/CompositionTest.cpp
index 425768e..9e4d57e 100644
--- a/services/surfaceflinger/tests/unittests/CompositionTest.cpp
+++ b/services/surfaceflinger/tests/unittests/CompositionTest.cpp
@@ -614,6 +614,12 @@
displaySettings.clip);
// screen capture adds an additional color layer as an alpha
// prefill, so gtet the back layer.
+ if (layerSettings.empty()) {
+ ADD_FAILURE() << "layerSettings was not expected to be empty in "
+ "setupREBufferCompositionCommonCallExpectations "
+ "verification lambda";
+ return NO_ERROR;
+ }
renderengine::LayerSettings layer = layerSettings.back();
EXPECT_THAT(layer.source.buffer.buffer, Not(IsNull()));
EXPECT_THAT(layer.source.buffer.fence, Not(IsNull()));
@@ -657,6 +663,12 @@
displaySettings.clip);
// screen capture adds an additional color layer as an alpha
// prefill, so get the back layer.
+ if (layerSettings.empty()) {
+ ADD_FAILURE()
+ << "layerSettings was not expected to be empty in "
+ "setupREColorCompositionCallExpectations verification lambda";
+ return NO_ERROR;
+ }
renderengine::LayerSettings layer = layerSettings.back();
EXPECT_THAT(layer.source.buffer.buffer, IsNull());
EXPECT_EQ(half3(LayerProperties::COLOR[0], LayerProperties::COLOR[1],
@@ -727,6 +739,12 @@
displaySettings.clip);
// screen capture adds an additional color layer as an alpha
// prefill, so get the back layer.
+ if (layerSettings.empty()) {
+ ADD_FAILURE() << "layerSettings was not expected to be empty in "
+ "setupInsecureREBufferCompositionCommonCallExpectations "
+ "verification lambda";
+ return NO_ERROR;
+ }
renderengine::LayerSettings layer = layerSettings.back();
EXPECT_THAT(layer.source.buffer.buffer, IsNull());
EXPECT_EQ(half3(0.0f, 0.0f, 0.0f), layer.source.solidColor);
@@ -786,7 +804,6 @@
layerDrawingState.color = half4(LayerProperties::COLOR[0], LayerProperties::COLOR[1],
LayerProperties::COLOR[2], LayerProperties::COLOR[3]);
layer->computeBounds(FloatRect(0, 0, 100, 100), ui::Transform());
- layer->setVisibleRegion(Region(Rect(0, 0, 100, 100)));
return layer;
}
@@ -801,6 +818,9 @@
layer->getCompositionLayer(),
layer));
+ outputLayers.back()->editState().visibleRegion = Region(Rect(0, 0, 100, 100));
+ outputLayers.back()->editState().outputSpaceVisibleRegion = Region(Rect(0, 0, 100, 100));
+
test->mDisplay->getCompositionDisplay()->setOutputLayersOrderedByZ(std::move(outputLayers));
Mock::VerifyAndClear(test->mComposer);