diff options
author | Simon Ser <contact@emersion.fr> | 2021-05-31 20:16:32 +0200 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-05-31 15:50:13 -0400 |
commit | 766a24fa7791d115fa36aded57d7cde87b20d4da (patch) | |
tree | a6d86ae0bf50772ed03746fcd6b90c97947d8807 /render/drm_dumb_allocator.c | |
parent | 5c30cf3d9441f7121acadd834ac610bff610eca1 (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/drm_dumb_allocator.c')
-rw-r--r-- | render/drm_dumb_allocator.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/render/drm_dumb_allocator.c b/render/drm_dumb_allocator.c index c0605593..9e14e38e 100644 --- a/render/drm_dumb_allocator.c +++ b/render/drm_dumb_allocator.c @@ -15,6 +15,7 @@ #include "render/drm_dumb_allocator.h" #include "render/pixel_format.h" +#include "types/wlr_buffer.h" static const struct wlr_buffer_impl buffer_impl; @@ -127,7 +128,7 @@ create_err: return NULL; } -static bool buffer_get_data_ptr(struct wlr_buffer *wlr_buffer, void **data, +static bool drm_dumb_buffer_get_data_ptr(struct wlr_buffer *wlr_buffer, void **data, uint32_t *format, size_t *stride) { struct wlr_drm_dumb_buffer *buf = drm_dumb_buffer_from_buffer(wlr_buffer); *data = buf->data; @@ -152,7 +153,7 @@ static void buffer_destroy(struct wlr_buffer *wlr_buffer) { static const struct wlr_buffer_impl buffer_impl = { .destroy = buffer_destroy, .get_dmabuf = buffer_get_dmabuf, - .get_data_ptr = buffer_get_data_ptr, + .get_data_ptr = drm_dumb_buffer_get_data_ptr, }; static const struct wlr_allocator_interface allocator_impl; @@ -231,7 +232,8 @@ struct wlr_allocator *wlr_drm_dumb_allocator_create(int fd) { free(path); return NULL; } - wlr_allocator_init(&alloc->base, &allocator_impl); + wlr_allocator_init(&alloc->base, &allocator_impl, + WLR_BUFFER_CAP_DATA_PTR | WLR_BUFFER_CAP_DMABUF); alloc->drm_fd = drm_fd; wl_list_init(&alloc->buffers); |