summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishnu Nair <vishnun@google.com>2021-08-05 16:12:48 -0700
committerVishnu Nair <vishnun@google.com>2021-08-05 16:14:23 -0700
commit52846cd871a8e89bc1d42427e87d53936331f351 (patch)
tree832fc274e4fbfeb884f1ab2b61fbdc6d52a0d0ba
parentcebf2e6cd693b0ad9cd9560c283e24f7e38aa0cf (diff)
downloadnative-52846cd871a8e89bc1d42427e87d53936331f351.tar.gz
Blast: Fix missing release callbacks for shared buffers
Fixes an issue where buffers were compared only using the buffer id. In shared buffer mode, the client will queue up the same buffer id multiple times so we need to distinguish using the frame number as well. Test: https://buganizer.corp.google.com/issues/195447981#comment18 Fixes: 195447981 Change-Id: I2a2d02a0d7e67ee9577857a210cb6157683e5598
-rw-r--r--services/surfaceflinger/BufferStateLayer.cpp19
-rw-r--r--services/surfaceflinger/BufferStateLayer.h1
-rw-r--r--services/surfaceflinger/Layer.h6
3 files changed, 2 insertions, 24 deletions
diff --git a/services/surfaceflinger/BufferStateLayer.cpp b/services/surfaceflinger/BufferStateLayer.cpp
index 6253036c41..8bc51dfa5d 100644
--- a/services/surfaceflinger/BufferStateLayer.cpp
+++ b/services/surfaceflinger/BufferStateLayer.cpp
@@ -425,7 +425,8 @@ bool BufferStateLayer::setBuffer(const std::shared_ptr<renderengine::ExternalTex
if (mDrawingState.buffer) {
mReleasePreviousBuffer = true;
- if (mDrawingState.buffer != mBufferInfo.mBuffer) {
+ if (mDrawingState.buffer != mBufferInfo.mBuffer ||
+ mDrawingState.frameNumber != mBufferInfo.mFrameNumber) {
// If mDrawingState has a buffer, and we are about to update again
// before swapping to drawing state, then the first buffer will be
// dropped and we should decrement the pending buffer count and
@@ -963,22 +964,6 @@ void BufferStateLayer::tracePendingBufferCount(int32_t pendingBuffers) {
ATRACE_INT(mBlastTransactionName.c_str(), pendingBuffers);
}
-void BufferStateLayer::bufferMayChange(const sp<GraphicBuffer>& newBuffer) {
- if (mDrawingState.buffer != nullptr &&
- (!mBufferInfo.mBuffer ||
- mDrawingState.buffer->getBuffer() != mBufferInfo.mBuffer->getBuffer()) &&
- newBuffer != mDrawingState.buffer->getBuffer()) {
- // If we are about to update mDrawingState.buffer but it has not yet latched
- // then we will drop a buffer and should decrement the pending buffer count and
- // call any release buffer callbacks if set.
- callReleaseBufferCallback(mDrawingState.releaseBufferListener,
- mDrawingState.buffer->getBuffer(), mDrawingState.frameNumber,
- mDrawingState.acquireFence, mTransformHint,
- mFlinger->getMaxAcquiredBufferCountForCurrentRefreshRate(
- mOwnerUid));
- decrementPendingBufferCount();
- }
-}
/*
* We don't want to send the layer's transform to input, but rather the
diff --git a/services/surfaceflinger/BufferStateLayer.h b/services/surfaceflinger/BufferStateLayer.h
index e5674785af..cab48994b3 100644
--- a/services/surfaceflinger/BufferStateLayer.h
+++ b/services/surfaceflinger/BufferStateLayer.h
@@ -97,7 +97,6 @@ public:
// See mPendingBufferTransactions
void decrementPendingBufferCount();
- void bufferMayChange(const sp<GraphicBuffer>& newBuffer) override;
std::atomic<int32_t>* getPendingBufferCounter() override { return &mPendingBufferTransactions; }
std::string getPendingBufferCounterName() override { return mBlastTransactionName; }
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index c5cb17ffc7..8eb7e7d613 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -703,12 +703,6 @@ public:
virtual uint32_t doTransaction(uint32_t transactionFlags);
/*
- * Called before updating the drawing state buffer. Used by BufferStateLayer to release any
- * unlatched buffers in the drawing state.
- */
- virtual void bufferMayChange(const sp<GraphicBuffer>& /* newBuffer */){};
-
- /*
* Remove relative z for the layer if its relative parent is not part of the
* provided layer tree.
*/