output: trigger frame/present events on all commits on enabled output

Up until now, frame/present events were only triggered when the
user submitted a buffer. Change the wlr_output API so that these
events are triggered when any commit is applied on an enabled
output.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3708
This commit is contained in:
Simon Ser 2023-08-14 19:39:33 +02:00 committed by Alexander Orzechowski
parent 462f04db9e
commit e5fc8cd4c7
7 changed files with 24 additions and 9 deletions

View file

@ -319,7 +319,7 @@ static void output_apply_state(struct wlr_output *output,
output->cursor_swapchain = NULL;
}
if (state->committed & WLR_OUTPUT_STATE_BUFFER) {
if (output_pending_enabled(output, state)) {
output->frame_pending = true;
output->needs_frame = false;
}
@ -592,6 +592,14 @@ void output_pending_resolution(struct wlr_output *output,
}
}
bool output_pending_enabled(struct wlr_output *output,
const struct wlr_output_state *state) {
if (state->committed & WLR_OUTPUT_STATE_ENABLED) {
return state->enabled;
}
return output->enabled;
}
/**
* Compare a struct wlr_output_state with the current state of a struct
* wlr_output.