From feec2c60b201ea4ff65244c6d65f08acc9796a9f Mon Sep 17 00:00:00 2001 From: John Reck Date: Mon, 13 Feb 2023 10:19:08 -0500 Subject: Add ASurfaceTransaction_setExtendedRangeBrightness Bug: 241001465 Test: make / silkfx demo Change-Id: I043474aeda46a65ac93c124d854d71e1a8c082c9 --- include/android/surface_control.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/include/android/surface_control.h b/include/android/surface_control.h index f76e73d3cf..79c59f28fb 100644 --- a/include/android/surface_control.h +++ b/include/android/surface_control.h @@ -520,6 +520,45 @@ void ASurfaceTransaction_setHdrMetadata_cta861_3(ASurfaceTransaction* transactio struct AHdrMetadata_cta861_3* metadata) __INTRODUCED_IN(29); +/** + * Sets the desired extended range brightness for the layer. This only applies for layers whose + * dataspace has RANGE_EXTENDED set on it. + * + * @param surface_control The layer whose extended range brightness is being specified + * @param currentBufferRatio The current hdr/sdr ratio of the current buffer as represented as + * peakHdrBrightnessInNits / targetSdrWhitePointInNits. For example if the + * buffer was rendered with a target SDR whitepoint of 100nits and a max + * display brightness of 200nits, this should be set to 2.0f. + * + * Default value is 1.0f. + * + * Transfer functions that encode their own brightness ranges, such as + * HLG or PQ, should also set this to 1.0f and instead communicate + * extended content brightness information via metadata such as CTA861_3 + * or SMPTE2086. + * + * Must be finite && >= 1.0f + * + * @param desiredRatio The desired hdr/sdr ratio as represented as peakHdrBrightnessInNits / + * targetSdrWhitePointInNits. This can be used to communicate the max desired + * brightness range. This is similar to the "max luminance" value in other + * HDR metadata formats, but represented as a ratio of the target SDR whitepoint + * to the max display brightness. The system may not be able to, or may choose + * not to, deliver the requested range. + * + * If unspecified, the system will attempt to provide the best range it can + * for the given ambient conditions & device state. However, voluntarily + * reducing the requested range can help improve battery life as well as can + * improve quality by ensuring greater bit depth is allocated to the luminance + * range in use. + * + * Must be finite && >= 1.0f + */ +void ASurfaceTransaction_setExtendedRangeBrightness(ASurfaceTransaction* transaction, + ASurfaceControl* surface_control, + float currentBufferRatio, + float desiredRatio) __INTRODUCED_IN(__ANDROID_API_U__); + /** * Same as ASurfaceTransaction_setFrameRateWithChangeStrategy(transaction, surface_control, * frameRate, compatibility, ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS). -- cgit v1.2.3-59-g8ed1b