pan/midgard: Breakout texture reg select printer
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 19 Aug 2019 15:09:57 +0000 (08:09 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 21 Aug 2019 17:41:15 +0000 (10:41 -0700)
This data structure is shared in other parts of the texture word, so
let's streamline printing.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/panfrost/midgard/disassemble.c

index 9174bef33a8fc3291606a4fa4720016f5df2987f..eba9cb1505dcbe80cccc6e10d3ad351bdca86a78 100644 (file)
@@ -1101,6 +1101,30 @@ print_texture_reg_triple(unsigned triple)
         print_texture_reg(full, select, upper);
 }
 
+static void
+print_texture_reg_select(uint8_t u)
+{
+        midgard_tex_register_select sel;
+        memcpy(&sel, &u, sizeof(u));
+
+        if (!sel.full)
+                printf("h");
+
+        printf("r%d", REG_TEX_BASE + sel.select);
+
+        unsigned component = sel.component;
+
+        /* Use the upper half in half-reg mode */
+        if (sel.upper) {
+                assert(!sel.full);
+                component += 4;
+        }
+
+        printf(".%c", components[component]);
+
+        assert(sel.zero == 0);
+}
+
 static void
 print_texture_format(int format)
 {
@@ -1273,19 +1297,12 @@ print_texture_word(uint32_t *word, unsigned tabs)
         char lod_operand = texture_op_takes_bias(texture->op) ? '+' : '=';
 
         if (texture->lod_register) {
-                midgard_tex_register_select sel;
-                uint8_t raw = texture->bias;
-                memcpy(&sel, &raw, sizeof(raw));
-
                 printf("lod %c ", lod_operand);
-                print_texture_reg(sel.full, sel.select, sel.upper);
-                printf(".%c, ", components[sel.component]);
+                print_texture_reg_select(texture->bias);
+                printf(", ");
 
                 if (texture->bias_int)
                         printf(" /* bias_int = 0x%X */", texture->bias_int);
-
-                if (sel.zero)
-                        printf(" /* sel.zero = 0x%X */", sel.zero);
         } else if (texture->op == TEXTURE_OP_TEXEL_FETCH) {
                 /* For texel fetch, the int LOD is in the fractional place and
                  * there is no fraction / possibility of bias. We *always* have