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>