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

Commit cdcfcafc authored by ramindani's avatar ramindani
Browse files

[VTS] Update validateDisplay with frameIntervalNs

Test: atest VtsHalGraphicsComposer3_TargetTest
BUG: 284845445
Change-Id: I4821a535518b113923fac02adadb3f4867ce922e
parent ac6e50ab
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -197,6 +197,7 @@ class VtsComposerClient {
    std::vector<RefreshRateChangedDebugData> takeListOfRefreshRateChangedDebugData();

    static constexpr int32_t kMaxFrameIntervalNs = 50000000;  // 20fps
    static constexpr int32_t kNoFrameIntervalNs = 0;

  private:
    void addDisplayConfigs(VtsDisplay*, const std::vector<DisplayConfiguration>&);
+42 −21
Original line number Diff line number Diff line
@@ -220,7 +220,8 @@ TEST_P(GraphicsCompositionTest, SingleSolidColorLayer) {

        writeLayers(layers);
        ASSERT_TRUE(mReader.takeErrors().empty());
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();
        // if hwc cannot handle and asks for composition change,
        // just succeed the test
@@ -279,7 +280,8 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) {

        writeLayers(layers);
        ASSERT_TRUE(mReader.takeErrors().empty());
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();

        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
@@ -338,7 +340,8 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) {
                                      getDisplayHeight(), mPixelFormat, mDataspace);
        ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());

        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();

        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
@@ -465,7 +468,8 @@ TEST_P(GraphicsCompositionTest, ClientComposition) {
        ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
        writeLayers(layers);
        ASSERT_TRUE(mReader.takeErrors().empty());
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();

        auto changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId());
@@ -498,7 +502,8 @@ TEST_P(GraphicsCompositionTest, ClientComposition) {
            mWriter->setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, clientFence,
                                     clientDataspace, std::vector<common::Rect>(1, damage));
            layer->setToClientComposition(*mWriter);
            mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
            mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                     VtsComposerClient::kNoFrameIntervalNs);
            execute();
            changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId());
            ASSERT_TRUE(changedCompositionTypes.empty());
@@ -575,7 +580,8 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) {
        clientLayer->setDisplayFrame(clientFrame);
        clientLayer->setZOrder(0);
        clientLayer->write(*mWriter);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();

        auto changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId());
@@ -604,7 +610,8 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) {
        mWriter->setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, clientFence,
                                 clientDataspace, std::vector<common::Rect>(1, clientFrame));
        clientLayer->setToClientComposition(*mWriter);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();
        changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId());
        ASSERT_TRUE(changedCompositionTypes.empty());
@@ -652,7 +659,8 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) {

        writeLayers(layers);
        ASSERT_TRUE(mReader.takeErrors().empty());
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();
        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
            GTEST_SUCCEED();
@@ -680,7 +688,8 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) {

        writeLayers(layers);
        ASSERT_TRUE(mReader.takeErrors().empty());
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();
        ASSERT_TRUE(mReader.takeErrors().empty());
        ASSERT_TRUE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty());
@@ -721,7 +730,8 @@ TEST_P(GraphicsCompositionTest, SetLayerPlaneAlpha) {

        writeLayers(layers);
        ASSERT_TRUE(mReader.takeErrors().empty());
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();
        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
            GTEST_SUCCEED();
@@ -785,7 +795,8 @@ TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) {
        ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
        writeLayers(layers);
        ASSERT_TRUE(mReader.takeErrors().empty());
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();
        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
            GTEST_SUCCEED();
@@ -843,7 +854,8 @@ TEST_P(GraphicsCompositionTest, SetLayerZOrder) {

        writeLayers(layers);
        ASSERT_TRUE(mReader.takeErrors().empty());
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();
        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
            GTEST_SUCCEED();
@@ -865,7 +877,8 @@ TEST_P(GraphicsCompositionTest, SetLayerZOrder) {

        writeLayers(layers);
        ASSERT_TRUE(mReader.takeErrors().empty());
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();
        ASSERT_TRUE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty());
        ASSERT_TRUE(mReader.takeErrors().empty());
@@ -930,7 +943,8 @@ TEST_P(GraphicsCompositionTest, SetLayerBrightnessDims) {

        writeLayers(layers);
        ASSERT_TRUE(mReader.takeErrors().empty());
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();
        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
            GTEST_SUCCEED()
@@ -1065,7 +1079,8 @@ TEST_P(GraphicsBlendModeCompositionTest, None) {
        ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
        writeLayers(mLayers);
        ASSERT_TRUE(mReader.takeErrors().empty());
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();
        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
            GTEST_SUCCEED();
@@ -1110,7 +1125,8 @@ TEST_P(GraphicsBlendModeCompositionTest, Coverage) {
        ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
        writeLayers(mLayers);
        ASSERT_TRUE(mReader.takeErrors().empty());
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();
        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
            GTEST_SUCCEED();
@@ -1150,7 +1166,8 @@ TEST_P(GraphicsBlendModeCompositionTest, Premultiplied) {
        ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
        writeLayers(mLayers);
        ASSERT_TRUE(mReader.takeErrors().empty());
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();
        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
            GTEST_SUCCEED();
@@ -1234,7 +1251,8 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_H) {

        writeLayers(mLayers);
        ASSERT_TRUE(mReader.takeErrors().empty());
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();
        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
            GTEST_SUCCEED();
@@ -1280,7 +1298,8 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_V) {

        writeLayers(mLayers);
        ASSERT_TRUE(mReader.takeErrors().empty());
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();
        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
            GTEST_SUCCEED();
@@ -1326,7 +1345,8 @@ TEST_P(GraphicsTransformCompositionTest, ROT_180) {

        writeLayers(mLayers);
        ASSERT_TRUE(mReader.takeErrors().empty());
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                 VtsComposerClient::kNoFrameIntervalNs);
        execute();
        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
            GTEST_SUCCEED();
@@ -1419,7 +1439,8 @@ TEST_P(GraphicsColorManagementCompositionTest, ColorConversion) {
            EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON).isOk());

            ASSERT_TRUE(mReader.takeErrors().empty());
            mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
            mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                                     VtsComposerClient::kNoFrameIntervalNs);
            execute();
            if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
                continue;
+22 −11
Original line number Diff line number Diff line
@@ -1479,7 +1479,8 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest {
                                  /*acquireFence*/ -1);
            writer.setLayerDataspace(display.getDisplayId(), layer, common::Dataspace::UNKNOWN);

            writer.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp);
            writer.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp,
                                   VtsComposerClient::kNoFrameIntervalNs);
            execute();
            ASSERT_TRUE(mReader.takeErrors().empty());

@@ -1496,7 +1497,8 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest {
                                  /*acquireFence*/ -1);
            writer.setLayerSurfaceDamage(display.getDisplayId(), layer,
                                         std::vector<Rect>(1, {0, 0, 10, 10}));
            writer.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp);
            writer.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp,
                                   VtsComposerClient::kNoFrameIntervalNs);
            execute();
            ASSERT_TRUE(mReader.takeErrors().empty());

@@ -1510,7 +1512,8 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest {
    sp<::android::Fence> presentAndGetFence(
            std::optional<ClockMonotonicTimestamp> expectedPresentTime) {
        auto& writer = getWriter(getPrimaryDisplayId());
        writer.validateDisplay(getPrimaryDisplayId(), expectedPresentTime);
        writer.validateDisplay(getPrimaryDisplayId(), expectedPresentTime,
                               VtsComposerClient::kNoFrameIntervalNs);
        execute();
        EXPECT_TRUE(mReader.takeErrors().empty());

@@ -1852,20 +1855,23 @@ TEST_P(GraphicsComposerAidlCommandTest, SetOutputBuffer) {

TEST_P(GraphicsComposerAidlCommandTest, ValidDisplay) {
    auto& writer = getWriter(getPrimaryDisplayId());
    writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
    writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                           VtsComposerClient::kNoFrameIntervalNs);
    execute();
}

TEST_P(GraphicsComposerAidlCommandTest, AcceptDisplayChanges) {
    auto& writer = getWriter(getPrimaryDisplayId());
    writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
    writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                           VtsComposerClient::kNoFrameIntervalNs);
    writer.acceptDisplayChanges(getPrimaryDisplayId());
    execute();
}

TEST_P(GraphicsComposerAidlCommandTest, PresentDisplay) {
    auto& writer = getWriter(getPrimaryDisplayId());
    writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
    writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                           VtsComposerClient::kNoFrameIntervalNs);
    writer.presentDisplay(getPrimaryDisplayId());
    execute();
}
@@ -1904,7 +1910,8 @@ TEST_P(GraphicsComposerAidlCommandTest, PresentDisplayNoLayerStateChanges) {
        writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle,
                              /*acquireFence*/ -1);
        writer.setLayerDataspace(getPrimaryDisplayId(), layer, Dataspace::UNKNOWN);
        writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
        writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                               VtsComposerClient::kNoFrameIntervalNs);
        execute();
        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
            GTEST_SUCCEED() << "Composition change requested, skipping test";
@@ -1946,7 +1953,8 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerCursorPosition) {
                   (float)getPrimaryDisplay().getDisplayHeight()};
    configureLayer(getPrimaryDisplay(), layer, Composition::CURSOR, displayFrame, cropRect);
    writer.setLayerDataspace(getPrimaryDisplayId(), layer, Dataspace::UNKNOWN);
    writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
    writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                           VtsComposerClient::kNoFrameIntervalNs);

    execute();

@@ -1961,7 +1969,8 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerCursorPosition) {
    execute();

    writer.setLayerCursorPosition(getPrimaryDisplayId(), layer, /*x*/ 0, /*y*/ 0);
    writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
    writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
                           VtsComposerClient::kNoFrameIntervalNs);
    writer.presentDisplay(getPrimaryDisplayId());
    execute();
}
@@ -2160,7 +2169,8 @@ TEST_P(GraphicsComposerAidlCommandTest, DisplayDecoration) {
        auto& writer = getWriter(display.getDisplayId());
        writer.setLayerBuffer(display.getDisplayId(), layer, /*slot*/ 0, decorBuffer->handle,
                              /*acquireFence*/ -1);
        writer.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp);
        writer.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp,
                               VtsComposerClient::kNoFrameIntervalNs);
        execute();
        if (support) {
            ASSERT_TRUE(mReader.takeErrors().empty());
@@ -2864,7 +2874,8 @@ TEST_P(GraphicsComposerAidlCommandTest, MultiThreadedPresent) {
        auto& reader = readers.at(displayId);
        lock.unlock();

        writer.validateDisplay(displayId, ComposerClientWriter::kNoTimestamp);
        writer.validateDisplay(displayId, ComposerClientWriter::kNoTimestamp,
                               VtsComposerClient::kNoFrameIntervalNs);
        execute(writer, reader);

        threads.emplace_back([this, displayId, &readers, &readersMutex]() {