[Mesa-dev] [PATCH v2 08/11] intel: decoder: change find_instruction() to take first dword

Lionel Landwerlin lionel.g.landwerlin at intel.com
Wed Nov 1 18:12:15 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 b8f7c3c79a7..7aebcef278c 100644
--- a/src/intel/common/gen_decoder.c
+++ b/src/intel/common/gen_decoder.c
@@ -677,13 +677,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 971fe04d2bd..d4a5984e578 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 a5141c34d78..bf9490e315f 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -692,7 +692,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 fef85ffde1f..0881a8ef502 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



More information about the mesa-dev mailing list