2021-02-17 02:22:28 +01:00
|
|
|
#ifndef TYPES_WLR_BUFFER
|
|
|
|
#define TYPES_WLR_BUFFER
|
|
|
|
|
|
|
|
#include <wlr/types/wlr_buffer.h>
|
2021-04-26 19:48:35 +02:00
|
|
|
|
2021-04-14 19:11:35 +02:00
|
|
|
struct wlr_shm_client_buffer {
|
|
|
|
struct wlr_buffer base;
|
|
|
|
|
|
|
|
uint32_t format;
|
|
|
|
size_t stride;
|
|
|
|
|
|
|
|
// The following fields are NULL if the client has destroyed the wl_buffer
|
|
|
|
struct wl_resource *resource;
|
|
|
|
struct wl_shm_buffer *shm_buffer;
|
|
|
|
|
|
|
|
// This is used to keep the backing storage alive after the client has
|
|
|
|
// destroyed the wl_buffer
|
|
|
|
struct wl_shm_pool *saved_shm_pool;
|
|
|
|
void *saved_data;
|
|
|
|
|
|
|
|
struct wl_listener resource_destroy;
|
|
|
|
struct wl_listener release;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wlr_shm_client_buffer *shm_client_buffer_create(
|
|
|
|
struct wl_resource *resource);
|
|
|
|
|
2021-04-28 16:01:49 +02:00
|
|
|
/**
|
|
|
|
* Buffer capabilities.
|
|
|
|
*
|
|
|
|
* These bits indicate the features supported by a wlr_buffer. There is one bit
|
|
|
|
* per function in wlr_buffer_impl.
|
|
|
|
*/
|
|
|
|
enum wlr_buffer_cap {
|
|
|
|
WLR_BUFFER_CAP_DATA_PTR = 1 << 0,
|
|
|
|
WLR_BUFFER_CAP_DMABUF = 1 << 1,
|
|
|
|
WLR_BUFFER_CAP_SHM = 1 << 2,
|
|
|
|
};
|
|
|
|
|
2021-02-17 02:22:28 +01:00
|
|
|
/**
|
2021-06-02 17:02:28 +02:00
|
|
|
* 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.
|
2021-02-17 02:22:28 +01:00
|
|
|
*
|
2021-06-02 17:02:28 +02:00
|
|
|
* 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.
|
2021-02-17 02:22:28 +01:00
|
|
|
*/
|
2021-06-02 17:02:28 +02:00
|
|
|
bool buffer_begin_data_ptr_access(struct wlr_buffer *buffer, void **data,
|
2021-04-26 19:48:35 +02:00
|
|
|
uint32_t *format, size_t *stride);
|
2021-06-02 17:02:28 +02:00
|
|
|
void buffer_end_data_ptr_access(struct wlr_buffer *buffer);
|
2021-02-17 02:22:28 +01:00
|
|
|
|
|
|
|
#endif
|