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

Commit 238f4a2a authored by Robert Carr's avatar Robert Carr
Browse files

SurfaceFlinger: Only block calling thread on sync transactions.

We use synchronous transactions and synchronous input commands so that
the caller can block until after the transaction has executed. However
the current implementation blocks all other callers. This isn't required
and could create performance issues or binder exhaustion issues so
this CL modifies the code so only the calling thread will block.

Bug: 154443842
Test: Existing tests pass
Change-Id: I556497b1a48de5add753f4de09227b16ca1fc428
parent d6f449d4
Loading
Loading
Loading
Loading
+13 −5
Original line number Original line Diff line number Diff line
@@ -3416,18 +3416,26 @@ void SurfaceFlinger::applyTransactionState(
                                                  : Scheduler::TransactionStart::NORMAL;
                                                  : Scheduler::TransactionStart::NORMAL;
        setTransactionFlags(transactionFlags, start);
        setTransactionFlags(transactionFlags, start);


        if (flags & eAnimation) {
            mAnimTransactionPending = true;
        }

        // if this is a synchronous transaction, wait for it to take effect
        // if this is a synchronous transaction, wait for it to take effect
        // before returning.
        // before returning.
        if (flags & eSynchronous) {
        const bool synchronous = flags & eSynchronous;
            mTransactionPending = true;
        const bool syncInput = inputWindowCommands.syncInputWindows;
        if (!synchronous && !syncInput) {
            return;
        }
        }
        if (flags & eAnimation) {

            mAnimTransactionPending = true;
        if (synchronous) {
            mTransactionPending = true;
        }
        }
        if (mPendingInputWindowCommands.syncInputWindows) {
        if (syncInput) {
            mPendingSyncInputWindows = true;
            mPendingSyncInputWindows = true;
        }
        }



        // applyTransactionState can be called by either the main SF thread or by
        // applyTransactionState can be called by either the main SF thread or by
        // another process through setTransactionState.  While a given process may wish
        // another process through setTransactionState.  While a given process may wish
        // to wait on synchronous transactions, the main SF thread should never
        // to wait on synchronous transactions, the main SF thread should never