Merge "Do not set eTraversalNeeded w/out wake up" into rvc-dev am: 4f6205d3cc am: 5a33a8a399 am: 3cc5626673 am: db5b2c6058
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/11887945
Change-Id: I46ee23019dc91f6a64666d532e2ef3a1fc4f3d71
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 6fc9fe2..f36b67d 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -866,13 +866,12 @@
}
// 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 11ee41b..d46f80f 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2748,7 +2748,8 @@
* (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;
@@ -2761,7 +2762,6 @@
mInputInfoChanged = true;
}
});
- mTraversalNeededMainThread = false;
}
/*
@@ -3237,8 +3237,8 @@
return old;
}
-uint32_t SurfaceFlinger::setTransactionFlagsNoWake(uint32_t flags) {
- return mTransactionFlags.fetch_or(flags);
+void SurfaceFlinger::setTraversalNeeded() {
+ mForceTraversal = true;
}
bool SurfaceFlinger::flushTransactionQueues() {
@@ -3438,7 +3438,7 @@
// 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 0785dda..8d3211b 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -627,12 +627,12 @@
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();
@@ -998,7 +998,7 @@
bool mTransactionPending = false;
bool mAnimTransactionPending = false;
SortedVector<sp<Layer>> mLayersPendingRemoval;
- bool mTraversalNeededMainThread = false;
+ bool mForceTraversal = false;
// global color transform states
Daltonizer mDaltonizer;