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/CompositionEngine/tests/OutputLayerTest.cpp b/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp
index 75e960c..2276dc3 100644
--- a/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp
+++ b/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp
@@ -574,7 +574,7 @@
static const half4 kColor;
static const Rect kDisplayFrame;
- static const Region kVisibleRegion;
+ static const Region kOutputSpaceVisibleRegion;
static const mat4 kColorTransform;
static const Region kSurfaceDamage;
static const HdrMetadata kHdrMetadata;
@@ -590,7 +590,7 @@
outputLayerState.sourceCrop = kSourceCrop;
outputLayerState.z = kZOrder;
outputLayerState.bufferTransform = static_cast<Hwc2::Transform>(kBufferTransform);
- outputLayerState.visibleRegion = kVisibleRegion;
+ outputLayerState.outputSpaceVisibleRegion = kOutputSpaceVisibleRegion;
outputLayerState.dataspace = kDataspace;
mLayerState.frontEnd.blendMode = kBlendMode;
@@ -629,7 +629,7 @@
}
void expectPerFrameCommonCalls(SimulateUnsupported unsupported = SimulateUnsupported::None) {
- EXPECT_CALL(*mHwcLayer, setVisibleRegion(RegionEq(kVisibleRegion)))
+ EXPECT_CALL(*mHwcLayer, setVisibleRegion(RegionEq(kOutputSpaceVisibleRegion)))
.WillOnce(Return(kError));
EXPECT_CALL(*mHwcLayer, setDataspace(kDataspace)).WillOnce(Return(kError));
EXPECT_CALL(*mHwcLayer, setColorTransform(kColorTransform))
@@ -673,7 +673,8 @@
const half4 OutputLayerWriteStateToHWCTest::kColor{81.f / 255.f, 82.f / 255.f, 83.f / 255.f,
84.f / 255.f};
const Rect OutputLayerWriteStateToHWCTest::kDisplayFrame{1001, 1002, 1003, 10044};
-const Region OutputLayerWriteStateToHWCTest::kVisibleRegion{Rect{1005, 1006, 1007, 1008}};
+const Region OutputLayerWriteStateToHWCTest::kOutputSpaceVisibleRegion{
+ Rect{1005, 1006, 1007, 1008}};
const mat4 OutputLayerWriteStateToHWCTest::kColorTransform{
1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016,
1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024,
diff --git a/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp b/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp
index 1d5f2f0..b0e8e36 100644
--- a/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp
+++ b/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp
@@ -661,9 +661,9 @@
impl::OutputLayerCompositionState leftOutputLayerState;
leftOutputLayerState.clearClientTarget = false;
+ leftOutputLayerState.visibleRegion = Region{Rect{0, 0, 1000, 1000}};
impl::LayerCompositionState leftLayerState;
- leftLayerState.frontEnd.geomVisibleRegion = Region{Rect{0, 0, 1000, 1000}};
leftLayerState.frontEnd.isOpaque = true;
const half3 leftLayerColor{1.f, 0.f, 0.f};
@@ -672,9 +672,9 @@
impl::OutputLayerCompositionState rightOutputLayerState;
rightOutputLayerState.clearClientTarget = false;
+ rightOutputLayerState.visibleRegion = Region{Rect{1000, 0, 2000, 1000}};
impl::LayerCompositionState rightLayerState;
- rightLayerState.frontEnd.geomVisibleRegion = Region{Rect{1000, 0, 2000, 1000}};
rightLayerState.frontEnd.isOpaque = true;
const half3 rightLayerColor{0.f, 1.f, 0.f};
@@ -735,9 +735,9 @@
impl::OutputLayerCompositionState outputLayerState;
outputLayerState.clearClientTarget = false;
+ outputLayerState.visibleRegion = Region{Rect{3000, 0, 4000, 1000}};
impl::LayerCompositionState layerState;
- layerState.frontEnd.geomVisibleRegion = Region{Rect{3000, 0, 4000, 1000}};
layerState.frontEnd.isOpaque = true;
EXPECT_CALL(*outputLayer, getState()).WillRepeatedly(ReturnRef(outputLayerState));
@@ -790,16 +790,16 @@
impl::OutputLayerCompositionState leftOutputLayerState;
leftOutputLayerState.clearClientTarget = true;
+ leftOutputLayerState.visibleRegion = Region{Rect{0, 0, 1000, 1000}};
impl::LayerCompositionState leftLayerState;
- leftLayerState.frontEnd.geomVisibleRegion = Region{Rect{0, 0, 1000, 1000}};
leftLayerState.frontEnd.isOpaque = true;
impl::OutputLayerCompositionState rightOutputLayerState;
rightOutputLayerState.clearClientTarget = true;
+ rightOutputLayerState.visibleRegion = Region{Rect{1000, 0, 2000, 1000}};
impl::LayerCompositionState rightLayerState;
- rightLayerState.frontEnd.geomVisibleRegion = Region{Rect{1000, 0, 2000, 1000}};
rightLayerState.frontEnd.isOpaque = true;
const half3 rightLayerColor{0.f, 1.f, 0.f};