buffer: use wlr_texture_from_buffer for DMA-BUFs

This commit is contained in:
Simon Ser 2021-04-12 18:39:03 +02:00
parent f6ba26ff58
commit 68758e8c21

View file

@ -5,6 +5,7 @@
#include <wlr/types/wlr_linux_dmabuf_v1.h> #include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "render/pixel_format.h" #include "render/pixel_format.h"
#include "render/wlr_texture.h"
#include "types/wlr_buffer.h" #include "types/wlr_buffer.h"
#include "util/signal.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)) { } else if (wlr_dmabuf_v1_resource_is_buffer(resource)) {
struct wlr_dmabuf_v1_buffer *dmabuf = struct wlr_dmabuf_v1_buffer *dmabuf =
wlr_dmabuf_v1_buffer_from_buffer_resource(resource); 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 // The renderer is responsible for releasing the buffer when
// re-using the same DMA-BUF for the next frames, so we don't release // appropriate
// the buffer yet. resource_released = true;
} else { } else {
wlr_log(WLR_ERROR, "Cannot upload texture: unknown buffer type"); wlr_log(WLR_ERROR, "Cannot upload texture: unknown buffer type");