EventThread: wake for two frames after vsync request by default
The common case seems to be that many frames are rendered in a row
before the system quiesces, but EventThread assumes that only a single
frame will be rendered after a call to requestNextVsync. This patch
moves requestNextVsync to wake for two frames by default, allowing it to
skip the EventThread wakeup when there's a pending wakeup for that
EventThread already.
Test: no EventThread wakeups from requestNextVsync in BouncyBall
bug: 169368457
Change-Id: I5cb880dad27062e158de640540a73cba59b223e5
diff --git a/services/surfaceflinger/Scheduler/EventThread.h b/services/surfaceflinger/Scheduler/EventThread.h
index 80bd606..e42ca05 100644
--- a/services/surfaceflinger/Scheduler/EventThread.h
+++ b/services/surfaceflinger/Scheduler/EventThread.h
@@ -50,8 +50,11 @@
using ResyncCallback = std::function<void()>;
enum class VSyncRequest {
- None = -1,
- Single = 0,
+ None = -2,
+ // Single wakes up for the next two frames to avoid scheduler overhead
+ Single = -1,
+ // SingleSuppressCallback only wakes up for the next frame
+ SingleSuppressCallback = 0,
Periodic = 1,
// Subsequent values are periods.
};