From b44480e86a13c2f268174380d65ed6ac10374fb8 Mon Sep 17 00:00:00 2001 From: Zan Dobersek Date: Thu, 17 Oct 2024 14:03:12 +0200 Subject: [PATCH] zink: fix bo_export caching When creating and caching the bo_export object for a given zink_bo, the screen file descriptor was used. Since no buffer object's file descriptor would match that, bo_export objects were continuously added to the exports list and no bo_export was effectively picked from the cache. Using the buffer object's file descriptor avoids that. Signed-off-by: Zan Dobersek Fixes: b0fe621459c ("zink: add back kms handling") Part-of: --- src/gallium/drivers/zink/zink_bo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/zink/zink_bo.c b/src/gallium/drivers/zink/zink_bo.c index 26e65a68ea2..7ec0c5ff02b 100644 --- a/src/gallium/drivers/zink/zink_bo.c +++ b/src/gallium/drivers/zink/zink_bo.c @@ -130,7 +130,7 @@ bo_destroy(struct zink_screen *screen, struct pb_buffer *pbuf) simple_mtx_lock(&bo->u.real.export_lock); list_for_each_entry_safe(struct bo_export, export, &bo->u.real.exports, link) { struct drm_gem_close args = { .handle = export->gem_handle }; - drmIoctl(export->drm_fd, DRM_IOCTL_GEM_CLOSE, &args); + drmIoctl(screen->drm_fd, DRM_IOCTL_GEM_CLOSE, &args); list_del(&export->link); free(export); } @@ -1216,7 +1216,7 @@ zink_bo_get_kms_handle(struct zink_screen *screen, struct zink_bo *bo, int fd, u if (success) { list_addtail(&export->link, &bo->u.real.exports); export->gem_handle = *handle; - export->drm_fd = screen->drm_fd; + export->drm_fd = fd; } else { mesa_loge("zink: failed drmPrimeFDToHandle %s", strerror(errno)); FREE(export);