summaryrefslogtreecommitdiff
path: root/libs/gui/BLASTBufferQueue.cpp
diff options
context:
space:
mode:
author Melody Hsu <melodymhsu@google.com> 2024-12-12 00:50:15 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2024-12-12 00:50:15 -0800
commit0a5a04af383de5e25a5c0fe5afbc955f4a25ff6f (patch)
tree0bddace9b2687e9682d7ac70f2fa2e81bf05d6b5 /libs/gui/BLASTBufferQueue.cpp
parente965b80ab0013ea3bf475e5b10c6d22fccb67219 (diff)
parente59a4df8dff658e4d0755826cd1052d5fc2b7179 (diff)
Merge "Buffer stuffing recovery when blocked on dequeueBuffer" into main
Diffstat (limited to 'libs/gui/BLASTBufferQueue.cpp')
-rw-r--r--libs/gui/BLASTBufferQueue.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp
index 7aee90393b..f476ce1238 100644
--- a/libs/gui/BLASTBufferQueue.cpp
+++ b/libs/gui/BLASTBufferQueue.cpp
@@ -1232,6 +1232,11 @@ public:
return OK;
}
+ // Provide a callback for Choreographer to start buffer stuffing recovery when blocked
+ // on buffer release.
+ std::function<void()> callbackCopy = bbq->getWaitForBufferReleaseCallback();
+ if (callbackCopy) callbackCopy();
+
// BufferQueue has already checked if we have a free buffer. If there's an unread interrupt,
// we want to ignore it. This must be done before unlocking the BufferQueue lock to ensure
// we don't miss an interrupt.
@@ -1344,6 +1349,16 @@ void BLASTBufferQueue::setApplyToken(sp<IBinder> applyToken) {
mApplyToken = std::move(applyToken);
}
+void BLASTBufferQueue::setWaitForBufferReleaseCallback(std::function<void()> callback) {
+ std::lock_guard _lock{mWaitForBufferReleaseMutex};
+ mWaitForBufferReleaseCallback = std::move(callback);
+}
+
+std::function<void()> BLASTBufferQueue::getWaitForBufferReleaseCallback() const {
+ std::lock_guard _lock{mWaitForBufferReleaseMutex};
+ return mWaitForBufferReleaseCallback;
+}
+
#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(BUFFER_RELEASE_CHANNEL)
void BLASTBufferQueue::updateBufferReleaseProducer() {