[Mesa-dev] [PATCH 30/33] intel: decoder: change find_instruction() to take first dword

Lionel Landwerlin lionel.g.landwerlin at intel.com
Mon Oct 30 16:58:43 UTC 2017


Another step into decoupling memory access from pointers.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
---
 src/intel/common/gen_decoder.c                | 4 ++--
 src/intel/common/gen_decoder.h                | 2 +-
 src/intel/tools/aubinator.c                   | 2 +-
 src/intel/tools/aubinator_error_decode.c      | 2 +-
 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
index 217e84fb38e..098ff472b37 100644
--- a/src/intel/common/gen_decoder.c
+++ b/src/intel/common/gen_decoder.c
@@ -685,13 +685,13 @@ void gen_spec_destroy(struct gen_spec *spec)
 }
 
 struct gen_group *
-gen_spec_find_instruction(struct gen_spec *spec, const uint32_t *p)
+gen_spec_find_instruction(struct gen_spec *spec, uint32_t dw0)
 {
    struct hash_entry *entry;
 
    hash_table_foreach(spec->commands, entry) {
       struct gen_group *command = entry->data;
-      uint32_t opcode = *p & command->opcode_mask;
+      uint32_t opcode = dw0 & command->opcode_mask;
       if (opcode == command->opcode)
          return command;
    }
diff --git a/src/intel/common/gen_decoder.h b/src/intel/common/gen_decoder.h
index 334cfaac2c2..b6cb735753d 100644
--- a/src/intel/common/gen_decoder.h
+++ b/src/intel/common/gen_decoder.h
@@ -50,7 +50,7 @@ struct gen_spec *gen_spec_load_from_path(const struct gen_device_info *devinfo,
                                          const char *path);
 void gen_spec_destroy(struct gen_spec *spec);
 uint32_t gen_spec_get_gen(struct gen_spec *spec);
-struct gen_group *gen_spec_find_instruction(struct gen_spec *spec, const uint32_t *p);
+struct gen_group *gen_spec_find_instruction(struct gen_spec *spec, const uint32_t dw0);
 struct gen_group *gen_spec_find_instruction_by_name(struct gen_spec *spec, const char *name);
 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);
diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 72f8d2aa4e8..abbebbb462f 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -698,7 +698,7 @@ parse_commands(struct gen_spec *spec, uint32_t *cmds, int size, int engine)
    struct gen_group *inst;
 
    for (p = cmds; p < end; p += length) {
-      inst = gen_spec_find_instruction(spec, p);
+      inst = gen_spec_find_instruction(spec, p[0]);
       length = gen_group_get_length(inst, p[0]);
       assert(inst == NULL || length > 0);
       length = MAX2(1, length);
diff --git a/src/intel/tools/aubinator_error_decode.c b/src/intel/tools/aubinator_error_decode.c
index 089683dac98..6573c2cc25b 100644
--- a/src/intel/tools/aubinator_error_decode.c
+++ b/src/intel/tools/aubinator_error_decode.c
@@ -249,7 +249,7 @@ static void decode(struct gen_spec *spec,
          *reset_color = NORMAL;
       uint64_t offset = gtt_offset + 4 * (p - data);
 
-      inst = gen_spec_find_instruction(spec, p);
+      inst = gen_spec_find_instruction(spec, p[0]);
       length = gen_group_get_length(inst, p[0]);
       assert(inst == NULL || length > 0);
       length = MAX2(1, length);
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 811f8a42f1e..0f6759d55aa 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -454,7 +454,7 @@ do_batch_dump(struct brw_context *brw)
    const char *reset_color  = color ? NORMAL : "";
 
    for (uint32_t *p = batch_data; p < end; p += length) {
-      struct gen_group *inst = gen_spec_find_instruction(spec, p);
+      struct gen_group *inst = gen_spec_find_instruction(spec, p[0]);
       length = gen_group_get_length(inst, p[0]);
       assert(inst == NULL || length > 0);
       length = MAX2(1, length);
-- 
2.15.0.rc2



More information about the mesa-dev mailing list