compositor: add repaint delay timer
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Wed, 21 May 2014 13:17:27 +0000 (16:17 +0300)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Fri, 20 Mar 2015 10:19:29 +0000 (12:19 +0200)
commit0513a95a06b55921321e41588c19eb41c932032d
tree6c684d8df59d34b8e208c53021c2076cbdc5d521
parent662f384e6a184d6249b01de8437c9cd4027af069
compositor: add repaint delay timer

This timer delays the output_repaint towards the end of the refresh
period, reducing the time from repaint to present.

The length of the repaint window can be set in weston.ini.

The call to weston_output_schedule_repaint_reset() is delayed by one
more period.  If we exit the continuous repaint loop (set
output->repaint_scheduled to false) in finish_frame, we may call
start_repaint_loop() unnecessarily.  The problem case was actually
observed with two outputs on the DRM backend at 60 Hz, and 7 ms
repaint-window. During a window move, one output was constantly falling
off the continuous repaint loop and introducing additional one frame
latency, leading to jerky window motion. This code now avoids the
problem.

Changes in v2:

- Rename repaint_delay_timer to repaint_timer and
output_repaint_delay_handler to output_repaint_timer_handler.

- When computing the delay, take the current time into account. The timer
uses a relative timeout, so we have to subtract any time already gone.

Note, that 'gone' may also be negative. DRM has a habit of predicting
the page flip timestamp so it may be still in the future when we get the
completion event.

- Do also a sanity check 'msec > 1000'. In the unlikely case that
something fails to provide a good timestamp, never delay for more than
one second.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
man/weston.ini.man
src/compositor.c
src/compositor.h