Latch and relase buffers for offscreen layers on main thread.
The current code was calling fakeVsync, which was latching and releasing
buffers on a binder thread when a new frame arrived. This was causing a
race with the latchBuffer on the main thread. This change calls
latchAndReleaseBuffer on the main thread for offscreen layers to ensure
we don't block dequeueBuffer but also don't race the other latchBuffer
call.
Fixes: 139118508
Test: Race was only reproducible in monkey tests
Change-Id: Ie7d87aa775c215de3fb2322b73849402596cc3fc
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 87a5896..2a1564a 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -544,6 +544,8 @@
virtual bool isBufferLatched() const { return false; }
+ virtual void latchAndReleaseBuffer() {}
+
/*
* Remove relative z for the layer if its relative parent is not part of the
* provided layer tree.