Mesa (main): freedreno/afuc: Extract full gpu-id

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 1 00:30:14 UTC 2021


Module: Mesa
Branch: main
Commit: 9a4ca194e8f918e3f90fed737c9686e1e4ca58af
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9a4ca194e8f918e3f90fed737c9686e1e4ca58af

Author: Rob Clark <robdclark at chromium.org>
Date:   Thu May 27 11:04:42 2021 -0700

freedreno/afuc: Extract full gpu-id

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 at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>

---

 src/freedreno/.gitlab-ci/genoutput.sh |  2 +-
 src/freedreno/afuc/disasm.c           | 22 +++++++++++++++-------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/freedreno/.gitlab-ci/genoutput.sh b/src/freedreno/.gitlab-ci/genoutput.sh
index 30adc8a9dce..e97daa6e079 100755
--- a/src/freedreno/.gitlab-ci/genoutput.sh
+++ b/src/freedreno/.gitlab-ci/genoutput.sh
@@ -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
diff --git a/src/freedreno/afuc/disasm.c b/src/freedreno/afuc/disasm.c
index 44e7eaf1017..78377f0e230 100644
--- a/src/freedreno/afuc/disasm.c
+++ b/src/freedreno/afuc/disasm.c
@@ -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.



More information about the mesa-commit mailing list