[PATCH weston] main: report presentation clock resolution

Pekka Paalanen ppaalanen at gmail.com
Mon Jun 13 11:34:17 UTC 2016


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

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 at collabora.co.uk>
---
 src/main.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/main.c b/src/main.c
index 193a845..28f6969 100644
--- a/src/main.c
+++ b/src/main.c
@@ -647,6 +647,7 @@ weston_compositor_log_capabilities(struct weston_compositor *compositor)
 {
 	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_compositor_log_capabilities(struct weston_compositor *compositor)
 	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
-- 
2.7.3



More information about the wayland-devel mailing list