buffer: replace get_data_ptr with {begin,end}_data_ptr_access

This new API allows buffer implementations to know when a user is
actively accessing the buffer's underlying storage. This is
important for the upcoming client-backed wlr_buffer implementation.
This commit is contained in:
Simon Ser 2021-06-02 17:02:28 +02:00 committed by Simon Zeni
parent 9e58301df7
commit 38ba5881a0
7 changed files with 79 additions and 18 deletions

View file

@ -16,13 +16,16 @@ enum wlr_buffer_cap {
};
/**
* Access a pointer to the allocated data from the underlying implementation,
* its format and its stride.
* 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 location for read
* and write operations.
* The returned pointer should be pointing to a valid memory region for read
* and write operations. The returned pointer is only valid up to the next
* buffer_end_data_ptr_access call.
*/
bool buffer_get_data_ptr(struct wlr_buffer *buffer, void **data,
bool buffer_begin_data_ptr_access(struct wlr_buffer *buffer, void **data,
uint32_t *format, size_t *stride);
void buffer_end_data_ptr_access(struct wlr_buffer *buffer);
#endif