freedreno/afuc: Extract full gpu-id
authorRob Clark <robdclark@chromium.org>
Thu, 27 May 2021 18:04:42 +0000 (11:04 -0700)
committerMarge Bot <eric+marge@anholt.net>
Mon, 31 May 2021 23:34:43 +0000 (23:34 +0000)
Some of the a6xx gens will require some control reg initialization, and
go into an infinite loop if they don't see the values they expect, so
we'll need to extract the compute gpu-id.

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

src/freedreno/.gitlab-ci/genoutput.sh
src/freedreno/afuc/disasm.c

index 30adc8a..e97daa6 100755 (executable)
@@ -55,4 +55,4 @@ $cffdump --script $base/decode/scripts/parse-submits.lua $traces/shadow.rd.gz |
 $crashdec -sf $traces/crash.devcore | filter $output/crash.log
 
 $asm -g 6 $traces/afuc_test.asm $output/afuc_test.fw
-$disasm -g 6 $reference/afuc_test.fw | filter $output/afuc_test.asm
+$disasm -g 630 $reference/afuc_test.fw | filter $output/afuc_test.asm
index 44e7eaf..78377f0 100644 (file)
@@ -813,6 +813,7 @@ main(int argc, char **argv)
    uint32_t *buf;
    char *file;
    bool colors = false;
+   uint32_t gpu_id = 0;
    size_t sz;
    int c, ret;
 
@@ -820,7 +821,7 @@ main(int argc, char **argv)
    while ((c = getopt(argc, argv, "g:vce")) != -1) {
       switch (c) {
       case 'g':
-         gpuver = atoi(optarg);
+         gpu_id = atoi(optarg);
          break;
       case 'v':
          verbose = true;
@@ -845,14 +846,21 @@ main(int argc, char **argv)
    file = argv[optind];
 
    /* if gpu version not specified, infer from filename: */
-   if (!gpuver) {
-      if (strstr(file, "a5")) {
-         gpuver = 5;
-      } else if (strstr(file, "a6")) {
-         gpuver = 6;
-      }
+   if (!gpu_id) {
+      char *str = strstr(file, "a5");
+      if (!str)
+         str = strstr(file, "a6");
+      if (str)
+         gpu_id = atoi(str + 1);
    }
 
+   if (gpu_id < 500) {
+      printf("invalid gpu_id: %d\n", gpu_id);
+      return -1;
+   }
+
+   gpuver = gpu_id / 100;
+
    /* a6xx is *mostly* a superset of a5xx, but some opcodes shuffle
     * around, and behavior of special regs is a bit different.  Right
     * now we only bother to support the a6xx variant.