summaryrefslogtreecommitdiff
path: root/libs/gui/LayerState.cpp
diff options
context:
space:
mode:
author Vishnu Nair <vishnun@google.com> 2021-02-22 14:35:15 -0800
committer Vishnu Nair <vishnun@google.com> 2021-03-17 15:58:29 +0000
commit1506b181085e1f2156283d0e7b62fe94a918427f (patch)
treee712ebf2d2f90c5c76600b29f9637ddb1955573d /libs/gui/LayerState.cpp
parent3fabf687ee63461d1aad186ae540156aa7765b25 (diff)
Introduce release buffer callback for BufferStateLayer
Currently BLAST clients use the TransactionCompleted callbacks to determine when to release buffers. The TransactionCompleted callback is overloaded. For transactions without buffers, the callback is called when the transaction is applied on the server. If the Transaction contains one or more buffers, the callback is called when all the buffers are latched and ready to be presented. If we have multiple buffers on multiple transactions, where one or more buffers maybe dropped, the pending callbacks are called together. This may delay signaling the client when a buffer can be released. To fix this, we introduce a new buffer release callback that is called as soon as a buffer is dropped by the server or when a new buffer has been latched and the buffer will no longer be presented. This new callback provides a graphic bufferid to identify the buffer that can be released and a release fence to wait on. BlastBufferQueue has been switched to use this new callback. Other BLAST users continue to use the existing callback. Test: go/wm-smoke Test: atest ReleaseBufferCallbackTest Bug: 178385281 Change-Id: Idd88e4994e543443198a5a8cfa0e3f5f67d5d482
Diffstat (limited to 'libs/gui/LayerState.cpp')
-rw-r--r--libs/gui/LayerState.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index 6bb8bf2d5b..7a18ca61fe 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -63,7 +63,8 @@ layer_state_t::layer_state_t()
fixedTransformHint(ui::Transform::ROT_INVALID),
frameNumber(0),
frameTimelineInfo(),
- autoRefresh(false) {
+ autoRefresh(false),
+ releaseBufferListener(nullptr) {
matrix.dsdx = matrix.dtdy = 1.0f;
matrix.dsdy = matrix.dtdx = 0.0f;
hdrMetadata.validTypes = 0;
@@ -152,6 +153,7 @@ status_t layer_state_t::write(Parcel& output) const
SAFE_PARCEL(output.writeUint64, frameNumber);
SAFE_PARCEL(frameTimelineInfo.write, output);
SAFE_PARCEL(output.writeBool, autoRefresh);
+ SAFE_PARCEL(output.writeStrongBinder, IInterface::asBinder(releaseBufferListener));
SAFE_PARCEL(output.writeUint32, blurRegions.size());
for (auto region : blurRegions) {
@@ -275,6 +277,12 @@ status_t layer_state_t::read(const Parcel& input)
SAFE_PARCEL(frameTimelineInfo.read, input);
SAFE_PARCEL(input.readBool, &autoRefresh);
+ tmpBinder = nullptr;
+ SAFE_PARCEL(input.readNullableStrongBinder, &tmpBinder);
+ if (tmpBinder) {
+ releaseBufferListener = checked_interface_cast<ITransactionCompletedListener>(tmpBinder);
+ }
+
uint32_t numRegions = 0;
SAFE_PARCEL(input.readUint32, &numRegions);
blurRegions.clear();
@@ -543,6 +551,13 @@ void layer_state_t::merge(const layer_state_t& other) {
what |= eAutoRefreshChanged;
autoRefresh = other.autoRefresh;
}
+ if (other.what & eReleaseBufferListenerChanged) {
+ if (releaseBufferListener) {
+ ALOGW("Overriding releaseBufferListener");
+ }
+ what |= eReleaseBufferListenerChanged;
+ releaseBufferListener = other.releaseBufferListener;
+ }
if (other.what & eStretchChanged) {
what |= eStretchChanged;
stretchEffect = other.stretchEffect;