compositor, backends: weston_compositor_read_presentation_clock
Create a new function weston_compositor_read_presentation_clock() to
wrap the clock_gettime() call for the Presentation clock.
Reading the presentation clock is never supposed to fail, but if it
does, this will notify about it. I have not seen it fail yet, though.
This prepares for new testing features in the future that might allow
controlling the presentation clock. Right now it is just a convenience
function for clock_gettime().
All presentation clock readers are converted to call this new function
except rpi-backend's rpi_flippipe_update_complete(), because it gets its
clock id via a thread-safe mechanism. There shouldn't be anything really
thread-unsafe in weston_compositor_read_presentation_clock() at the
moment, but might be in the future, and weston core is not expected to
need to be thread-safe.
This is based on the original patch by
Cc: Derek Foreman <derekf@osg.samsung.com>
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>
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index e9735c5..e89acb7 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -346,7 +346,7 @@
{
struct timespec ts;
- clock_gettime(output->compositor->presentation_clock, &ts);
+ weston_compositor_read_presentation_clock(output->compositor, &ts);
weston_output_finish_frame(output, &ts, PRESENTATION_FEEDBACK_INVALID);
}
@@ -458,7 +458,7 @@
struct x11_output *output = data;
struct timespec ts;
- clock_gettime(output->base.compositor->presentation_clock, &ts);
+ weston_compositor_read_presentation_clock(output->base.compositor, &ts);
weston_output_finish_frame(&output->base, &ts, 0);
return 1;