[Mesa-dev] [PATCH 29/33] intel: decoder: change group_get_length() to take first dword
Lionel Landwerlin
lionel.g.landwerlin at intel.com
Mon Oct 30 16:58:42 UTC 2017
This is a first step in not accessing the dwords through pointers.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
---
src/intel/common/gen_decoder.c | 27 +++++++++++++--------------
src/intel/common/gen_decoder.h | 2 +-
src/intel/tools/aubinator.c | 4 ++--
src/intel/tools/aubinator_error_decode.c | 2 +-
src/mesa/drivers/dri/i965/intel_batchbuffer.c | 2 +-
5 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
index bd39ff3654c..217e84fb38e 100644
--- a/src/intel/common/gen_decoder.c
+++ b/src/intel/common/gen_decoder.c
@@ -726,35 +726,34 @@ gen_group_find_field(struct gen_group *group, const char *name)
}
int
-gen_group_get_length(struct gen_group *group, const uint32_t *p)
+gen_group_get_length(struct gen_group *group, uint32_t dw0)
{
- uint32_t h = p[0];
- uint32_t type = field_value(h, 29, 31);
+ uint32_t type = field_value(dw0, 29, 31);
switch (type) {
case 0: /* MI */ {
- uint32_t opcode = field_value(h, 23, 28);
+ uint32_t opcode = field_value(dw0, 23, 28);
if (opcode < 16)
return 1;
else
- return field_value(h, 0, 7) + 2;
+ return field_value(dw0, 0, 7) + 2;
break;
}
case 2: /* BLT */ {
- return field_value(h, 0, 7) + 2;
+ return field_value(dw0, 0, 7) + 2;
}
case 3: /* Render */ {
- uint32_t subtype = field_value(h, 27, 28);
- uint32_t opcode = field_value(h, 24, 26);
- uint16_t whole_opcode = field_value(h, 16, 31);
+ uint32_t subtype = field_value(dw0, 27, 28);
+ uint32_t opcode = field_value(dw0, 24, 26);
+ uint16_t whole_opcode = field_value(dw0, 16, 31);
switch (subtype) {
case 0:
if (whole_opcode == 0x6104 /* PIPELINE_SELECT_965 */)
return 1;
else if (opcode < 2)
- return field_value(h, 0, 7) + 2;
+ return field_value(dw0, 0, 7) + 2;
else
return -1;
case 1:
@@ -764,9 +763,9 @@ gen_group_get_length(struct gen_group *group, const uint32_t *p)
return -1;
case 2: {
if (opcode == 0)
- return field_value(h, 0, 7) + 2;
+ return field_value(dw0, 0, 7) + 2;
else if (opcode < 3)
- return field_value(h, 0, 15) + 2;
+ return field_value(dw0, 0, 15) + 2;
else
return -1;
}
@@ -774,7 +773,7 @@ gen_group_get_length(struct gen_group *group, const uint32_t *p)
if (whole_opcode == 0x780b)
return 1;
else if (opcode < 4)
- return field_value(h, 0, 7) + 2;
+ return field_value(dw0, 0, 7) + 2;
else
return -1;
}
@@ -978,7 +977,7 @@ gen_field_iterator_init(struct gen_field_iterator *iter,
else
iter->field = group->next->fields;
iter->p = p;
- iter->end = &p[gen_group_get_length(iter->group, iter->p)];
+ iter->end = &p[gen_group_get_length(iter->group, p[0])];
iter->print_colors = print_colors;
iter_decode_field(iter);
diff --git a/src/intel/common/gen_decoder.h b/src/intel/common/gen_decoder.h
index 89ce05ef6d0..334cfaac2c2 100644
--- a/src/intel/common/gen_decoder.h
+++ b/src/intel/common/gen_decoder.h
@@ -56,7 +56,7 @@ struct gen_group *gen_spec_find_register(struct gen_spec *spec, uint32_t offset)
struct gen_group *gen_spec_find_register_by_name(struct gen_spec *spec, const char *name);
struct gen_enum *gen_spec_find_enum(struct gen_spec *spec, const char *name);
-int gen_group_get_length(struct gen_group *group, const uint32_t *p);
+int gen_group_get_length(struct gen_group *group, uint32_t dw0);
const char *gen_group_get_name(struct gen_group *group);
uint32_t gen_group_get_opcode(struct gen_group *group);
struct gen_field *gen_group_find_field(struct gen_group *group, const char *name);
diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 436a4928979..72f8d2aa4e8 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -699,7 +699,7 @@ parse_commands(struct gen_spec *spec, uint32_t *cmds, int size, int engine)
for (p = cmds; p < end; p += length) {
inst = gen_spec_find_instruction(spec, p);
- length = gen_group_get_length(inst, p);
+ length = gen_group_get_length(inst, p[0]);
assert(inst == NULL || length > 0);
length = MAX2(1, length);
if (inst == NULL) {
@@ -732,7 +732,7 @@ parse_commands(struct gen_spec *spec, uint32_t *cmds, int size, int engine)
fprintf(outfile, "%s0x%08"PRIx64": 0x%08x: %s (%i Dwords) %-80s %s\n",
color, offset, p[0],
gen_group_get_name(inst),
- gen_group_get_length(inst, p),
+ gen_group_get_length(inst, p[0]),
"",
reset_color);
diff --git a/src/intel/tools/aubinator_error_decode.c b/src/intel/tools/aubinator_error_decode.c
index 52c323e77ee..089683dac98 100644
--- a/src/intel/tools/aubinator_error_decode.c
+++ b/src/intel/tools/aubinator_error_decode.c
@@ -250,7 +250,7 @@ static void decode(struct gen_spec *spec,
uint64_t offset = gtt_offset + 4 * (p - data);
inst = gen_spec_find_instruction(spec, p);
- length = gen_group_get_length(inst, p);
+ length = gen_group_get_length(inst, p[0]);
assert(inst == NULL || length > 0);
length = MAX2(1, length);
if (inst == NULL) {
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 1a366c78b00..811f8a42f1e 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -455,7 +455,7 @@ do_batch_dump(struct brw_context *brw)
for (uint32_t *p = batch_data; p < end; p += length) {
struct gen_group *inst = gen_spec_find_instruction(spec, p);
- length = gen_group_get_length(inst, p);
+ length = gen_group_get_length(inst, p[0]);
assert(inst == NULL || length > 0);
length = MAX2(1, length);
if (inst == NULL) {
--
2.15.0.rc2
More information about the mesa-dev
mailing list