From b7fb70630a206a92dfb7ffec09ccee41b0e2d9a7 Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Tue, 19 Sep 2023 11:37:37 +0200 Subject: [PATCH] backend-x11: Use weston_output_finish_frame_from_timer() Replace the finish frame handler logic with a call to the weston_output_finish_frame_from_timer() helper function that does the same. Signed-off-by: Philipp Zabel --- libweston/backend-x11/x11.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/libweston/backend-x11/x11.c b/libweston/backend-x11/x11.c index 0da5c019..e1b95e71 100644 --- a/libweston/backend-x11/x11.c +++ b/libweston/backend-x11/x11.c @@ -542,23 +542,8 @@ static int finish_frame_handler(void *data) { struct x11_output *output = data; - int refresh_nsec = millihz_to_nsec(output->base.current_mode->refresh); - struct timespec now, ts; - int delta; - /* The timer only has msec precision, but if we approximately hit our - * target, report an exact time stamp by adding to the previous frame - * time. - */ - timespec_add_nsec(&ts, &output->base.frame_time, refresh_nsec); - - /* If we are more than 1.5 ms late, report the current time instead. */ - weston_compositor_read_presentation_clock(output->base.compositor, &now); - delta = (int)timespec_sub_to_nsec(&now, &ts); - if (delta > 1500000) - ts = now; - - weston_output_finish_frame(&output->base, &ts, 0); + weston_output_finish_frame_from_timer(&output->base); return 1; }