panfrost/decode: Add flags for tilebuffer readback
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Fri, 5 Apr 2019 01:17:21 +0000 (01:17 +0000)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sun, 7 Apr 2019 15:58:19 +0000 (15:58 +0000)
These flags are set when reading back the tilebuffer from a fragment
shader via various mechanisms (including ARM_shader_framebuffer_fetch
and EXT_pixel_local_storage).

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/gallium/drivers/panfrost/include/panfrost-job.h
src/gallium/drivers/panfrost/pandecode/decode.c

index f0a4de730853af8f19aa91092f476a1dc36083e5..2f739bf22ba27dc2629216ae226b7bf045121ef9 100644 (file)
@@ -408,6 +408,13 @@ enum mali_format {
 /* Applies to unknown1 */
 #define MALI_NO_ALPHA_TO_COVERAGE (1 << 10)
 
+/* Flags denoting the fragment shader's use of tilebuffer readback. If the
+ * shader might read any part of the tilebuffer, set MALI_READS_TILEBUFFER. If
+ * it might read depth/stencil in particular, also set MALI_READS_ZS */
+
+#define MALI_READS_ZS (1 << 12)
+#define MALI_READS_TILEBUFFER (1 << 16)
+
 struct mali_blend_meta {
 #ifndef BIFROST
         /* Base value of 0x200.
index 20f789dc9f8dd73bdb79b0fc83a49a8972ada2d5..bb6f4b1971140c682e08fcbd461d14c9249de9d6 100644 (file)
@@ -218,6 +218,15 @@ static const struct pandecode_flag_info mfbd_extra_flag_info[] = {
 };
 #undef FLAG_INFO
 
+#define FLAG_INFO(flag) { MALI_##flag, "MALI_" #flag }
+static const struct pandecode_flag_info shader_unknown1_flag_info [] = {
+        FLAG_INFO(NO_ALPHA_TO_COVERAGE),
+        FLAG_INFO(READS_TILEBUFFER),
+        FLAG_INFO(READS_ZS),
+        {}
+};
+#undef FLAG_INFO
+
 extern char *replace_fragment;
 extern char *replace_vertex;
 
@@ -1163,9 +1172,11 @@ pandecode_replay_vertex_tiler_postfix_pre(const struct mali_vertex_tiler_postfix
 
                         pandecode_prop("uniform_count = %" PRId16, s->midgard1.uniform_count);
                         pandecode_prop("work_count = %" PRId16, s->midgard1.work_count);
-                        pandecode_prop("unknown1 = %s0x%" PRIx32,
-                                     s->midgard1.unknown1 & MALI_NO_ALPHA_TO_COVERAGE ? "MALI_NO_ALPHA_TO_COVERAGE | " : "",
-                                     s->midgard1.unknown1 & ~MALI_NO_ALPHA_TO_COVERAGE);
+
+                        pandecode_log(".unknown1 = ");
+                        pandecode_log_decoded_flags(shader_unknown1_flag_info, s->midgard1.unknown1);
+                        pandecode_log_cont(",\n");
+
                         pandecode_prop("unknown2 = 0x%" PRIx32, s->midgard1.unknown2);
 
                         pandecode_indent--;