Enable backpressure for BufferStateLayer
The default behaviour of buffer state layer is to drop older
buffers if there are newer buffers that are ready to be presented.
When emulating BufferQueue behavior via the adapter, we want
to queue up buffers without any present timestamps. To solve this,
we introduce a layer state flag to keep the buffer in the transaction
queue if there is already a buffer that is ready to be applied.
Test: atest SurfaceViewBufferTests:BufferPresentationTests
Bug: 176967609
Change-Id: I33f6347bd1c7a2d80dc4214e596bb864abe8c6bf
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index e5e10a0..2946aae 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -183,12 +183,9 @@
SAFE_PARCEL(input.readUint32, &layerStack);
SAFE_PARCEL(input.readFloat, &alpha);
- uint32_t tmpUint32 = 0;
- SAFE_PARCEL(input.readUint32, &tmpUint32);
- flags = static_cast<uint8_t>(tmpUint32);
+ SAFE_PARCEL(input.readUint32, &flags);
- SAFE_PARCEL(input.readUint32, &tmpUint32);
- mask = static_cast<uint8_t>(tmpUint32);
+ SAFE_PARCEL(input.readUint32, &mask);
SAFE_PARCEL(matrix.read, input);
SAFE_PARCEL(input.read, crop_legacy);
@@ -229,6 +226,7 @@
SAFE_PARCEL(input.read, *acquireFence);
}
+ uint32_t tmpUint32 = 0;
SAFE_PARCEL(input.readUint32, &tmpUint32);
dataspace = static_cast<ui::Dataspace>(tmpUint32);