From 24fde77c620f7fceb62da17163ab71ea3921d373 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 26 Apr 2021 19:48:35 +0200 Subject: buffer: add format param to get_data_ptr Allow wlr_buffer_impl.get_data_ptr to return a format. This allows the Pixman renderer to not care about get_dmabuf/get_shm, and only care about get_data_ptr. This will also help with [1], because client wl_shm buffers can't implement get_shm. [1]: https://github.com/swaywm/wlroots/pull/2892 References: https://github.com/swaywm/wlroots/issues/2864 --- render/shm_allocator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'render/shm_allocator.c') diff --git a/render/shm_allocator.c b/render/shm_allocator.c index 3bfb62e5..8da7bea6 100644 --- a/render/shm_allocator.c +++ b/render/shm_allocator.c @@ -31,9 +31,10 @@ static bool buffer_get_shm(struct wlr_buffer *wlr_buffer, } static bool buffer_get_data_ptr(struct wlr_buffer *wlr_buffer, void **data, - size_t *stride) { + uint32_t *format, size_t *stride) { struct wlr_shm_buffer *buffer = shm_buffer_from_buffer(wlr_buffer); *data = buffer->data; + *format = buffer->shm.format; *stride = buffer->shm.stride; return true; } -- cgit v1.2.3