From c76eb7ea8490e630451beb056b4294fd846902d2 Mon Sep 17 00:00:00 2001 From: Andreas Baierl Date: Thu, 17 Oct 2019 12:21:13 +0200 Subject: [PATCH] lima: Beautify stream dumps Change the dump, that the output looks more like the output of mali-syscall-tracker [1]. This is a preparation for a more detailed stream analysis. Reviewed-by: Qiang Yu Signed-off-by: Andreas Baierl [1]: https://gitlab.freedesktop.org/lima/mali-syscall-tracker --- src/gallium/drivers/lima/lima_util.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/lima/lima_util.c b/src/gallium/drivers/lima/lima_util.c index 9e1cdf646b9..579eba7ec3d 100644 --- a/src/gallium/drivers/lima/lima_util.c +++ b/src/gallium/drivers/lima/lima_util.c @@ -51,18 +51,22 @@ bool lima_get_absolute_timeout(uint64_t *timeout) void lima_dump_blob(FILE *fp, void *data, int size, bool is_float) { + fprintf(fp, "{\n"); for (int i = 0; i * 4 < size; i++) { - if (i % 4 == 0) { - if (i) fprintf(fp, "\n"); - fprintf(fp, "%04x:", i * 4); - } + if (i % 4 == 0) + fprintf(fp, "\t"); if (is_float) - fprintf(fp, " %f", ((float *)data)[i]); + fprintf(fp, "%f, ", ((float *)data)[i]); else - fprintf(fp, " 0x%08x", ((uint32_t *)data)[i]); + fprintf(fp, "0x%08x, ", ((uint32_t *)data)[i]); + + if ((i % 4 == 3) || (i == size / 4 - 1)) { + fprintf(fp, "/* 0x%08x */", (i - 3) * 4); + if (i) fprintf(fp, "\n"); + } } - fprintf(fp, "\n"); + fprintf(fp, "}\n"); } void -- 2.30.2