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
Change-Id: Idb3c6d0778d522d1487baaffba36fae5d7b0d524
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 66a3a8e..f1a45cb 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -7829,7 +7829,10 @@
displayBrightnessNits);
}
}
- if (requestedDataspace == ui::Dataspace::UNKNOWN) {
+
+ // Screenshots leaving the device should be colorimetric
+ if (requestedDataspace == ui::Dataspace::UNKNOWN &&
+ renderArea->getHintForSeamlessTransition()) {
renderIntent = state.renderIntent;
}
}
@@ -7873,6 +7876,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,
@@ -7885,7 +7892,7 @@
.regionSampling = regionSampling,
.treat170mAsSrgb = mTreat170mAsSrgb,
.dimInGammaSpaceForEnhancedScreenshots =
- mDimInGammaSpaceForEnhancedScreenshots});
+ dimInGammaSpaceForEnhancedScreenshots});
const float colorSaturation = grayscale ? 0 : 1;
compositionengine::CompositionRefreshArgs refreshArgs{