summaryrefslogtreecommitdiff
path: root/src/compositor-fbdev.c
diff options
context:
space:
mode:
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-09-23 22:08:45 -0400
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-09-30 11:37:02 +0300
commitb5eedade367098c61e656c1c5b795760da60b978 (patch)
tree056a84a901b01f6c028c029f8826cae6ec4b2ee7 /src/compositor-fbdev.c
parent93a6afdf6ed88a1ee2965a3de56a49ec152087ce (diff)
downloadweston-b5eedade367098c61e656c1c5b795760da60b978.tar.gz
compositor: set and use the presentation clock everywhere
Add presentation clock setters that verify the given clock actually works. Offer an automatic choice of a software fallback clock, when a backend has to always use clock_gettime() to approximate the presentation time. The DRM backend already queried the DRM about the clock id, just let the DRM backend set the presentation clock from that. For all other backends which do not get a timestamp from the driver, call the software clock setter to choose a suitable clock. Report the chosen clock via presentation.clock_id event to clients. In finish_frame(), upgrade the argument from uint32_t milliseconds to struct timespec which can accurately hold the presentation clock values. This will be needed when weston_output_finish_frame() starts to send out presentation_feedback.presented events. While at it, replace gettimeofday() calls with clock_gettime() using the chosen presentation clock, so we manufacture presentation timestamps from the presentation clock when the gfx drivers cannot give us a proper timestamp. Rpi patch is more verbose due to not having the compositor pointer available in rpi_flippipe_update_complete(). Explicitly carry the clock id with flippipe so it is available in the thread. Changes in v4: * rpi debug build fix v4 Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> v3 Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Diffstat (limited to 'src/compositor-fbdev.c')
-rw-r--r--src/compositor-fbdev.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
index e703e0ec..138aaab5 100644
--- a/src/compositor-fbdev.c
+++ b/src/compositor-fbdev.c
@@ -114,12 +114,10 @@ to_fbdev_compositor(struct weston_compositor *base)
static void
fbdev_output_start_repaint_loop(struct weston_output *output)
{
- uint32_t msec;
- struct timeval tv;
+ struct timespec ts;
- gettimeofday(&tv, NULL);
- msec = tv.tv_sec * 1000 + tv.tv_usec / 1000;
- weston_output_finish_frame(output, msec);
+ clock_gettime(output->compositor->presentation_clock, &ts);
+ weston_output_finish_frame(output, &ts);
}
static void
@@ -883,6 +881,10 @@ fbdev_compositor_create(struct wl_display *display, int *argc, char *argv[],
config) < 0)
goto out_free;
+ if (weston_compositor_set_presentation_clock_software(
+ &compositor->base) < 0)
+ goto out_compositor;
+
compositor->udev = udev_new();
if (compositor->udev == NULL) {
weston_log("Failed to initialize udev context.\n");