Mesa (staging/19.2): anv: invalidate file descriptor of semaphore sync fd at vkQueueSubmit

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 20 00:56:27 UTC 2019


Module: Mesa
Branch: staging/19.2
Commit: 2281258a7b8db521d0d3d3f24d2552311a00bafd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2281258a7b8db521d0d3d3f24d2552311a00bafd

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Thu Aug 29 14:54:12 2019 +0300

anv: invalidate file descriptor of semaphore sync fd at vkQueueSubmit

We always close the in_fence at the end the anv_cmd_buffer_execbuf()
so when we take it from the semaphore, let's not forget to invalidate
it.

Note that the code leaks the fence_in if we get any error before
reaching the close(). Let's fix that in another patch or better,
rewrite the whole thing!

v2: drop redundant fd = -1 (Jason)

v3: Update commit message (Jason)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Cc: <mesa-stable at lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
(cherry picked from commit 048f0690ee4b39f865d4d6ad82a6c0290dcaaf41)

---

 src/intel/vulkan/anv_batch_chain.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c
index e5d8b3b568d..1a8a3197427 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -1620,6 +1620,9 @@ anv_cmd_buffer_execbuf(struct anv_device *device,
          assert(!pdevice->has_syncobj);
          if (in_fence == -1) {
             in_fence = impl->fd;
+            if (in_fence == -1)
+               return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+            impl->fd = -1;
          } else {
             int merge = anv_gem_sync_file_merge(device, in_fence, impl->fd);
             if (merge == -1)
@@ -1627,10 +1630,9 @@ anv_cmd_buffer_execbuf(struct anv_device *device,
 
             close(impl->fd);
             close(in_fence);
+            impl->fd = -1;
             in_fence = merge;
          }
-
-         impl->fd = -1;
          break;
 
       case ANV_SEMAPHORE_TYPE_DRM_SYNCOBJ:




More information about the mesa-commit mailing list