Module: Mesa
Branch: main
Commit: 0f218362721b0e2a59f8c1102406dbe8334678af
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0f218362721b0e2a59f8c1102406dbe8334678af

Author: Paulo Zanoni <paulo.r.zan...@intel.com>
Date:   Mon Nov 13 16:01:12 2023 -0800

anv/trtt: add support for queue->sync to the TR-TT batches

At this moment this patch won't buy us anything since we're already
being completely synchronous, but the next patch is going to change
this and so queue->sync will start making sense.

Reviewed-by: Lionel Landwerlin <lionel.g.landwer...@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zan...@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25512>

---

 src/intel/vulkan/i915/anv_batch_chain.c | 17 +++++++++++++++++
 src/intel/vulkan/xe/anv_batch_chain.c   |  9 +++++++++
 2 files changed, 26 insertions(+)

diff --git a/src/intel/vulkan/i915/anv_batch_chain.c 
b/src/intel/vulkan/i915/anv_batch_chain.c
index 9c65e4e3165..622ae0fddd1 100644
--- a/src/intel/vulkan/i915/anv_batch_chain.c
+++ b/src/intel/vulkan/i915/anv_batch_chain.c
@@ -1020,6 +1020,14 @@ i915_execute_trtt_batch(struct anv_sparse_submission 
*submit,
          goto out;
    }
 
+   if (queue->sync) {
+      result = anv_execbuf_add_sync(device, &execbuf, queue->sync,
+                                    true /* is_signal */,
+                                    0 /* signal_value */);
+      if (result != VK_SUCCESS)
+         goto out;
+   }
+
    result = anv_execbuf_add_bo(device, &execbuf, trtt_bbo->bo, NULL, 0);
    if (result != VK_SUCCESS)
       goto out;
@@ -1050,6 +1058,15 @@ i915_execute_trtt_batch(struct anv_sparse_submission 
*submit,
       goto out;
    }
 
+   if (queue->sync) {
+      result = vk_sync_wait(&device->vk, queue->sync, 0,
+                            VK_SYNC_WAIT_COMPLETE, UINT64_MAX);
+      if (result != VK_SUCCESS) {
+         result = vk_queue_set_lost(&queue->vk, "trtt sync wait failed");
+         goto out;
+      }
+   }
+
    /* TODO: we can get rid of this wait once we can properly handle the buffer
     * lifetimes.
     */
diff --git a/src/intel/vulkan/xe/anv_batch_chain.c 
b/src/intel/vulkan/xe/anv_batch_chain.c
index 3c28b908014..d251b743016 100644
--- a/src/intel/vulkan/xe/anv_batch_chain.c
+++ b/src/intel/vulkan/xe/anv_batch_chain.c
@@ -226,6 +226,15 @@ xe_execute_trtt_batch(struct anv_sparse_submission *submit,
       }
    }
 
+   if (queue->sync) {
+      result = vk_sync_wait(&device->vk, queue->sync, 0,
+                            VK_SYNC_WAIT_COMPLETE, UINT64_MAX);
+      if (result != VK_SUCCESS) {
+         result = vk_queue_set_lost(&queue->vk, "trtt sync wait failed");
+         goto exec_error;
+      }
+   }
+
    /* FIXME: we shouldn't need this wait, figure out a way to remove it. */
    struct drm_syncobj_wait wait = {
       .handles = (uintptr_t)&syncobj_handle,

Reply via email to