From 6879659d589a17d362f91bba4bec5737504a75e7 Mon Sep 17 00:00:00 2001 From: John Reck Date: Wed, 25 Jan 2023 13:47:12 -0500 Subject: Add extended brightness range impl Bug: 241001465 Test: manual currently, flagged off Change-Id: I707281b9acaf6ea218f1d9ce888fc7cdbf1cf7c9 --- libs/gui/LayerState.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libs/gui/LayerState.cpp') diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index 43acb16299..8372363185 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -187,6 +187,8 @@ status_t layer_state_t::write(Parcel& output) const } SAFE_PARCEL(output.writeParcelable, trustedPresentationThresholds); SAFE_PARCEL(output.writeParcelable, trustedPresentationListener); + SAFE_PARCEL(output.writeFloat, currentSdrHdrRatio); + SAFE_PARCEL(output.writeFloat, desiredSdrHdrRatio); return NO_ERROR; } @@ -321,6 +323,11 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.readParcelable, &trustedPresentationThresholds); SAFE_PARCEL(input.readParcelable, &trustedPresentationListener); + SAFE_PARCEL(input.readFloat, &tmpFloat); + currentSdrHdrRatio = tmpFloat; + SAFE_PARCEL(input.readFloat, &tmpFloat); + desiredSdrHdrRatio = tmpFloat; + return NO_ERROR; } @@ -568,6 +575,11 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eDataspaceChanged; dataspace = other.dataspace; } + if (other.what & eExtendedRangeBrightnessChanged) { + what |= eExtendedRangeBrightnessChanged; + desiredSdrHdrRatio = other.desiredSdrHdrRatio; + currentSdrHdrRatio = other.currentSdrHdrRatio; + } if (other.what & eHdrMetadataChanged) { what |= eHdrMetadataChanged; hdrMetadata = other.hdrMetadata; @@ -714,6 +726,8 @@ uint64_t layer_state_t::diff(const layer_state_t& other) const { CHECK_DIFF(diff, eCropChanged, other, crop); if (other.what & eBufferChanged) diff |= eBufferChanged; CHECK_DIFF(diff, eDataspaceChanged, other, dataspace); + CHECK_DIFF2(diff, eExtendedRangeBrightnessChanged, other, currentSdrHdrRatio, + desiredSdrHdrRatio); CHECK_DIFF(diff, eHdrMetadataChanged, other, hdrMetadata); if (other.what & eSurfaceDamageRegionChanged && (!surfaceDamageRegion.hasSameRects(other.surfaceDamageRegion))) { -- cgit v1.2.3-59-g8ed1b