aboutsummaryrefslogtreecommitdiff
path: root/include/render/allocator/drm_dumb.h
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-08-25 09:33:19 +0200
committerSimon Zeni <simon@bl4ckb0ne.ca>2021-08-25 09:57:20 -0400
commit3ce2ea9e16fcd1bfab4ec9d5994fa721c5d58dcd (patch)
tree1bce6445158968c4d73cd73be30c141468dbc84c /include/render/allocator/drm_dumb.h
parentb37731cdbbef4dc52033c2d26b04d2329720fa07 (diff)
Move allocator stuff into new directory
Add render/allocator/ and include/render/allocator/ to hold everything allocator-related.
Diffstat (limited to 'include/render/allocator/drm_dumb.h')
-rw-r--r--include/render/allocator/drm_dumb.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/render/allocator/drm_dumb.h b/include/render/allocator/drm_dumb.h
new file mode 100644
index 00000000..7e37acfb
--- /dev/null
+++ b/include/render/allocator/drm_dumb.h
@@ -0,0 +1,37 @@
+#ifndef RENDER_ALLOCATOR_DRM_DUMB_H
+#define RENDER_ALLOCATOR_DRM_DUMB_H
+
+#include <wlr/render/dmabuf.h>
+#include <wlr/types/wlr_buffer.h>
+#include "render/allocator/allocator.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