diff --git a/.pick_status.json b/.pick_status.json index 780d5e094ac..c1bf110a90a 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4774,7 +4774,7 @@ "description": "panfrost: Fix FD resource_get_handle", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "7da251fc721360fc28b984507959ebfa0c88c8b2" }, diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index 5cf7839457f..d65b14d657b 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -153,31 +153,15 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen, return true; } } else if (handle->type == WINSYS_HANDLE_TYPE_FD) { - if (scanout) { - struct drm_prime_handle args = { - .handle = scanout->handle, - .flags = DRM_CLOEXEC, - }; + int fd = panfrost_bo_export(rsrc->image.data.bo); - int ret = drmIoctl(dev->ro->kms_fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &args); - if (ret == -1) - return false; + if (fd < 0) + return false; - handle->stride = scanout->stride; - handle->handle = args.fd; - - return true; - } else { - int fd = panfrost_bo_export(rsrc->image.data.bo); - - if (fd < 0) - return false; - - handle->handle = fd; - handle->stride = rsrc->image.layout.slices[0].line_stride; - handle->offset = rsrc->image.layout.slices[0].offset; - return true; - } + handle->handle = fd; + handle->stride = rsrc->image.layout.slices[0].line_stride; + handle->offset = rsrc->image.layout.slices[0].offset; + return true; } return false;