diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/types/wlr_buffer.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/types/wlr_buffer.h b/include/types/wlr_buffer.h index 8abb68d6..85a8d8b4 100644 --- a/include/types/wlr_buffer.h +++ b/include/types/wlr_buffer.h @@ -26,6 +26,34 @@ struct wlr_shm_client_buffer *shm_client_buffer_create( struct wl_resource *resource); /** + * A read-only buffer that holds a data pointer. + * + * This is suitable for passing raw pixel data to a function that accepts a + * wlr_buffer. + */ +struct wlr_readonly_data_buffer { + struct wlr_buffer base; + + const void *data; + uint32_t format; + size_t stride; + + void *saved_data; +}; + +/** + * Wraps a read-only data pointer into a wlr_buffer. The data pointer may be + * accessed until readonly_data_buffer_drop() is called. + */ +struct wlr_readonly_data_buffer *readonly_data_buffer_create(uint32_t format, + size_t stride, uint32_t width, uint32_t height, const void *data); +/** + * Drops ownership of the buffer (see wlr_buffer_drop() for more details) and + * perform a copy of the data pointer if a consumer still has the buffer locked. + */ +bool readonly_data_buffer_drop(struct wlr_readonly_data_buffer *buffer); + +/** * Buffer capabilities. * * These bits indicate the features supported by a wlr_buffer. There is one bit |