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

Commit 0b7962c8 authored by Valerie Hau's avatar Valerie Hau Committed by Android (Google) Code Review
Browse files

Merge "Do not block transaction application on flush"

parents a37d5802 0779dedb
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -3514,7 +3514,7 @@ bool SurfaceFlinger::flushTransactionQueues() {
                break;
            }
            applyTransactionState(states, displays, flags, mPendingInputWindowCommands,
                                  desiredPresentTime, postTime, privileged);
                                  desiredPresentTime, postTime, privileged, /*isMainThread*/ true);
            transactionQueue.pop();
        }

@@ -3601,7 +3601,7 @@ void SurfaceFlinger::applyTransactionState(const Vector<ComposerState>& states,
                                           const Vector<DisplayState>& displays, uint32_t flags,
                                           const InputWindowCommands& inputWindowCommands,
                                           const int64_t desiredPresentTime, const int64_t postTime,
                                           bool privileged) {
                                           bool privileged, bool isMainThread) {
    uint32_t transactionFlags = 0;

    if (flags & eAnimation) {
@@ -3665,7 +3665,12 @@ void SurfaceFlinger::applyTransactionState(const Vector<ComposerState>& states,
        }

        mPendingSyncInputWindows = mPendingInputWindowCommands.syncInputWindows;
        while (mTransactionPending || mPendingSyncInputWindows) {

        // applyTransactionState can be called by either the main SF thread or by
        // another process through setTransactionState.  While a given process may wish
        // to wait on synchronous transactions, the main SF thread should never
        // be blocked.  Therefore, we only wait if isMainThread is false.
        while (!isMainThread && (mTransactionPending || mPendingSyncInputWindows)) {
            status_t err = mTransactionCV.waitRelative(mStateLock, s2ns(5));
            if (CC_UNLIKELY(err != NO_ERROR)) {
                // just in case something goes wrong in SF, return to the
+1 −1
Original line number Diff line number Diff line
@@ -578,7 +578,7 @@ private:
                               const Vector<DisplayState>& displays, uint32_t flags,
                               const InputWindowCommands& inputWindowCommands,
                               const int64_t desiredPresentTime, const int64_t postTime,
                               bool privileged) REQUIRES(mStateLock);
                               bool privileged, bool isMainThread = false) REQUIRES(mStateLock);
    bool flushTransactionQueues();
    uint32_t getTransactionFlags(uint32_t flags);
    uint32_t peekTransactionFlags();