[Mesa-dev] [PATCH 08/11] intel/decoder: Add a gen_print_group_length helper

Jason Ekstrand jason at jlekstrand.net
Wed Dec 13 20:05:45 UTC 2017


---
 src/intel/common/gen_decoder.c | 17 ++++++++++++++---
 src/intel/common/gen_decoder.h |  5 +++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
index 1f6b984..c6ddae0 100644
--- a/src/intel/common/gen_decoder.c
+++ b/src/intel/common/gen_decoder.c
@@ -1014,7 +1014,7 @@ gen_field_is_header(struct gen_field *field)
 
 static void
 _gen_print_group(FILE *outfile, struct gen_group *group, uint64_t offset,
-                 const uint32_t *p, int p_bit, bool color)
+                 const uint32_t *p, int p_bit, int dw_length, bool color)
 {
    struct gen_field_iterator iter;
    int last_dword = -1;
@@ -1022,6 +1022,9 @@ _gen_print_group(FILE *outfile, struct gen_group *group, uint64_t offset,
    gen_field_iterator_init(&iter, group, p, p_bit, color);
    do {
       int iter_dword = iter.bit / 32;
+      if (dw_length >= 0 && iter_dword >= dw_length)
+         break;
+
       if (last_dword != iter_dword) {
          for (int i = last_dword + 1; i <= iter_dword; i++)
             print_dword_header(outfile, &iter, offset, i);
@@ -1032,7 +1035,8 @@ _gen_print_group(FILE *outfile, struct gen_group *group, uint64_t offset,
          if (iter.struct_desc) {
             uint64_t struct_offset = offset + 4 * iter_dword;
             _gen_print_group(outfile, iter.struct_desc, struct_offset,
-                             &p[iter_dword], iter.bit % 32, color);
+                             &p[iter_dword], iter.bit % 32,
+                             dw_length - iter_dword, color);
          }
       }
    } while (gen_field_iterator_next(&iter));
@@ -1042,5 +1046,12 @@ void
 gen_print_group(FILE *outfile, struct gen_group *group, uint64_t offset,
                 const uint32_t *p, bool color)
 {
-   _gen_print_group(outfile, group, offset, p, 0, color);
+   _gen_print_group(outfile, group, offset, p, 0, -1, color);
+}
+
+void
+gen_print_group_length(FILE *outfile, struct gen_group *group, uint64_t offset,
+                       const uint32_t *p, int dw_length, bool color)
+{
+   _gen_print_group(outfile, group, offset, p, 0, dw_length, color);
 }
diff --git a/src/intel/common/gen_decoder.h b/src/intel/common/gen_decoder.h
index 2532a36..300dd8f 100644
--- a/src/intel/common/gen_decoder.h
+++ b/src/intel/common/gen_decoder.h
@@ -184,6 +184,11 @@ void gen_print_group(FILE *out,
                      uint64_t offset, const uint32_t *p,
                      bool color);
 
+void gen_print_group_length(FILE *out,
+                            struct gen_group *group,
+                            uint64_t offset, const uint32_t *p,
+                            int dw_length, bool color);
+
 enum gen_batch_decode_flags {
    /** Print in color! */
    GEN_BATCH_DECODE_IN_COLOR  = (1 << 0),
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list