freedreno/decode: Lookup device info
authorRob Clark <robdclark@chromium.org>
Wed, 20 Sep 2023 22:59:18 +0000 (15:59 -0700)
committerMarge Bot <emma+marge@anholt.net>
Fri, 22 Sep 2023 19:17:14 +0000 (19:17 +0000)
First step for migration to chip_id.  With newer devices we won't be
able to decode the chip_id in any meaningful way, ie. it is just a
number.  But we can use the device table to figure out things like
generation which are needed to properly decode cmdstream, etc.

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

src/freedreno/.gitlab-ci/reference/crash.log
src/freedreno/.gitlab-ci/reference/crash_prefetch.log
src/freedreno/.gitlab-ci/reference/prefetch-test.log
src/freedreno/decode/cffdec.h
src/freedreno/decode/cffdump.c
src/freedreno/decode/crashdec.c
src/freedreno/decode/crashdec.h

index 765c97a..94a1799 100644 (file)
@@ -5,7 +5,7 @@ time: 1593887022.767858793
 comm: crashit
 cmdline: ./crashit IB1 4 5
 revision: 630 (6.3.0.2)
-Got gpu_id=630
+Got chip_id=0x6030002
 rbbm-status: 0x00000000
 ringbuffer:
   - id: 0
index cab1f6f..eabec47 100644 (file)
@@ -6,7 +6,7 @@ comm: deqp-vk
 cmdline: ./deqp-vk --deqp-log-images=enable --deqp-log-filename=/home/anholt/TestResults.qpa --deqp-surface-type=pbuffer --deqp-surface-width=256 --deqp-surface-height=256 --deqp-gl-config-name=rgba8888d24s8ms0 --deqp-case=dEQP-VK.renderpass2.dedicated_allocation.attachment_allocation.roll.46
 gpu-initialized: 1
 revision: 618 (6.1.8.0)
-Got gpu_id=618
+Got chip_id=0x6010800
 rbbm-status: 0x00000000
 ringbuffer:
   - id: 0
index c8b05bc..3c43f9b 100644 (file)
@@ -6,7 +6,7 @@ comm: testfw_app:sq0
 cmdline: ./testfw_app --gfx glfw --gl_api=gles -t gl_driver2_short
 gpu-initialized: 1
 revision: 618 (6.1.8.0)
-Got gpu_id=618
+Got chip_id=0x6010800
 rbbm-status: 0x00000000
 ringbuffer:
   - id: 0
index d277aca..7ef0688 100644 (file)
@@ -46,6 +46,7 @@ enum query_mode {
 
 struct cffdec_options {
    struct fd_dev_id dev_id;
+   const struct fd_dev_info *info;
    unsigned gpu_id;
    int draw_filter;
    int color;
index 00f7b76..6a9b2df 100644 (file)
@@ -339,10 +339,10 @@ handle_file(const char *filename, int start, int end, int draw)
             options.dev_id.gpu_id = gpu_id;
             printl(2, "gpu_id: %d\n", options.dev_id.gpu_id);
 
-            const struct fd_dev_info *info = fd_dev_info(&options.dev_id);
-            if (!info)
+            options.info = fd_dev_info(&options.dev_id);
+            if (!options.info)
                break;
-            options.gpu_id = info->chip * 100;
+            options.gpu_id = options.info->chip * 100;
 
             cffdec_init(&options);
             got_gpu_id = 1;
@@ -353,10 +353,10 @@ handle_file(const char *filename, int start, int end, int draw)
             options.dev_id.chip_id = parse_chip_id(ps.buf);
             printl(2, "chip_id: 0x%" PRIx64 "\n", options.dev_id.chip_id);
 
-            const struct fd_dev_info *info = fd_dev_info(&options.dev_id);
-            if (!info)
+            options.info = fd_dev_info(&options.dev_id);
+            if (!options.info)
                break;
-            options.gpu_id = info->chip * 100;
+            options.gpu_id = options.info->chip * 100;
 
             cffdec_init(&options);
             got_gpu_id = 1;
index 2b6e99b..256f9a9 100644 (file)
@@ -767,14 +767,19 @@ decode(void)
       if (startswith(line, "revision:")) {
          unsigned core, major, minor, patchid;
 
-         parseline(line, "revision: %u (%u.%u.%u.%u)", &options.gpu_id,
+         parseline(line, "revision: %u (%u.%u.%u.%u)", &options.dev_id.gpu_id,
                    &core, &major, &minor, &patchid);
 
-         if (options.gpu_id == 0) {
-            options.gpu_id = (core * 100) + (major * 10) + minor;
+         options.dev_id.chip_id = (core << 24) | (major << 16) | (minor << 8) | patchid;
+         options.info = fd_dev_info(&options.dev_id);
+         if (!options.info) {
+            printf("Unsupported device\n");
+            break;
          }
 
-         printf("Got gpu_id=%u\n", options.gpu_id);
+         options.gpu_id = options.dev_id.gpu_id;
+
+         printf("Got chip_id=0x%"PRIx64"\n", options.dev_id.chip_id);
 
          cffdec_init(&options);
 
index e181b5b..b6191c9 100644 (file)
@@ -74,7 +74,7 @@ is_64b(void)
 static inline bool
 is_gmu_legacy(void)
 {
-   switch (options.gpu_id) {
+   switch (options.dev_id.gpu_id) {
    case 615:
    case 618:
    case 630: