[Mesa-dev] [PATCH 04/18] panfrost/midgard/disasm: Varying perspective divides

Alyssa Rosenzweig alyssa.rosenzweig at collabora.com
Mon Jun 10 22:01:32 UTC 2019


With an extra flag, we're able to do a perspective division "for free"
while loading a varying.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
 .../drivers/panfrost/midgard/disassemble.c       | 13 ++++++++++---
 src/gallium/drivers/panfrost/midgard/midgard.h   | 16 +++++++++++++++-
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/panfrost/midgard/disassemble.c b/src/gallium/drivers/panfrost/midgard/disassemble.c
index b26ab5da8c9..8d21afeac1c 100644
--- a/src/gallium/drivers/panfrost/midgard/disassemble.c
+++ b/src/gallium/drivers/panfrost/midgard/disassemble.c
@@ -924,12 +924,19 @@ print_varying_parameters(midgard_load_store_word *word)
                         else
                                 printf(".interp%d", param.interpolation);
                 }
-        } else if (param.flat || param.interpolation) {
+
+                if (param.modifier != midgard_varying_mod_none) {
+                        if (param.modifier == midgard_varying_mod_perspective)
+                                printf(".perspective");
+                        else
+                                printf(".mod%d", param.modifier);
+                }
+        } else if (param.flat || param.interpolation || param.modifier) {
                 printf(" /* is_varying not set but varying metadata attached */");
         }
 
-        if (param.zero1 || param.zero2)
-                printf(" /* zero tripped, %d %d */ ", param.zero1, param.zero2);
+        if (param.zero0 || param.zero1 || param.zero2)
+                printf(" /* zero tripped, %d %d %d */ ", param.zero0, param.zero1, param.zero2);
 }
 
 static bool
diff --git a/src/gallium/drivers/panfrost/midgard/midgard.h b/src/gallium/drivers/panfrost/midgard/midgard.h
index 5f7e4862e66..4354efc97b8 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard.h
+++ b/src/gallium/drivers/panfrost/midgard/midgard.h
@@ -433,10 +433,24 @@ typedef enum {
         midgard_interp_default = 2
 } midgard_interpolation;
 
+typedef enum {
+        midgard_varying_mod_none = 0,
+
+        /* Other values unknown */
+
+        /* Take the would-be result and divide all components by its w
+         * (perspective division baked in with the load)  */
+        midgard_varying_mod_perspective = 3,
+} midgard_varying_modifier;
+
 typedef struct
 __attribute__((__packed__))
 {
-        unsigned zero1 : 4; /* Always zero */
+        unsigned zero0 : 1; /* Always zero */
+
+        midgard_varying_modifier modifier : 2;
+
+        unsigned zero1: 1; /* Always zero */
 
         /* Varying qualifiers, zero if not a varying */
         unsigned flat    : 1;
-- 
2.20.1



More information about the mesa-dev mailing list