buffer: stop using resource in client_buffer_get_dmabuf

Instead, delegate to the source wlr_buffer.
This commit is contained in:
Simon Ser 2021-07-09 17:06:56 +02:00 committed by Simon Zeni
parent a0baba4fa0
commit d7c68ce632
1 changed files with 2 additions and 11 deletions

View File

@ -133,20 +133,11 @@ static bool client_buffer_get_dmabuf(struct wlr_buffer *buffer,
struct wlr_dmabuf_attributes *attribs) { struct wlr_dmabuf_attributes *attribs) {
struct wlr_client_buffer *client_buffer = client_buffer_from_buffer(buffer); struct wlr_client_buffer *client_buffer = client_buffer_from_buffer(buffer);
if (client_buffer->resource == NULL) { if (client_buffer->source == NULL) {
return false; return false;
} }
struct wl_resource *buffer_resource = client_buffer->resource; return wlr_buffer_get_dmabuf(client_buffer->source, attribs);
if (!wlr_dmabuf_v1_resource_is_buffer(buffer_resource)) {
return false;
}
struct wlr_dmabuf_v1_buffer *dmabuf_buffer =
wlr_dmabuf_v1_buffer_from_buffer_resource(buffer_resource);
memcpy(attribs, &dmabuf_buffer->attributes,
sizeof(struct wlr_dmabuf_attributes));
return true;
} }
static const struct wlr_buffer_impl client_buffer_impl = { static const struct wlr_buffer_impl client_buffer_impl = {