From 109460f03a1f1b09411c1be3b3eb7c6a3a63d754 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 10 Jun 2019 11:18:41 -0700 Subject: [PATCH] panfrost/midgard/disasm: Varying perspective divides With an extra flag, we're able to do a perspective division "for free" while loading a varying. Signed-off-by: Alyssa Rosenzweig --- .../drivers/panfrost/midgard/disassemble.c | 15 ++++++++++++--- src/gallium/drivers/panfrost/midgard/midgard.h | 17 ++++++++++++++++- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/panfrost/midgard/disassemble.c b/src/gallium/drivers/panfrost/midgard/disassemble.c index 9796eaa2d09..084064eb615 100644 --- a/src/gallium/drivers/panfrost/midgard/disassemble.c +++ b/src/gallium/drivers/panfrost/midgard/disassemble.c @@ -924,12 +924,21 @@ 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_w) + printf(".perspectivew"); + else if (param.modifier == midgard_varying_mod_perspective_z) + printf(".perspectivez"); + 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 980a968cbe9..c8331f64a67 100644 --- a/src/gallium/drivers/panfrost/midgard/midgard.h +++ b/src/gallium/drivers/panfrost/midgard/midgard.h @@ -435,10 +435,25 @@ 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 z/w + * (perspective division baked in with the load) */ + midgard_varying_mod_perspective_z = 2, + midgard_varying_mod_perspective_w = 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.30.2