output: clean up after modifierless test failure

If the first test in output_ensure_buffer() fails with modifiers we
replace the swapchain with a modifierless swapchain and try again.
However if that fails as well the output is currently stuck without
modifiers until the next modeset.

To fix this, destroy the modifierless swapchain if the test using it
fails. The next output_attach_back_buffer() call will create a swapchain
that allows modifiers when needed.
This commit is contained in:
Isaac Freund 2022-08-27 12:20:03 +02:00
parent fa7d2cb8d6
commit d94d1bf0ea
No known key found for this signature in database
GPG key ID: 86DED400DDFD7A11

View file

@ -240,7 +240,7 @@ bool output_ensure_buffer(struct wlr_output *output,
}
if (!output_attach_empty_back_buffer(output, state)) {
return false;
goto error_destroy_swapchain;
}
if (output_test_with_back_buffer(output, state)) {
@ -250,6 +250,13 @@ bool output_ensure_buffer(struct wlr_output *output,
output_clear_back_buffer(output);
error_destroy_swapchain:
// Destroy the modifierless swapchain so that the output does not get stuck
// without modifiers. A new swapchain with modifiers will be created when
// needed by output_attach_back_buffer().
wlr_swapchain_destroy(output->swapchain);
output->swapchain = NULL;
return false;
}