pan/bi: Pretty-print clause types in disassembler
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 18 Mar 2020 17:23:00 +0000 (13:23 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 19 Mar 2020 03:23:07 +0000 (03:23 +0000)
Also note that type=1 is for load_vary.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4242>

src/panfrost/bifrost/bi_print.c
src/panfrost/bifrost/bi_print.h
src/panfrost/bifrost/bifrost.h
src/panfrost/bifrost/disassemble.c

index 389d4fff409f46f69d1a906b13af51c61ca7882b..2a03b3cab5d8fff34bf39f5620301be9d80cb1a8 100644 (file)
 
 #include "bi_print.h"
 
+const char *
+bi_clause_type_name(enum bifrost_clause_type T)
+{
+        switch (T) {
+        case BIFROST_CLAUSE_NONE: return "";
+        case BIFROST_CLAUSE_LOAD_VARY: return "load_vary";
+        case BIFROST_CLAUSE_UBO: return "ubo";
+        case BIFROST_CLAUSE_TEX: return "tex";
+        case BIFROST_CLAUSE_SSBO_LOAD: return "load";
+        case BIFROST_CLAUSE_SSBO_STORE: return "store";
+        case BIFROST_CLAUSE_BLEND: return "blend";
+        case BIFROST_CLAUSE_ATEST: return "atest";
+        case BIFROST_CLAUSE_64BIT: return "64";
+        default: return "??";
+        }
+}
+
 const char *
 bi_output_mod_name(enum bifrost_outmod mod)
 {
index 545f5254ae4cf5cf4381ee1b3da05cf114f8b2fb..04e3851c11f43dcc06438022941fc32b1bfb8dd6 100644 (file)
@@ -31,6 +31,7 @@
 #include "bifrost.h"
 #include "compiler.h"
 
+const char * bi_clause_type_name(enum bifrost_clause_type T);
 const char * bi_output_mod_name(enum bifrost_outmod mod);
 const char * bi_minmax_mode_name(enum bifrost_minmax_mode mod);
 const char * bi_round_mode_name(enum bifrost_roundmode mod);
index c7e6bcf8630bdc00eeca60fdfa23dd4a6008bb69..959ef94f6c10622adbd867bf57182f60e44c9c4b 100644 (file)
 #include <stdint.h>
 #include <stdbool.h>
 
+enum bifrost_clause_type {
+        BIFROST_CLAUSE_NONE       = 0,
+        BIFROST_CLAUSE_LOAD_VARY  = 1,
+        BIFROST_CLAUSE_UBO        = 2,
+        BIFROST_CLAUSE_TEX        = 3,
+        BIFROST_CLAUSE_SSBO_LOAD  = 5,
+        BIFROST_CLAUSE_SSBO_STORE = 6,
+        BIFROST_CLAUSE_BLEND      = 9,
+        BIFROST_CLAUSE_ATEST      = 13,
+        BIFROST_CLAUSE_64BIT      = 15
+};
+
 struct bifrost_header {
         unsigned unk0 : 7;
         // If true, convert any infinite result of any floating-point operation to
@@ -66,9 +78,9 @@ struct bifrost_header {
         unsigned datareg : 6;
         unsigned scoreboard_deps: 8;
         unsigned scoreboard_index: 3;
-        unsigned clause_type: 4;
+        enum bifrost_clause_type clause_type: 4;
         unsigned unk3 : 1; // part of clauseType?
-        unsigned next_clause_type: 4;
+        enum bifrost_clause_type next_clause_type: 4;
         unsigned unk4 : 1; // part of nextClauseType?
 } __attribute__((packed));
 
index 367cc5b96262b434808949b29621a894bf1c3c85..e025d5c89d4d90e9ed9b569026a10d7eb9297443 100644 (file)
@@ -136,8 +136,15 @@ bool dump_clause(FILE *fp, uint32_t *words, unsigned *size, unsigned offset, boo
 
 void dump_header(FILE *fp, struct bifrost_header header, bool verbose)
 {
+        fprintf(fp, "id(%du) ", header.scoreboard_index);
+
         if (header.clause_type != 0) {
-                fprintf(fp, "id(%du) ", header.scoreboard_index);
+                const char *name = bi_clause_type_name(header.clause_type);
+
+                if (name[0] == '?')
+                        fprintf(fp, "unk%u ", header.clause_type);
+                else
+                        fprintf(fp, "%s ", name);
         }
 
         if (header.scoreboard_deps != 0) {