summaryrefslogtreecommitdiff
path: root/src/intel/tools/aubinator.c
diff options
context:
space:
mode:
authorRafael Antognolli <rafael.antognolli@intel.com>2017-04-18 09:41:40 -0700
committerKenneth Graunke <kenneth@whitecape.org>2017-04-24 15:13:51 -0700
commit1ea41163eb0657e7c6cd46c45bdbc3fd4e8e72f8 (patch)
tree90a04709966e49edf6d5d4569aac84749dba3e73 /src/intel/tools/aubinator.c
parent50134cede1eee1222c1a28022b42b2177f7379c2 (diff)
intel/aubinator: Correctly read variable length structs.
Before this commit, when a group with count="0" is found, only one field is added to the struct representing the instruction. This causes only one entry to be printed by aubinator, for variable length groups. With this commit we "detect" that there's a variable length group (count="0") and store the offset of the last entry added to the struct when reading the xml. When finally reading the aubdump file, we check the size of the group and whether we have variable number of elements, and in that case, reuse the last field to add the remaining elements. Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com> Tested-by: Jason Ekstrand <jason@jlekstrand.net> Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/intel/tools/aubinator.c')
-rw-r--r--src/intel/tools/aubinator.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index f1bedd271e1..53b2a27fa90 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -95,10 +95,28 @@ valid_offset(uint32_t offset)
return offset < gtt_end;
}
+/**
+ * Set group variable size for groups with count="0".
+ *
+ * By default the group size is fixed and not needed because the struct
+ * describing a group knows the number of elements. However, for groups with
+ * count="0" we have a variable number of elements, and the struct describing
+ * the group only includes one of them. So we calculate the remaining size of
+ * the group based on the size we get here, and the offset after the last
+ * element added to the group.
+ */
+static void
+group_set_size(struct gen_group *strct, uint32_t size)
+{
+ if (strct->variable && strct->elem_size)
+ strct->group_size = size - (strct->variable_offset / 32);
+}
+
static void
decode_group(struct gen_group *strct, const uint32_t *p, int starting_dword)
{
uint64_t offset = option_print_offsets ? (void *) p - gtt : 0;
+
gen_print_group(outfile, strct, offset, p, option_color == COLOR_ALWAYS);
}
@@ -722,6 +740,7 @@ parse_commands(struct gen_spec *spec, uint32_t *cmds, int size, int engine)
gen_group_get_name(inst), reset_color);
if (option_full_decode) {
+ group_set_size(inst, length);
decode_group(inst, p, 0);
for (i = 0; i < ARRAY_LENGTH(custom_handlers); i++) {