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

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

Merge "[Lut backend] Fix a bug where we were passing a nullptr to the HWC when...

Merge "[Lut backend] Fix a bug where we were passing a nullptr to the HWC when we wanted to clear the LUTs." into main
parents 7a858008 36349ac2
Loading
Loading
Loading
Loading
+22 −20
Original line number Diff line number Diff line
@@ -589,9 +589,10 @@ void OutputLayer::writeOutputIndependentGeometryStateToHWC(

void OutputLayer::writeLutToHWC(HWC2::Layer* hwcLayer,
                                const LayerFECompositionState& outputIndependentState) {
    if (!outputIndependentState.luts) {
        return;
    }
    Luts luts;
    // if outputIndependentState.luts is nullptr, it means we want to clear the LUTs
    // and we pass an empty Luts object to the HWC.
    if (outputIndependentState.luts) {
        auto& lutFileDescriptor = outputIndependentState.luts->getLutFileDescriptor();
        auto lutOffsets = outputIndependentState.luts->offsets;
        auto& lutProperties = outputIndependentState.luts->lutProperties;
@@ -607,10 +608,11 @@ void OutputLayer::writeLutToHWC(HWC2::Layer* hwcLayer,
            aidlProperties.emplace_back(properties);
        }

    Luts luts;

        luts.pfd = ndk::ScopedFileDescriptor(dup(lutFileDescriptor.get()));
        luts.offsets = lutOffsets;
        luts.lutProperties = std::move(aidlProperties);
    }

    switch (auto error = hwcLayer->setLuts(luts)) {
        case hal::Error::NONE:
+1 −0
Original line number Diff line number Diff line
@@ -901,6 +901,7 @@ struct OutputLayerWriteStateToHWCTest : public OutputLayerTest {
        EXPECT_CALL(*mHwcLayer, setSurfaceDamage(RegionEq(surfaceDamage))).WillOnce(Return(kError));
        EXPECT_CALL(*mHwcLayer, setBlockingRegion(RegionEq(blockingRegion)))
                .WillOnce(Return(kError));
        EXPECT_CALL(*mHwcLayer, setLuts(_)).WillOnce(Return(kError));
    }

    void expectSetCompositionTypeCall(Composition compositionType) {