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:
Kenneth Graunke
2021-10-26 14:46:21 -07:00
committed by Marge Bot
parent 58dc7f6ea6
commit e69d395cd1
3 changed files with 10 additions and 3 deletions
+3
View File
@@ -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);