diff --git a/.pick_status.json b/.pick_status.json index aabede9cd75..d7195f607e8 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1444,7 +1444,7 @@ "description": "zink: Return early if the file descriptor could not have been duplicated/acquired", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index bc014a44938..268f9b53c98 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -2277,7 +2277,7 @@ zink_screen_export_dmabuf_semaphore(struct zink_screen *screen, struct zink_reso .fd = -1, }; - int fd; + int fd = -1; if (res->obj->is_aux) { fd = os_dupfd_cloexec(res->obj->handle); } else { @@ -2288,6 +2288,11 @@ zink_screen_export_dmabuf_semaphore(struct zink_screen *screen, struct zink_reso VKSCR(GetMemoryFdKHR)(screen->dev, &fd_info, &fd); } + if (unlikely(fd < 0)) { + mesa_loge("MESA: Unable to get a valid memory fd"); + return VK_NULL_HANDLE; + } + int ret = drmIoctl(fd, DMA_BUF_IOCTL_EXPORT_SYNC_FILE, &export); if (ret) { if (errno == ENOTTY || errno == EBADF || errno == ENOSYS) {