DisplayDecoration test: destroy layers per display
This appears to have been broken with
Ic3c0415612b1387671ab8efa0ec95ed727f6bf68, which attempts to destroy
layers for all displays using a single writer. The display command that
destroys a layer must be in the writer for that display, in order for
the displays to run independently. Do so in the test itself, rather than
relying on TearDown to destroy all of them.
Bug: 333974982
Test: atest VtsHalGraphicsComposer3_TargetTest
Flag: TEST_ONLY
Change-Id: Ib6807c85bc6cb32c56cc72126a9fa68363365912
diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
index f72cf55..e686358 100644
--- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
+++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -2197,13 +2197,13 @@
TEST_P(GraphicsComposerAidlCommandTest, DisplayDecoration) {
for (VtsDisplay& display : mDisplays) {
- auto& writer = getWriter(display.getDisplayId());
+ const auto displayId = display.getDisplayId();
+ auto& writer = getWriter(displayId);
const auto [layerStatus, layer] =
- mComposerClient->createLayer(display.getDisplayId(), kBufferSlotCount, &writer);
- EXPECT_TRUE(layerStatus.isOk());
+ mComposerClient->createLayer(displayId, kBufferSlotCount, &writer);
+ ASSERT_TRUE(layerStatus.isOk());
- const auto [error, support] =
- mComposerClient->getDisplayDecorationSupport(display.getDisplayId());
+ const auto [error, support] = mComposerClient->getDisplayDecorationSupport(displayId);
const auto format = (error.isOk() && support) ? support->format
: aidl::android::hardware::graphics::common::PixelFormat::RGBA_8888;
@@ -2223,9 +2223,9 @@
configureLayer(display, layer, Composition::DISPLAY_DECORATION, display.getFrameRect(),
display.getCrop());
- writer.setLayerBuffer(display.getDisplayId(), layer, /*slot*/ 0, decorBuffer->handle,
+ writer.setLayerBuffer(displayId, layer, /*slot*/ 0, decorBuffer->handle,
/*acquireFence*/ -1);
- writer.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp,
+ writer.validateDisplay(displayId, ComposerClientWriter::kNoTimestamp,
VtsComposerClient::kNoFrameIntervalNs);
execute();
if (support) {
@@ -2235,6 +2235,7 @@
ASSERT_EQ(1, errors.size());
EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, errors[0].errorCode);
}
+ EXPECT_TRUE(mComposerClient->destroyLayer(displayId, layer, &writer).isOk());
}
}