Make backends always specify output repaint time
Most backends relies on gettimeofday(2) for output repaint timestamps
but this is not a requirement. Before this patch repaints coming from
idle_repaint() always used gettimeofday(2) for timestamps. For backends
not using that time source this could cause large jumps between
timestamps.
To fix this, timestamps needs to always come from the backend. This
means that the backend needs to always be responsible of starting the
repaint loop in case that the repaint cannot start immediately.
The drm backend implementation is from the patch by Ander Conselvan de
Oliveira found here:
http://lists.freedesktop.org/archives/wayland-devel/2013-February/007393.html
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
index 61cacc7..9d9eff5 100644
--- a/src/compositor-fbdev.c
+++ b/src/compositor-fbdev.c
@@ -123,6 +123,17 @@
}
static void
+fbdev_output_start_repaint_loop(struct weston_output *output)
+{
+ uint32_t msec;
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+ msec = tv.tv_sec * 1000 + tv.tv_usec / 1000;
+ weston_output_finish_frame(output, msec);
+}
+
+static void
fbdev_output_repaint(struct weston_output *base, pixman_region32_t *damage)
{
struct fbdev_output *output = to_fbdev_output(base);
@@ -200,12 +211,8 @@
finish_frame_handler(void *data)
{
struct fbdev_output *output = data;
- uint32_t msec;
- struct timeval tv;
- gettimeofday(&tv, NULL);
- msec = tv.tv_sec * 1000 + tv.tv_usec / 1000;
- weston_output_finish_frame(&output->base, msec);
+ fbdev_output_start_repaint_loop(&output->base);
return 1;
}
@@ -504,6 +511,7 @@
goto out_free;
}
+ output->base.start_repaint_loop = fbdev_output_start_repaint_loop;
output->base.repaint = fbdev_output_repaint;
output->base.destroy = fbdev_output_destroy;
output->base.assign_planes = NULL;