summaryrefslogtreecommitdiff
path: root/libs/gui/LayerState.cpp
diff options
context:
space:
mode:
author Marissa Wall <marissaw@google.com> 2019-03-15 14:58:34 -0700
committer Marissa Wall <marissaw@google.com> 2019-03-22 14:13:10 -0700
commit78b7220f542826771223f9b5c0b876874dd398d2 (patch)
treead06c575e7f760c4d4b79448cd69026d8cffe6e8 /libs/gui/LayerState.cpp
parent4c6f904ffde2795886477f6de54edcae5d036e68 (diff)
blast: drop buffer from SF's cache when destroyed
When an app drops its reference to an AHardwareBuffer, the buffer should be removed from the client and SurfaceFlinger caches. Ideally, both caches would have wp to the buffer and the buffer would automatically be removed from the cache. Unfortunately, GraphicBuffers are refcounted per process. If SurfaceFlinger just has a wp to the GraphicBuffer, the buffer's destructor will be called and SurfaceFlinger will lose access to the buffer. SurfaceFlinger can't just hold onto a sp to the buffer because then the buffer wouldn't be destoryed when the app drops its reference. Instead, when the app process drops its last strong reference, GraphicBuffer will send a callback to the client side cache. The cache will send a Transaction to SurfaceFlinger to drop its sp to the buffer. Bug: 127689853 Test: SurfaceFlinger_test Change-Id: I2182578ed33d7c731945cb88cd1decb2892266b0
Diffstat (limited to 'libs/gui/LayerState.cpp')
-rw-r--r--libs/gui/LayerState.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index 84ba64494f..f6ca9e8f0b 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -95,7 +95,7 @@ status_t layer_state_t::write(Parcel& output) const
}
output.writeStrongBinder(cachedBuffer.token);
- output.writeInt32(cachedBuffer.bufferId);
+ output.writeUint64(cachedBuffer.cacheId);
output.writeParcelable(metadata);
output.writeFloat(bgColorAlpha);
@@ -173,7 +173,7 @@ status_t layer_state_t::read(const Parcel& input)
}
cachedBuffer.token = input.readStrongBinder();
- cachedBuffer.bufferId = input.readInt32();
+ cachedBuffer.cacheId = input.readUint64();
input.readParcelable(&metadata);
bgColorAlpha = input.readFloat();