From b78e04c17b345d79439c27ef7c76eb21410f2ff2 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 14 Aug 2019 16:01:38 -0700 Subject: [PATCH] panfrost: Note "MFBD preload disable" bit It's a chicken bit, as far as I can tell. Buck buck. Signed-off-by: Alyssa Rosenzweig --- src/gallium/drivers/panfrost/pan_mfbd.c | 4 ++-- src/panfrost/include/panfrost-job.h | 11 ++++++++++- src/panfrost/pandecode/decode.c | 5 ++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c index 3039ab96ab1..1f504294bda 100644 --- a/src/gallium/drivers/panfrost/pan_mfbd.c +++ b/src/gallium/drivers/panfrost/pan_mfbd.c @@ -73,7 +73,7 @@ panfrost_mfbd_format(struct pipe_surface *surf) .unk3 = 0x4, .flags = 0x8, .swizzle = panfrost_translate_swizzle_4(swizzle), - .unk4 = 0x8 + .no_preload = true }; if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) @@ -424,7 +424,7 @@ panfrost_mfbd_fragment(struct panfrost_context *ctx, bool has_draws) } else { struct mali_rt_format null_rt = { .unk1 = 0x4000000, - .unk4 = 0x8 + .no_preload = true }; rts[cb].format = null_rt; diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h index 98d77e718fc..51e9e78b8bd 100644 --- a/src/panfrost/include/panfrost-job.h +++ b/src/panfrost/include/panfrost-job.h @@ -1482,7 +1482,16 @@ struct mali_rt_format { unsigned swizzle : 12; - unsigned unk4 : 4; + unsigned zero : 3; + + /* Disables MFBD preload. When this bit is set, the render target will + * be cleared every frame. When this bit is clear, the hardware will + * automatically wallpaper the render target back from main memory. + * Unfortunately, MFBD preload is very broken on Midgard, so in + * practice, this is a chicken bit that should always be set. + * Discovered by accident, as all good chicken bits are. */ + + unsigned no_preload : 1; } __attribute__((packed)); struct bifrost_render_target { diff --git a/src/panfrost/pandecode/decode.c b/src/panfrost/pandecode/decode.c index 771383ce866..75fa1971237 100644 --- a/src/panfrost/pandecode/decode.c +++ b/src/panfrost/pandecode/decode.c @@ -652,7 +652,10 @@ pandecode_rt_format(struct mali_rt_format format) pandecode_swizzle(format.swizzle); - pandecode_prop("unk4 = 0x%" PRIx32, format.unk4); + pandecode_prop("no_preload = 0x%" PRIx32, format.no_preload); + + if (format.zero) + pandecode_prop("zero = 0x%" PRIx32, format.zero); pandecode_indent--; pandecode_log("},\n"); -- 2.30.2