diff options
| author | 2021-04-20 16:09:49 +0000 | |
|---|---|---|
| committer | 2021-04-20 16:09:49 +0000 | |
| commit | 8514c8e0a39f6d542e90aee2200dec8855590cb8 (patch) | |
| tree | d14083cf9e74afca6085c05c047c2e5e31037f78 /libs/gui/BLASTBufferQueue.cpp | |
| parent | a3a235f56fc2b015d8ee938e4507d942b0f6f9d4 (diff) | |
| parent | 42026164d1f75b92ee208fc8f772786c737d6b21 (diff) | |
Merge "Check SurfaceControl in stats sent to transactionCallback" into sc-dev
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 e3b59b2584..dbc1a7ed22 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)); |