pan/midgard: Add support for disassembling derivatives
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 29 Jul 2019 21:07:19 +0000 (14:07 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 30 Jul 2019 17:01:19 +0000 (10:01 -0700)
They're just texture ops.

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

index acc1f408e98a30470322fac3f1d6015d62702934..eb6b98a94bd677796322eba5029631633137b58a 100644 (file)
@@ -1074,6 +1074,8 @@ print_texture_op(unsigned op, bool gather)
                 DEFINE_CASE(TEXTURE_OP_NORMAL, "texture");
                 DEFINE_CASE(TEXTURE_OP_LOD, "textureLod");
                 DEFINE_CASE(TEXTURE_OP_TEXEL_FETCH, "texelFetch");
+                DEFINE_CASE(TEXTURE_OP_DFDX, "dFdx");
+                DEFINE_CASE(TEXTURE_OP_DFDY, "dFdy");
 
         default:
                 printf("tex_%d", op);
index 84b9aa2fe08a32f57eac867b7a040a07c5ef4148..d0e15ce86d1d4a29329038ae10fd03176ee3e148 100644 (file)
@@ -541,6 +541,16 @@ midgard_tex_register_select;
 #define TEXTURE_OP_LOD 0x12             /* textureLod */
 #define TEXTURE_OP_TEXEL_FETCH 0x14     /* texelFetch */
 
+/* Computes horizontal and vertical derivatives respectively. Use with a float
+ * sampler and a "2D" texture.  Leave texture/sampler IDs as zero; they ought
+ * to be ignored. Only works for fp32 on 64-bit at a time, so derivatives of a
+ * vec4 require 2 texture ops.  For some reason, the blob computes both X and Y
+ * derivatives at the same time and just throws out whichever is unused; it's
+ * not known if this is a quirk of the hardware or just of the blob. */
+
+#define TEXTURE_OP_DFDX 0x0D
+#define TEXTURE_OP_DFDY 0x1D
+
 enum mali_sampler_type {
         MALI_SAMPLER_UNK        = 0x0,
         MALI_SAMPLER_FLOAT      = 0x1, /* sampler */