From: Nicolai Hähnle Date: Fri, 4 Aug 2017 16:55:39 +0000 (+0200) Subject: amd/common: split out ac_parse_ib_chunk from ac_parse_ib X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fbbb5f71cd02e33a4dc7bb1be5b468e638df7670;p=mesa.git amd/common: split out ac_parse_ib_chunk from ac_parse_ib Reviewed-by: Marek Olšák --- diff --git a/src/amd/common/ac_debug.c b/src/amd/common/ac_debug.c index 79473ecb8d0..42a72c086b1 100644 --- a/src/amd/common/ac_debug.c +++ b/src/amd/common/ac_debug.c @@ -390,12 +390,10 @@ static uint32_t *ac_parse_packet3(FILE *f, uint32_t *ib, int *num_dw, * be NULL. * \param addr_callback_data user data for addr_callback */ -void ac_parse_ib(FILE *f, uint32_t *ib, int num_dw, int trace_id, - const char *name, enum chip_class chip_class, - ac_debug_addr_callback addr_callback, void *addr_callback_data) +void ac_parse_ib_chunk(FILE *f, uint32_t *ib, int num_dw, int trace_id, + enum chip_class chip_class, + ac_debug_addr_callback addr_callback, void *addr_callback_data) { - fprintf(f, "------------------ %s begin ------------------\n", name); - while (num_dw > 0) { unsigned type = PKT_TYPE_G(ib[0]); @@ -420,10 +418,33 @@ void ac_parse_ib(FILE *f, uint32_t *ib, int num_dw, int trace_id, } } - fprintf(f, "------------------- %s end -------------------\n", name); if (num_dw < 0) { - printf("Packet ends after the end of IB.\n"); + printf("\nPacket ends after the end of IB.\n"); exit(0); } - fprintf(f, "\n"); +} + +/** + * Parse and print an IB into a file. + * + * \param f file + * \param ib IB + * \param num_dw size of the IB + * \param chip_class chip class + * \param trace_id the last trace ID that is known to have been reached + * and executed by the CP, typically read from a buffer + * \param addr_callback Get a mapped pointer of the IB at a given address. Can + * be NULL. + * \param addr_callback_data user data for addr_callback + */ +void ac_parse_ib(FILE *f, uint32_t *ib, int num_dw, int trace_id, + const char *name, enum chip_class chip_class, + ac_debug_addr_callback addr_callback, void *addr_callback_data) +{ + fprintf(f, "------------------ %s begin ------------------\n", name); + + ac_parse_ib_chunk(f, ib, num_dw, trace_id, chip_class, addr_callback, + addr_callback_data); + + fprintf(f, "------------------- %s end -------------------\n\n", name); } diff --git a/src/amd/common/ac_debug.h b/src/amd/common/ac_debug.h index 63ac4fa84d1..872420d2b9d 100644 --- a/src/amd/common/ac_debug.h +++ b/src/amd/common/ac_debug.h @@ -39,6 +39,9 @@ typedef void *(*ac_debug_addr_callback)(void *data, uint64_t addr); void ac_dump_reg(FILE *file, unsigned offset, uint32_t value, uint32_t field_mask); +void ac_parse_ib_chunk(FILE *f, uint32_t *ib, int num_dw, int trace_id, + enum chip_class chip_class, + ac_debug_addr_callback addr_callback, void *addr_callback_data); void ac_parse_ib(FILE *f, uint32_t *ib, int num_dw, int trace_id, const char *name, enum chip_class chip_class, ac_debug_addr_callback addr_callback, void *addr_callback_data);