pan/midgard: Analyze helper invocations
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 22 Aug 2019 23:31:03 +0000 (16:31 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 23 Aug 2019 22:51:25 +0000 (15:51 -0700)
We check for texture ops which calculate derivatives (either explicitly
via dFd* or implicitly) and mark the shader as requiring helper
invocations.

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

index b26dfb84e8d97d1e4b9439ec08758deef33b60d6..a7f407bdef857fa8674a685fb7d68e3fb72d0cab 100644 (file)
@@ -1221,6 +1221,22 @@ print_texture_format(int format)
         }
 }
 
+static bool
+midgard_op_has_helpers(unsigned op, bool gather)
+{
+        if (gather)
+                return true;
+
+        switch (op) {
+        case TEXTURE_OP_NORMAL:
+        case TEXTURE_OP_DFDX:
+        case TEXTURE_OP_DFDY:
+                return true;
+        default:
+                return false;
+        }
+}
+
 static void
 print_texture_op(unsigned op, bool gather)
 {
@@ -1281,6 +1297,9 @@ print_texture_word(uint32_t *word, unsigned tabs)
 {
         midgard_texture_word *texture = (midgard_texture_word *) word;
 
+        midg_stats.helper_invocations |=
+                midgard_op_has_helpers(texture->op, texture->is_gather);
+
         /* Broad category of texture operation in question */
         print_texture_op(texture->op, texture->is_gather);
 
index dacc7a16d5dcc72ab890de5690411e1b211b0376..fc39875007a8708bf36405db2c8760625734d73f 100644 (file)
@@ -17,6 +17,9 @@ struct midgard_disasm_stats {
         unsigned instruction_count;
         unsigned bundle_count;
         unsigned quadword_count;
+
+        /* Should we enable helper invocations? */
+        bool helper_invocations;
 };
 
 struct midgard_disasm_stats