Skip to content

Commit 23ac46c

Browse files
author
Melody Hsu
committed
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
1 parent 18a80f9 commit 23ac46c

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

services/surfaceflinger/SurfaceFlinger.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7823,15 +7823,16 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::renderScreenImpl(
78237823
// Otherwise for seamless transitions it's important to match the current
78247824
// display state as the buffer will be shown under these same conditions, and we
78257825
// want to avoid any flickers.
7826-
if (captureResults.capturedHdrLayers && !enableLocalTonemapping &&
7827-
args.sdrWhitePointNits > 1.0f && !args.seamlessTransition) {
7828-
// Restrict the amount of HDR "headroom" in the screenshot to avoid
7829-
// over-dimming the SDR portion. 2.0 chosen by experimentation
7830-
constexpr float kMaxScreenshotHeadroom = 2.0f;
7831-
// TODO: Aim to update displayBrightnessNits earlier in screenshot
7832-
// path so ScreenshotArgs can be passed as const
7833-
args.displayBrightnessNits = std::min(args.sdrWhitePointNits * kMaxScreenshotHeadroom,
7834-
args.displayBrightnessNits);
7826+
if (captureResults.capturedHdrLayers) {
7827+
if (!enableLocalTonemapping && args.sdrWhitePointNits > 1.0f && !args.seamlessTransition) {
7828+
// Restrict the amount of HDR "headroom" in the screenshot to avoid
7829+
// over-dimming the SDR portion. 2.0 chosen by experimentation
7830+
constexpr float kMaxScreenshotHeadroom = 2.0f;
7831+
// TODO: Aim to update displayBrightnessNits earlier in screenshot
7832+
// path so ScreenshotArgs can be passed as const
7833+
args.displayBrightnessNits = std::min(args.sdrWhitePointNits * kMaxScreenshotHeadroom,
7834+
args.displayBrightnessNits);
7835+
}
78357836
} else {
78367837
args.displayBrightnessNits = args.sdrWhitePointNits;
78377838
}

0 commit comments

Comments
 (0)