From 0b9288ec0b8885ba0a76e54fc8949c563d39cabd Mon Sep 17 00:00:00 2001 From: Simon Zeni Date: Tue, 16 Feb 2021 20:22:28 -0500 Subject: buffer: introduce wlr_buffer_get_data_ptr The function has been place in an internal header for API stability reasons. --- include/types/wlr_buffer.h | 15 +++++++++++++++ include/wlr/types/wlr_buffer.h | 2 ++ 2 files changed, 17 insertions(+) create mode 100644 include/types/wlr_buffer.h (limited to 'include') diff --git a/include/types/wlr_buffer.h b/include/types/wlr_buffer.h new file mode 100644 index 00000000..8f62179a --- /dev/null +++ b/include/types/wlr_buffer.h @@ -0,0 +1,15 @@ +#ifndef TYPES_WLR_BUFFER +#define TYPES_WLR_BUFFER + +#include +/** + * Access a pointer to the allocated data from the underlying implementation, + * and its stride. + * + * The returned pointer should be pointing to a valid memory location for read + * and write operations. + */ +bool buffer_get_data_ptr(struct wlr_buffer *buffer, void **data, + size_t *stride); + +#endif diff --git a/include/wlr/types/wlr_buffer.h b/include/wlr/types/wlr_buffer.h index 84555899..59996fce 100644 --- a/include/wlr/types/wlr_buffer.h +++ b/include/wlr/types/wlr_buffer.h @@ -19,6 +19,8 @@ struct wlr_buffer_impl { void (*destroy)(struct wlr_buffer *buffer); bool (*get_dmabuf)(struct wlr_buffer *buffer, struct wlr_dmabuf_attributes *attribs); + bool (*get_data_ptr)(struct wlr_buffer *buffer, void **data, + size_t *stride); }; /** -- cgit v1.2.3