summaryrefslogtreecommitdiff
path: root/libs/gui/BufferQueueConsumer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/gui/BufferQueueConsumer.cpp')
-rw-r--r--libs/gui/BufferQueueConsumer.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/libs/gui/BufferQueueConsumer.cpp b/libs/gui/BufferQueueConsumer.cpp
index da6143c59f..7f7a0437f1 100644
--- a/libs/gui/BufferQueueConsumer.cpp
+++ b/libs/gui/BufferQueueConsumer.cpp
@@ -94,7 +94,10 @@ status_t BufferQueueConsumer::acquireBuffer(BufferItem* outBuffer,
++numAcquiredBuffers;
}
}
- if (numAcquiredBuffers >= mCore->mMaxAcquiredBufferCount + 1) {
+ const bool acquireNonDroppableBuffer = mCore->mAllowExtraAcquire &&
+ numAcquiredBuffers == mCore->mMaxAcquiredBufferCount + 1;
+ if (numAcquiredBuffers >= mCore->mMaxAcquiredBufferCount + 1 &&
+ !acquireNonDroppableBuffer) {
BQ_LOGE("acquireBuffer: max acquired buffer count reached: %d (max %d)",
numAcquiredBuffers, mCore->mMaxAcquiredBufferCount);
return INVALID_OPERATION;
@@ -254,6 +257,9 @@ status_t BufferQueueConsumer::acquireBuffer(BufferItem* outBuffer,
outBuffer->mIsStale = false;
outBuffer->mAutoRefresh = mCore->mSharedBufferMode &&
mCore->mAutoRefresh;
+ } else if (acquireNonDroppableBuffer && front->mIsDroppable) {
+ BQ_LOGV("acquireBuffer: front buffer is not droppable");
+ return NO_BUFFER_AVAILABLE;
} else {
slot = front->mSlot;
*outBuffer = *front;
@@ -824,4 +830,9 @@ status_t BufferQueueConsumer::dumpState(const String8& prefix, String8* outResul
return NO_ERROR;
}
+void BufferQueueConsumer::setAllowExtraAcquire(bool allow) {
+ std::lock_guard<std::mutex> lock(mCore->mMutex);
+ mCore->mAllowExtraAcquire = allow;
+}
+
} // namespace android