diff options
author | Jason Ekstrand <[email protected]> | 2017-12-12 17:36:47 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-12-14 13:27:04 -0800 |
commit | a7ae72032f550d9680673b67b1e81452d0b74fed (patch) | |
tree | 290cffff477670f5d56b92461e7d2488723e5e8f /src/intel/common/gen_decoder.c | |
parent | dca8f466ee3c1d2d3a8f120895639c9a2cca9272 (diff) |
intel/decoder: Take a bit offset in gen_print_group
Previously, if a group was nested in another group such that it didn't
start on a dword boundary, we would decode it as if it started at the
start of its first dword. This changes things to work even more in
terms of bits so that we can properly decode these structs. This
affects MOCS, attribute swizzles, and several other things.
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/common/gen_decoder.c')
-rw-r--r-- | src/intel/common/gen_decoder.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c index 59c76eab7ef..4f373a371ee 100644 --- a/src/intel/common/gen_decoder.c +++ b/src/intel/common/gen_decoder.c @@ -851,8 +851,8 @@ iter_decode_field_raw(struct gen_field_iterator *iter) { uint64_t qw = 0; - int field_start = iter->bit; - int field_end = iter->bit + (iter->field->end - iter->field->start); + int field_start = iter->p_bit + iter->bit; + int field_end = field_start + (iter->field->end - iter->field->start); const uint32_t *p = iter->p + (iter->bit / 32); if ((field_end - field_start) > 32) { @@ -959,7 +959,7 @@ iter_decode_field(struct gen_field_iterator *iter) void gen_field_iterator_init(struct gen_field_iterator *iter, struct gen_group *group, - const uint32_t *p, + const uint32_t *p, int p_bit, bool print_colors) { memset(iter, 0, sizeof(*iter)); @@ -970,6 +970,7 @@ gen_field_iterator_init(struct gen_field_iterator *iter, else iter->field = group->next->fields; iter->p = p; + iter->p_bit = p_bit; iter->p_end = &p[gen_group_get_length(iter->group, iter->p)]; iter->print_colors = print_colors; @@ -1011,13 +1012,13 @@ gen_field_is_header(struct gen_field *field) } void -gen_print_group(FILE *outfile, struct gen_group *group, - uint64_t offset, const uint32_t *p, bool color) +gen_print_group(FILE *outfile, struct gen_group *group, uint64_t offset, + const uint32_t *p, int p_bit, bool color) { struct gen_field_iterator iter; int last_dword = -1; - gen_field_iterator_init(&iter, group, p, color); + gen_field_iterator_init(&iter, group, p, p_bit, color); do { int iter_dword = iter.bit / 32; if (last_dword != iter_dword) { @@ -1030,7 +1031,7 @@ gen_print_group(FILE *outfile, struct gen_group *group, if (iter.struct_desc) { uint64_t struct_offset = offset + 4 * iter_dword; gen_print_group(outfile, iter.struct_desc, struct_offset, - &p[iter_dword], color); + &p[iter_dword], iter.bit % 32, color); } } } while (gen_field_iterator_next(&iter)); |