panfrost: Use framebuffer pointer XML

Rather than manipulating the raw pointers. This is cleaner.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20445>
This commit is contained in:
Alyssa Rosenzweig
2022-12-28 16:14:14 -05:00
committed by Marge Bot
parent 1a5546293c
commit 67cbbf9417
5 changed files with 49 additions and 43 deletions

View File

@@ -4381,8 +4381,6 @@ init_batch(struct panfrost_batch *batch)
pan_pool_alloc_desc_aggregate(
&batch->pool.base, PAN_DESC(FRAMEBUFFER), PAN_DESC(ZS_CRC_EXTENSION),
PAN_DESC_ARRAY(MAX2(batch->key.nr_cbufs, 1), RENDER_TARGET));
batch->framebuffer.gpu |= MALI_FBD_TAG_IS_MFBD;
#endif
#if PAN_ARCH >= 6
@@ -4390,6 +4388,13 @@ init_batch(struct panfrost_batch *batch)
#else
/* On Midgard, the TLS is embedded in the FB descriptor */
batch->tls = batch->framebuffer;
#if PAN_ARCH == 5
pan_pack(&batch->tls.gpu, FRAMEBUFFER_POINTER, cfg) {
cfg.pointer = batch->framebuffer.gpu;
cfg.render_target_count = 1; /* a necessary lie */
}
#endif
#endif
}

View File

@@ -107,12 +107,6 @@ pandecode_sample_locations(const void *fb)
struct pandecode_fbd
GENX(pandecode_fbd)(uint64_t gpu_va, bool is_fragment, unsigned gpu_id)
{
#if PAN_ARCH >= 5
/* We only see MFBDs on architectures that support them */
assert(gpu_va & MALI_FBD_TAG_IS_MFBD);
gpu_va &= ~MALI_FBD_TAG_MASK;
#endif
const void *PANDECODE_PTR_VAR(fb, (mali_ptr)gpu_va);
pan_section_unpack(fb, FRAMEBUFFER, PARAMETERS, params);
DUMP_UNPACKED(FRAMEBUFFER_PARAMETERS, params, "Parameters:\n");

View File

@@ -259,7 +259,21 @@ GENX(pandecode_dcd)(const struct MALI_DRAW *p, enum mali_job_type job_type,
DUMP_ADDR(LOCAL_STORAGE, p->thread_storage & ~1, "Local Storage:\n");
#endif
} else {
#if PAN_ARCH <= 5
#if PAN_ARCH == 5
/* On v5 only, the actual framebuffer pointer is tagged with extra
* metadata that we validate but do not print.
*/
pan_unpack(&p->fbd, FRAMEBUFFER_POINTER, ptr);
if (!ptr.type || ptr.zs_crc_extension_present ||
ptr.render_target_count != 1) {
fprintf(pandecode_dump_stream,
"Unexpected framebuffer pointer settings");
}
GENX(pandecode_fbd)(ptr.pointer, false, gpu_id);
#elif PAN_ARCH == 4
GENX(pandecode_fbd)(p->fbd, false, gpu_id);
#endif
}
@@ -307,13 +321,13 @@ GENX(pandecode_dcd)(const struct MALI_DRAW *p, enum mali_job_type job_type,
pandecode_indent--;
pandecode_log("\n");
/* MRT blend fields are used whenever MFBD is used, with
* per-RT descriptors */
/* MRT blend fields are used on v5+. Technically, they are optional on v5
* for backwards compatibility but we don't care about that.
*/
#if PAN_ARCH >= 5
if ((job_type == MALI_JOB_TYPE_TILER ||
job_type == MALI_JOB_TYPE_FRAGMENT) &&
(PAN_ARCH >= 6 || p->thread_storage & MALI_FBD_TAG_IS_MFBD)) {
PAN_ARCH >= 5) {
void *blend_base = ((void *)cl) + pan_size(RENDERER_STATE);
for (unsigned i = 0; i < fbd_info.rt_count; i++) {
@@ -455,36 +469,31 @@ pandecode_fragment_job(mali_ptr job, unsigned gpu_id)
struct mali_fragment_job_packed *PANDECODE_PTR_VAR(p, job);
pan_section_unpack(p, FRAGMENT_JOB, PAYLOAD, s);
UNUSED struct pandecode_fbd info =
GENX(pandecode_fbd)(s.framebuffer, true, gpu_id);
uint64_t fbd_pointer;
#if PAN_ARCH >= 5
unsigned expected_tag = 0;
/* On v5 and newer, the actual framebuffer pointer is tagged with extra
* metadata that we need to disregard.
*/
pan_unpack(&s.framebuffer, FRAMEBUFFER_POINTER, ptr);
fbd_pointer = ptr.pointer;
#else
/* On v4, the framebuffer pointer is untagged. */
fbd_pointer = s.framebuffer;
#endif
/* Compute the tag for the tagged pointer. This contains the type of
* FBD (MFBD/SFBD), and in the case of an MFBD, information about which
* additional structures follow the MFBD header (an extra payload or
* not, as well as a count of render targets) */
UNUSED struct pandecode_fbd info =
GENX(pandecode_fbd)(fbd_pointer, true, gpu_id);
expected_tag = MALI_FBD_TAG_IS_MFBD;
if (info.has_extra)
expected_tag |= MALI_FBD_TAG_HAS_ZS_RT;
expected_tag |= MALI_FBD_TAG_IS_MFBD | (MALI_POSITIVE(info.rt_count) << 2);
#if PAN_ARCH >= 5
if (!ptr.type || ptr.zs_crc_extension_present != info.has_extra ||
ptr.render_target_count != info.rt_count) {
pandecode_log("invalid FBD tag\n");
}
#endif
DUMP_UNPACKED(FRAGMENT_JOB_PAYLOAD, s, "Fragment Job Payload:\n");
#if PAN_ARCH >= 5
/* The FBD is a tagged pointer */
unsigned tag = (s.framebuffer & MALI_FBD_TAG_MASK);
if (tag != expected_tag)
pandecode_log("// XXX: expected FBD tag %X but got %X\n", expected_tag,
tag);
#endif
pandecode_log("\n");
}

View File

@@ -717,7 +717,6 @@ GENX(pan_emit_fbd)(const struct panfrost_device *dev,
const struct pan_fb_info *fb, const struct pan_tls_info *tls,
const struct pan_tiler_context *tiler_ctx, void *out)
{
unsigned tags = MALI_FBD_TAG_IS_MFBD;
void *fbd = out;
void *rtd = out + pan_size(FRAMEBUFFER);
@@ -815,7 +814,6 @@ GENX(pan_emit_fbd)(const struct panfrost_device *dev,
if (has_zs_crc_ext) {
pan_emit_zs_crc_ext(fb, crc_rt, out + pan_size(FRAMEBUFFER));
rtd += pan_size(ZS_CRC_EXTENSION);
tags |= MALI_FBD_TAG_HAS_ZS_RT;
}
unsigned rt_count = MAX2(fb->rt_count, 1);
@@ -832,9 +830,13 @@ GENX(pan_emit_fbd)(const struct panfrost_device *dev,
if (i != crc_rt)
*(fb->rts[i].crc_valid) = false;
}
tags |= MALI_POSITIVE(MAX2(fb->rt_count, 1)) << 2;
return tags;
uint64_t tag = 0;
pan_pack(&tag, FRAMEBUFFER_POINTER, cfg) {
cfg.zs_crc_extension_present = has_zs_crc_ext;
cfg.render_target_count = MAX2(fb->rt_count, 1);
}
return tag;
}
#else /* PAN_ARCH == 4 */
unsigned

View File

@@ -181,7 +181,6 @@ panvk_per_arch(cmd_alloc_fb_desc)(struct panvk_cmd_buffer *cmdbuf)
const struct pan_fb_info *fbinfo = &cmdbuf->state.fb.info;
bool has_zs_ext = fbinfo->zs.view.zs || fbinfo->zs.view.s;
unsigned tags = MALI_FBD_TAG_IS_MFBD;
batch->fb.info = cmdbuf->state.framebuffer;
batch->fb.desc =
@@ -190,9 +189,6 @@ panvk_per_arch(cmd_alloc_fb_desc)(struct panvk_cmd_buffer *cmdbuf)
PAN_DESC_ARRAY(has_zs_ext ? 1 : 0, ZS_CRC_EXTENSION),
PAN_DESC_ARRAY(MAX2(fbinfo->rt_count, 1), RENDER_TARGET));
/* Tag the pointer */
batch->fb.desc.gpu |= tags;
memset(&cmdbuf->state.fb.info.bifrost.pre_post.dcds, 0,
sizeof(cmdbuf->state.fb.info.bifrost.pre_post.dcds));
}