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 <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2022-11-03 14:29:50 -05:00
parent f9b57c5234
commit a82cb25108
3 changed files with 10 additions and 9 deletions

View File

@ -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 {

View File

@ -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);
}
}

View File

@ -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