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

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

Merge "VtsHalGraphicsComposer3_TargetTest test fixes."

parents 2909ca28 deb059e4
Loading
Loading
Loading
Loading
+19 −20
Original line number Diff line number Diff line
@@ -81,6 +81,8 @@ class GraphicsComposerAidlTest : public ::testing::TestWithParam<std::string> {
        // assume the first displays are built-in and are never removed
        mDisplays = waitForDisplays();

        mPrimaryDisplay = mDisplays[0].get();

        // explicitly disable vsync
        for (const auto& display : mDisplays) {
            EXPECT_TRUE(mComposerClient->setVsyncEnabled(display.get(), false).isOk());
@@ -318,7 +320,7 @@ class GraphicsComposerAidlTest : public ::testing::TestWithParam<std::string> {
        }

        mWriter->selectDisplay(display.get());
        setPowerMode(display.get(), PowerMode::ON);
        EXPECT_TRUE(mComposerClient->setPowerMode(display.get(), PowerMode::ON).isOk());
        EXPECT_TRUE(
                mComposerClient
                        ->setColorMode(display.get(), ColorMode::NATIVE, RenderIntent::COLORIMETRIC)
@@ -484,13 +486,6 @@ class GraphicsComposerAidlTest : public ::testing::TestWithParam<std::string> {
        }
    }

    void setPowerMode(int64_t display, PowerMode powerMode) {
        ::ndk::ScopedAStatus error = mComposerClient->setPowerMode(display, powerMode);
        ASSERT_TRUE(error.isOk() ||
                    IComposerClient::EX_UNSUPPORTED == error.getServiceSpecificError())
                << "failed to set power mode";
    }

    // Keep track of all virtual displays and layers.  When a test fails with
    // ASSERT_*, the destructor will clean up the resources for the test.
    struct DisplayResource {
@@ -617,6 +612,7 @@ TEST_P(GraphicsComposerAidlTest, setActiveConfigWithConstraints_SeamlessNotAllow
TEST_P(GraphicsComposerAidlTest, setActiveConfigWithConstraints) {
    Test_setActiveConfigWithConstraints({.delayForChange = 0, .refreshMiss = false});
}

TEST_P(GraphicsComposerAidlTest, GetDisplayIdentificationData) {
    DisplayIdentification displayIdentification0;

@@ -826,16 +822,18 @@ TEST_P(GraphicsComposerAidlTest, GetDisplayedContentSample) {
    displayContentSamplingAttributes.format = static_cast<common::PixelFormat>(invalid);
    displayContentSamplingAttributes.dataspace = static_cast<common::Dataspace>(invalid);
    displayContentSamplingAttributes.componentMask = static_cast<FormatColorComponent>(invalid);
    EXPECT_TRUE(mComposerClient
                        ->getDisplayedContentSamplingAttributes(mPrimaryDisplay,
                                                                &displayContentSamplingAttributes)
                        .isOk());
    auto error = mComposerClient->getDisplayedContentSamplingAttributes(
            mPrimaryDisplay, &displayContentSamplingAttributes);
    if (error.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
        SUCCEED() << "Sampling attributes aren't supported on this device, test skipped";
        return;
    }

    int64_t maxFrames = 10;
    int64_t timestamp = 0;
    int64_t frameCount = 0;
    DisplayContentSample displayContentSample;
    auto error = mComposerClient->getDisplayedContentSample(mPrimaryDisplay, maxFrames, timestamp,
    error = mComposerClient->getDisplayedContentSample(mPrimaryDisplay, maxFrames, timestamp,
                                                       &displayContentSample);
    if (error.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
        SUCCEED() << "Device does not support optional extension. Test skipped";
@@ -1197,7 +1195,7 @@ TEST_P(GraphicsComposerAidlTest, SetPowerMode) {
    modes.push_back(PowerMode::ON);

    for (auto mode : modes) {
        setPowerMode(mPrimaryDisplay, mode);
        EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
    }
}

@@ -1208,7 +1206,7 @@ TEST_P(GraphicsComposerAidlTest, SetPowerModeVariations) {
    modes.push_back(PowerMode::OFF);

    for (auto mode : modes) {
        setPowerMode(mPrimaryDisplay, mode);
        EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
    }

    modes.clear();
@@ -1217,7 +1215,7 @@ TEST_P(GraphicsComposerAidlTest, SetPowerModeVariations) {
    modes.push_back(PowerMode::ON);

    for (auto mode : modes) {
        setPowerMode(mPrimaryDisplay, mode);
        EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
    }

    modes.clear();
@@ -1226,7 +1224,7 @@ TEST_P(GraphicsComposerAidlTest, SetPowerModeVariations) {
    modes.push_back(PowerMode::ON_SUSPEND);

    for (auto mode : modes) {
        setPowerMode(mPrimaryDisplay, mode);
        EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
    }

    bool isDozeSupported = false;
@@ -1238,7 +1236,7 @@ TEST_P(GraphicsComposerAidlTest, SetPowerModeVariations) {
        modes.push_back(PowerMode::DOZE);

        for (auto mode : modes) {
            setPowerMode(mPrimaryDisplay, mode);
            EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
        }

        modes.clear();
@@ -1247,7 +1245,7 @@ TEST_P(GraphicsComposerAidlTest, SetPowerModeVariations) {
        modes.push_back(PowerMode::DOZE_SUSPEND);

        for (auto mode : modes) {
            setPowerMode(mPrimaryDisplay, mode);
            EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
        }
    }
}
@@ -1285,6 +1283,7 @@ TEST_P(GraphicsComposerAidlTest, GetDataspaceSaturationMatrix) {
    EXPECT_TRUE(
            mComposerClient->getDataspaceSaturationMatrix(common::Dataspace::SRGB_LINEAR, &matrix)
                    .isOk());

    // the last row is known
    ASSERT_EQ(0.0f, matrix[12]);
    ASSERT_EQ(0.0f, matrix[13]);
+0 −8
Original line number Diff line number Diff line
@@ -125,12 +125,4 @@ GraphicsComposerCallback::takeLastVsyncPeriodChangeTimeline() {
    return ::ndk::ScopedAStatus::ok();
}

::ndk::SpAIBinder GraphicsComposerCallback::asBinder() {
    return nullptr;
}

bool GraphicsComposerCallback::isRemote() {
    return true;
}

}  // namespace aidl::android::hardware::graphics::composer3::vts
+12 −12
Original line number Diff line number Diff line
@@ -37,15 +37,15 @@ void TestCommandReader::parseSingleCommand(int32_t commandRaw, uint16_t length)
    auto command = static_cast<Command>(commandRaw);

    switch (command) {
        case Command::SET_CLIENT_TARGET_PROPERTY:
        case Command::SET_CLIENT_TARGET_PROPERTY: {
            ASSERT_EQ(2, length);
            read();
            close(readFence());
            break;
        case Command::SELECT_DISPLAY:
        } break;
        case Command::SELECT_DISPLAY: {
            ASSERT_EQ(2, length);
            read64();  // display
            break;
        } break;
        case Command::SET_ERROR: {
            ASSERT_EQ(2, length);
            auto loc = read();
@@ -53,7 +53,7 @@ void TestCommandReader::parseSingleCommand(int32_t commandRaw, uint16_t length)
            std::pair<uint32_t, uint32_t> error(loc, err);
            mErrors.push_back(error);
        } break;
        case Command::SET_CHANGED_COMPOSITION_TYPES:
        case Command::SET_CHANGED_COMPOSITION_TYPES: {
            ASSERT_EQ(0, length % 3);
            for (uint16_t count = 0; count < length / 3; ++count) {
                uint64_t layerId = read64();
@@ -62,8 +62,8 @@ void TestCommandReader::parseSingleCommand(int32_t commandRaw, uint16_t length)
                std::pair<uint64_t, uint32_t> compositionChange(layerId, composition);
                mCompositionChanges.push_back(compositionChange);
            }
            break;
        case Command::SET_DISPLAY_REQUESTS:
        } break;
        case Command::SET_DISPLAY_REQUESTS: {
            ASSERT_EQ(1, length % 3);
            read();  // displayRequests, ignored for now
            for (uint16_t count = 0; count < (length - 1) / 3; ++count) {
@@ -72,18 +72,18 @@ void TestCommandReader::parseSingleCommand(int32_t commandRaw, uint16_t length)
                // client composition anyway
                ASSERT_EQ(1u, read());
            }
            break;
        case Command::SET_PRESENT_FENCE:
        } break;
        case Command::SET_PRESENT_FENCE: {
            ASSERT_EQ(1, length);
            close(readFence());
            break;
        case Command::SET_RELEASE_FENCES:
        } break;
        case Command::SET_RELEASE_FENCES: {
            ASSERT_EQ(0, length % 3);
            for (uint16_t count = 0; count < length / 3; ++count) {
                read64();
                close(readFence());
            }
            break;
        } break;
        default:
            GTEST_FAIL() << "unexpected return command " << std::hex << static_cast<int>(command);
            break;
+2 −6
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion"

#include <aidl/android/hardware/graphics/composer3/IComposerCallback.h>
#include <aidl/android/hardware/graphics/composer3/BnComposerCallback.h>
#include <android-base/thread_annotations.h>
#include <mutex>
#include <unordered_set>
@@ -29,8 +29,7 @@

namespace aidl::android::hardware::graphics::composer3::vts {

// IComposerCallback to be installed with IComposerClient::registerCallback.
class GraphicsComposerCallback : public IComposerCallback {
class GraphicsComposerCallback : public BnComposerCallback {
  public:
    void setVsyncAllowed(bool allowed);

@@ -59,9 +58,6 @@ class GraphicsComposerCallback : public IComposerCallback {
            const ::aidl::android::hardware::graphics::composer3::VsyncPeriodChangeTimeline&
                    in_updatedTimeline) override;

    ::ndk::SpAIBinder asBinder() override;
    bool isRemote() override;

    mutable std::mutex mMutex;
    // the set of all currently connected displays
    std::unordered_set<int64_t> mDisplays GUARDED_BY(mMutex);