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
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index a6276e5..f6bba16 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -189,6 +189,7 @@
SAFE_PARCEL(output.writeParcelable, trustedPresentationListener);
SAFE_PARCEL(output.writeFloat, currentSdrHdrRatio);
SAFE_PARCEL(output.writeFloat, desiredSdrHdrRatio);
+ SAFE_PARCEL(output.writeInt32, static_cast<int32_t>(cachingHint))
return NO_ERROR;
}
@@ -328,6 +329,10 @@
SAFE_PARCEL(input.readFloat, &tmpFloat);
desiredSdrHdrRatio = tmpFloat;
+ int32_t tmpInt32;
+ SAFE_PARCEL(input.readInt32, &tmpInt32);
+ cachingHint = static_cast<gui::CachingHint>(tmpInt32);
+
return NO_ERROR;
}
@@ -580,6 +585,10 @@
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 @@
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))) {