summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2024-08-26 13:23:07 +1000
committerMarge Bot <emma+marge@anholt.net>2024-08-26 22:53:12 +0000
commit4bf257a18fdad05d359c60464076a4fb78b2c79a (patch)
tree253bfe61df2bfcdb08cc6d81271307f00362548b
parent521dc42e6c35730c10bf175622bbb6aa2e2cd76e (diff)
llvmpipe: make sure to duplicate the fd handle before giving out
This handle is given to the user to close, so make sure to dup it first. Fixes: d74ea2c117fe ("llvmpipe: Implement dmabuf handling") Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Reviewed-by: Lucas Fryzek <lfryzek@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30839>
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index eb553d93b2b..043bacdaa75 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -822,8 +822,9 @@ llvmpipe_resource_get_handle(struct pipe_screen *_screen,
lpr->data = lpr->dmabuf_alloc->cpu_addr;
/* reuse lavapipe codepath to handle destruction */
lpr->backable = true;
+ } else {
+ whandle->handle = os_dupfd_cloexec(lpr->dmabuf_alloc->dmabuf_fd);
}
- whandle->handle = lpr->dmabuf_alloc->dmabuf_fd;
whandle->modifier = DRM_FORMAT_MOD_LINEAR;
whandle->stride = lpr->row_stride[0];
return true;