From 2e49fa1a0aa9af87a1f8152d5518e99a7ec32dbb Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 30 Jan 2023 14:20:36 +0100 Subject: [PATCH] backend/wayland: allow superseding a previous commit During a modeset, the core wlr_output logic will allocate a buffer with a new size and commit it. However if we still have a frame callback pending we'd refuse to perform the commit. This is inconsistent with the DRM backend, which performs a blocking modeset. This is visible when resizing the Wayland toplevel. The logs are filled with "Skipping buffer swap", and the wlr_damage_ring's bounds are not properly updated. Fix this by destroying the pending frame wl_callback. --- backend/wayland/output.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 1e96f03b..0a256890 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -43,7 +43,12 @@ static struct wlr_wl_output *get_wl_output_from_output( static void surface_frame_callback(void *data, struct wl_callback *cb, uint32_t time) { struct wlr_wl_output *output = data; - assert(output); + + if (cb == NULL) { + return; + } + + assert(output->frame_callback == cb); wl_callback_destroy(cb); output->frame_callback = NULL; @@ -300,10 +305,8 @@ static bool output_commit(struct wlr_output *wlr_output, } if (output->frame_callback != NULL) { - wlr_log(WLR_ERROR, "Skipping buffer swap"); - return false; + wl_callback_destroy(output->frame_callback); } - output->frame_callback = wl_surface_frame(output->surface); wl_callback_add_listener(output->frame_callback, &frame_listener, output);