Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 14bd07b1 authored by Brian Lindahl's avatar Brian Lindahl
Browse files

Revert "Add VTS test for clearing buffer slots to Composer HIDL and AIDL"

This reverts commit ca3eef29.

NOTE: This is not a full revert, it leaves the production code in place and only reverts the VTS test changes.

Reason for revert: b/262370410

Test: atest VtsHalGraphicsComposerV2_1TargetTest on Oriole
Test: atest VtsHalGraphicsComposerV2_2TargetTest on Oriole
Test: atest VtsHalGraphicsComposerV2_3TargetTest on Oriole
Test: atest VtsHalGraphicsComposerV2_4TargetTest on Oriole
Bug: 262370410
Change-Id: Ie5ba7402cda2828ba33131d527ab0c3a66937648
parent e887a252
Loading
Loading
Loading
Loading
+2 −56
Original line number Diff line number Diff line
@@ -657,7 +657,6 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest {
                                                             IComposerClient::Attribute::WIDTH);
        mDisplayHeight = mComposerClient->getDisplayAttribute(mPrimaryDisplay, activeConfig,
                                                              IComposerClient::Attribute::HEIGHT);

        mWriter = std::make_unique<CommandWriterBase>(1024);
        mReader = std::make_unique<TestCommandReader>();
    }
@@ -667,13 +666,11 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest {
        ASSERT_NO_FATAL_FAILURE(GraphicsComposerHidlTest::TearDown());
    }

    NativeHandleWrapper allocate() { return allocate(mDisplayWidth, mDisplayHeight); }

    NativeHandleWrapper allocate(uint32_t width, uint32_t height) {
    NativeHandleWrapper allocate() {
        uint64_t usage =
                static_cast<uint64_t>(BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN |
                                      BufferUsage::COMPOSER_OVERLAY);
        return mGralloc->allocate(width, height, 1, PixelFormat::RGBA_8888, usage);
        return mGralloc->allocate(mDisplayWidth, mDisplayHeight, 1, PixelFormat::RGBA_8888, usage);
    }

    void execute() { mComposerClient->execute(mReader.get(), mWriter.get()); }
@@ -886,57 +883,6 @@ TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_BUFFER) {
    execute();
}

/**
 * Test IComposerClient::Command::SET_LAYER_BUFFER with the behavior used for clearing buffer slots.
 */
TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_BUFFER_TO_CLEAR_BUFFER_SLOTS) {
    // A buffer used to clear buffer slots
    auto clearSlotBuffer = allocate(1u, 1u);

    auto handle1 = allocate();
    ASSERT_NE(nullptr, handle1.get());
    IComposerClient::Rect displayFrame{0, 0, mDisplayWidth, mDisplayHeight};
    Layer layer;
    ASSERT_NO_FATAL_FAILURE(
            layer = mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount));
    mWriter->selectDisplay(mPrimaryDisplay);
    mWriter->selectLayer(layer);
    mWriter->setLayerCompositionType(IComposerClient::Composition::DEVICE);
    mWriter->setLayerDisplayFrame(displayFrame);
    mWriter->setLayerBuffer(0, handle1.get(), -1);
    mWriter->setLayerDataspace(Dataspace::UNKNOWN);
    mWriter->validateDisplay();
    execute();
    if (mReader->mCompositionChanges.size() != 0) {
        GTEST_SUCCEED() << "Composition change requested, skipping test";
        return;
    }
    ASSERT_EQ(0, mReader->mErrors.size());

    mWriter->selectDisplay(mPrimaryDisplay);
    mWriter->presentDisplay();
    execute();
    ASSERT_EQ(0, mReader->mErrors.size());

    // Ensure we can clear a buffer slot and then set that same slot with a new buffer
    auto handle2 = allocate();
    ASSERT_NE(nullptr, handle2.get());
    mWriter->selectDisplay(mPrimaryDisplay);
    mWriter->selectLayer(layer);
    mWriter->setLayerBuffer(0, clearSlotBuffer.get(), -1);
    mWriter->selectDisplay(mPrimaryDisplay);
    mWriter->selectLayer(layer);
    mWriter->setLayerBuffer(0, handle2.get(), -1);
    mWriter->validateDisplay();
    execute();
    ASSERT_EQ(0, mReader->mErrors.size());

    mWriter->selectDisplay(mPrimaryDisplay);
    mWriter->presentDisplay();
    execute();
    ASSERT_EQ(0, mReader->mErrors.size());
}

/**
 * Test IComposerClient::Command::SET_LAYER_SURFACE_DAMAGE.
 */
+7 −38
Original line number Diff line number Diff line
@@ -1188,21 +1188,17 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest {
        }
    }

    sp<GraphicBuffer> allocate(uint32_t width, uint32_t height,
                               ::android::PixelFormat pixelFormat) {
    sp<GraphicBuffer> allocate(::android::PixelFormat pixelFormat) {
        return sp<GraphicBuffer>::make(
                width, height, pixelFormat, /*layerCount*/ 1U,
                static_cast<uint64_t>(common::BufferUsage::CPU_WRITE_OFTEN) |
                static_cast<uint32_t>(getPrimaryDisplay().getDisplayWidth()),
                static_cast<uint32_t>(getPrimaryDisplay().getDisplayHeight()), pixelFormat,
                /*layerCount*/ 1U,
                (static_cast<uint64_t>(common::BufferUsage::CPU_WRITE_OFTEN) |
                 static_cast<uint64_t>(common::BufferUsage::CPU_READ_OFTEN) |
                        static_cast<uint64_t>(common::BufferUsage::COMPOSER_OVERLAY),
                 static_cast<uint64_t>(common::BufferUsage::COMPOSER_OVERLAY)),
                "VtsHalGraphicsComposer3_TargetTest");
    }

    sp<GraphicBuffer> allocate(::android::PixelFormat pixelFormat) {
        return allocate(static_cast<uint32_t>(getPrimaryDisplay().getDisplayWidth()),
                        static_cast<uint32_t>(getPrimaryDisplay().getDisplayHeight()), pixelFormat);
    }

    void sendRefreshFrame(const VtsDisplay& display, const VsyncPeriodChangeTimeline* timeline) {
        if (timeline != nullptr) {
            // Refresh time should be before newVsyncAppliedTimeNanos
@@ -1703,33 +1699,6 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerBuffer) {
    execute();
}

TEST_P(GraphicsComposerAidlCommandTest, SetLayerBufferWithSlotsToClear) {
    auto clearSlotBuffer = allocate(1u, 1u, ::android::PIXEL_FORMAT_RGB_888);
    ASSERT_NE(nullptr, clearSlotBuffer);
    auto clearSlotBufferHandle = clearSlotBuffer->handle;

    const auto buffer1 = allocate(::android::PIXEL_FORMAT_RGBA_8888);
    ASSERT_NE(nullptr, buffer1);
    const auto handle1 = buffer1->handle;
    const auto& [layerStatus, layer] =
            mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
    EXPECT_TRUE(layerStatus.isOk());
    auto& writer = getWriter(getPrimaryDisplayId());
    writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle1, /*acquireFence*/ -1);
    execute();
    ASSERT_TRUE(mReader.takeErrors().empty());

    // Ensure we can clear a buffer slot and then set that same slot with a new buffer
    const auto buffer2 = allocate(::android::PIXEL_FORMAT_RGBA_8888);
    ASSERT_NE(nullptr, buffer2);
    const auto handle2 = buffer2->handle;
    writer.setLayerBufferWithNewCommand(getPrimaryDisplayId(), layer, /* slot */ 0,
                                        clearSlotBufferHandle, /*acquireFence*/ -1);
    writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle2, /*acquireFence*/ -1);
    execute();
    ASSERT_TRUE(mReader.takeErrors().empty());
}

TEST_P(GraphicsComposerAidlCommandTest, SetLayerSurfaceDamage) {
    const auto& [layerStatus, layer] =
            mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);