diff options
author | Rafael Antognolli <[email protected]> | 2019-07-12 16:30:39 -0700 |
---|---|---|
committer | Rafael Antognolli <[email protected]> | 2019-07-23 17:45:19 +0000 |
commit | f670c2e1ff1025ac497005f4b0a06a7308636882 (patch) | |
tree | 8fc8f707520a1b5fb9a0bf591490da4b61739f34 /src/intel | |
parent | 618d0542830bf478f23da8216bd0df62e9f5ce18 (diff) |
intel/gen_decoder: Add the concept of array "levels".
We currently only support one level, which is the basic level of a
<group> tag.
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/common/gen_decoder.c | 21 | ||||
-rw-r--r-- | src/intel/common/gen_decoder.h | 7 |
2 files changed, 19 insertions, 9 deletions
diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c index cb182b15722..8c83512330b 100644 --- a/src/intel/common/gen_decoder.c +++ b/src/intel/common/gen_decoder.c @@ -904,13 +904,15 @@ iter_array_offset_bits(const struct gen_field_iterator *iter, static bool iter_more_arrays(const struct gen_field_iterator *iter) { + int lvl = iter->level; + if (iter->group->variable) { int length = gen_group_get_length(iter->group, iter->p); assert(length >= 0 && "error the length is unknown!"); - return iter_array_offset_bits(iter, iter->array_iter + 1) < + return iter_array_offset_bits(iter, iter->array_iter[lvl] + 1) < (length * 32); } else { - return (iter->array_iter + 1) < iter->group->array_count || + return (iter->array_iter[lvl] + 1) < iter->group->array_count || iter->group->next != NULL; } } @@ -920,7 +922,8 @@ iter_start_field(struct gen_field_iterator *iter, struct gen_field *field) { iter->field = field; - int array_member_offset = iter_array_offset_bits(iter, iter->array_iter); + int array_member_offset = + iter_array_offset_bits(iter, iter->array_iter[iter->level]); iter->start_bit = array_member_offset + iter->field->start; iter->end_bit = array_member_offset + iter->field->end; @@ -930,14 +933,16 @@ iter_start_field(struct gen_field_iterator *iter, struct gen_field *field) static void iter_advance_array(struct gen_field_iterator *iter) { + int lvl = iter->level; + if (iter->group->variable) - iter->array_iter++; + iter->array_iter[lvl]++; else { - if ((iter->array_iter + 1) < iter->group->array_count) { - iter->array_iter++; + if ((iter->array_iter[lvl] + 1) < iter->group->array_count) { + iter->array_iter[lvl]++; } else { iter->group = iter->group->next; - iter->array_iter = 0; + iter->array_iter[lvl] = 0; } } @@ -1067,7 +1072,7 @@ iter_decode_field(struct gen_field_iterator *iter) if (strlen(iter->group->name) == 0) { int length = strlen(iter->name); snprintf(iter->name + length, sizeof(iter->name) - length, - "[%i]", iter->array_iter); + "[%i]", iter->array_iter[iter->level]); } if (enum_name) { diff --git a/src/intel/common/gen_decoder.h b/src/intel/common/gen_decoder.h index c71095f122b..85d88196456 100644 --- a/src/intel/common/gen_decoder.h +++ b/src/intel/common/gen_decoder.h @@ -72,6 +72,10 @@ struct gen_enum *gen_spec_find_enum(struct gen_spec *spec, const char *name); bool gen_field_is_header(struct gen_field *field); +/* Only allow 5 levels of subgroup'ing + */ +#define DECODE_MAX_ARRAY_DEPTH 5 + struct gen_field_iterator { struct gen_group *group; char name[128]; @@ -84,7 +88,8 @@ struct gen_field_iterator { int start_bit; /**< current field starts at this bit offset into p */ int end_bit; /**< current field ends at this bit offset into p */ - int array_iter; + int array_iter[DECODE_MAX_ARRAY_DEPTH]; + int level; struct gen_field *field; bool print_colors; |