An MI_BATCH_BUFFER_START in the ring buffer acts as a second level
batchbuffer (aka jump back to ring buffer when running into a
MI_BATCH_BUFFER_END).

Signed-off-by: Lionel Landwerlin <[email protected]>
---
 src/intel/common/gen_batch_decoder.c          | 6 +++---
 src/intel/common/gen_decoder.h                | 2 +-
 src/intel/tools/aubinator.c                   | 4 ++--
 src/intel/tools/aubinator_error_decode.c      | 2 +-
 src/intel/tools/aubinator_viewer.cpp          | 4 ++--
 src/intel/tools/aubinator_viewer.h            | 2 +-
 src/intel/tools/aubinator_viewer_decoder.cpp  | 6 +++---
 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 2 +-
 8 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/intel/common/gen_batch_decoder.c 
b/src/intel/common/gen_batch_decoder.c
index 50c031e9164..3609bd3f0ad 100644
--- a/src/intel/common/gen_batch_decoder.c
+++ b/src/intel/common/gen_batch_decoder.c
@@ -799,7 +799,7 @@ get_address(struct gen_spec *spec, const uint32_t *p)
 void
 gen_print_batch(struct gen_batch_decode_ctx *ctx,
                 const uint32_t *batch, uint32_t batch_size,
-                uint64_t batch_addr)
+                uint64_t batch_addr, bool from_ring)
 {
    const uint32_t *p, *end = batch + batch_size / 4;
    int length;
@@ -881,7 +881,7 @@ gen_print_batch(struct gen_batch_decode_ctx *ctx,
                     next_batch_addr);
          } else {
             gen_print_batch(ctx, next_batch.map, next_batch.size,
-                            next_batch.addr);
+                            next_batch.addr, false);
          }
          if (second_level) {
             /* MI_BATCH_BUFFER_START with "2nd Level Batch Buffer" set acts
@@ -890,7 +890,7 @@ gen_print_batch(struct gen_batch_decode_ctx *ctx,
              * MI_BATCH_BUFFER_END.
              */
             continue;
-         } else {
+         } else if (!from_ring) {
             /* MI_BATCH_BUFFER_START with "2nd Level Batch Buffer" unset acts
              * like a goto.  Nothing after it will ever get processed.  In
              * order to prevent the recursion from growing, we just reset the
diff --git a/src/intel/common/gen_decoder.h b/src/intel/common/gen_decoder.h
index ac1e199005e..964543581e3 100644
--- a/src/intel/common/gen_decoder.h
+++ b/src/intel/common/gen_decoder.h
@@ -242,7 +242,7 @@ void gen_batch_decode_ctx_finish(struct 
gen_batch_decode_ctx *ctx);
 
 void gen_print_batch(struct gen_batch_decode_ctx *ctx,
                      const uint32_t *batch, uint32_t batch_size,
-                     uint64_t batch_addr);
+                     uint64_t batch_addr, bool from_ring);
 
 #ifdef __cplusplus
 }
diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 55519f13e5e..5c4761ba9dd 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -153,7 +153,7 @@ handle_execlist_write(void *user_data, enum gen_engine 
engine, uint64_t context_
 
    (void)engine; /* TODO */
    gen_print_batch(&batch_ctx, commands, ring_buffer_tail - ring_buffer_head,
-                   0);
+                   0, true);
    aub_mem_clear_bo_maps(&mem);
 }
 
@@ -170,7 +170,7 @@ handle_ring_write(void *user_data, enum gen_engine engine,
    batch_ctx.user_data = &mem;
    batch_ctx.get_bo = get_legacy_bo;
 
-   gen_print_batch(&batch_ctx, data, data_len, 0);
+   gen_print_batch(&batch_ctx, data, data_len, 0, false);
 
    aub_mem_clear_bo_maps(&mem);
 }
diff --git a/src/intel/tools/aubinator_error_decode.c 
b/src/intel/tools/aubinator_error_decode.c
index 8cf4909f528..735d3552722 100644
--- a/src/intel/tools/aubinator_error_decode.c
+++ b/src/intel/tools/aubinator_error_decode.c
@@ -611,7 +611,7 @@ read_data_file(FILE *file)
           strcmp(sections[s].buffer_name, "ring buffer") == 0 ||
           strcmp(sections[s].buffer_name, "HW Context") == 0) {
          gen_print_batch(&batch_ctx, sections[s].data, sections[s].count,
-                         sections[s].gtt_offset);
+                         sections[s].gtt_offset, false);
       }
    }
 
diff --git a/src/intel/tools/aubinator_viewer.cpp 
b/src/intel/tools/aubinator_viewer.cpp
index c96f9a9cea3..abb2045c5d4 100644
--- a/src/intel/tools/aubinator_viewer.cpp
+++ b/src/intel/tools/aubinator_viewer.cpp
@@ -702,7 +702,7 @@ display_batch_ring_write(void *user_data, enum gen_engine 
engine,
 
    window->uses_ppgtt = false;
 
-   aub_viewer_render_batch(&window->decode_ctx, data, data_len, 0);
+   aub_viewer_render_batch(&window->decode_ctx, data, data_len, 0, false);
 }
 
 static void
@@ -734,7 +734,7 @@ display_batch_execlist_write(void *user_data, enum 
gen_engine engine,
 
    aub_viewer_render_batch(&window->decode_ctx, commands,
                            ring_buffer_tail - ring_buffer_head,
-                           ring_buffer_start);
+                           ring_buffer_start, true);
 }
 
 static void
diff --git a/src/intel/tools/aubinator_viewer.h 
b/src/intel/tools/aubinator_viewer.h
index cdbd9c98f39..e204516784f 100644
--- a/src/intel/tools/aubinator_viewer.h
+++ b/src/intel/tools/aubinator_viewer.h
@@ -92,6 +92,6 @@ void aub_viewer_decode_ctx_init(struct aub_viewer_decode_ctx 
*ctx,
 
 void aub_viewer_render_batch(struct aub_viewer_decode_ctx *ctx,
                              const void *batch, uint32_t batch_size,
-                             uint64_t batch_addr);
+                             uint64_t batch_addr, bool from_ring);
 
 #endif /* AUBINATOR_VIEWER_H */
diff --git a/src/intel/tools/aubinator_viewer_decoder.cpp 
b/src/intel/tools/aubinator_viewer_decoder.cpp
index 58d4f0fa5d7..2079deb48d2 100644
--- a/src/intel/tools/aubinator_viewer_decoder.cpp
+++ b/src/intel/tools/aubinator_viewer_decoder.cpp
@@ -867,7 +867,7 @@ get_address(struct gen_spec *spec, const uint32_t *p)
 void
 aub_viewer_render_batch(struct aub_viewer_decode_ctx *ctx,
                         const void *_batch, uint32_t batch_size,
-                        uint64_t batch_addr)
+                        uint64_t batch_addr, bool from_ring)
 {
    struct gen_group *inst;
    const uint32_t *p, *batch = (const uint32_t *) _batch, *end = batch + 
batch_size / 4;
@@ -945,7 +945,7 @@ aub_viewer_render_batch(struct aub_viewer_decode_ctx *ctx,
                                next_batch_addr);
          } else {
             aub_viewer_render_batch(ctx, next_batch.map, next_batch.size,
-                                    next_batch.addr);
+                                    next_batch.addr, false);
          }
          if (second_level) {
             /* MI_BATCH_BUFFER_START with "2nd Level Batch Buffer" set acts
@@ -954,7 +954,7 @@ aub_viewer_render_batch(struct aub_viewer_decode_ctx *ctx,
              * MI_BATCH_BUFFER_END.
              */
             continue;
-         } else {
+         } else if (!from_ring) {
             /* MI_BATCH_BUFFER_START with "2nd Level Batch Buffer" unset acts
              * like a goto.  Nothing after it will ever get processed.  In
              * order to prevent the recursion from growing, we just reset the
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c 
b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 7ab9da663da..28ab7fc604a 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -815,7 +815,7 @@ submit_batch(struct brw_context *brw, int in_fence_fd, int 
*out_fence_fd)
    if (unlikely(INTEL_DEBUG & DEBUG_BATCH)) {
       gen_print_batch(&batch->decoder, batch->batch.map,
                       4 * USED_BATCH(*batch),
-                      batch->batch.bo->gtt_offset);
+                      batch->batch.bo->gtt_offset, false);
    }
 
    if (brw->ctx.Const.ResetStrategy == GL_LOSE_CONTEXT_ON_RESET_ARB)
-- 
2.19.0.rc1

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

Reply via email to