From 14d5b8632c365428cb5f69f119365dff86ecc77f Mon Sep 17 00:00:00 2001 From: Alec Mouri Date: Wed, 27 Apr 2022 21:20:04 +0000 Subject: Propagate HDR information to screenshot animation. The screenshot animation must know whether the screenshot contains HDR layers so that it can correctly inform SurfaceFlinger whether its layer can be dimmed. This is due to the interplay of the following: 1. Devices are now able to configure DisplayManager to send significantly lower SDR white points relative to display brightness to SurfaceFlinger when HDR is simultaneously on-screen. 2. AIDL composer is required to support per-layer dimming, so that SDR layers may be dimmed to preserve the relative luminance of HDR video content. 3. Because the screenshot does not contain an HDR transfer function, SurfaceFlinger will treat the layer as SDR, and attempt to dim it. 4. Screen rotations containing HDR layers must request SurfaceFlinger to present the rotated screenshot at display brightness, to override (3) above. Otherwise, HDR content captured in the screenshot will suddenly dim during the rotation animation. 5. Also due to (3), DisplayManager no longer thinks that there is HDR content on screen, so a prior patch treated layers that requested to to be dimmed to be reported as HDR (I1d1b0dcaf230300ca34b84ea407d0817feb2c664). Otherwise, the display brightness will decrease during the animation and ramp back up afterwards. 6. But because of (5), screenshots that only contained SDR layers were incorrectly treated as HDR, which caused the display brightness to ramp up during the animation. This patch fixes (6) by allowing for the screenshot animation to learn whether the screenshot contains HDR layers, and request dimming capabilities accordingly. Bug: 230068567 Test: screen rotation Change-Id: I6bbb2433f976e368bfe2c04e084e110cfb551c15 --- libs/gui/ScreenCaptureResults.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libs/gui/ScreenCaptureResults.cpp') diff --git a/libs/gui/ScreenCaptureResults.cpp b/libs/gui/ScreenCaptureResults.cpp index e91f74f3d3..fe387064bc 100644 --- a/libs/gui/ScreenCaptureResults.cpp +++ b/libs/gui/ScreenCaptureResults.cpp @@ -36,6 +36,7 @@ status_t ScreenCaptureResults::writeToParcel(android::Parcel* parcel) const { } SAFE_PARCEL(parcel->writeBool, capturedSecureLayers); + SAFE_PARCEL(parcel->writeBool, capturedHdrLayers); SAFE_PARCEL(parcel->writeUint32, static_cast(capturedDataspace)); SAFE_PARCEL(parcel->writeInt32, result); return NO_ERROR; @@ -57,6 +58,7 @@ status_t ScreenCaptureResults::readFromParcel(const android::Parcel* parcel) { } SAFE_PARCEL(parcel->readBool, &capturedSecureLayers); + SAFE_PARCEL(parcel->readBool, &capturedHdrLayers); uint32_t dataspace = 0; SAFE_PARCEL(parcel->readUint32, &dataspace); capturedDataspace = static_cast(dataspace); -- cgit v1.2.3-59-g8ed1b