From f4af03ed9592dae0f2355dfff92c3c75c1b980d4 Mon Sep 17 00:00:00 2001 From: Alec Mouri Date: Sat, 11 Feb 2023 00:25:24 +0000 Subject: Add CachingHint into SurfaceFlinger Some system layers may need to be excluded from surfaceflinger caching for a variety of reasons, including power or image quality considerations. This provides a mechanism for those system layers to never be cached on the GPU. Bug: 259311918 Test: libcompositionengine_test Test: run test app and inspect planner state Change-Id: I35418ad5a41cb2546e3b27b0af290bf3c31a0180 --- libs/gui/LayerState.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libs/gui/LayerState.cpp') diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index a6276e500c..f6bba16899 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -189,6 +189,7 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.writeParcelable, trustedPresentationListener); SAFE_PARCEL(output.writeFloat, currentSdrHdrRatio); SAFE_PARCEL(output.writeFloat, desiredSdrHdrRatio); + SAFE_PARCEL(output.writeInt32, static_cast(cachingHint)) return NO_ERROR; } @@ -328,6 +329,10 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.readFloat, &tmpFloat); desiredSdrHdrRatio = tmpFloat; + int32_t tmpInt32; + SAFE_PARCEL(input.readInt32, &tmpInt32); + cachingHint = static_cast(tmpInt32); + return NO_ERROR; } @@ -580,6 +585,10 @@ void layer_state_t::merge(const layer_state_t& other) { desiredSdrHdrRatio = other.desiredSdrHdrRatio; currentSdrHdrRatio = other.currentSdrHdrRatio; } + if (other.what & eCachingHintChanged) { + what |= eCachingHintChanged; + cachingHint = other.cachingHint; + } if (other.what & eHdrMetadataChanged) { what |= eHdrMetadataChanged; hdrMetadata = other.hdrMetadata; @@ -731,6 +740,7 @@ uint64_t layer_state_t::diff(const layer_state_t& other) const { CHECK_DIFF(diff, eDataspaceChanged, other, dataspace); CHECK_DIFF2(diff, eExtendedRangeBrightnessChanged, other, currentSdrHdrRatio, desiredSdrHdrRatio); + CHECK_DIFF(diff, eCachingHintChanged, other, cachingHint); CHECK_DIFF(diff, eHdrMetadataChanged, other, hdrMetadata); if (other.what & eSurfaceDamageRegionChanged && (!surfaceDamageRegion.hasSameRects(other.surfaceDamageRegion))) { -- cgit v1.2.3-59-g8ed1b