From 7b7562eb658f180ddb8c712803d8c646613a86c3 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 19 Mar 2022 13:58:16 +0100 Subject: [PATCH] backend/headless: allow variable refresh rate Instead of waking up each 16ms to emit a frame event, arm the timer when the output is committed. This allows the headless backend to idle when nothing changes on screen, and behaves similarly to the other backends. --- backend/headless/output.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/headless/output.c b/backend/headless/output.c index f03d6ee0d..10de845f3 100644 --- a/backend/headless/output.c +++ b/backend/headless/output.c @@ -70,6 +70,8 @@ static bool output_commit(struct wlr_output *wlr_output) { wlr_output_send_present(wlr_output, &present_event); } + wl_event_source_timer_update(output->frame_timer, output->frame_delay); + return true; } @@ -93,7 +95,6 @@ bool wlr_output_is_headless(struct wlr_output *wlr_output) { static int signal_frame(void *data) { struct wlr_headless_output *output = data; wlr_output_send_frame(&output->wlr_output); - wl_event_source_timer_update(output->frame_timer, output->frame_delay); return 0; }