Mesa (master): anv: Add exec_flags to anv_queue

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 28 18:34:22 UTC 2021


Module: Mesa
Branch: master
Commit: 40d4799d8a5c426498b69f13d9128895e8eb8691
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=40d4799d8a5c426498b69f13d9128895e8eb8691

Author: Jordan Justen <jordan.l.justen at intel.com>
Date:   Fri Apr  5 18:37:36 2019 -0700

anv: Add exec_flags to anv_queue

This may vary based on the newer kernel engines based contexts.

v2 (Jason Ekstrand):
 - Initialize anv_queue::exec_flags in anv_queue_init
 - Don't conflate this with refactors to get_reset_stats

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8667>

---

 src/intel/vulkan/anv_batch_chain.c | 16 +++++++++-------
 src/intel/vulkan/anv_device.c      |  2 +-
 src/intel/vulkan/anv_private.h     |  3 +++
 src/intel/vulkan/anv_queue.c       |  2 ++
 4 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c
index 867aad91ca9..a62339395e8 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -1456,6 +1456,7 @@ relocate_cmd_buffer(struct anv_cmd_buffer *cmd_buffer,
 
 static VkResult
 setup_execbuf_for_cmd_buffer(struct anv_execbuf *execbuf,
+                             struct anv_queue *queue,
                              struct anv_cmd_buffer *cmd_buffer)
 {
    struct anv_batch *batch = &cmd_buffer->batch;
@@ -1607,7 +1608,7 @@ setup_execbuf_for_cmd_buffer(struct anv_execbuf *execbuf,
       .num_cliprects = 0,
       .DR1 = 0,
       .DR4 = 0,
-      .flags = I915_EXEC_HANDLE_LUT | I915_EXEC_RENDER,
+      .flags = I915_EXEC_HANDLE_LUT | queue->exec_flags,
       .rsvd1 = cmd_buffer->device->context_id,
       .rsvd2 = 0,
    };
@@ -1656,8 +1657,9 @@ setup_execbuf_for_cmd_buffer(struct anv_execbuf *execbuf,
 }
 
 static VkResult
-setup_empty_execbuf(struct anv_execbuf *execbuf, struct anv_device *device)
+setup_empty_execbuf(struct anv_execbuf *execbuf, struct anv_queue *queue)
 {
+   struct anv_device *device = queue->device;
    VkResult result = anv_execbuf_add_bo(device, execbuf,
                                         device->trivial_batch_bo,
                                         NULL, 0);
@@ -1669,7 +1671,7 @@ setup_empty_execbuf(struct anv_execbuf *execbuf, struct anv_device *device)
       .buffer_count = execbuf->bo_count,
       .batch_start_offset = 0,
       .batch_len = 8, /* GEN7_MI_BATCH_BUFFER_END and NOOP */
-      .flags = I915_EXEC_HANDLE_LUT | I915_EXEC_RENDER | I915_EXEC_NO_RELOC,
+      .flags = I915_EXEC_HANDLE_LUT | queue->exec_flags | I915_EXEC_NO_RELOC,
       .rsvd1 = device->context_id,
       .rsvd2 = 0,
    };
@@ -1731,7 +1733,7 @@ anv_queue_execbuf_locked(struct anv_queue *queue,
    }
 
    if (submit->cmd_buffer) {
-      result = setup_execbuf_for_cmd_buffer(&execbuf, submit->cmd_buffer);
+      result = setup_execbuf_for_cmd_buffer(&execbuf, queue, submit->cmd_buffer);
    } else if (submit->simple_bo) {
       result = anv_execbuf_add_bo(device, &execbuf, submit->simple_bo, NULL, 0);
       if (result != VK_SUCCESS)
@@ -1742,12 +1744,12 @@ anv_queue_execbuf_locked(struct anv_queue *queue,
          .buffer_count = execbuf.bo_count,
          .batch_start_offset = 0,
          .batch_len = submit->simple_bo_size,
-         .flags = I915_EXEC_HANDLE_LUT | I915_EXEC_RENDER | I915_EXEC_NO_RELOC,
+         .flags = I915_EXEC_HANDLE_LUT | queue->exec_flags | I915_EXEC_NO_RELOC,
          .rsvd1 = device->context_id,
          .rsvd2 = 0,
       };
    } else {
-      result = setup_empty_execbuf(&execbuf, queue->device);
+      result = setup_empty_execbuf(&execbuf, queue);
    }
 
    if (result != VK_SUCCESS)
@@ -1848,7 +1850,7 @@ anv_queue_execbuf_locked(struct anv_queue *queue,
          .buffer_count = 1,
          .batch_start_offset = khr_perf_query_preamble_offset(query_pool,
                                                               submit->perf_query_pass),
-         .flags = I915_EXEC_HANDLE_LUT | I915_EXEC_RENDER,
+         .flags = I915_EXEC_HANDLE_LUT | queue->exec_flags,
          .rsvd1 = device->context_id,
       };
 
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 72147526461..299c869a1cb 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -2869,7 +2869,7 @@ VkResult anv_CreateDevice(
 
    device->has_thread_submit = physical_device->has_thread_submit;
 
-   result = anv_queue_init(device, &device->queue,
+   result = anv_queue_init(device, &device->queue, I915_EXEC_RENDER,
                            &pCreateInfo->pQueueCreateInfos[0]);
    if (result != VK_SUCCESS)
       goto fail_context_id;
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 389c1d49661..183e5a3ec89 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -1263,6 +1263,8 @@ struct anv_queue {
    VkDeviceQueueCreateFlags                  flags;
    struct anv_queue_family *                 family;
 
+   uint32_t                                  exec_flags;
+
    /* Set once from the device api calls. */
    bool                                      lost_signaled;
 
@@ -1591,6 +1593,7 @@ VkResult anv_device_wait(struct anv_device *device, struct anv_bo *bo,
                          int64_t timeout);
 
 VkResult anv_queue_init(struct anv_device *device, struct anv_queue *queue,
+                        uint32_t exec_flags,
                         const VkDeviceQueueCreateInfo *pCreateInfo);
 void anv_queue_finish(struct anv_queue *queue);
 
diff --git a/src/intel/vulkan/anv_queue.c b/src/intel/vulkan/anv_queue.c
index 6a7e57db230..2dfb2c1a550 100644
--- a/src/intel/vulkan/anv_queue.c
+++ b/src/intel/vulkan/anv_queue.c
@@ -486,6 +486,7 @@ _anv_queue_submit(struct anv_queue *queue, struct anv_queue_submit **_submit,
 
 VkResult
 anv_queue_init(struct anv_device *device, struct anv_queue *queue,
+               uint32_t exec_flags,
                const VkDeviceQueueCreateInfo *pCreateInfo)
 {
    struct anv_physical_device *pdevice = device->physical;
@@ -497,6 +498,7 @@ anv_queue_init(struct anv_device *device, struct anv_queue *queue,
    assert(pCreateInfo->queueFamilyIndex < pdevice->queue.family_count);
    queue->family = &pdevice->queue.families[pCreateInfo->queueFamilyIndex];
 
+   queue->exec_flags = exec_flags;
    queue->lost = false;
    queue->quit = false;
 



More information about the mesa-commit mailing list