diff options
author | Jason Ekstrand <[email protected]> | 2017-12-13 00:10:12 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-12-14 13:27:10 -0800 |
commit | be20043d005a8c0a2a5e00383b02d43a6876dbd5 (patch) | |
tree | 3ca680ad05da174b49ee1dfaf668053c0bdece0a /src/intel/common/gen_decoder.h | |
parent | 4cb96fbd91a50bf87d0ac4e014de5986278ee7ee (diff) |
intel/tools: Add the start of a generic batch decoder
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/common/gen_decoder.h')
-rw-r--r-- | src/intel/common/gen_decoder.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/intel/common/gen_decoder.h b/src/intel/common/gen_decoder.h index fe3cf273ed6..b188787a76f 100644 --- a/src/intel/common/gen_decoder.h +++ b/src/intel/common/gen_decoder.h @@ -26,6 +26,7 @@ #include <stdint.h> #include <stdbool.h> +#include <stdio.h> #include "common/gen_device_info.h" #include "util/hash_table.h" @@ -183,6 +184,53 @@ void gen_print_group(FILE *out, uint64_t offset, const uint32_t *p, int p_bit, bool color); +enum gen_batch_decode_flags { + /** Print in color! */ + GEN_BATCH_DECODE_IN_COLOR = (1 << 0), + /** Print everything, not just headers */ + GEN_BATCH_DECODE_FULL = (1 << 1), + /** Print offsets along with the batch */ + GEN_BATCH_DECODE_OFFSETS = (1 << 2), +}; + +struct gen_batch_decode_bo { + uint64_t addr; + uint32_t size; + const void *map; +}; + +struct gen_disasm *disasm; + +struct gen_batch_decode_ctx { + struct gen_batch_decode_bo (*get_bo)(void *user_data, + uint64_t base_address); + void *user_data; + + FILE *fp; + struct gen_spec *spec; + enum gen_batch_decode_flags flags; + + struct gen_disasm *disasm; + + struct gen_batch_decode_bo surface_base; + struct gen_batch_decode_bo dynamic_base; + struct gen_batch_decode_bo instruction_base; +}; + +void gen_batch_decode_ctx_init(struct gen_batch_decode_ctx *ctx, + const struct gen_device_info *devinfo, + FILE *fp, enum gen_batch_decode_flags flags, + const char *xml_path, + struct gen_batch_decode_bo (*get_bo)(void *, + uint64_t), + void *user_data); +void gen_batch_decode_ctx_finish(struct gen_batch_decode_ctx *ctx); + + +void gen_print_batch(struct gen_batch_decode_ctx *ctx, + const uint32_t *batch, uint32_t batch_size, + uint64_t batch_addr); + #ifdef __cplusplus } #endif |