summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2023-07-11 14:07:00 -0400
committerJohn Reck <jreck@google.com>2023-07-21 18:52:07 +0000
commit4546de0814ce7fdd0afed47c5ef833788cb1d79e (patch)
tree6139a9fd5812e4ffb3b9aafaba1628ee27447e2c
parentd430717d81ee3053db7c707a2ab5276e0f5c938f (diff)
downloadnative-4546de0814ce7fdd0afed47c5ef833788cb1d79e.tar.gz
Fix brightness change during screenrotation
When doing a layer capture for seamless transitions avoid clamping the max HDR headroom. Fixes: 288063548 Test: repro steps in bug Change-Id: Ic90c8b4478ad90b1776c455cbe696ec22182496d (cherry picked from commit 1dadaa6b78f2939e717451303cd29d8f683e5f08)
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 1c646869a5..f4f4bccc7e 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -7424,7 +7424,10 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::renderScreenImpl(
renderArea->getHintForSeamlessTransition());
sdrWhitePointNits = state.sdrWhitePointNits;
displayBrightnessNits = state.displayBrightnessNits;
- if (sdrWhitePointNits > 1.0f) {
+ // Only clamp the display brightness if this is not a seamless transition. 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 (sdrWhitePointNits > 1.0f && !renderArea->getHintForSeamlessTransition()) {
// 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;