mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-11 01:30:25 +01:00
intel/genxml: Add an "mbz" data type
There are some fields which Must Be Zero, and we don't want to allow setting them from the template struct, but we do want them in the XML to allow them to be decoded properly, and for documentation purposes. This adds a new "mbz" type, much like "mbo", except it doesn't set anything in the struct. We also update the decoder to handle it. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13480>
This commit is contained in:
parent
58dc7f6ea6
commit
e69d395cd1
3 changed files with 10 additions and 3 deletions
|
|
@ -303,6 +303,8 @@ string_to_type(struct parser_context *ctx, const char *s)
|
|||
return (struct intel_type) { .kind = INTEL_TYPE_ENUM, .intel_enum = e };
|
||||
else if (strcmp(s, "mbo") == 0)
|
||||
return (struct intel_type) { .kind = INTEL_TYPE_MBO };
|
||||
else if (strcmp(s, "mbz") == 0)
|
||||
return (struct intel_type) { .kind = INTEL_TYPE_MBZ };
|
||||
else
|
||||
fail(&ctx->loc, "invalid type: %s", s);
|
||||
}
|
||||
|
|
@ -1058,6 +1060,7 @@ iter_decode_field(struct intel_field_iterator *iter)
|
|||
enum_name = intel_get_enum_name(&iter->field->inline_enum, v.qw);
|
||||
break;
|
||||
}
|
||||
case INTEL_TYPE_MBZ:
|
||||
case INTEL_TYPE_UINT: {
|
||||
snprintf(iter->value, sizeof(iter->value), "%"PRIu64, v.qw);
|
||||
enum_name = intel_get_enum_name(&iter->field->inline_enum, v.qw);
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ struct intel_type {
|
|||
INTEL_TYPE_UFIXED,
|
||||
INTEL_TYPE_SFIXED,
|
||||
INTEL_TYPE_MBO,
|
||||
INTEL_TYPE_MBZ,
|
||||
INTEL_TYPE_ENUM
|
||||
} kind;
|
||||
|
||||
|
|
|
|||
|
|
@ -245,7 +245,8 @@ class Field(object):
|
|||
|
||||
def is_builtin_type(self):
|
||||
builtins = [ 'address', 'bool', 'float', 'ufixed',
|
||||
'offset', 'sfixed', 'offset', 'int', 'uint', 'mbo' ]
|
||||
'offset', 'sfixed', 'offset', 'int', 'uint',
|
||||
'mbo', 'mbz' ]
|
||||
return self.type in builtins
|
||||
|
||||
def is_struct_type(self):
|
||||
|
|
@ -277,7 +278,7 @@ class Field(object):
|
|||
type = 'struct ' + self.parser.gen_prefix(safe_name(self.type))
|
||||
elif self.is_enum_type():
|
||||
type = 'enum ' + self.parser.gen_prefix(safe_name(self.type))
|
||||
elif self.type == 'mbo':
|
||||
elif self.type == 'mbo' or self.type == 'mbz':
|
||||
return
|
||||
else:
|
||||
print("#error unhandled type: %s" % self.type)
|
||||
|
|
@ -431,12 +432,14 @@ class Group(object):
|
|||
field_index = 0
|
||||
non_address_fields = []
|
||||
for field in dw.fields:
|
||||
if field.type != "mbo":
|
||||
if field.type != "mbo" and field.type != "mbz":
|
||||
name = field.name + field.dim
|
||||
|
||||
if field.type == "mbo":
|
||||
non_address_fields.append("__gen_mbo(%d, %d)" % \
|
||||
(field.start - dword_start, field.end - dword_start))
|
||||
elif field.type == "mbz":
|
||||
pass
|
||||
elif field.type == "address":
|
||||
pass
|
||||
elif field.type == "uint":
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue