Mesa (master): panfrost: Add MSAA mode selection field
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Aug 4 19:05:43 UTC 2020
Module: Mesa
Branch: master
Commit: 2c47993b698ad3eca1303e9fb5e44f71f8e3d2c8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c47993b698ad3eca1303e9fb5e44f71f8e3d2c8
Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date: Tue Jul 21 18:51:07 2020 -0400
panfrost: Add MSAA mode selection field
This field enables MSAA, either writing samples to separate surfaces, to
a single large-bpp surface, or implicitly resolved and to a single
surface.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6161>
---
src/gallium/drivers/panfrost/pan_mfbd.c | 12 +++++++-----
src/panfrost/include/panfrost-job.h | 25 +++++++++++++++++--------
src/panfrost/pandecode/decode.c | 20 ++++++++++++++++++--
3 files changed, 42 insertions(+), 15 deletions(-)
diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c
index d253b897b98..43a26a81e03 100644
--- a/src/gallium/drivers/panfrost/pan_mfbd.c
+++ b/src/gallium/drivers/panfrost/pan_mfbd.c
@@ -48,7 +48,7 @@ panfrost_mfbd_format(struct pipe_surface *surf)
.unk2 = 0x1,
.nr_channels = MALI_POSITIVE(desc->nr_channels),
.unk3 = 0x4,
- .flags = 0x8,
+ .flags = 0x2,
.swizzle = panfrost_translate_swizzle_4(swizzle),
.no_preload = true
};
@@ -225,7 +225,11 @@ panfrost_mfbd_set_cbuf(
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 */
@@ -580,7 +584,7 @@ panfrost_mfbd_fragment(struct panfrost_batch *batch, bool has_draws)
};
if (is_bifrost) {
- null_rt.flags = 0x8;
+ null_rt.flags = 0x2;
null_rt.unk3 = 0x8;
}
@@ -613,8 +617,6 @@ panfrost_mfbd_fragment(struct panfrost_batch *batch, bool has_draws)
/* 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;
diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h
index 8ac799b81f2..ab0f8f7048f 100644
--- a/src/panfrost/include/panfrost-job.h
+++ b/src/panfrost/include/panfrost-job.h
@@ -1693,14 +1693,22 @@ struct mali_single_framebuffer {
/* 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;
@@ -1711,7 +1719,8 @@ struct mali_rt_format {
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;
diff --git a/src/panfrost/pandecode/decode.c b/src/panfrost/pandecode/decode.c
index 119fcc0287f..04add67b820 100644
--- a/src/panfrost/pandecode/decode.c
+++ b/src/panfrost/pandecode/decode.c
@@ -245,8 +245,6 @@ static const struct pandecode_flag_info u4_flag_info[] = {
#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),
{}
};
@@ -411,6 +409,22 @@ pandecode_func(enum mali_func mode)
}
#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)
@@ -1028,6 +1042,8 @@ pandecode_rt_format(struct mali_rt_format format)
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
More information about the mesa-commit
mailing list