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

Commit eb6a613c authored by Sally Qi's avatar Sally Qi
Browse files

[Lut] Fix the issue that HDR videos are too dark in adaptive mode.

- For layer Lut, HDR gpu path, in adaptive mode, oetf should be
  gamma2p2.

Bug: 410686984
Test: play with HDR10+ video in Photos; ASurfaceControlTest
Flag: EXEMPT bugfix

Change-Id: I07f85297ee96d3f74047b57c055ebe1aafb19a1f
parent 968f1fbd
Loading
Loading
Loading
Loading
+4 −12
Original line number Diff line number Diff line
@@ -547,18 +547,9 @@ sk_sp<SkShader> SkiaRenderEngine::createRuntimeEffectShader(
    }

    if (graphicBuffer && parameters.layer.luts) {
        const bool dimInLinearSpace = parameters.display.dimmingStage !=
                aidl::android::hardware::graphics::composer3::DimmingStage::GAMMA_OETF;
        const ui::Dataspace runtimeEffectDataspace = !dimInLinearSpace
                ? static_cast<ui::Dataspace>(
                          (parameters.outputDataSpace & ui::Dataspace::STANDARD_MASK) |
                          ui::Dataspace::TRANSFER_GAMMA2_2 |
                          (parameters.outputDataSpace & ui::Dataspace::RANGE_MASK))
                : parameters.outputDataSpace;

        shader = mLutShader.lutShader(shader, parameters.layer.luts,
                                      parameters.layer.sourceDataspace,
                                      toSkColorSpace(runtimeEffectDataspace));
                                      toSkColorSpace(parameters.outputDataSpace));
    }

    if (parameters.requiresLinearEffect) {
@@ -1038,7 +1029,8 @@ void SkiaRenderEngine::drawLayersInternal(
                (display.outputDataspace & ui::Dataspace::TRANSFER_MASK) ==
                        static_cast<int32_t>(ui::Dataspace::TRANSFER_SRGB);

        const bool useFakeOutputDataspaceForRuntimeEffect = !dimInLinearSpace && isExtendedHdr;
        const bool useFakeOutputDataspaceForRuntimeEffect =
                !dimInLinearSpace && (isExtendedHdr || layer.luts);

        const ui::Dataspace fakeDataspace = useFakeOutputDataspaceForRuntimeEffect
                ? static_cast<ui::Dataspace>(
@@ -1058,7 +1050,7 @@ void SkiaRenderEngine::drawLayersInternal(
        const bool requiresLinearEffect = layer.colorTransform != mat4() ||
                (needsToneMapping(layer.sourceDataspace, display.outputDataspace)) ||
                (dimInLinearSpace && !equalsWithinMargin(1.f, layerDimmingRatio)) ||
                (!dimInLinearSpace && isExtendedHdr);
                useFakeOutputDataspaceForRuntimeEffect;

        // quick abort from drawing the remaining portion of the layer
        if (layer.skipContentDraw ||