Mesa (master): anv: allow NULL batch parameter to anv_queue_submit_simple_batch

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Nov 11 22:11:43 UTC 2019


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

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Fri Aug 23 20:14:34 2019 +0300

anv: allow NULL batch parameter to anv_queue_submit_simple_batch

We can reuse device->trivial_batch_bo

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/intel/vulkan/anv_device.c | 12 ++----------
 src/intel/vulkan/anv_queue.c  | 24 +++++++++++++++---------
 2 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index cc72b55f53e..3e1e6e1c804 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -2959,19 +2959,11 @@ VkResult anv_DeviceWaitIdle(
     VkDevice                                    _device)
 {
    ANV_FROM_HANDLE(anv_device, device, _device);
+
    if (anv_device_is_lost(device))
       return VK_ERROR_DEVICE_LOST;
 
-   struct anv_batch batch;
-
-   uint32_t cmds[8];
-   batch.start = batch.next = cmds;
-   batch.end = (void *) cmds + sizeof(cmds);
-
-   anv_batch_emit(&batch, GEN7_MI_BATCH_BUFFER_END, bbe);
-   anv_batch_emit(&batch, GEN7_MI_NOOP, noop);
-
-   return anv_device_submit_simple_batch(device, &batch);
+   return anv_device_submit_simple_batch(device, NULL);
 }
 
 bool
diff --git a/src/intel/vulkan/anv_queue.c b/src/intel/vulkan/anv_queue.c
index 87abbebe8ab..dbe2febaef7 100644
--- a/src/intel/vulkan/anv_queue.c
+++ b/src/intel/vulkan/anv_queue.c
@@ -123,15 +123,20 @@ anv_device_submit_simple_batch(struct anv_device *device,
    VkResult result = VK_SUCCESS;
    uint32_t size;
 
-   /* Kernel driver requires 8 byte aligned batch length */
-   size = align_u32(batch->next - batch->start, 8);
-   result = anv_bo_pool_alloc(&device->batch_bo_pool, size, &bo);
-   if (result != VK_SUCCESS)
-      return result;
+   if (batch) {
+      /* Kernel driver requires 8 byte aligned batch length */
+      size = align_u32(batch->next - batch->start, 8);
+      result = anv_bo_pool_alloc(&device->batch_bo_pool, size, &bo);
+      if (result != VK_SUCCESS)
+         return result;
 
-   memcpy(bo->map, batch->start, size);
-   if (!device->info.has_llc)
-      gen_flush_range(bo->map, size);
+      memcpy(bo->map, batch->start, size);
+      if (!device->info.has_llc)
+         gen_flush_range(bo->map, size);
+   } else {
+      size = device->trivial_batch_bo->size;
+      bo = device->trivial_batch_bo;
+   }
 
    exec2_objects[0].handle = bo->gem_handle;
    exec2_objects[0].relocation_count = 0;
@@ -168,7 +173,8 @@ anv_device_submit_simple_batch(struct anv_device *device,
    result = anv_device_wait(device, bo, INT64_MAX);
 
  fail:
-   anv_bo_pool_free(&device->batch_bo_pool, bo);
+   if (batch)
+      anv_bo_pool_free(&device->batch_bo_pool, bo);
 
    return result;
 }




More information about the mesa-commit mailing list