summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Rob Carr <racarr@google.com> 2020-06-02 20:21:05 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-06-02 20:21:05 +0000
commitc43da98656bbf1944991b5d3fa415e2a8f2c966c (patch)
tree3d6041a0acef8e07db4ae9a52d6265a705e47e2a
parentab63fa0eb5722b30e4e3f0340f80b9662f6fc494 (diff)
parent7ec777d9452c236a546c5811ff31f5800ec7ef58 (diff)
Merge "DO NOT MERGE: SurfaceFlinger: Don't wake for pending transactions." into rvc-dev
-rw-r--r--services/surfaceflinger/Layer.cpp9
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp4
-rw-r--r--services/surfaceflinger/SurfaceFlinger.h6
3 files changed, 16 insertions, 3 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 5a4d9cd6b9..96552770c4 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -855,11 +855,14 @@ bool Layer::applyPendingStates(State* stateToCommit) {
}
}
- // If we still have pending updates, wake SurfaceFlinger back up and point
- // it at this layer so we can process them
+ // If we still have pending updates, we need to ensure SurfaceFlinger
+ // will keep calling doTransaction, and so we set the transaction flags.
+ // 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.
if (!mPendingStates.empty()) {
setTransactionFlags(eTransactionNeeded);
- mFlinger->setTransactionFlags(eTraversalNeeded);
+ mFlinger->setTransactionFlagsNoWake(eTraversalNeeded);
}
mCurrentState.modified = false;
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 83f49dd46b..2e2273594e 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3243,6 +3243,10 @@ uint32_t SurfaceFlinger::setTransactionFlags(uint32_t flags,
return old;
}
+uint32_t SurfaceFlinger::setTransactionFlagsNoWake(uint32_t flags) {
+ return mTransactionFlags.fetch_or(flags);
+}
+
bool SurfaceFlinger::flushTransactionQueues() {
// to prevent onHandleDestroyed from being called while the lock is held,
// we must keep a copy of the transactions (specifically the composer
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 4cfbdddc31..113b03557f 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -628,6 +628,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
+ // 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);
uint32_t setTransactionFlags(uint32_t flags, Scheduler::TransactionStart transactionStart);
void commitTransaction() REQUIRES(mStateLock);
void commitOffscreenLayers();