diff options
| author | 2021-04-16 15:46:12 -0500 | |
|---|---|---|
| committer | 2021-04-19 18:19:01 -0500 | |
| commit | 42026164d1f75b92ee208fc8f772786c737d6b21 (patch) | |
| tree | 5bd78e48a5f0c9e2576225a702658dff40e557de /libs/gui/BLASTBufferQueue.cpp | |
| parent | e4d7d43dd2a079e6ac89264c417fa58ce6ae8d7b (diff) | |
Check SurfaceControl in stats sent to transactionCallback
The stats sent to the transactionCallback can contain stats about
multiple SurfaceControls. This is because the callback is created for a
single transaction, not a single SurfaceControl.
Instead, check the stats for the matching SurfaceControl in BBQ.
Fixes: 185510248
Test: Rotate device with new shell transition. Doesn't timeout
Change-Id: I9d759de3b8b8b5c089c707904f69ebaed56513b6
Diffstat (limited to 'libs/gui/BLASTBufferQueue.cpp')
| -rw-r--r-- | libs/gui/BLASTBufferQueue.cpp | 63 |
1 files changed, 42 insertions, 21 deletions
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp index 476617db48..571da690a7 100644 --- a/libs/gui/BLASTBufferQueue.cpp +++ b/libs/gui/BLASTBufferQueue.cpp @@ -242,29 +242,49 @@ void BLASTBufferQueue::transactionCallback(nsecs_t /*latchTime*/, const sp<Fence ATRACE_CALL(); BQA_LOGV("transactionCallback"); - if (!stats.empty()) { - mTransformHint = stats[0].transformHint; - mBufferItemConsumer->setTransformHint(mTransformHint); - mBufferItemConsumer - ->updateFrameTimestamps(stats[0].frameEventStats.frameNumber, - stats[0].frameEventStats.refreshStartTime, - stats[0].frameEventStats.gpuCompositionDoneFence, - stats[0].presentFence, stats[0].previousReleaseFence, - stats[0].frameEventStats.compositorTiming, - stats[0].latchTime, - stats[0].frameEventStats.dequeueReadyTime); - currFrameNumber = stats[0].frameEventStats.frameNumber; - - if (mTransactionCompleteCallback && - currFrameNumber >= mTransactionCompleteFrameNumber) { - if (currFrameNumber > mTransactionCompleteFrameNumber) { - BQA_LOGE("transactionCallback received for a newer framenumber=%" PRIu64 - " than expected=%" PRIu64, - currFrameNumber, mTransactionCompleteFrameNumber); + if (!mSurfaceControlsWithPendingCallback.empty()) { + sp<SurfaceControl> pendingSC = mSurfaceControlsWithPendingCallback.front(); + mSurfaceControlsWithPendingCallback.pop(); + bool found = false; + for (auto stat : stats) { + if (!SurfaceControl::isSameSurface(pendingSC, stat.surfaceControl)) { + continue; } - transactionCompleteCallback = std::move(mTransactionCompleteCallback); - mTransactionCompleteFrameNumber = 0; + + mTransformHint = stat.transformHint; + mBufferItemConsumer->setTransformHint(mTransformHint); + mBufferItemConsumer + ->updateFrameTimestamps(stat.frameEventStats.frameNumber, + stat.frameEventStats.refreshStartTime, + stat.frameEventStats.gpuCompositionDoneFence, + stat.presentFence, stat.previousReleaseFence, + stat.frameEventStats.compositorTiming, + stat.latchTime, + stat.frameEventStats.dequeueReadyTime); + + currFrameNumber = stat.frameEventStats.frameNumber; + + if (mTransactionCompleteCallback && + currFrameNumber >= mTransactionCompleteFrameNumber) { + if (currFrameNumber > mTransactionCompleteFrameNumber) { + BQA_LOGE("transactionCallback received for a newer framenumber=%" PRIu64 + " than expected=%" PRIu64, + currFrameNumber, mTransactionCompleteFrameNumber); + } + transactionCompleteCallback = std::move(mTransactionCompleteCallback); + mTransactionCompleteFrameNumber = 0; + } + + found = true; + break; + } + + if (!found) { + BQA_LOGE("Failed to find matching SurfaceControl in transaction callback"); } + } else { + BQA_LOGE("No matching SurfaceControls found: mSurfaceControlsWithPendingCallback was " + "empty."); } decStrong((void*)transactionCallbackThunk); @@ -392,6 +412,7 @@ void BLASTBufferQueue::processNextBufferLocked(bool useNextTransaction) { t->setAcquireFence(mSurfaceControl, bufferItem.mFence ? new Fence(bufferItem.mFence->dup()) : Fence::NO_FENCE); t->addTransactionCompletedCallback(transactionCallbackThunk, static_cast<void*>(this)); + mSurfaceControlsWithPendingCallback.push(mSurfaceControl); setMatrix(t, mLastBufferInfo); t->setCrop(mSurfaceControl, computeCrop(bufferItem)); |