From 68758e8c2138a06bbb6edca94cdfae1be8bc3c57 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 12 Apr 2021 18:39:03 +0200 Subject: [PATCH] buffer: use wlr_texture_from_buffer for DMA-BUFs --- types/wlr_buffer.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/types/wlr_buffer.c b/types/wlr_buffer.c index 8ae5e839..10ed7295 100644 --- a/types/wlr_buffer.c +++ b/types/wlr_buffer.c @@ -5,6 +5,7 @@ #include #include #include "render/pixel_format.h" +#include "render/wlr_texture.h" #include "types/wlr_buffer.h" #include "util/signal.h" @@ -220,11 +221,11 @@ struct wlr_client_buffer *wlr_client_buffer_import( } else if (wlr_dmabuf_v1_resource_is_buffer(resource)) { struct wlr_dmabuf_v1_buffer *dmabuf = wlr_dmabuf_v1_buffer_from_buffer_resource(resource); - texture = wlr_texture_from_dmabuf(renderer, &dmabuf->attributes); + texture = wlr_texture_from_buffer(renderer, &dmabuf->base); - // We have imported the DMA-BUF, but we need to prevent the client from - // re-using the same DMA-BUF for the next frames, so we don't release - // the buffer yet. + // The renderer is responsible for releasing the buffer when + // appropriate + resource_released = true; } else { wlr_log(WLR_ERROR, "Cannot upload texture: unknown buffer type");