From 74ca6abe7824c909092db5d27cb5387f216be9d1 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Tue, 1 Nov 2022 14:29:10 -0700 Subject: BBQ: Check if the buffer is already in the pending release queue before logging As a workaround for lost release callbacks, we try to release buffers in the submitted queue. If the buffer was released previously but held in the pending release queue, we would log incorrectly. This fixes the misleading logs. Test: presubmit Test: logcat Fixes: 255679881 Change-Id: I7e46f21f4c4fa1ee8c70e3ee8cd3f3665fe7442a (cherry picked from commit 28fe2e694f5cafaf0eaad1417e15fdee2943b15b) --- libs/gui/BLASTBufferQueue.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'libs/gui/BLASTBufferQueue.cpp') diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp index a51bbb1553..24a5295112 100644 --- a/libs/gui/BLASTBufferQueue.cpp +++ b/libs/gui/BLASTBufferQueue.cpp @@ -357,11 +357,12 @@ void BLASTBufferQueue::transactionCallback(nsecs_t /*latchTime*/, const sp& releaseFence, std::optional currentMaxAcquiredBufferCount) { +void BLASTBufferQueue::releaseBufferCallbackLocked( + const ReleaseCallbackId& id, const sp& releaseFence, + std::optional currentMaxAcquiredBufferCount, bool fakeRelease) { ATRACE_CALL(); BQA_LOGV("releaseBufferCallback %s", id.to_string().c_str()); @@ -432,6 +435,11 @@ void BLASTBufferQueue::releaseBufferCallbackLocked(const ReleaseCallbackId& id, auto rb = ReleasedBuffer{id, releaseFence}; if (std::find(mPendingRelease.begin(), mPendingRelease.end(), rb) == mPendingRelease.end()) { mPendingRelease.emplace_back(rb); + if (fakeRelease) { + BQA_LOGE("Faking releaseBufferCallback from transactionCompleteCallback %" PRIu64, + id.framenumber); + BBQ_TRACE("FakeReleaseCallback"); + } } // Release all buffers that are beyond the ones that we need to hold -- cgit v1.2.3-59-g8ed1b