aboutsummaryrefslogtreecommitdiff
path: root/include/render/drm_dumb_allocator.h
diff options
context:
space:
mode:
authorSimon Zeni <simon@bl4ckb0ne.ca>2021-01-27 22:10:59 -0500
committerSimon Ser <contact@emersion.fr>2021-05-05 10:40:21 +0200
commited7f2651b60e2d2e401041502656cd9f954a56cf (patch)
treee2b49fd5b3bba47d4a671a916bfb3f075d96e3f6 /include/render/drm_dumb_allocator.h
parent2c90e0f521b2bb57d00e5a374b0eff99f3a2d744 (diff)
render: add DRM dumb buffer allocator
Diffstat (limited to 'include/render/drm_dumb_allocator.h')
-rw-r--r--include/render/drm_dumb_allocator.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/render/drm_dumb_allocator.h b/include/render/drm_dumb_allocator.h
new file mode 100644
index 00000000..ff10d54b
--- /dev/null
+++ b/include/render/drm_dumb_allocator.h
@@ -0,0 +1,37 @@
+#ifndef RENDER_DRM_DUMB_ALLOCATOR_H
+#define RENDER_DRM_DUMB_ALLOCATOR_H
+
+#include "render/allocator.h"
+
+#include <wlr/types/wlr_buffer.h>
+
+struct wlr_drm_dumb_buffer {
+ struct wlr_buffer base;
+ struct wl_list link; // wlr_drm_dumb_allocator::buffers
+
+ int drm_fd; // -1 if the allocator has been destroyed
+ struct wlr_dmabuf_attributes dmabuf;
+
+ uint32_t format;
+ uint32_t handle;
+ uint32_t stride;
+ uint32_t width, height;
+
+ uint64_t size;
+ void *data;
+};
+
+struct wlr_drm_dumb_allocator {
+ struct wlr_allocator base;
+ struct wl_list buffers; // wlr_drm_dumb_buffer::link
+ int drm_fd;
+};
+
+/**
+ * Creates a new drm dumb allocator from a DRM FD.
+ *
+ * Does not take ownership over the FD.
+ */
+struct wlr_allocator *wlr_drm_dumb_allocator_create(int fd);
+
+#endif