From ed7f2651b60e2d2e401041502656cd9f954a56cf Mon Sep 17 00:00:00 2001 From: Simon Zeni Date: Wed, 27 Jan 2021 22:10:59 -0500 Subject: render: add DRM dumb buffer allocator --- include/render/drm_dumb_allocator.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 include/render/drm_dumb_allocator.h (limited to 'include/render') 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 + +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 -- cgit v1.2.3