SF: add a work duration slack when missing a frame
When missing a frame, SF usually ends up waiting 1ms for the
previous fence to fire. This causes sometimes skipping the next frame
as the work duration with the 1ms pushes the vsync one more frame.
Bug: 354007767
Flag: com.android.graphics.surfaceflinger.flags.allow_n_vsyncs_in_targeter
Test: SF unit tests
Change-Id: Ia4e2791c420c17bcbe123bd61cc569695702a40c
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index b17fd49..7263aaa 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -273,7 +273,7 @@
enum class FrameHint { kNone, kActive };
// Schedule commit of transactions on the main thread ahead of the next VSYNC.
- void scheduleCommit(FrameHint);
+ void scheduleCommit(FrameHint, Duration workDurationSlack = Duration::fromNs(0));
// As above, but also force composite regardless if transactions were committed.
void scheduleComposite(FrameHint);
// As above, but also force dirty geometry to repaint.