From a82cb251087c345c6ff5b6a8619493cb838adb66 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 3 Nov 2022 14:29:50 -0500 Subject: [PATCH] libweston: Use paced logger for presentation clock read failure The current code only prints this once, and this is a probably a sensible thing to do, as a clock read failure is probably not a condition that will correct itself. Signed-off-by: Derek Foreman --- include/libweston/libweston.h | 2 ++ libweston/compositor.c | 15 +++++++-------- libweston/libweston-internal.h | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index e50b4971..92941ec0 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -1328,6 +1328,8 @@ struct weston_compositor { /* One-time warning about a view appearing in the layer list when it * or its surface are not mapped. */ bool warned_about_unmapped_surface_or_view; + + struct weston_log_pacer presentation_clock_failure_pacer; }; struct weston_solid_buffer_values { diff --git a/libweston/compositor.c b/libweston/compositor.c index b30bc29e..12b0f26b 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -8392,10 +8392,9 @@ weston_compositor_set_presentation_clock_software( */ WL_EXPORT void weston_compositor_read_presentation_clock( - const struct weston_compositor *compositor, + struct weston_compositor *compositor, struct timespec *ts) { - static bool warned; int ret; ret = clock_gettime(compositor->presentation_clock, ts); @@ -8403,12 +8402,12 @@ weston_compositor_read_presentation_clock( ts->tv_sec = 0; ts->tv_nsec = 0; - if (!warned) - weston_log("Error: failure to read " - "the presentation clock %#x: '%s' (%d)\n", - compositor->presentation_clock, - strerror(errno), errno); - warned = true; + weston_log_paced(&compositor->presentation_clock_failure_pacer, + 1, 0, + "Error: failure to read " + "the presentation clock %#x: '%s' (%d)\n", + compositor->presentation_clock, + strerror(errno), errno); } } diff --git a/libweston/libweston-internal.h b/libweston/libweston-internal.h index dbb764d4..d3515ecf 100644 --- a/libweston/libweston-internal.h +++ b/libweston/libweston-internal.h @@ -156,7 +156,7 @@ weston_compositor_print_scene_graph(struct weston_compositor *ec); void weston_compositor_read_presentation_clock( - const struct weston_compositor *compositor, + struct weston_compositor *compositor, struct timespec *ts); int