From 1b0d4e16530a4feb99eafbfdfce2aeb39c5e23e3 Mon Sep 17 00:00:00 2001 From: Alec Mouri Date: Mon, 12 Feb 2024 22:27:19 +0000 Subject: Add support for restricting HDR headroom for video This is needed for allowing apps to vote for HDR headroom restrictions for SurfaceView and SurfaceControl Bug: 323964760 Test: manually poking at test app Test: SurfaceViewTests Test: SurfaceControlTest Test: ASurfaceControlTest Change-Id: Ie886e67879525462d49fdedc535aea659d69321a --- libs/gui/LayerState.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libs/gui/LayerState.cpp') diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index 38fab9cdaa..9d7d304afb 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -605,6 +605,10 @@ void layer_state_t::merge(const layer_state_t& other) { desiredHdrSdrRatio = other.desiredHdrSdrRatio; currentHdrSdrRatio = other.currentHdrSdrRatio; } + if (other.what & eDesiredHdrHeadroomChanged) { + what |= eDesiredHdrHeadroomChanged; + desiredHdrSdrRatio = other.desiredHdrSdrRatio; + } if (other.what & eCachingHintChanged) { what |= eCachingHintChanged; cachingHint = other.cachingHint; @@ -768,6 +772,7 @@ uint64_t layer_state_t::diff(const layer_state_t& other) const { CHECK_DIFF(diff, eDataspaceChanged, other, dataspace); CHECK_DIFF2(diff, eExtendedRangeBrightnessChanged, other, currentHdrSdrRatio, desiredHdrSdrRatio); + CHECK_DIFF(diff, eDesiredHdrHeadroomChanged, other, desiredHdrSdrRatio); CHECK_DIFF(diff, eCachingHintChanged, other, cachingHint); CHECK_DIFF(diff, eHdrMetadataChanged, other, hdrMetadata); if (other.what & eSurfaceDamageRegionChanged && -- cgit v1.2.3-59-g8ed1b