Change slot generation for BufferState
BufferState layers now do slot generation with buffer death considered
appropriately. When a buffer dies, the slot will be pushed onto a stack
of available slots to be reused at the next opportunity. This should
mimic BufferQueue slot behavior and prevent Composer Resources from
growing too large.
Test: build, boot, manual
Bug: 129351223
Change-Id: Icef9592593cacb0b5c6b12f6679fc2c4dabdcd19
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index 3077b21..075bb52 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -87,8 +87,8 @@
colorTransform.asArray(), 16 * sizeof(float));
output.writeFloat(cornerRadius);
output.writeBool(hasListenerCallbacks);
- output.writeStrongBinder(cachedBuffer.token);
- output.writeUint64(cachedBuffer.cacheId);
+ output.writeWeakBinder(cachedBuffer.token);
+ output.writeUint64(cachedBuffer.id);
output.writeParcelable(metadata);
output.writeFloat(bgColorAlpha);
@@ -157,8 +157,8 @@
colorTransform = mat4(static_cast<const float*>(input.readInplace(16 * sizeof(float))));
cornerRadius = input.readFloat();
hasListenerCallbacks = input.readBool();
- cachedBuffer.token = input.readStrongBinder();
- cachedBuffer.cacheId = input.readUint64();
+ cachedBuffer.token = input.readWeakBinder();
+ cachedBuffer.id = input.readUint64();
input.readParcelable(&metadata);
bgColorAlpha = input.readFloat();