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

Commit a0513115 authored by Ram Indani's avatar Ram Indani Committed by Android (Google) Code Review
Browse files

Merge "ClientComposition test fix"

parents 9a034e45 b1144219
Loading
Loading
Loading
Loading
+20 −16
Original line number Diff line number Diff line
@@ -562,16 +562,18 @@ TEST_P(GraphicsCompositionTest, ClientComposition) {
            ASSERT_NO_FATAL_FAILURE(
                    ReadbackHelper::fillBuffer(layer->getWidth(), layer->getHeight(), stride,
                                               clientBufData, clientFormat, expectedColors));
            EXPECT_EQ(::android::OK, graphicBuffer->unlock());

            const auto& [status, bufferFence] =
                    mComposerClient->getReadbackBufferFence(getPrimaryDisplayId());
            EXPECT_TRUE(status.isOk());
            int32_t clientFence;
            const auto unlockStatus = graphicBuffer->unlockAsync(&clientFence);
            ASSERT_EQ(::android::OK, unlockStatus);
            if (clientFence >= 0) {
                sync_wait(clientFence, -1);
                close(clientFence);
            }

            layer->setToClientComposition(mWriter);
            mWriter.acceptDisplayChanges(getPrimaryDisplayId());
            mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, bufferFence.get(),
            mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, clientFence,
                                    clientDataspace, std::vector<common::Rect>(1, damage));
            layer->setToClientComposition(mWriter);
            mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
            execute();
            changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId());
            ASSERT_TRUE(changedCompositionTypes.empty());
@@ -671,16 +673,18 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) {
        ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBuffer(
                static_cast<uint32_t>(getDisplayWidth()), static_cast<uint32_t>(getDisplayHeight()),
                graphicBuffer->getStride(), clientBufData, clientFormat, clientColors));
        EXPECT_EQ(::android::OK, graphicBuffer->unlock());

        const auto& [status, bufferFence] =
                mComposerClient->getReadbackBufferFence(getPrimaryDisplayId());
        EXPECT_TRUE(status.isOk());
        int32_t clientFence;
        const auto unlockStatus = graphicBuffer->unlockAsync(&clientFence);
        ASSERT_EQ(::android::OK, unlockStatus);
        if (clientFence >= 0) {
            sync_wait(clientFence, -1);
            close(clientFence);
        }

        clientLayer->setToClientComposition(mWriter);
        mWriter.acceptDisplayChanges(getPrimaryDisplayId());
        mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, bufferFence.get(),
        mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, clientFence,
                                clientDataspace, std::vector<common::Rect>(1, clientFrame));
        clientLayer->setToClientComposition(mWriter);
        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        execute();
        changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId());
        ASSERT_TRUE(changedCompositionTypes.empty());