From d94d1bf0ea9d777a03429a20c544195402965d9b Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Sat, 27 Aug 2022 12:20:03 +0200 Subject: [PATCH] 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. --- types/output/render.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/types/output/render.c b/types/output/render.c index 2e38919a..eaacf8a0 100644 --- a/types/output/render.c +++ b/types/output/render.c @@ -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; }