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

Author: Lionel Landwerlin <[email protected]>
Date:   Wed Dec  9 11:56:31 2020 +0200

anv: track the end of the command buffers

Where MI_BATCH_BUFFER_END is recorded.

Signed-off-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2371>

---

 src/intel/vulkan/anv_batch_chain.c | 4 ++++
 src/intel/vulkan/anv_private.h     | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/src/intel/vulkan/anv_batch_chain.c 
b/src/intel/vulkan/anv_batch_chain.c
index 5ea24bb3945..34e0868f3d1 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -913,8 +913,12 @@ anv_cmd_buffer_end_batch_buffer(struct anv_cmd_buffer 
*cmd_buffer)
        * with our BATCH_BUFFER_END in another BO.
        */
       cmd_buffer->batch.end += GEN8_MI_BATCH_BUFFER_START_length * 4;
+      assert(cmd_buffer->batch.start == batch_bo->bo->map);
       assert(cmd_buffer->batch.end == batch_bo->bo->map + batch_bo->bo->size);
 
+      /* Save end instruction location to override it later. */
+      cmd_buffer->batch_end = cmd_buffer->batch.next;
+
       anv_batch_emit(&cmd_buffer->batch, GEN8_MI_BATCH_BUFFER_END, bbe);
 
       /* Round batch up to an even number of dwords. */
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 1183d143252..5eb042f39ac 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -2951,6 +2951,12 @@ struct anv_cmd_buffer {
 
    struct anv_batch                             batch;
 
+   /* Pointer to the location in the batch where MI_BATCH_BUFFER_END was
+    * recorded upon calling vkEndCommandBuffer(). This is useful if we need to
+    * rewrite the end to chain multiple batch together at vkQueueSubmit().
+    */
+   void *                                       batch_end;
+
    /* Fields required for the actual chain of anv_batch_bo's.
     *
     * These fields are initialized by anv_cmd_buffer_init_batch_bo_chain().

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to