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@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6161>
This commit is contained in:

committed by
Marge Bot

parent
7973b6c1e0
commit
2c47993b69
@@ -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;
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user