.unk2 = 0x1,
.nr_channels = MALI_POSITIVE(desc->nr_channels),
.unk3 = 0x4,
- .flags = 0x8,
+ .flags = 0x2,
.swizzle = panfrost_translate_swizzle_4(swizzle),
.no_preload = true
};
rt->format = panfrost_mfbd_format(surf);
if (layer_stride)
- rt->format.flags |= MALI_MFBD_FORMAT_MSAA | MALI_MFBD_FORMAT_LAYERED;
+ rt->format.msaa = MALI_MSAA_LAYERED;
+ else if (surf->nr_samples)
+ rt->format.msaa = MALI_MSAA_AVERAGE;
+ else
+ rt->format.msaa = MALI_MSAA_SINGLE;
/* Now, we set the layout specific pieces */
};
if (is_bifrost) {
- null_rt.flags = 0x8;
+ null_rt.flags = 0x2;
null_rt.unk3 = 0x8;
}
/* Actualize the requirements */
if (batch->requirements & PAN_REQ_MSAA) {
- rts[0].format.flags |= MALI_MFBD_FORMAT_MSAA;
-
/* XXX */
fb.unk1 |= (1 << 4) | (1 << 1);
fb.rt_count_2 = 4;
/* More below this, maybe */
} __attribute__((packed));
-/* Format bits for the render target flags. Setting MSAA alone works for on
- * chip MSAA. Setting MSAA with the LAYERED flag works for MSAA where each
- * sample is its own image (implements the ES3 spec directly but inefficient on
- * mobile). */
-#define MALI_MFBD_FORMAT_LAYERED (1 << 0)
-#define MALI_MFBD_FORMAT_MSAA (1 << 1)
-#define MALI_MFBD_FORMAT_SRGB (1 << 2)
+/* SINGLE to disable multisampling, AVERAGE for
+ * EXT_multisampled_render_to_texture operation where multiple tilebuffer
+ * samples are implicitly resolved before writeout, MULTIPLE to write multiple
+ * samples inline, and LAYERED for ES3-style multisampling with each sample in
+ * a different buffer.
+ */
+
+enum mali_msaa_mode {
+ MALI_MSAA_SINGLE = 0,
+ MALI_MSAA_AVERAGE = 1,
+ MALI_MSAA_MULTIPLE = 2,
+ MALI_MSAA_LAYERED = 3,
+};
+
+#define MALI_MFBD_FORMAT_SRGB (1 << 0)
struct mali_rt_format {
unsigned unk1 : 32;
unsigned unk3 : 4;
unsigned unk4 : 1;
enum mali_block_format block : 2;
- unsigned flags : 4;
+ enum mali_msaa_mode msaa : 2;
+ unsigned flags : 2;
unsigned swizzle : 12;
#define FLAG_INFO(flag) { MALI_MFBD_FORMAT_##flag, "MALI_MFBD_FORMAT_" #flag }
static const struct pandecode_flag_info mfbd_fmt_flag_info[] = {
- FLAG_INFO(LAYERED),
- FLAG_INFO(MSAA),
FLAG_INFO(SRGB),
{}
};
}
#undef DEFINE_CASE
+#define DEFINE_CASE(name) case MALI_MSAA_ ## name: return "MALI_MSAA_" #name
+static char *
+pandecode_msaa_mode(enum mali_msaa_mode mode)
+{
+ switch (mode) {
+ DEFINE_CASE(SINGLE);
+ DEFINE_CASE(AVERAGE);
+ DEFINE_CASE(MULTIPLE);
+ DEFINE_CASE(LAYERED);
+ default:
+ unreachable("Impossible");
+ return "";
+ }
+}
+#undef DEFINE_CASE
+
#define DEFINE_CASE(name) case MALI_STENCIL_ ## name: return "MALI_STENCIL_" #name
static char *
pandecode_stencil_op(enum mali_stencil_op op)
pandecode_log_decoded_flags(mfbd_fmt_flag_info, format.flags);
pandecode_log_cont(",\n");
+ pandecode_prop("msaa = %s", pandecode_msaa_mode(format.msaa));
+
/* In theory, the no_preload bit can be cleared to enable MFBD preload,
* which is a faster hardware-based alternative to the wallpaper method
* to preserve framebuffer contents across frames. In practice, MFBD