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.
This commit is contained in:
Simon Ser 2022-03-19 13:58:16 +01:00 committed by Kirill Primak
parent 8b0d4947cc
commit 7b7562eb65

View File

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