diff options
author | Bas Nieuwenhuizen <[email protected]> | 2017-01-01 16:47:12 +0100 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2017-01-09 21:44:08 +0100 |
commit | 8cb60c7dd3cb608615d3e5f89ad4198c0babdb3d (patch) | |
tree | 0a5a7651fced7daf712da778e22637529832b0e8 /src/amd/common/ac_debug.c | |
parent | 97dfff54105ac10b6e2daace020687eefdcc28c0 (diff) |
ac/debug: Dump indirect buffers.
This is for handling chained command buffers and secondary command
buffers. It doesn't handle the trace id for secondary command buffers
yet, but I don't think that is possible in general with just writes,
as we could call a secondary command buffer multiple times.
I think this is good enough for now, as the most useful case is the
chaining when we grow an IB.
Signed-off-by: Bas Nieuwenhuizen <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/common/ac_debug.c')
-rw-r--r-- | src/amd/common/ac_debug.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/amd/common/ac_debug.c b/src/amd/common/ac_debug.c index d068492885e..f91e448a47f 100644 --- a/src/amd/common/ac_debug.c +++ b/src/amd/common/ac_debug.c @@ -139,7 +139,9 @@ static void ac_parse_set_reg_packet(FILE *f, uint32_t *ib, unsigned count, } static uint32_t *ac_parse_packet3(FILE *f, uint32_t *ib, int *num_dw, - int trace_id, enum chip_class chip_class) + int trace_id, enum chip_class chip_class, + ac_debug_addr_callback addr_callback, + void *addr_callback_data) { unsigned count = PKT_COUNT_G(ib[0]); unsigned op = PKT3_IT_OPCODE_G(ib[0]); @@ -258,6 +260,17 @@ static uint32_t *ac_parse_packet3(FILE *f, uint32_t *ib, int *num_dw, ac_dump_reg(f, R_3F0_IB_BASE_LO, ib[1], ~0); ac_dump_reg(f, R_3F1_IB_BASE_HI, ib[2], ~0); ac_dump_reg(f, R_3F2_CONTROL, ib[3], ~0); + + if (addr_callback) { + uint64_t addr = ((uint64_t)ib[2] << 32) | ib[1]; + void *data = addr_callback(addr_callback_data, addr); + const char *name = G_3F2_CHAIN(ib[3]) ? "chained" : "nested"; + + if (data) + ac_parse_ib(f, data, G_3F2_IB_SIZE(ib[3]), + trace_id, name, chip_class, + addr_callback, addr_callback_data); + } break; case PKT3_CLEAR_STATE: case PKT3_INCREMENT_DE_COUNTER: @@ -320,9 +333,13 @@ static uint32_t *ac_parse_packet3(FILE *f, uint32_t *ib, int *num_dw, * \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) + const char *name, enum chip_class chip_class, + ac_debug_addr_callback addr_callback, void *addr_callback_data) { fprintf(f, "------------------ %s begin ------------------\n", name); @@ -332,7 +349,8 @@ void ac_parse_ib(FILE *f, uint32_t *ib, int num_dw, int trace_id, switch (type) { case 3: ib = ac_parse_packet3(f, ib, &num_dw, trace_id, - chip_class); + chip_class, addr_callback, + addr_callback_data); break; case 2: /* type-2 nop */ |