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
This commit is contained in:
Simon Ser 2021-04-26 19:48:35 +02:00
parent ccbce0f0a6
commit 24fde77c62
5 changed files with 12 additions and 20 deletions

View file

@ -67,11 +67,11 @@ bool wlr_buffer_get_dmabuf(struct wlr_buffer *buffer,
}
bool buffer_get_data_ptr(struct wlr_buffer *buffer, void **data,
size_t *size) {
uint32_t *format, size_t *stride) {
if (!buffer->impl->get_data_ptr) {
return false;
}
return buffer->impl->get_data_ptr(buffer, data, size);
return buffer->impl->get_data_ptr(buffer, data, format, stride);
}
bool wlr_buffer_get_shm(struct wlr_buffer *buffer,