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

Commit 04d2587f authored by Peiyong Lin's avatar Peiyong Lin
Browse files

[SurfaceFlinger] Use GPU composition for per layer color transform when necessary.

Previously we moved the fallback mechanism to composer@2.3 passthrough, as a
result composer before 2.3 can't trigger GPU composition. This patch help
proactively set the composition type to CLIENT on devices that don't upgrade to
composer@2.3.

BUG: 130621073
Test: Verify with customized grayscaled matrix.
Change-Id: I08e6a215872a62008deef708444245bd50807640
parent aa45ab58
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -321,7 +321,10 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice,
    }

    error = hwcLayer->setColorTransform(getColorTransform());
    if (error != HWC2::Error::None) {
    if (error == HWC2::Error::Unsupported) {
        // If per layer color transform is not supported, we use GPU composition.
        setCompositionType(displayDevice, Hwc2::IComposerClient::Composition::CLIENT);
    } else if (error != HWC2::Error::None) {
        ALOGE("[%s] Failed to setColorTransform: %s (%d)", mName.string(),
                to_string(error).c_str(), static_cast<int32_t>(error));
    }
+6 −2
Original line number Diff line number Diff line
@@ -1029,9 +1029,13 @@ Error Layer::setColorTransform(const android::mat4& matrix) {
    if (matrix == mColorMatrix) {
        return Error::None;
    }
    mColorMatrix = matrix;
    auto intError = mComposer.setLayerColorTransform(mDisplayId, mId, matrix.asArray());
    return static_cast<Error>(intError);
    Error error = static_cast<Error>(intError);
    if (error != Error::None) {
        return error;
    }
    mColorMatrix = matrix;
    return error;
}

} // namespace impl