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

Commit db06e5e5 authored by Chia-I Wu's avatar Chia-I Wu
Browse files

surfaceflinger: fix video color conversion in WCG

There is a typo in RenderEngine that causes
Dataspace::TRANSFER_SMPTE_170M and others to be treated as
Dataspace::TRANSFER_LINEAR.

Bug: 77629979
Test: manual
Change-Id: I26cf386304909015fc914b2dd86ef8fdeb34479a
parent 4610a203
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -321,10 +321,16 @@ void GLES20RenderEngine::drawMesh(const Mesh& mesh) {
            default:
                // treat all other dataspaces as sRGB
                wideColorState.setColorMatrix(mState.getColorMatrix() * mSrgbToDisplayP3);
                if ((mDataSpace & Dataspace::TRANSFER_MASK) & Dataspace::TRANSFER_LINEAR) {
                    wideColorState.setInputTransferFunction(Description::TransferFunction::LINEAR);
                } else {
                    wideColorState.setInputTransferFunction(Description::TransferFunction::SRGB);
                switch (static_cast<Dataspace>(mDataSpace & Dataspace::TRANSFER_MASK)) {
                    case Dataspace::TRANSFER_LINEAR:
                        wideColorState.setInputTransferFunction(
                                Description::TransferFunction::LINEAR);
                        break;
                    default:
                        // treat all other transfer functions as sRGB
                        wideColorState.setInputTransferFunction(
                                Description::TransferFunction::SRGB);
                        break;
                }
                wideColorState.setOutputTransferFunction(Description::TransferFunction::SRGB);
                ALOGV("drawMesh: gamut transform applied");