diff options
| -rw-r--r-- | services/surfaceflinger/Layer.cpp | 7 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 10 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 10 |
3 files changed, 13 insertions, 14 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index c1463151f8..13049eddf2 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -866,13 +866,12 @@ bool Layer::applyPendingStates(State* stateToCommit) { } // If we still have pending updates, we need to ensure SurfaceFlinger - // will keep calling doTransaction, and so we set the transaction flags. + // will keep calling doTransaction, and so we force a traversal. // However, our pending states won't clear until a frame is available, - // and so there is no need to specifically trigger a wakeup. Rather - // we set the flags and wait for something else to wake us up. + // and so there is no need to specifically trigger a wakeup. if (!mPendingStates.empty()) { setTransactionFlags(eTransactionNeeded); - mFlinger->setTransactionFlagsNoWake(eTraversalNeeded); + mFlinger->setTraversalNeeded(); } mCurrentState.modified = false; diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 1a222e3e08..068049dfea 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2765,7 +2765,8 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags) * (perform the transaction for each of them if needed) */ - if ((transactionFlags & eTraversalNeeded) || mTraversalNeededMainThread) { + if ((transactionFlags & eTraversalNeeded) || mForceTraversal) { + mForceTraversal = false; mCurrentState.traverse([&](Layer* layer) { uint32_t trFlags = layer->getTransactionFlags(eTransactionNeeded); if (!trFlags) return; @@ -2778,7 +2779,6 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags) mInputInfoChanged = true; } }); - mTraversalNeededMainThread = false; } /* @@ -3249,8 +3249,8 @@ uint32_t SurfaceFlinger::setTransactionFlags(uint32_t flags, return old; } -uint32_t SurfaceFlinger::setTransactionFlagsNoWake(uint32_t flags) { - return mTransactionFlags.fetch_or(flags); +void SurfaceFlinger::setTraversalNeeded() { + mForceTraversal = true; } bool SurfaceFlinger::flushTransactionQueues() { @@ -3450,7 +3450,7 @@ void SurfaceFlinger::applyTransactionState( // so we don't have to wake up again next frame to preform an uneeded traversal. if (isMainThread && (transactionFlags & eTraversalNeeded)) { transactionFlags = transactionFlags & (~eTraversalNeeded); - mTraversalNeededMainThread = true; + mForceTraversal = true; } if (transactionFlags) { diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 1bfda49caa..38db62be1d 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -627,12 +627,12 @@ private: uint32_t peekTransactionFlags(); // Can only be called from the main thread or with mStateLock held uint32_t setTransactionFlags(uint32_t flags); - // Set the transaction flags, but don't trigger a wakeup! We use this cases where - // there are still pending transactions but we know they won't be ready until a frame + // Indicate SF should call doTraversal on layers, but don't trigger a wakeup! We use this cases + // where there are still pending transactions but we know they won't be ready until a frame // arrives from a different layer. So we need to ensure we performTransaction from invalidate // but there is no need to try and wake up immediately to do it. Rather we rely on - // onFrameAvailable to wake us up. - uint32_t setTransactionFlagsNoWake(uint32_t flags); + // onFrameAvailable or another layer update to wake us up. + void setTraversalNeeded(); uint32_t setTransactionFlags(uint32_t flags, Scheduler::TransactionStart transactionStart); void commitTransaction() REQUIRES(mStateLock); void commitOffscreenLayers(); @@ -1000,7 +1000,7 @@ private: bool mTransactionPending = false; bool mAnimTransactionPending = false; SortedVector<sp<Layer>> mLayersPendingRemoval; - bool mTraversalNeededMainThread = false; + bool mForceTraversal = false; // global color transform states Daltonizer mDaltonizer; |