diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2013-04-05 23:07:11 +0200 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2013-04-08 14:24:03 -0400 |
commit | e5a1225bc436f86b5241152bb332014d64f5b446 (patch) | |
tree | 53ba499a646ba92e4e36ef3266c01c4f3c60c1bc /src/compositor-fbdev.c | |
parent | b76237e508d7440ce3f210b03d03f09723506436 (diff) |
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>
Diffstat (limited to 'src/compositor-fbdev.c')
-rw-r--r-- | src/compositor-fbdev.c | 18 |
1 files changed, 13 insertions, 5 deletions
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 @@ to_fbdev_compositor(struct weston_compositor *base) } 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 @@ static int 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 @@ fbdev_output_create(struct fbdev_compositor *compositor, 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; |