freedreno/decode: Handle chip-id
authorRob Clark <robdclark@chromium.org>
Fri, 14 Jan 2022 21:35:16 +0000 (13:35 -0800)
committerMarge Bot <emma+marge@anholt.net>
Fri, 14 Jan 2022 23:17:03 +0000 (23:17 +0000)
For cmdstream traces from newer devices, we need to identify the gpu
based on chip-id.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14564>

src/freedreno/decode/cffdump.c
src/freedreno/decode/redump.h

index 0ed1989..0220b23 100644 (file)
@@ -370,7 +370,21 @@ handle_file(const char *filename, int start, int end, int draw)
          break;
       case RD_GPU_ID:
          if (!got_gpu_id) {
-            options.gpu_id = *((unsigned int *)buf);
+            uint32_t gpu_id = *((unsigned int *)buf);
+            if (!gpu_id)
+               break;
+            options.gpu_id = gpu_id;
+            printl(2, "gpu_id: %d\n", options.gpu_id);
+            cffdec_init(&options);
+            got_gpu_id = 1;
+         }
+         break;
+      case RD_CHIP_ID:
+         if (!got_gpu_id) {
+            uint64_t chip_id = *((uint64_t *)buf);
+            options.gpu_id = 100 * ((chip_id >> 24) & 0xff) +
+                  10 * ((chip_id >> 16) & 0xff) +
+                  ((chip_id >> 8) & 0xff);
             printl(2, "gpu_id: %d\n", options.gpu_id);
             cffdec_init(&options);
             got_gpu_id = 1;
index 5c4b8f0..bf202d8 100644 (file)
@@ -41,6 +41,7 @@ enum rd_sect_type {
    RD_FRAG_SHADER,
    RD_BUFFER_CONTENTS,
    RD_GPU_ID,
+   RD_CHIP_ID,
 };
 
 /* RD_PARAM types: */