Mesa (master): intel/batch_decoder: Don't follow predicated MI_BATCH_BUFFER_START

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Mar 8 16:59:02 UTC 2021


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

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Wed Feb 24 00:28:17 2021 -0600

intel/batch_decoder: Don't follow predicated MI_BATCH_BUFFER_START

The stuff after these may be executed so we want to decode it too.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9445>

---

 src/intel/common/gen_batch_decoder.c | 49 ++++++++++++++++++++----------------
 1 file changed, 27 insertions(+), 22 deletions(-)

diff --git a/src/intel/common/gen_batch_decoder.c b/src/intel/common/gen_batch_decoder.c
index 8b78aa905a4..7719b7b61da 100644
--- a/src/intel/common/gen_batch_decoder.c
+++ b/src/intel/common/gen_batch_decoder.c
@@ -1151,6 +1151,7 @@ gen_print_batch(struct gen_batch_decode_ctx *ctx,
          uint64_t next_batch_addr = 0;
          bool ppgtt = false;
          bool second_level = false;
+         bool predicate = false;
          struct gen_field_iterator iter;
          gen_field_iterator_init(&iter, inst, p, 0, false);
          while (gen_field_iterator_next(&iter)) {
@@ -1160,32 +1161,36 @@ gen_print_batch(struct gen_batch_decode_ctx *ctx,
                second_level = iter.raw_value;
             } else if (strcmp(iter.name, "Address Space Indicator") == 0) {
                ppgtt = iter.raw_value;
+            } else if (strcmp(iter.name, "Predication Enable") == 0) {
+               predicate = iter.raw_value;
             }
          }
 
-         struct gen_batch_decode_bo next_batch = ctx_get_bo(ctx, ppgtt, next_batch_addr);
+         if (!predicate) {
+            struct gen_batch_decode_bo next_batch = ctx_get_bo(ctx, ppgtt, next_batch_addr);
 
-         if (next_batch.map == NULL) {
-            fprintf(ctx->fp, "Secondary batch at 0x%08"PRIx64" unavailable\n",
-                    next_batch_addr);
-         } else {
-            gen_print_batch(ctx, next_batch.map, next_batch.size,
-                            next_batch.addr, false);
-         }
-         if (second_level) {
-            /* MI_BATCH_BUFFER_START with "2nd Level Batch Buffer" set acts
-             * like a subroutine call.  Commands that come afterwards get
-             * processed once the 2nd level batch buffer returns with
-             * MI_BATCH_BUFFER_END.
-             */
-            continue;
-         } 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
-             * loop and continue;
-             */
-            break;
+            if (next_batch.map == NULL) {
+               fprintf(ctx->fp, "Secondary batch at 0x%08"PRIx64" unavailable\n",
+                       next_batch_addr);
+            } else {
+               gen_print_batch(ctx, next_batch.map, next_batch.size,
+                               next_batch.addr, false);
+            }
+            if (second_level) {
+               /* MI_BATCH_BUFFER_START with "2nd Level Batch Buffer" set acts
+                * like a subroutine call.  Commands that come afterwards get
+                * processed once the 2nd level batch buffer returns with
+                * MI_BATCH_BUFFER_END.
+                */
+               continue;
+            } 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
+                * loop and continue;
+                */
+               break;
+            }
          }
       } else if (strcmp(inst_name, "MI_BATCH_BUFFER_END") == 0) {
          break;



More information about the mesa-commit mailing list