From 9579d62a160821a107763325a515d3aee0a1e158 Mon Sep 17 00:00:00 2001 From: Simon Zeni Date: Fri, 10 Sep 2021 13:25:42 -0400 Subject: types/buffer: make {begin,end}_data_ptr_access part of the public API --- include/wlr/types/wlr_buffer.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'include/wlr') diff --git a/include/wlr/types/wlr_buffer.h b/include/wlr/types/wlr_buffer.h index 6bf3c97b..60dbb5c3 100644 --- a/include/wlr/types/wlr_buffer.h +++ b/include/wlr/types/wlr_buffer.h @@ -137,6 +137,33 @@ void wlr_buffer_register_resource_interface( */ struct wlr_buffer *wlr_buffer_from_resource(struct wl_resource *resource); +/** + * Buffer data pointer access flags. + */ +enum wlr_buffer_data_ptr_access_flag { + /** + * The buffer contents can be read back. + */ + WLR_BUFFER_DATA_PTR_ACCESS_READ = 1 << 0, + /** + * The buffer contents can be written to. + */ + WLR_BUFFER_DATA_PTR_ACCESS_WRITE = 1 << 1, +}; + +/** + * Get a pointer to a region of memory referring to the buffer's underlying + * storage. The format and stride can be used to interpret the memory region + * contents. + * + * The returned pointer should be pointing to a valid memory region for the + * operations specified in the flags. The returned pointer is only valid up to + * the next buffer_end_data_ptr_access call. + */ +bool wlr_buffer_begin_data_ptr_access(struct wlr_buffer *buffer, uint32_t flags, + void **data, uint32_t *format, size_t *stride); +void wlr_buffer_end_data_ptr_access(struct wlr_buffer *buffer); + /** * A client buffer. */ -- cgit v1.2.3