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-rdp.c b/src/compositor-rdp.c
index 2caaa57..80f8b15 100644
--- a/src/compositor-rdp.c
+++ b/src/compositor-rdp.c
@@ -265,6 +265,16 @@
}
}
+static void
+rdp_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
rdp_output_repaint(struct weston_output *output_base, pixman_region32_t *damage)
@@ -302,13 +312,7 @@
static int
finish_frame_handler(void *data)
{
- struct weston_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, msec);
+ rdp_output_start_repaint_loop(data);
return 1;
}
@@ -461,6 +465,7 @@
output->finish_frame_timer = wl_event_loop_add_timer(loop, finish_frame_handler, output);
output->base.origin = output->base.current;
+ output->base.start_repaint_loop = rdp_output_start_repaint_loop;
output->base.repaint = rdp_output_repaint;
output->base.destroy = rdp_output_destroy;
output->base.assign_planes = NULL;