SF: Simplify setTransactionFlags
Merge overloads and remove unused return value.
Bug: 185535769
Test: Build
Change-Id: If2fe712614181e82bbe219775745a1ee7af2e210
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 1b8d0d5..cfe520e 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3676,16 +3676,13 @@
return mTransactionFlags.fetch_and(~mask) & mask;
}
-uint32_t SurfaceFlinger::setTransactionFlags(uint32_t mask) {
- return setTransactionFlags(mask, TransactionSchedule::Late);
-}
-
-uint32_t SurfaceFlinger::setTransactionFlags(uint32_t mask, TransactionSchedule schedule,
- const sp<IBinder>& applyToken) {
- const uint32_t old = mTransactionFlags.fetch_or(mask);
+void SurfaceFlinger::setTransactionFlags(uint32_t mask, TransactionSchedule schedule,
+ const sp<IBinder>& applyToken) {
modulateVsync(&VsyncModulator::setTransactionSchedule, schedule, applyToken);
- if ((old & mask) == 0) scheduleCommit(FrameHint::kActive);
- return old;
+
+ if (const bool scheduled = mTransactionFlags.fetch_or(mask) & mask; !scheduled) {
+ scheduleCommit(FrameHint::kActive);
+ }
}
bool SurfaceFlinger::stopTransactionProcessing(
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 55d0358..335a6fe 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -779,21 +779,15 @@
uint32_t getTransactionFlags() const;
- // Sets the masked bits, and returns the old flags.
- uint32_t setTransactionFlags(uint32_t mask);
+ // Sets the masked bits, and schedules a commit if needed.
+ void setTransactionFlags(uint32_t mask, TransactionSchedule = TransactionSchedule::Late,
+ const sp<IBinder>& applyToken = nullptr);
// Clears and returns the masked bits.
uint32_t clearTransactionFlags(uint32_t mask);
- // 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 or another layer update to wake us up.
- void setTraversalNeeded();
- uint32_t setTransactionFlags(uint32_t mask, TransactionSchedule,
- const sp<IBinder>& applyToken = {});
void commitOffscreenLayers();
+
enum class TransactionReadiness {
NotReady,
NotReadyBarrier,