From d9f6498f8a29cb5820ae14f6b368a1a5b678449f Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Sun, 11 Feb 2024 10:38:59 +0300 Subject: [PATCH] backend/wayland: commit null buffer only on unmap If the guest compositor disabled an output and then immediately committed another state, we would perform a commit with a null buffer, which is against the protocol, as the host compositor expects an initial commit with no buffer at all. --- backend/wayland/output.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/wayland/output.c b/backend/wayland/output.c index a783abe5..238c1938 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -548,7 +548,9 @@ static bool output_commit(struct wlr_output *wlr_output, return false; } - if ((state->committed & WLR_OUTPUT_STATE_ENABLED) && !state->enabled) { + bool pending_enabled = output_pending_enabled(wlr_output, state); + + if (wlr_output->enabled && !pending_enabled) { wl_surface_attach(output->surface, NULL, 0, 0); wl_surface_commit(output->surface); } @@ -575,7 +577,7 @@ static bool output_commit(struct wlr_output *wlr_output, return false; } - if (output_pending_enabled(wlr_output, state)) { + if (pending_enabled) { if (output->frame_callback != NULL) { wl_callback_destroy(output->frame_callback); }