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

Commit bd612009 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

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

parents e387960d eb6a613c
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) {
@@ -1056,7 +1047,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>(
@@ -1076,7 +1068,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 ||