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

Commit 159c436e authored by Sally Qi's avatar Sally Qi Committed by Android (Google) Code Review
Browse files

Merge "[Lut VTS] add vts for getLuts()" into main

parents 8db65b18 dee4de90
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -696,4 +696,10 @@ std::pair<ScopedAStatus, int32_t> VtsComposerClient::getMaxLayerPictureProfiles(
    return {mComposerClient->getMaxLayerPictureProfiles(display, &outMaxProfiles), outMaxProfiles};
}

std::pair<ScopedAStatus, std::vector<Luts>> VtsComposerClient::getLuts(
        int64_t display, const std::vector<Buffer>& buffers) {
    std::vector<Luts> outLuts;
    return {mComposerClient->getLuts(display, buffers, &outLuts), std::move(outLuts)};
}

}  // namespace aidl::android::hardware::graphics::composer3::vts
+3 −0
Original line number Diff line number Diff line
@@ -200,6 +200,9 @@ class VtsComposerClient {

    std::pair<ScopedAStatus, int32_t> getMaxLayerPictureProfiles(int64_t display);

    std::pair<ScopedAStatus, std::vector<Luts>> getLuts(int64_t display,
                                                        const std::vector<Buffer>& buffers);

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

+24 −0
Original line number Diff line number Diff line
@@ -3356,6 +3356,30 @@ TEST_P(GraphicsComposerAidlCommandV4Test, setLayerPictureProfileId_failsWithTooM
    }
}

// @NonApiTest = check the status if calling getLuts
TEST_P(GraphicsComposerAidlCommandV4Test, GetLuts) {
    for (auto& display : mDisplays) {
        int64_t displayId = display.getDisplayId();
        auto& writer = getWriter(displayId);
        const auto layer = createOnScreenLayer(display);
        const auto buffer = allocate(::android::PIXEL_FORMAT_RGBA_8888);
        ASSERT_NE(nullptr, buffer->handle);
        writer.setLayerBuffer(displayId, layer, /*slot*/ 0, buffer->handle,
                              /*acquireFence*/ -1);
        Buffer aidlbuffer;
        aidlbuffer.handle = ::android::dupToAidl(buffer->handle);
        std::vector<Buffer> buffers;
        buffers.push_back(std::move(aidlbuffer));
        const auto& [status, _] = mComposerClient->getLuts(displayId, buffers);
        if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC &&
            status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
            GTEST_SKIP() << "getLuts is not supported";
            return;
        }
        ASSERT_TRUE(status.isOk());
    }
}

TEST_P(GraphicsComposerAidlCommandV4Test, SetUnsupportedLayerLuts) {
    auto& writer = getWriter(getPrimaryDisplayId());
    const auto& [layerStatus, layer] =