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

Commit 23ac46c2 authored by Melody Hsu's avatar Melody Hsu
Browse files

Fix display brightness for HDR layers during transitions

Transitions with HDR would have a white flash due to incorrect
logic with setting display brightness. The bug was caused by
attempting to evaluate the logic for capturedHdrLayers with
several other conditions, causing the brightness to be set
to the sdrWhitePointNits if any of the conditions were false.

Fixes: b/397159125
Test: play HDR video on YouTube and switch orientation to
observe if a white flash occurs
Flag: EXEMPT, bug fix

Change-Id: Ib15060e5b113ec1345da6b3b51a66132c6ae4e6c
parent 18a80f97
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -7823,8 +7823,8 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::renderScreenImpl(
    // Otherwise for seamless transitions it's important to match the current
    // display state as the buffer will be shown under these same conditions, and we
    // want to avoid any flickers.
    if (captureResults.capturedHdrLayers && !enableLocalTonemapping &&
        args.sdrWhitePointNits > 1.0f && !args.seamlessTransition) {
    if (captureResults.capturedHdrLayers) {
        if (!enableLocalTonemapping && args.sdrWhitePointNits > 1.0f && !args.seamlessTransition) {
            // Restrict the amount of HDR "headroom" in the screenshot to avoid
            // over-dimming the SDR portion. 2.0 chosen by experimentation
            constexpr float kMaxScreenshotHeadroom = 2.0f;
@@ -7832,6 +7832,7 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::renderScreenImpl(
            // path so ScreenshotArgs can be passed as const
            args.displayBrightnessNits = std::min(args.sdrWhitePointNits * kMaxScreenshotHeadroom,
                                                  args.displayBrightnessNits);
        }
    } else {
        args.displayBrightnessNits = args.sdrWhitePointNits;
    }