summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2024-08-26 13:23:07 +1000
committerEric Engestrom <eric@engestrom.ch>2024-08-27 09:08:28 +0200
commit87ea4ab7d2ad151ec34e55f61e02a52d9a468d71 (patch)
tree0af4f29bf6548dea46347cbff0231909d1c51f68 /src/gallium
parent6cd669911e4ef16c15797b13e476ae82f4c30eb6 (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> (cherry picked from commit 4bf257a18fdad05d359c60464076a4fb78b2c79a)
Diffstat (limited to 'src/gallium')
-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;