SurfaceComposerClient BLAST: Avoid recaching buffers.
cacheBuffers works like this:
1. Look for any State with eBufferChanged
2. If it has a cache entry clear eBufferChanged and set the cache
3. If it doesn't have an entry leave eBufferChanged set, but also set
the cache so we can use it next time.
In the third case where we don't clear eBufferChanged we might attempt
to recache buffers that have already been cached. This might happen
in the wrong process.
Bug: 153561718
Test: Existing tests pass. BLAST Sync Engine manual test.
Change-Id: Ibe02e76d40fedef46a2418587e28e598d6e2c614
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index e89863f..605c2e8 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -560,6 +560,11 @@
layer_state_t* s = getLayerState(handle);
if (!(s->what & layer_state_t::eBufferChanged)) {
continue;
+ } else if (s->what & layer_state_t::eCachedBufferChanged) {
+ // If eBufferChanged and eCachedBufferChanged are both trued then that means
+ // we already cached the buffer in a previous call to cacheBuffers, perhaps
+ // from writeToParcel on a Transaction that was merged in to this one.
+ continue;
}
// Don't try to cache a null buffer. Sending null buffers is cheap so we shouldn't waste