anv: Plumb timeline semaphore signal/wait values through from the API
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 16 Oct 2018 20:58:14 +0000 (15:58 -0500)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Mon, 11 Nov 2019 21:46:51 +0000 (21:46 +0000)
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/anv_private.h
src/intel/vulkan/anv_queue.c

index 67049cc37fe584a042c334b87af39dfe1f2decee..3174e5ea236c736c26fd677b6ca8a10c174be02f 100644 (file)
@@ -2695,8 +2695,10 @@ void anv_cmd_buffer_prepare_execbuf(struct anv_cmd_buffer *cmd_buffer);
 VkResult anv_cmd_buffer_execbuf(struct anv_queue *queue,
                                 struct anv_cmd_buffer *cmd_buffer,
                                 const VkSemaphore *in_semaphores,
+                                const uint64_t *in_wait_values,
                                 uint32_t num_in_semaphores,
                                 const VkSemaphore *out_semaphores,
+                                const uint64_t *out_signal_values,
                                 uint32_t num_out_semaphores,
                                 VkFence fence);
 
index 959b96aaaf2aeea1929915ccb16a386b0ae8e8e5..dc476470b75e7201069bb78d6fa3be972e8e5f02 100644 (file)
@@ -382,8 +382,10 @@ static VkResult
 anv_queue_submit(struct anv_queue *queue,
                  struct anv_cmd_buffer *cmd_buffer,
                  const VkSemaphore *in_semaphores,
+                 const uint64_t *in_values,
                  uint32_t num_in_semaphores,
                  const VkSemaphore *out_semaphores,
+                 const uint64_t *out_values,
                  uint32_t num_out_semaphores,
                  VkFence _fence)
 {
@@ -590,7 +592,7 @@ VkResult anv_QueueSubmit(
        * come up with something more efficient but this shouldn't be a
        * common case.
        */
-      result = anv_queue_submit(queue, NULL, NULL, 0, NULL, 0, fence);
+      result = anv_queue_submit(queue, NULL, NULL, NULL, 0, NULL, NULL, 0, fence);
       goto out;
    }
 
@@ -598,6 +600,16 @@ VkResult anv_QueueSubmit(
       /* Fence for this submit.  NULL for all but the last one */
       VkFence submit_fence = (i == submitCount - 1) ? fence : VK_NULL_HANDLE;
 
+      const VkTimelineSemaphoreSubmitInfoKHR *timeline_info =
+         vk_find_struct_const(pSubmits[i].pNext,
+                              TIMELINE_SEMAPHORE_SUBMIT_INFO_KHR);
+      const uint64_t *wait_values =
+         timeline_info && timeline_info->waitSemaphoreValueCount ?
+         timeline_info->pWaitSemaphoreValues : NULL;
+      const uint64_t *signal_values =
+         timeline_info && timeline_info->signalSemaphoreValueCount ?
+         timeline_info->pSignalSemaphoreValues : NULL;
+
       if (pSubmits[i].commandBufferCount == 0) {
          /* If we don't have any command buffers, we need to submit a dummy
           * batch to give GEM something to wait on.  We could, potentially,
@@ -606,8 +618,10 @@ VkResult anv_QueueSubmit(
           */
          result = anv_queue_submit(queue, NULL,
                                    pSubmits[i].pWaitSemaphores,
+                                   wait_values,
                                    pSubmits[i].waitSemaphoreCount,
                                    pSubmits[i].pSignalSemaphores,
+                                   signal_values,
                                    pSubmits[i].signalSemaphoreCount,
                                    submit_fence);
          if (result != VK_SUCCESS)
@@ -628,22 +642,25 @@ VkResult anv_QueueSubmit(
             submit_fence : VK_NULL_HANDLE;
 
          const VkSemaphore *in_semaphores = NULL, *out_semaphores = NULL;
+         const uint64_t *in_values = NULL, *out_values = NULL;
          uint32_t num_in_semaphores = 0, num_out_semaphores = 0;
          if (j == 0) {
             /* Only the first batch gets the in semaphores */
             in_semaphores = pSubmits[i].pWaitSemaphores;
+            in_values = wait_values;
             num_in_semaphores = pSubmits[i].waitSemaphoreCount;
          }
 
          if (j == pSubmits[i].commandBufferCount - 1) {
             /* Only the last batch gets the out semaphores */
             out_semaphores = pSubmits[i].pSignalSemaphores;
+            out_values = signal_values;
             num_out_semaphores = pSubmits[i].signalSemaphoreCount;
          }
 
          result = anv_queue_submit(queue, cmd_buffer,
-                                   in_semaphores, num_in_semaphores,
-                                   out_semaphores, num_out_semaphores,
+                                   in_semaphores, in_values, num_in_semaphores,
+                                   out_semaphores, out_values, num_out_semaphores,
                                    execbuf_fence);
          if (result != VK_SUCCESS)
             goto out;