Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fdac316f authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Automerger Merge Worker
Browse files

Merge "Check SurfaceControl in stats sent to transactionCallback" into sc-dev am: 8514c8e0

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/14215925

Change-Id: I5a45dd0ded42caea6e527b33bdf56571b0df82c4
parents d0b1cd16 8514c8e0
Loading
Loading
Loading
Loading
+42 −21
Original line number Diff line number Diff line
@@ -242,18 +242,27 @@ void BLASTBufferQueue::transactionCallback(nsecs_t /*latchTime*/, const sp<Fence
        ATRACE_CALL();
        BQA_LOGV("transactionCallback");

        if (!stats.empty()) {
            mTransformHint = stats[0].transformHint;
        if (!mSurfaceControlsWithPendingCallback.empty()) {
            sp<SurfaceControl> pendingSC = mSurfaceControlsWithPendingCallback.front();
            mSurfaceControlsWithPendingCallback.pop();
            bool found = false;
            for (auto stat : stats) {
                if (!SurfaceControl::isSameSurface(pendingSC, stat.surfaceControl)) {
                    continue;
                }

                mTransformHint = stat.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;
                        ->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) {
@@ -265,6 +274,17 @@ void BLASTBufferQueue::transactionCallback(nsecs_t /*latchTime*/, const sp<Fence
                    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));
+4 −0
Original line number Diff line number Diff line
@@ -203,6 +203,10 @@ private:
    // it for debugging purposes.
    std::unordered_map<uint64_t /* bufferId */, nsecs_t> mDequeueTimestamps
            GUARDED_BY(mTimestampMutex);

    // Keep track of SurfaceControls that have submitted a transaction and BBQ is waiting on a
    // callback for them.
    std::queue<sp<SurfaceControl>> mSurfaceControlsWithPendingCallback GUARDED_BY(mMutex);
};

} // namespace android