main: report presentation clock resolution
For debugging weird timing issues. If your clock resolution is
unexpectedly e.g. 10 ms, you can be sure you will have strange timing
issues. This is almost certainly caused by kernel misconfiguration.
We rely on clock_getres() being available by the same thing that gets us
clock_gettime(), so that no new configure.ac check is needed.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: David Fort <contact@hardening-consulting.com>
diff --git a/src/main.c b/src/main.c
index d022615..ec3d799 100644
--- a/src/main.c
+++ b/src/main.c
@@ -647,6 +647,7 @@
{
unsigned i;
int yes;
+ struct timespec res;
weston_log("Compositor capabilities:\n");
for (i = 0; i < ARRAY_LENGTH(capability_strings); i++) {
@@ -659,6 +660,14 @@
weston_log_continue(STAMP_SPACE "presentation clock: %s, id %d\n",
clock_name(compositor->presentation_clock),
compositor->presentation_clock);
+
+ if (clock_getres(compositor->presentation_clock, &res) == 0)
+ weston_log_continue(STAMP_SPACE
+ "presentation clock resolution: %d.%09ld s\n",
+ (int)res.tv_sec, res.tv_nsec);
+ else
+ weston_log_continue(STAMP_SPACE
+ "presentation clock resolution: N/A\n");
}
static void