[04/18] panfrost/midgard/disasm: Varying perspective divides

Submitted by Alyssa Rosenzweig on June 10, 2019, 10:01 p.m.

Details

Message ID 20190610220146.7832-5-alyssa.rosenzweig@collabora.com
State New
Headers show
Series "panfrost/midgard: Decode GLES3 texture op" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Alyssa Rosenzweig June 10, 2019, 10:01 p.m.
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@collabora.com>
---
 .../drivers/panfrost/midgard/disassemble.c       | 13 ++++++++++---
 src/gallium/drivers/panfrost/midgard/midgard.h   | 16 +++++++++++++++-
 2 files changed, 25 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

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;