aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-01-30 14:20:36 +0100
committerSimon Ser <contact@emersion.fr>2023-02-02 17:24:37 +0000
commit2e49fa1a0aa9af87a1f8152d5518e99a7ec32dbb (patch)
treeea7d476a3e5f394b971478d33b4b86019b4262b8
parent92eedb84c153474024878a9780c83967f5bc63e6 (diff)
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.
-rw-r--r--backend/wayland/output.c11
1 files 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);