<div dir="ltr"><div>Wow, good work us...<br><br></div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 3, 2018 at 2:21 PM, Kevin Strasser <span dir="ltr"><<a href="mailto:kevin.strasser@intel.com" target="_blank">kevin.strasser@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If we close the fd before calling DRM_IOCTL_PRIME_FD_TO_HANDLE the kernel<br>
will hit a -EBADF error. Move the close(fd) call to the end of<br>
anv_CreateDmaBufImageINTEL().<br>
<br>
Signed-off-by: Kevin Strasser <<a href="mailto:kevin.strasser@intel.com">kevin.strasser@intel.com</a>><br>
---<br>
 src/intel/vulkan/anv_intel.c | 4 ++--<br>
 1 file changed, 2 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_intel.c b/src/intel/vulkan/anv_intel.c<br>
index 82373f0..976c833 100644<br>
--- a/src/intel/vulkan/anv_intel.c<br>
+++ b/src/intel/vulkan/anv_intel.c<br>
@@ -71,8 +71,6 @@ VkResult anv_CreateDmaBufImageINTEL(<br>
    if (result != VK_SUCCESS)<br>
       goto fail;<br>
<br>
-   close(pCreateInfo->fd);<br>
-<br>
    image = anv_image_from_handle(image_h)<wbr>;<br>
<br>
    result = anv_bo_cache_import(device, &device->bo_cache,<br>
@@ -105,6 +103,8 @@ VkResult anv_CreateDmaBufImageINTEL(<br>
    *pMem = anv_device_memory_to_handle(<wbr>mem);<br>
    *pImage = anv_image_to_handle(image);<br>
<br>
+   close(pCreateInfo->fd);<br>
+<br>
    return VK_SUCCESS;<br>
<br>
  fail_import:<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.4<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>