summaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/common/gen_decoder.c21
-rw-r--r--src/intel/common/gen_decoder.h7
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;