Loading graphics/composer/aidl/vts/ReadbackVts.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -293,8 +293,8 @@ LayerSettings TestColorLayer::toRenderEngineLayerSettings() { TestBufferLayer::TestBufferLayer(const std::shared_ptr<VtsComposerClient>& client, TestRenderEngine& renderEngine, int64_t display, uint32_t width, uint32_t height, common::PixelFormat format, Composition composition) : TestLayer{client, display}, mRenderEngine(renderEngine) { ComposerClientWriter& writer, Composition composition) : TestLayer{client, display, writer}, mRenderEngine(renderEngine) { mComposition = composition; mWidth = width; mHeight = height; Loading graphics/composer/aidl/vts/ReadbackVts.h +7 −5 Original line number Diff line number Diff line Loading @@ -50,9 +50,10 @@ class TestRenderEngine; class TestLayer { public: TestLayer(const std::shared_ptr<VtsComposerClient>& client, int64_t display) TestLayer(const std::shared_ptr<VtsComposerClient>& client, int64_t display, ComposerClientWriter& writer) : mDisplay(display) { const auto& [status, layer] = client->createLayer(display, kBufferSlotCount); const auto& [status, layer] = client->createLayer(display, kBufferSlotCount, &writer); EXPECT_TRUE(status.isOk()); mLayer = layer; } Loading Loading @@ -108,8 +109,9 @@ class TestLayer { class TestColorLayer : public TestLayer { public: TestColorLayer(const std::shared_ptr<VtsComposerClient>& client, int64_t display) : TestLayer{client, display} {} TestColorLayer(const std::shared_ptr<VtsComposerClient>& client, int64_t display, ComposerClientWriter& writer) : TestLayer{client, display, writer} {} void write(ComposerClientWriter& writer) override; Loading @@ -125,7 +127,7 @@ class TestBufferLayer : public TestLayer { public: TestBufferLayer(const std::shared_ptr<VtsComposerClient>& client, TestRenderEngine& renderEngine, int64_t display, uint32_t width, uint32_t height, common::PixelFormat format, uint32_t height, common::PixelFormat format, ComposerClientWriter& writer, Composition composition = Composition::DEVICE); void write(ComposerClientWriter& writer) override; Loading graphics/composer/aidl/vts/VtsComposerClient.cpp +34 −11 Original line number Diff line number Diff line Loading @@ -33,6 +33,14 @@ VtsComposerClient::VtsComposerClient(const std::string& name) { mComposer = IComposer::fromBinder(binder); ALOGE_IF(mComposer == nullptr, "Failed to acquire the composer from the binder"); } const auto& [status, capabilities] = getCapabilities(); EXPECT_TRUE(status.isOk()); if (std::any_of(capabilities.begin(), capabilities.end(), [&](const Capability& cap) { return cap == Capability::LAYER_LIFECYCLE_BATCH_COMMAND; })) { mSupportsBatchedCreateLayer = true; } } ScopedAStatus VtsComposerClient::createClient() { Loading @@ -54,8 +62,8 @@ ScopedAStatus VtsComposerClient::createClient() { return mComposerClient->registerCallback(mComposerCallback); } bool VtsComposerClient::tearDown() { return verifyComposerCallbackParams() && destroyAllLayers(); bool VtsComposerClient::tearDown(ComposerClientWriter* writer) { return verifyComposerCallbackParams() && destroyAllLayers(writer); } std::pair<ScopedAStatus, int32_t> VtsComposerClient::getInterfaceVersion() const { Loading Loading @@ -86,7 +94,16 @@ ScopedAStatus VtsComposerClient::destroyVirtualDisplay(int64_t display) { } std::pair<ScopedAStatus, int64_t> VtsComposerClient::createLayer(int64_t display, int32_t bufferSlotCount) { int32_t bufferSlotCount, ComposerClientWriter* writer) { if (mSupportsBatchedCreateLayer) { int64_t layer = mNextLayerHandle++; writer->setLayerLifecycleBatchCommandType(display, layer, LayerLifecycleBatchCommandType::CREATE); writer->setNewBufferSlotCount(display, layer, bufferSlotCount); return {addLayerToDisplayResources(display, layer), layer}; } int64_t outLayer; auto status = mComposerClient->createLayer(display, bufferSlotCount, &outLayer); Loading @@ -96,14 +113,20 @@ std::pair<ScopedAStatus, int64_t> VtsComposerClient::createLayer(int64_t display return {addLayerToDisplayResources(display, outLayer), outLayer}; } ScopedAStatus VtsComposerClient::destroyLayer(int64_t display, int64_t layer) { ScopedAStatus VtsComposerClient::destroyLayer(int64_t display, int64_t layer, ComposerClientWriter* writer) { if (mSupportsBatchedCreateLayer) { writer->setLayerLifecycleBatchCommandType(display, layer, LayerLifecycleBatchCommandType::DESTROY); } else { auto status = mComposerClient->destroyLayer(display, layer); if (!status.isOk()) { return status; } } removeLayerFromDisplayResources(display, layer); return status; return ScopedAStatus::ok(); } std::pair<ScopedAStatus, int32_t> VtsComposerClient::getActiveConfig(int64_t display) { Loading Loading @@ -632,7 +655,7 @@ bool VtsComposerClient::getDisplayConfigurationSupported() const { return interfaceVersion >= 3; } bool VtsComposerClient::destroyAllLayers() { bool VtsComposerClient::destroyAllLayers(ComposerClientWriter* writer) { std::unordered_map<int64_t, DisplayResource> physicalDisplays; while (!mDisplayResources.empty()) { const auto& it = mDisplayResources.begin(); Loading @@ -640,7 +663,7 @@ bool VtsComposerClient::destroyAllLayers() { while (!resource.layers.empty()) { auto layer = *resource.layers.begin(); const auto status = destroyLayer(display, layer); const auto status = destroyLayer(display, layer, writer); if (!status.isOk()) { ALOGE("Unable to destroy all the layers, failed at layer %" PRId64 " with error %s", layer, status.getDescription().c_str()); Loading graphics/composer/aidl/vts/VtsComposerClient.h +8 −4 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <android/binder_manager.h> #include <android/binder_process.h> #include <android/hardware/graphics/composer3/ComposerClientReader.h> #include <android/hardware/graphics/composer3/ComposerClientWriter.h> #include <binder/ProcessState.h> #include <gtest/gtest.h> #include <ui/Fence.h> Loading Loading @@ -59,7 +60,7 @@ class VtsComposerClient { ScopedAStatus createClient(); bool tearDown(); bool tearDown(ComposerClientWriter*); std::pair<ScopedAStatus, int32_t> getInterfaceVersion() const; Loading @@ -69,9 +70,10 @@ class VtsComposerClient { ScopedAStatus destroyVirtualDisplay(int64_t display); std::pair<ScopedAStatus, int64_t> createLayer(int64_t display, int32_t bufferSlotCount); std::pair<ScopedAStatus, int64_t> createLayer(int64_t display, int32_t bufferSlotCount, ComposerClientWriter*); ScopedAStatus destroyLayer(int64_t display, int64_t layer); ScopedAStatus destroyLayer(int64_t display, int64_t layer, ComposerClientWriter*); std::pair<ScopedAStatus, int32_t> getActiveConfig(int64_t display); Loading Loading @@ -211,7 +213,7 @@ class VtsComposerClient { void removeLayerFromDisplayResources(int64_t display, int64_t layer); bool destroyAllLayers(); bool destroyAllLayers(ComposerClientWriter*); bool verifyComposerCallbackParams(); Loading @@ -229,6 +231,8 @@ class VtsComposerClient { std::shared_ptr<IComposerClient> mComposerClient; std::shared_ptr<GraphicsComposerCallback> mComposerCallback; std::unordered_map<int64_t, DisplayResource> mDisplayResources; bool mSupportsBatchedCreateLayer = false; std::atomic<int64_t> mNextLayerHandle = 1; }; class VtsDisplay { Loading graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp +32 −27 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ class GraphicsCompositionTestBase : public ::testing::Test { void TearDown() override { ASSERT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk()); ASSERT_TRUE(mComposerClient->tearDown()); ASSERT_TRUE(mComposerClient->tearDown(mWriter.get())); mComposerClient.reset(); const auto errors = mReader.takeErrors(); ASSERT_TRUE(mReader.takeErrors().empty()); Loading Loading @@ -201,7 +201,8 @@ TEST_P(GraphicsCompositionTest, SingleSolidColorLayer) { return; } auto layer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId()); auto layer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId(), *mWriter); common::Rect coloredSquare({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setColor(BLUE); layer->setDisplayFrame(coloredSquare); Loading Loading @@ -270,7 +271,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { auto layer = std::make_shared<TestBufferLayer>( mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), common::PixelFormat::RGBA_8888); getDisplayHeight(), common::PixelFormat::RGBA_8888, *mWriter); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode)); Loading Loading @@ -315,7 +316,8 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { return; } auto layer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId()); auto layer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId(), *mWriter); common::Rect coloredSquare({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setColor(BLUE); layer->setDisplayFrame(coloredSquare); Loading Loading @@ -454,9 +456,9 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { expectedColors, getDisplayWidth(), {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}, BLUE); auto layer = std::make_shared<TestBufferLayer>(mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_FP16); auto layer = std::make_shared<TestBufferLayer>( mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_FP16, *mWriter); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode)); Loading Loading @@ -550,7 +552,7 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { auto deviceLayer = std::make_shared<TestBufferLayer>( mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight() / 2, PixelFormat::RGBA_8888); getDisplayHeight() / 2, PixelFormat::RGBA_8888, *mWriter); std::vector<Color> deviceColors(deviceLayer->getWidth() * deviceLayer->getHeight()); ReadbackHelper::fillColorsArea(deviceColors, static_cast<int32_t>(deviceLayer->getWidth()), {0, 0, static_cast<int32_t>(deviceLayer->getWidth()), Loading @@ -574,7 +576,7 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { auto clientLayer = std::make_shared<TestBufferLayer>( mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), clientWidth, clientHeight, PixelFormat::RGBA_FP16, Composition::DEVICE); clientHeight, PixelFormat::RGBA_FP16, *mWriter, Composition::DEVICE); common::Rect clientFrame = {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}; clientLayer->setDisplayFrame(clientFrame); Loading Loading @@ -643,9 +645,9 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) { static_cast<size_t>(getDisplayWidth() * getDisplayHeight())); ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED); auto layer = std::make_shared<TestBufferLayer>(mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_8888); auto layer = std::make_shared<TestBufferLayer>( mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_8888, *mWriter); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode)); Loading Loading @@ -714,7 +716,8 @@ TEST_P(GraphicsCompositionTest, SetLayerPlaneAlpha) { return; } auto layer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId()); auto layer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId(), *mWriter); layer->setColor(RED); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); Loading Loading @@ -774,9 +777,9 @@ TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) { expectedColors, getDisplayWidth(), {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}, BLUE); auto layer = std::make_shared<TestBufferLayer>(mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_8888); auto layer = std::make_shared<TestBufferLayer>( mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_8888, *mWriter); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode)); Loading Loading @@ -828,11 +831,13 @@ TEST_P(GraphicsCompositionTest, SetLayerZOrder) { common::Rect redRect = {0, 0, getDisplayWidth(), getDisplayHeight() / 2}; common::Rect blueRect = {0, getDisplayHeight() / 4, getDisplayWidth(), getDisplayHeight()}; auto redLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId()); auto redLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId(), *mWriter); redLayer->setColor(RED); redLayer->setDisplayFrame(redRect); auto blueLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId()); auto blueLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId(), *mWriter); blueLayer->setColor(BLUE); blueLayer->setDisplayFrame(blueRect); blueLayer->setZOrder(5); Loading Loading @@ -914,14 +919,14 @@ TEST_P(GraphicsCompositionTest, SetLayerBrightnessDims) { static constexpr float kMaxBrightnessNits = 300.f; const auto redLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId()); std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId(), *mWriter); redLayer->setColor(RED); redLayer->setDisplayFrame(redRect); redLayer->setWhitePointNits(kMaxBrightnessNits); redLayer->setBrightness(1.f); const auto dimmerRedLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId()); std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId(), *mWriter); dimmerRedLayer->setColor(RED); dimmerRedLayer->setDisplayFrame(dimmerRedRect); // Intentionally use a small dimming ratio as some implementations may be more likely to Loading Loading @@ -992,14 +997,14 @@ class GraphicsBlendModeCompositionTest mTopLayerColor); auto backgroundLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId()); std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId(), *mWriter); backgroundLayer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); backgroundLayer->setZOrder(0); backgroundLayer->setColor(mBackgroundColor); auto layer = std::make_shared<TestBufferLayer>(mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_8888); auto layer = std::make_shared<TestBufferLayer>( mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_8888, *mWriter); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); layer->setDataspace(Dataspace::UNKNOWN); Loading Loading @@ -1190,7 +1195,7 @@ class GraphicsTransformCompositionTest : public GraphicsCompositionTest { GraphicsCompositionTest::SetUp(); auto backgroundLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId()); std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId(), *mWriter); backgroundLayer->setColor({0.0f, 0.0f, 0.0f, 0.0f}); backgroundLayer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); backgroundLayer->setZOrder(0); Loading @@ -1202,7 +1207,7 @@ class GraphicsTransformCompositionTest : public GraphicsCompositionTest { mLayer = std::make_shared<TestBufferLayer>(mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), mSideLength, mSideLength, PixelFormat::RGBA_8888); PixelFormat::RGBA_8888, *mWriter); mLayer->setDisplayFrame({0, 0, mSideLength, mSideLength}); mLayer->setZOrder(10); Loading Loading @@ -1388,7 +1393,7 @@ class GraphicsColorManagementCompositionTest void makeLayer() { mLayer = std::make_shared<TestBufferLayer>( mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), common::PixelFormat::RGBA_8888); getDisplayHeight(), common::PixelFormat::RGBA_8888, *mWriter); mLayer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); mLayer->setZOrder(10); mLayer->setAlpha(1.f); Loading Loading
graphics/composer/aidl/vts/ReadbackVts.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -293,8 +293,8 @@ LayerSettings TestColorLayer::toRenderEngineLayerSettings() { TestBufferLayer::TestBufferLayer(const std::shared_ptr<VtsComposerClient>& client, TestRenderEngine& renderEngine, int64_t display, uint32_t width, uint32_t height, common::PixelFormat format, Composition composition) : TestLayer{client, display}, mRenderEngine(renderEngine) { ComposerClientWriter& writer, Composition composition) : TestLayer{client, display, writer}, mRenderEngine(renderEngine) { mComposition = composition; mWidth = width; mHeight = height; Loading
graphics/composer/aidl/vts/ReadbackVts.h +7 −5 Original line number Diff line number Diff line Loading @@ -50,9 +50,10 @@ class TestRenderEngine; class TestLayer { public: TestLayer(const std::shared_ptr<VtsComposerClient>& client, int64_t display) TestLayer(const std::shared_ptr<VtsComposerClient>& client, int64_t display, ComposerClientWriter& writer) : mDisplay(display) { const auto& [status, layer] = client->createLayer(display, kBufferSlotCount); const auto& [status, layer] = client->createLayer(display, kBufferSlotCount, &writer); EXPECT_TRUE(status.isOk()); mLayer = layer; } Loading Loading @@ -108,8 +109,9 @@ class TestLayer { class TestColorLayer : public TestLayer { public: TestColorLayer(const std::shared_ptr<VtsComposerClient>& client, int64_t display) : TestLayer{client, display} {} TestColorLayer(const std::shared_ptr<VtsComposerClient>& client, int64_t display, ComposerClientWriter& writer) : TestLayer{client, display, writer} {} void write(ComposerClientWriter& writer) override; Loading @@ -125,7 +127,7 @@ class TestBufferLayer : public TestLayer { public: TestBufferLayer(const std::shared_ptr<VtsComposerClient>& client, TestRenderEngine& renderEngine, int64_t display, uint32_t width, uint32_t height, common::PixelFormat format, uint32_t height, common::PixelFormat format, ComposerClientWriter& writer, Composition composition = Composition::DEVICE); void write(ComposerClientWriter& writer) override; Loading
graphics/composer/aidl/vts/VtsComposerClient.cpp +34 −11 Original line number Diff line number Diff line Loading @@ -33,6 +33,14 @@ VtsComposerClient::VtsComposerClient(const std::string& name) { mComposer = IComposer::fromBinder(binder); ALOGE_IF(mComposer == nullptr, "Failed to acquire the composer from the binder"); } const auto& [status, capabilities] = getCapabilities(); EXPECT_TRUE(status.isOk()); if (std::any_of(capabilities.begin(), capabilities.end(), [&](const Capability& cap) { return cap == Capability::LAYER_LIFECYCLE_BATCH_COMMAND; })) { mSupportsBatchedCreateLayer = true; } } ScopedAStatus VtsComposerClient::createClient() { Loading @@ -54,8 +62,8 @@ ScopedAStatus VtsComposerClient::createClient() { return mComposerClient->registerCallback(mComposerCallback); } bool VtsComposerClient::tearDown() { return verifyComposerCallbackParams() && destroyAllLayers(); bool VtsComposerClient::tearDown(ComposerClientWriter* writer) { return verifyComposerCallbackParams() && destroyAllLayers(writer); } std::pair<ScopedAStatus, int32_t> VtsComposerClient::getInterfaceVersion() const { Loading Loading @@ -86,7 +94,16 @@ ScopedAStatus VtsComposerClient::destroyVirtualDisplay(int64_t display) { } std::pair<ScopedAStatus, int64_t> VtsComposerClient::createLayer(int64_t display, int32_t bufferSlotCount) { int32_t bufferSlotCount, ComposerClientWriter* writer) { if (mSupportsBatchedCreateLayer) { int64_t layer = mNextLayerHandle++; writer->setLayerLifecycleBatchCommandType(display, layer, LayerLifecycleBatchCommandType::CREATE); writer->setNewBufferSlotCount(display, layer, bufferSlotCount); return {addLayerToDisplayResources(display, layer), layer}; } int64_t outLayer; auto status = mComposerClient->createLayer(display, bufferSlotCount, &outLayer); Loading @@ -96,14 +113,20 @@ std::pair<ScopedAStatus, int64_t> VtsComposerClient::createLayer(int64_t display return {addLayerToDisplayResources(display, outLayer), outLayer}; } ScopedAStatus VtsComposerClient::destroyLayer(int64_t display, int64_t layer) { ScopedAStatus VtsComposerClient::destroyLayer(int64_t display, int64_t layer, ComposerClientWriter* writer) { if (mSupportsBatchedCreateLayer) { writer->setLayerLifecycleBatchCommandType(display, layer, LayerLifecycleBatchCommandType::DESTROY); } else { auto status = mComposerClient->destroyLayer(display, layer); if (!status.isOk()) { return status; } } removeLayerFromDisplayResources(display, layer); return status; return ScopedAStatus::ok(); } std::pair<ScopedAStatus, int32_t> VtsComposerClient::getActiveConfig(int64_t display) { Loading Loading @@ -632,7 +655,7 @@ bool VtsComposerClient::getDisplayConfigurationSupported() const { return interfaceVersion >= 3; } bool VtsComposerClient::destroyAllLayers() { bool VtsComposerClient::destroyAllLayers(ComposerClientWriter* writer) { std::unordered_map<int64_t, DisplayResource> physicalDisplays; while (!mDisplayResources.empty()) { const auto& it = mDisplayResources.begin(); Loading @@ -640,7 +663,7 @@ bool VtsComposerClient::destroyAllLayers() { while (!resource.layers.empty()) { auto layer = *resource.layers.begin(); const auto status = destroyLayer(display, layer); const auto status = destroyLayer(display, layer, writer); if (!status.isOk()) { ALOGE("Unable to destroy all the layers, failed at layer %" PRId64 " with error %s", layer, status.getDescription().c_str()); Loading
graphics/composer/aidl/vts/VtsComposerClient.h +8 −4 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <android/binder_manager.h> #include <android/binder_process.h> #include <android/hardware/graphics/composer3/ComposerClientReader.h> #include <android/hardware/graphics/composer3/ComposerClientWriter.h> #include <binder/ProcessState.h> #include <gtest/gtest.h> #include <ui/Fence.h> Loading Loading @@ -59,7 +60,7 @@ class VtsComposerClient { ScopedAStatus createClient(); bool tearDown(); bool tearDown(ComposerClientWriter*); std::pair<ScopedAStatus, int32_t> getInterfaceVersion() const; Loading @@ -69,9 +70,10 @@ class VtsComposerClient { ScopedAStatus destroyVirtualDisplay(int64_t display); std::pair<ScopedAStatus, int64_t> createLayer(int64_t display, int32_t bufferSlotCount); std::pair<ScopedAStatus, int64_t> createLayer(int64_t display, int32_t bufferSlotCount, ComposerClientWriter*); ScopedAStatus destroyLayer(int64_t display, int64_t layer); ScopedAStatus destroyLayer(int64_t display, int64_t layer, ComposerClientWriter*); std::pair<ScopedAStatus, int32_t> getActiveConfig(int64_t display); Loading Loading @@ -211,7 +213,7 @@ class VtsComposerClient { void removeLayerFromDisplayResources(int64_t display, int64_t layer); bool destroyAllLayers(); bool destroyAllLayers(ComposerClientWriter*); bool verifyComposerCallbackParams(); Loading @@ -229,6 +231,8 @@ class VtsComposerClient { std::shared_ptr<IComposerClient> mComposerClient; std::shared_ptr<GraphicsComposerCallback> mComposerCallback; std::unordered_map<int64_t, DisplayResource> mDisplayResources; bool mSupportsBatchedCreateLayer = false; std::atomic<int64_t> mNextLayerHandle = 1; }; class VtsDisplay { Loading
graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp +32 −27 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ class GraphicsCompositionTestBase : public ::testing::Test { void TearDown() override { ASSERT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk()); ASSERT_TRUE(mComposerClient->tearDown()); ASSERT_TRUE(mComposerClient->tearDown(mWriter.get())); mComposerClient.reset(); const auto errors = mReader.takeErrors(); ASSERT_TRUE(mReader.takeErrors().empty()); Loading Loading @@ -201,7 +201,8 @@ TEST_P(GraphicsCompositionTest, SingleSolidColorLayer) { return; } auto layer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId()); auto layer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId(), *mWriter); common::Rect coloredSquare({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setColor(BLUE); layer->setDisplayFrame(coloredSquare); Loading Loading @@ -270,7 +271,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { auto layer = std::make_shared<TestBufferLayer>( mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), common::PixelFormat::RGBA_8888); getDisplayHeight(), common::PixelFormat::RGBA_8888, *mWriter); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode)); Loading Loading @@ -315,7 +316,8 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { return; } auto layer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId()); auto layer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId(), *mWriter); common::Rect coloredSquare({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setColor(BLUE); layer->setDisplayFrame(coloredSquare); Loading Loading @@ -454,9 +456,9 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { expectedColors, getDisplayWidth(), {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}, BLUE); auto layer = std::make_shared<TestBufferLayer>(mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_FP16); auto layer = std::make_shared<TestBufferLayer>( mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_FP16, *mWriter); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode)); Loading Loading @@ -550,7 +552,7 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { auto deviceLayer = std::make_shared<TestBufferLayer>( mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight() / 2, PixelFormat::RGBA_8888); getDisplayHeight() / 2, PixelFormat::RGBA_8888, *mWriter); std::vector<Color> deviceColors(deviceLayer->getWidth() * deviceLayer->getHeight()); ReadbackHelper::fillColorsArea(deviceColors, static_cast<int32_t>(deviceLayer->getWidth()), {0, 0, static_cast<int32_t>(deviceLayer->getWidth()), Loading @@ -574,7 +576,7 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { auto clientLayer = std::make_shared<TestBufferLayer>( mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), clientWidth, clientHeight, PixelFormat::RGBA_FP16, Composition::DEVICE); clientHeight, PixelFormat::RGBA_FP16, *mWriter, Composition::DEVICE); common::Rect clientFrame = {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}; clientLayer->setDisplayFrame(clientFrame); Loading Loading @@ -643,9 +645,9 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) { static_cast<size_t>(getDisplayWidth() * getDisplayHeight())); ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED); auto layer = std::make_shared<TestBufferLayer>(mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_8888); auto layer = std::make_shared<TestBufferLayer>( mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_8888, *mWriter); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode)); Loading Loading @@ -714,7 +716,8 @@ TEST_P(GraphicsCompositionTest, SetLayerPlaneAlpha) { return; } auto layer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId()); auto layer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId(), *mWriter); layer->setColor(RED); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); Loading Loading @@ -774,9 +777,9 @@ TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) { expectedColors, getDisplayWidth(), {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}, BLUE); auto layer = std::make_shared<TestBufferLayer>(mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_8888); auto layer = std::make_shared<TestBufferLayer>( mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_8888, *mWriter); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode)); Loading Loading @@ -828,11 +831,13 @@ TEST_P(GraphicsCompositionTest, SetLayerZOrder) { common::Rect redRect = {0, 0, getDisplayWidth(), getDisplayHeight() / 2}; common::Rect blueRect = {0, getDisplayHeight() / 4, getDisplayWidth(), getDisplayHeight()}; auto redLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId()); auto redLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId(), *mWriter); redLayer->setColor(RED); redLayer->setDisplayFrame(redRect); auto blueLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId()); auto blueLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId(), *mWriter); blueLayer->setColor(BLUE); blueLayer->setDisplayFrame(blueRect); blueLayer->setZOrder(5); Loading Loading @@ -914,14 +919,14 @@ TEST_P(GraphicsCompositionTest, SetLayerBrightnessDims) { static constexpr float kMaxBrightnessNits = 300.f; const auto redLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId()); std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId(), *mWriter); redLayer->setColor(RED); redLayer->setDisplayFrame(redRect); redLayer->setWhitePointNits(kMaxBrightnessNits); redLayer->setBrightness(1.f); const auto dimmerRedLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId()); std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId(), *mWriter); dimmerRedLayer->setColor(RED); dimmerRedLayer->setDisplayFrame(dimmerRedRect); // Intentionally use a small dimming ratio as some implementations may be more likely to Loading Loading @@ -992,14 +997,14 @@ class GraphicsBlendModeCompositionTest mTopLayerColor); auto backgroundLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId()); std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId(), *mWriter); backgroundLayer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); backgroundLayer->setZOrder(0); backgroundLayer->setColor(mBackgroundColor); auto layer = std::make_shared<TestBufferLayer>(mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_8888); auto layer = std::make_shared<TestBufferLayer>( mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_8888, *mWriter); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); layer->setDataspace(Dataspace::UNKNOWN); Loading Loading @@ -1190,7 +1195,7 @@ class GraphicsTransformCompositionTest : public GraphicsCompositionTest { GraphicsCompositionTest::SetUp(); auto backgroundLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId()); std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId(), *mWriter); backgroundLayer->setColor({0.0f, 0.0f, 0.0f, 0.0f}); backgroundLayer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); backgroundLayer->setZOrder(0); Loading @@ -1202,7 +1207,7 @@ class GraphicsTransformCompositionTest : public GraphicsCompositionTest { mLayer = std::make_shared<TestBufferLayer>(mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), mSideLength, mSideLength, PixelFormat::RGBA_8888); PixelFormat::RGBA_8888, *mWriter); mLayer->setDisplayFrame({0, 0, mSideLength, mSideLength}); mLayer->setZOrder(10); Loading Loading @@ -1388,7 +1393,7 @@ class GraphicsColorManagementCompositionTest void makeLayer() { mLayer = std::make_shared<TestBufferLayer>( mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), getDisplayHeight(), common::PixelFormat::RGBA_8888); getDisplayHeight(), common::PixelFormat::RGBA_8888, *mWriter); mLayer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); mLayer->setZOrder(10); mLayer->setAlpha(1.f); Loading