linux-dmabuf: Move the attributes part of linux_dmabuf_buffer into its own struct
This allows renderers to use that struct to create their own dmabufs,
in case they can’t import the one provided by the client directly but
know how to convert it into a format they can render.
Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D332
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
diff --git a/src/linux-dmabuf.h b/src/linux-dmabuf.h
index 162ff58..cd30f91 100644
--- a/src/linux-dmabuf.h
+++ b/src/linux-dmabuf.h
@@ -31,19 +31,23 @@
typedef void (*dmabuf_user_data_destroy_func)(
struct linux_dmabuf_buffer *buffer);
-struct linux_dmabuf_buffer {
- struct wl_resource *buffer_resource;
- struct wl_resource *params_resource;
- struct weston_compositor *compositor;
+struct dmabuf_attributes {
int32_t width;
int32_t height;
uint32_t format;
uint32_t flags; /* enum zlinux_buffer_params_flags */
int n_planes;
- int dmabuf_fd[MAX_DMABUF_PLANES];
+ int fd[MAX_DMABUF_PLANES];
uint32_t offset[MAX_DMABUF_PLANES];
uint32_t stride[MAX_DMABUF_PLANES];
uint64_t modifier[MAX_DMABUF_PLANES];
+};
+
+struct linux_dmabuf_buffer {
+ struct wl_resource *buffer_resource;
+ struct wl_resource *params_resource;
+ struct weston_compositor *compositor;
+ struct dmabuf_attributes attributes;
void *user_data;
dmabuf_user_data_destroy_func user_data_destroy_func;