Mesa (master): lima: Beautify stream dumps

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Nov 17 06:13:03 UTC 2019


Module: Mesa
Branch: master
Commit: c76eb7ea8490e630451beb056b4294fd846902d2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c76eb7ea8490e630451beb056b4294fd846902d2

Author: Andreas Baierl <ichgeh at imkreisrum.de>
Date:   Thu Oct 17 12:21:13 2019 +0200

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 <yuq825 at gmail.com>
Signed-off-by: Andreas Baierl <ichgeh at imkreisrum.de>

[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




More information about the mesa-commit mailing list