Make screenshots leaving the device more consistent.
For screenshots that we know won't be used for seamless transitions:
* Don't do dimming workarounds
* Don't use enhance or vendor-specific render intents
This ensures that screenshots that do not tonemap, i.e., screenshots
that do not contain PQ or HLG content, are rendered consistently for
use-cases like CTS where color accuracy is important.
Bug: 297832714
Test: TextureViewTests
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:ffb3221dd26c2d4def013e987d586d537c086775)
Merged-In: Idb3c6d0778d522d1487baaffba36fae5d7b0d524
Change-Id: Idb3c6d0778d522d1487baaffba36fae5d7b0d524
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 77ae03d..f4f03b6 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -7443,7 +7443,9 @@
}
}
- if (requestedDataspace == ui::Dataspace::UNKNOWN) {
+ // Screenshots leaving the device should be colorimetric
+ if (requestedDataspace == ui::Dataspace::UNKNOWN &&
+ renderArea->getHintForSeamlessTransition()) {
renderIntent = state.renderIntent;
}
}
@@ -7487,6 +7489,10 @@
}
}
+ // Screenshots leaving the device must not dim in gamma space.
+ const bool dimInGammaSpaceForEnhancedScreenshots = mDimInGammaSpaceForEnhancedScreenshots &&
+ renderArea->getHintForSeamlessTransition();
+
std::shared_ptr<ScreenCaptureOutput> output = createScreenCaptureOutput(
ScreenCaptureOutputArgs{.compositionEngine = *compositionEngine,
.colorProfile = colorProfile,
@@ -7499,7 +7505,7 @@
.regionSampling = regionSampling,
.treat170mAsSrgb = mTreat170mAsSrgb,
.dimInGammaSpaceForEnhancedScreenshots =
- mDimInGammaSpaceForEnhancedScreenshots});
+ dimInGammaSpaceForEnhancedScreenshots});
const float colorSaturation = grayscale ? 0 : 1;
compositionengine::CompositionRefreshArgs refreshArgs{