linux-dmabuf-v1: split params and buffer

Previously, the same struct was used for linux-dmabuf-v1 params
and buffer. This made the whole logic a little bit awkward, because
a wlr_dmabuf_v1_buffer could either be still being constructed, or
be a complete buffer.

Introduce a separate wlr_linux_buffer_params_v1 struct for buffer
params still being constructed. Once the params are complete (ie.
once the create request is sent), the params struct is destroyed
and the buffer struct is created.

This will help with [1] as well.

[1]: https://github.com/swaywm/wlroots/issues/2664
This commit is contained in:
Simon Ser 2021-04-12 11:49:57 +02:00
parent f64ed60c7b
commit e8df7c367a
3 changed files with 111 additions and 131 deletions

View file

@ -14,11 +14,8 @@
#include <wlr/render/dmabuf.h>
struct wlr_dmabuf_v1_buffer {
struct wlr_renderer *renderer;
struct wl_resource *buffer_resource;
struct wl_resource *params_resource;
struct wl_resource *resource;
struct wlr_dmabuf_attributes attributes;
bool has_modifier;
};
/**
@ -34,6 +31,13 @@ bool wlr_dmabuf_v1_resource_is_buffer(struct wl_resource *buffer_resource);
struct wlr_dmabuf_v1_buffer *wlr_dmabuf_v1_buffer_from_buffer_resource(
struct wl_resource *buffer_resource);
struct wlr_linux_buffer_params_v1 {
struct wl_resource *resource;
struct wlr_linux_dmabuf_v1 *linux_dmabuf;
struct wlr_dmabuf_attributes attributes;
bool has_modifier;
};
/* the protocol interface */
struct wlr_linux_dmabuf_v1 {
struct wl_global *global;