From f36a0c2cb88a85bf8e0958fb4ca23b6e2d6d85c4 Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Mon, 27 Jan 2025 12:05:35 +0100 Subject: [PATCH] backend-headless: use weston_output_arm_frame_timer() headless_output_repaint() is not actually called immediately after weston_output_finish_frame(): Weston waits for "frame-duration - repaint-window" but at least one millisecond. And renderning can also take an arbitrary amount of time. So use weston_output_arm_frame_timer() like all other timer based backends. It takes all of this into account and calculates the delay relative to the next expected vblank time. Signed-off-by: Michael Olbrich --- libweston/backend-headless/headless.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libweston/backend-headless/headless.c b/libweston/backend-headless/headless.c index 8b7d7206c..62dbf63b6 100644 --- a/libweston/backend-headless/headless.c +++ b/libweston/backend-headless/headless.c @@ -161,7 +161,6 @@ headless_output_repaint(struct weston_output *output_base) struct headless_output *output = to_headless_output(output_base); struct weston_compositor *ec; pixman_region32_t damage; - int delay_msec; assert(output); @@ -178,8 +177,7 @@ headless_output_repaint(struct weston_output *output_base) pixman_region32_fini(&damage); - delay_msec = millihz_to_nsec(output->mode.refresh) / 1000000; - wl_event_source_timer_update(output->finish_frame_timer, delay_msec); + weston_output_arm_frame_timer(output_base, output->finish_frame_timer); return 0; }