X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fintel%2Fcommon%2Fgen_decoder.h;h=8b00b6edc2f29bd93baecd624d9e324717116bda;hb=13a7a2d4557a068fbf86af9eaa43b600fa8bce88;hp=b8666ca3044c0bfed161ac46d27848002bb1cc67;hpb=3ae5c579169a62ee11be23d1587792a45747b77f;p=mesa.git diff --git a/src/intel/common/gen_decoder.h b/src/intel/common/gen_decoder.h index b8666ca3044..8b00b6edc2f 100644 --- a/src/intel/common/gen_decoder.h +++ b/src/intel/common/gen_decoder.h @@ -28,10 +28,16 @@ #include #include "common/gen_device_info.h" +#include "util/hash_table.h" + +#ifdef __cplusplus +extern "C" { +#endif struct gen_spec; struct gen_group; struct gen_field; +union gen_field_value; static inline uint32_t gen_make_gen(uint32_t major, uint32_t minor) { @@ -42,21 +48,31 @@ struct gen_group *gen_spec_find_struct(struct gen_spec *spec, const char *name); struct gen_spec *gen_spec_load(const struct gen_device_info *devinfo); 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_register(struct gen_spec *spec, uint32_t offset); struct gen_group *gen_spec_find_register_by_name(struct gen_spec *spec, const char *name); +struct gen_enum *gen_spec_find_enum(struct gen_spec *spec, const char *name); + 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_field *gen_group_find_field(struct gen_group *group, const char *name); struct gen_enum *gen_spec_find_enum(struct gen_spec *spec, const char *name); +bool gen_field_is_header(struct gen_field *field); +void gen_field_decode(struct gen_field *field, + const uint32_t *p, const uint32_t *end, + union gen_field_value *value); + struct gen_field_iterator { struct gen_group *group; char name[128]; char value[128]; struct gen_group *struct_desc; const uint32_t *p; + const uint32_t *p_end; int dword; /**< current field starts at &p[dword] */ int start; /**< current field starts at this bit number */ int end; /**< current field ends at this bit number */ @@ -70,14 +86,13 @@ struct gen_field_iterator { struct gen_spec { uint32_t gen; - uint32_t ncommands; - struct gen_group *commands[256]; - uint32_t nstructs; - struct gen_group *structs[256]; - uint32_t nregisters; - struct gen_group *registers[256]; - uint32_t nenums; - struct gen_enum *enums[256]; + struct hash_table *commands; + struct hash_table *structs; + struct hash_table *registers_by_name; + struct hash_table *registers_by_offset; + struct hash_table *enums; + + struct hash_table *access_cache; }; struct gen_group { @@ -86,6 +101,7 @@ struct gen_group { struct gen_field *fields; /* linked list of fields */ + uint32_t dw_length; uint32_t group_offset, group_count; uint32_t group_size; bool variable; @@ -138,7 +154,15 @@ struct gen_type { }; }; +union gen_field_value { + bool b32; + float f32; + uint64_t u64; + int64_t i64; +}; + struct gen_field { + struct gen_group *parent; struct gen_field *next; char *name; @@ -162,4 +186,9 @@ void gen_print_group(FILE *out, uint64_t offset, const uint32_t *p, bool color); +#ifdef __cplusplus +} +#endif + + #endif /* GEN_DECODER_H */