aboutsummaryrefslogtreecommitdiff
path: root/render/shm_allocator.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-05-31 20:16:32 +0200
committerSimon Zeni <simon@bl4ckb0ne.ca>2021-05-31 15:50:13 -0400
commit766a24fa7791d115fa36aded57d7cde87b20d4da (patch)
treea6d86ae0bf50772ed03746fcd6b90c97947d8807 /render/shm_allocator.c
parent5c30cf3d9441f7121acadd834ac610bff610eca1 (diff)
render/allocator: add wlr_allocator.buffer_caps
This allows users to know the capabilities of the buffers that will be allocated. The buffer capability is important to know when negotiating buffer formats.
Diffstat (limited to 'render/shm_allocator.c')
-rw-r--r--render/shm_allocator.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/render/shm_allocator.c b/render/shm_allocator.c
index 16d0e5c9..e1a3d9e5 100644
--- a/render/shm_allocator.c
+++ b/render/shm_allocator.c
@@ -7,6 +7,7 @@
#include "render/pixel_format.h"
#include "render/shm_allocator.h"
#include "util/shm.h"
+#include "types/wlr_buffer.h"
static const struct wlr_buffer_impl buffer_impl;
@@ -30,7 +31,7 @@ static bool buffer_get_shm(struct wlr_buffer *wlr_buffer,
return true;
}
-static bool buffer_get_data_ptr(struct wlr_buffer *wlr_buffer, void **data,
+static bool shm_buffer_get_data_ptr(struct wlr_buffer *wlr_buffer, void **data,
uint32_t *format, size_t *stride) {
struct wlr_shm_buffer *buffer = shm_buffer_from_buffer(wlr_buffer);
*data = buffer->data;
@@ -42,7 +43,7 @@ static bool buffer_get_data_ptr(struct wlr_buffer *wlr_buffer, void **data,
static const struct wlr_buffer_impl buffer_impl = {
.destroy = buffer_destroy,
.get_shm = buffer_get_shm,
- .get_data_ptr = buffer_get_data_ptr,
+ .get_data_ptr = shm_buffer_get_data_ptr,
};
static struct wlr_buffer *allocator_create_buffer(
@@ -103,7 +104,8 @@ struct wlr_allocator *wlr_shm_allocator_create(void) {
if (allocator == NULL) {
return NULL;
}
- wlr_allocator_init(&allocator->base, &allocator_impl);
+ wlr_allocator_init(&allocator->base, &allocator_impl,
+ WLR_BUFFER_CAP_DATA_PTR | WLR_BUFFER_CAP_SHM);
wlr_log(WLR_DEBUG, "Created shm allocator");
return &allocator->base;