From c6b009ef85fce07f490378e63ac8f3d17b5db92f Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 9 Feb 2021 20:57:47 +0100 Subject: render: introduce shared memory allocator It allocates in local main memory via shm_open, and provides a FD to allow sharing with other processes. This is suitable for software rendering under the Wayland and X11 backends. --- include/render/shm_allocator.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 include/render/shm_allocator.h (limited to 'include/render') diff --git a/include/render/shm_allocator.h b/include/render/shm_allocator.h new file mode 100644 index 00000000..e6cba83b --- /dev/null +++ b/include/render/shm_allocator.h @@ -0,0 +1,23 @@ +#ifndef RENDER_SHM_ALLOCATOR_H +#define RENDER_SHM_ALLOCATOR_H + +#include +#include "render/allocator.h" + +struct wlr_shm_buffer { + struct wlr_buffer base; + struct wlr_shm_attributes shm; + void *data; + size_t size; +}; + +struct wlr_shm_allocator { + struct wlr_allocator base; +}; + +/** + * Creates a new shared memory allocator. + */ +struct wlr_shm_allocator *wlr_shm_allocator_create(void); + +#endif -- cgit v1.2.3