[Mesa-dev] [PATCH 18/33] intel: decoder: simplify field_is_header()

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


Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
---
 src/intel/common/gen_decoder.c | 7 ++++---
 src/intel/common/gen_decoder.h | 3 ++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
index 050926f5642..94e7e15399f 100644
--- a/src/intel/common/gen_decoder.c
+++ b/src/intel/common/gen_decoder.c
@@ -288,6 +288,7 @@ create_field(struct parser_context *ctx, const char **atts)
    struct gen_field *field;
 
    field = rzalloc(ctx->group, struct gen_field);
+   field->parent = ctx->group;
 
    for (int i = 0; atts[i]; i += 2) {
       char *p;
@@ -952,7 +953,7 @@ print_dword_header(FILE *outfile,
 }
 
 bool
-gen_group_header_is_header(struct gen_group *group, struct gen_field *field)
+gen_field_is_header(struct gen_field *field)
 {
    uint32_t bits;
 
@@ -962,7 +963,7 @@ gen_group_header_is_header(struct gen_group *group, struct gen_field *field)
    bits = (1U << (field->end - field->start + 1)) - 1;
    bits <<= field->start;
 
-   return (group->opcode_mask & bits) != 0;
+   return (field->parent->opcode_mask & bits) != 0;
 }
 
 void
@@ -979,7 +980,7 @@ gen_print_group(FILE *outfile, struct gen_group *group,
             print_dword_header(outfile, &iter, offset, i);
          last_dword = iter.dword;
       }
-      if (!gen_group_header_is_header(group, iter.field)) {
+      if (!gen_field_is_header(iter.field)) {
          fprintf(outfile, "    %s: %s\n", iter.name, iter.value);
          if (iter.struct_desc) {
             uint64_t struct_offset = offset + 4 * iter.dword;
diff --git a/src/intel/common/gen_decoder.h b/src/intel/common/gen_decoder.h
index 2c54eed267b..658dd7f7b09 100644
--- a/src/intel/common/gen_decoder.h
+++ b/src/intel/common/gen_decoder.h
@@ -56,7 +56,7 @@ int gen_group_get_length(struct gen_group *group, const uint32_t *p);
 const char *gen_group_get_name(struct gen_group *group);
 uint32_t gen_group_get_opcode(struct gen_group *group);
 struct gen_enum *gen_spec_find_enum(struct gen_spec *spec, const char *name);
-bool gen_group_header_is_header(struct gen_group *group, struct gen_field *field);
+bool gen_field_is_header(struct gen_field *field);
 
 struct gen_field_iterator {
    struct gen_group *group;
@@ -143,6 +143,7 @@ struct gen_type {
 };
 
 struct gen_field {
+   struct gen_group *parent;
    struct gen_field *next;
 
    char *name;
-- 
2.15.0.rc2



More information about the mesa-dev mailing list