SF: do not latch unsignaled in early offsets
When we are in early offsets we are most likely in client composition
and/or WM animating windows. Avoid latching unsignaled buffers in this
case to avoid jank when an unsignaled buffers block newer transactions
from getting applied in the next frame.
Bug: 205153280
Test: modified TouchLatency app with long draws
Change-Id: Ice5456db1dec1feaf11f6e022a1eaaedfb26781f
diff --git a/services/surfaceflinger/Scheduler/VsyncModulator.cpp b/services/surfaceflinger/Scheduler/VsyncModulator.cpp
index 245db0f..be57b2a 100644
--- a/services/surfaceflinger/Scheduler/VsyncModulator.cpp
+++ b/services/surfaceflinger/Scheduler/VsyncModulator.cpp
@@ -134,16 +134,27 @@
return mVsyncConfig;
}
-const VsyncModulator::VsyncConfig& VsyncModulator::getNextVsyncConfig() const {
+auto VsyncModulator::getNextVsyncConfigType() const -> VsyncConfigType {
// Early offsets are used if we're in the middle of a refresh rate
// change, or if we recently begin a transaction.
if (!mEarlyWakeupRequests.empty() || mTransactionSchedule == Schedule::EarlyEnd ||
mEarlyTransactionFrames > 0 || mRefreshRateChangePending) {
- return mVsyncConfigSet.early;
+ return VsyncConfigType::Early;
} else if (mEarlyGpuFrames > 0) {
- return mVsyncConfigSet.earlyGpu;
+ return VsyncConfigType::EarlyGpu;
} else {
- return mVsyncConfigSet.late;
+ return VsyncConfigType::Late;
+ }
+}
+
+const VsyncModulator::VsyncConfig& VsyncModulator::getNextVsyncConfig() const {
+ switch (getNextVsyncConfigType()) {
+ case VsyncConfigType::Early:
+ return mVsyncConfigSet.early;
+ case VsyncConfigType::EarlyGpu:
+ return mVsyncConfigSet.earlyGpu;
+ case VsyncConfigType::Late:
+ return mVsyncConfigSet.late;
}
}
@@ -176,4 +187,9 @@
static_cast<void>(updateVsyncConfigLocked());
}
+bool VsyncModulator::isVsyncConfigDefault() const {
+ std::lock_guard<std::mutex> lock(mMutex);
+ return getNextVsyncConfigType() == VsyncConfigType::Late;
+}
+
} // namespace android::scheduler