diff options
author | Simon Ser <contact@emersion.fr> | 2021-06-29 21:01:45 +0200 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-07-01 14:57:52 -0400 |
commit | 7ad44051a250d54c4f84fa222186eb9da10f6dd7 (patch) | |
tree | 8d94956ce07160ab9ff7f97422d9a2a1aad12110 /render | |
parent | 08e5b909f94a0f8661e1455575bacbad8c79ae77 (diff) |
render: use wlr_dmabuf_buffer in wlr_texture_from_dmabuf
Diffstat (limited to 'render')
-rw-r--r-- | render/wlr_texture.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/render/wlr_texture.c b/render/wlr_texture.c index 73c1d8f3..a54d6af1 100644 --- a/render/wlr_texture.c +++ b/render/wlr_texture.c @@ -55,10 +55,19 @@ struct wlr_texture *wlr_texture_from_wl_drm(struct wlr_renderer *renderer, struct wlr_texture *wlr_texture_from_dmabuf(struct wlr_renderer *renderer, struct wlr_dmabuf_attributes *attribs) { - if (!renderer->impl->texture_from_dmabuf) { + struct wlr_dmabuf_buffer *buffer = dmabuf_buffer_create(attribs); + if (buffer == NULL) { return NULL; } - return renderer->impl->texture_from_dmabuf(renderer, attribs); + + struct wlr_texture *texture = + wlr_texture_from_buffer(renderer, &buffer->base); + + // By this point, the renderer should have locked the buffer if it still + // needs to access it in the future. + dmabuf_buffer_drop(buffer); + + return texture; } struct wlr_texture *wlr_texture_from_buffer(struct wlr_renderer *renderer, |