output: allocate swapchain on first commit

On first commit, require a new buffer if the compositor called a
mode-setting function, even if the mode won't change. This makes it
so the swapchain is created now.

Stop trying to check whether the backend supports buffer-less modesets
because that makes everything more complicated. For instance, the
DRM backend doesn't need a new buffer if the previous DRM master left
the output enabled.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3499
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3502
This commit is contained in:
Simon Ser 2022-10-07 13:51:01 +02:00 committed by Kenny Levinsen
parent e92b272616
commit 3be6658ee7

View file

@ -209,13 +209,13 @@ bool output_ensure_buffer(struct wlr_output *output,
if (state->committed & WLR_OUTPUT_STATE_RENDER_FORMAT) {
needs_new_buffer = true;
}
if (!needs_new_buffer) {
return true;
if (state->allow_artifacts && output->commit_seq == 0) {
// On first commit, require a new buffer if the compositor called a
// mode-setting function, even if the mode won't change. This makes it
// so the swapchain is created now.
needs_new_buffer = true;
}
// If the backend doesn't necessarily need a new buffer on modeset, don't
// bother allocating one.
if (!output->impl->test || output->impl->test(output, state)) {
if (!needs_new_buffer) {
return true;
}