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:
parent
1c606d0274
commit
d43f61ec76
4 changed files with 35 additions and 13 deletions
|
|
@ -14,16 +14,11 @@
|
|||
|
||||
#include "wayland.h"
|
||||
|
||||
static int commit_buffer_resize(struct ufkbd_wl_buffer *ctx);
|
||||
|
||||
static void on_buffer_release(void *data, struct wl_buffer *buf)
|
||||
{
|
||||
struct ufkbd_wl_buffer *ctx = data;
|
||||
|
||||
if (ctx->resize)
|
||||
commit_buffer_resize(ctx);
|
||||
|
||||
ctx->avail = true;
|
||||
ufkbd_wl_buffer_release(ctx);
|
||||
}
|
||||
|
||||
static const struct wl_buffer_listener buf_listener = {
|
||||
|
|
@ -140,6 +135,14 @@ int ufkbd_wl_buffer_resize(struct ufkbd_wl_buffer *ctx,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void ufkbd_wl_buffer_release(struct ufkbd_wl_buffer *ctx)
|
||||
{
|
||||
if (ctx->resize)
|
||||
commit_buffer_resize(ctx);
|
||||
|
||||
ctx->avail = true;
|
||||
}
|
||||
|
||||
int ufkbd_wl_buffer_init(struct ufkbd_wl_buffer *ctx,
|
||||
struct ufkbd_input_wayland *ufkbd_wl,
|
||||
unsigned int id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue