[Mesa-dev] [PATCH] anv: Fix close(fd) before import issue in vkCreateDmaBufImageINTEL

Jason Ekstrand jason at jlekstrand.net
Tue Apr 3 21:30:45 UTC 2018


Wow, good work us...

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

On Tue, Apr 3, 2018 at 2:21 PM, Kevin Strasser <kevin.strasser at intel.com>
wrote:

> If we close the fd before calling DRM_IOCTL_PRIME_FD_TO_HANDLE the kernel
> will hit a -EBADF error. Move the close(fd) call to the end of
> anv_CreateDmaBufImageINTEL().
>
> Signed-off-by: Kevin Strasser <kevin.strasser at intel.com>
> ---
>  src/intel/vulkan/anv_intel.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/intel/vulkan/anv_intel.c b/src/intel/vulkan/anv_intel.c
> index 82373f0..976c833 100644
> --- a/src/intel/vulkan/anv_intel.c
> +++ b/src/intel/vulkan/anv_intel.c
> @@ -71,8 +71,6 @@ VkResult anv_CreateDmaBufImageINTEL(
>     if (result != VK_SUCCESS)
>        goto fail;
>
> -   close(pCreateInfo->fd);
> -
>     image = anv_image_from_handle(image_h);
>
>     result = anv_bo_cache_import(device, &device->bo_cache,
> @@ -105,6 +103,8 @@ VkResult anv_CreateDmaBufImageINTEL(
>     *pMem = anv_device_memory_to_handle(mem);
>     *pImage = anv_image_to_handle(image);
>
> +   close(pCreateInfo->fd);
> +
>     return VK_SUCCESS;
>
>   fail_import:
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180403/aca720f0/attachment.html>


More information about the mesa-dev mailing list