summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMario Kleiner <mario.kleiner.de@gmail.com>2015-06-21 21:25:15 +0200
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2015-07-16 14:16:26 +0300
commitb7df04ebc048e18417a13d577d977d6e36c8a8ca (patch)
tree7e4404fd0b696c4e030d935280ae6be3e9f01378 /src
parentf507ec3587b00057bf97d11b7e8e57d1972303d1 (diff)
compositor: Respect repaint-window when restarting repaint loop.
If a stopped repaint loop gets restarted due to posting of new damage, and this restart of the repaint loop happens late in the video refresh cycle, ie. already inside the repaint-window and thereby after the composition deadline for the current frame, then defer the actual output repaint to the composition deadline of the next video refresh cycle by setting the repaint timer accordingly. This tries to make sure that: a) Client(s) posting damage timely before the composition deadline (video refresh duration - "repaint-window" duration) of the current refresh cycle will trigger a repaint within the current refresh cycle, thereby avoiding one extra frame of compositor lag due to the needed restart of the repaint loop if the loop was stopped. This allows them to benefit from the earlier "instant repaint restart" commit to keep latency low. b) Late clients which post damage close to the end of a refresh cycle can't race other clients if the repaint loop is restarted. Instead they will get deferred to the next compositor cycle, just as if the repaint loop would have been already running - the semantic of the "repaint-window" parameter is preserved. This is especially important to prevent a very late client from triggering a repaint very close to the vblank, which would cause the compositor to certainly miss the vblank and skip one frame and then cause a delay of another frame for other clients which posted their damage in time for the following frame. Iow. this provides clients with a more predictable compositor timing and makes it easier for them to latch onto the compositors repaint cycle. Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/compositor.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/compositor.c b/src/compositor.c
index ea507e8c..acaa4336 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -2373,6 +2373,13 @@ weston_output_finish_frame(struct weston_output *output,
msec = 0;
}
+ /* Called from restart_repaint_loop and restart happens already after
+ * the deadline given by repaint_msec? In that case we delay until
+ * the deadline of the next frame, to give clients a more predictable
+ * timing of the repaint cycle to lock on. */
+ if (presented_flags == PRESENTATION_FEEDBACK_INVALID && msec < 0)
+ msec += refresh_nsec / 1000000;
+
if (msec < 1)
output_repaint_timer_handler(output);
else