Mesa (master): intel: decoder: fix starting dword of struct fields

Lionel Landwerlin llandwerlin at kemper.freedesktop.org
Wed May 2 16:12:50 UTC 2018


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

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Wed May  2 00:13:39 2018 +0100

intel: decoder: fix starting dword of struct fields

Struct fields might span several dwords, but iter_dword is incremented
up to the last dword of the current field before we print out the
struct's fields. We can't use iter_dword for computing the offset into
the pointer of data to decode.

v2: Fix displayed offset number (Ken)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/intel/common/gen_decoder.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
index 93fa4864ee..bb87192d23 100644
--- a/src/intel/common/gen_decoder.c
+++ b/src/intel/common/gen_decoder.c
@@ -1062,9 +1062,10 @@ gen_print_group(FILE *outfile, struct gen_group *group, uint64_t offset,
       if (!gen_field_is_header(iter.field)) {
          fprintf(outfile, "    %s: %s\n", iter.name, iter.value);
          if (iter.struct_desc) {
-            uint64_t struct_offset = offset + 4 * iter_dword;
+            int struct_dword = iter.start_bit / 32;
+            uint64_t struct_offset = offset + 4 * struct_dword;
             gen_print_group(outfile, iter.struct_desc, struct_offset,
-                            &p[iter_dword], iter.start_bit % 32, color);
+                            &p[struct_dword], iter.start_bit % 32, color);
          }
       }
    }




More information about the mesa-commit mailing list