intel: decoder: fix starting dword of struct fields
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Tue, 1 May 2018 23:13:39 +0000 (00:13 +0100)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Wed, 2 May 2018 16:11:28 +0000 (17:11 +0100)
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@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/common/gen_decoder.c

index 93fa4864ee30bf57adb4785e83c2b42216c3c739..bb87192d23cc6462e5f7e8ec664916d6299c08ab 100644 (file)
@@ -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);
          }
       }
    }