wayland: release unused buffers after buffer swap

When the surface attaches to a buffer, all other buffers are available.
Export the function used to release a buffer, track the buffer used by
the surface, and release unused buffers when a new buffer is attached.
This commit is contained in:
Richard Acayan 2024-04-22 19:15:47 -04:00
parent 1c606d0274
commit d43f61ec76
4 changed files with 35 additions and 13 deletions

View file

@ -150,8 +150,6 @@ static int ufkbd_wayland_draw_begin(void *data, size_t *stride, void **ptr)
return ret;
}
wl_surface_attach(ctx->surface->wl, buf, 0, 0);
// NOPUSH
*stride = (size_t) ctx->surface->bufs[0].width * 4;
@ -170,6 +168,7 @@ static void ufkbd_wayland_draw_end(void *data)
struct ufkbd_input_wayland *ctx = data;
wl_surface_commit(ctx->surface->wl);
ufkbd_wl_surface_release_unused(ctx->surface);
}
static void *ufkbd_wayland_init(struct ufkbd_ctx *ufkbd)