From ac68946d9d0be7ca2ffd8b81443f298f59718cc6 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 14 Jun 2019 11:14:01 -0700 Subject: [PATCH] panfrost: Identify and decode mfbd_flags Previously known as the unk3 field. Signed-off-by: Alyssa Rosenzweig --- src/gallium/drivers/panfrost/include/panfrost-job.h | 4 ++-- src/gallium/drivers/panfrost/pan_mfbd.c | 12 ++++++------ src/gallium/drivers/panfrost/pandecode/decode.c | 16 ++++++++++++++-- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/panfrost/include/panfrost-job.h b/src/gallium/drivers/panfrost/include/panfrost-job.h index c7cb2d7..e320785 100644 --- a/src/gallium/drivers/panfrost/include/panfrost-job.h +++ b/src/gallium/drivers/panfrost/include/panfrost-job.h @@ -1493,7 +1493,7 @@ struct bifrost_fb_extra { u64 zero3, zero4; } __attribute__((packed)); -/* flags for unk3 */ +/* Flags for mfbd_flags */ /* Enables writing depth results back to main memory (rather than keeping them * on-chip in the tile buffer and then discarding) */ @@ -1524,7 +1524,7 @@ struct bifrost_framebuffer { u32 zero4 : 5; /* 0x30 */ u32 clear_stencil : 8; - u32 unk3 : 24; // = 0x100 + u32 mfbd_flags : 24; // = 0x100 float clear_depth; diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c index 78d6765..8f1ae32 100644 --- a/src/gallium/drivers/panfrost/pan_mfbd.c +++ b/src/gallium/drivers/panfrost/pan_mfbd.c @@ -124,7 +124,7 @@ panfrost_mfbd_set_zsbuf( struct panfrost_resource *rsrc = pan_resource(surf->texture); if (rsrc->bo->layout == PAN_AFBC) { - fb->unk3 |= MALI_MFBD_EXTRA; + fb->mfbd_flags |= MALI_MFBD_EXTRA; fbx->flags = MALI_EXTRA_PRESENT | @@ -141,7 +141,7 @@ panfrost_mfbd_set_zsbuf( fbx->ds_afbc.zero1 = 0x10009; fbx->ds_afbc.padding = 0x1000; } else if (rsrc->bo->layout == PAN_LINEAR) { - fb->unk3 |= MALI_MFBD_EXTRA; + fb->mfbd_flags |= MALI_MFBD_EXTRA; fbx->flags |= MALI_EXTRA_PRESENT | MALI_EXTRA_ZS | 0x1; fbx->ds_linear.depth = rsrc->bo->gpu; @@ -171,7 +171,7 @@ panfrost_mfbd_upload( off_t offset = 0; /* There may be extra data stuck in the middle */ - bool has_extra = fb->unk3 & MALI_MFBD_EXTRA; + bool has_extra = fb->mfbd_flags & MALI_MFBD_EXTRA; /* Compute total size for transfer */ @@ -213,7 +213,7 @@ panfrost_mfbd_fragment(struct panfrost_context *ctx) /* XXX: MRT case */ fb.rt_count_2 = 1; - fb.unk3 = 0x100; + fb.mfbd_flags = 0x100; /* TODO: MRT clear */ panfrost_mfbd_clear(job, &fb, &fbx, &rts[0]); @@ -263,13 +263,13 @@ panfrost_mfbd_fragment(struct panfrost_context *ctx) } if (job->requirements & PAN_REQ_DEPTH_WRITE) - fb.unk3 |= MALI_MFBD_DEPTH_WRITE; + fb.mfbd_flags |= MALI_MFBD_DEPTH_WRITE; if (ctx->pipe_framebuffer.nr_cbufs == 1) { struct panfrost_resource *rsrc = (struct panfrost_resource *) ctx->pipe_framebuffer.cbufs[0]->texture; if (rsrc->bo->has_checksum) { - fb.unk3 |= MALI_MFBD_EXTRA; + fb.mfbd_flags |= MALI_MFBD_EXTRA; fbx.flags |= MALI_EXTRA_PRESENT; fbx.checksum_stride = rsrc->bo->checksum_stride; fbx.checksum = rsrc->bo->gpu + rsrc->bo->slices[0].stride * rsrc->base.height0; diff --git a/src/gallium/drivers/panfrost/pandecode/decode.c b/src/gallium/drivers/panfrost/pandecode/decode.c index 46cdef3..fdb820a 100644 --- a/src/gallium/drivers/panfrost/pandecode/decode.c +++ b/src/gallium/drivers/panfrost/pandecode/decode.c @@ -230,6 +230,15 @@ static const struct pandecode_flag_info shader_unknown1_flag_info [] = { }; #undef FLAG_INFO +#define FLAG_INFO(flag) { MALI_MFBD_##flag, "MALI_MFBD_" #flag } +static const struct pandecode_flag_info mfbd_flag_info [] = { + FLAG_INFO(DEPTH_WRITE), + FLAG_INFO(EXTRA), + {} +}; +#undef FLAG_INFO + + extern char *replace_fragment; extern char *replace_vertex; @@ -659,7 +668,10 @@ pandecode_replay_mfbd_bfr(uint64_t gpu_va, int job_no, bool with_render_targets) pandecode_prop("rt_count_1 = MALI_POSITIVE(%d)", fb->rt_count_1 + 1); pandecode_prop("rt_count_2 = %d", fb->rt_count_2); - pandecode_prop("unk3 = 0x%x", fb->unk3); + pandecode_log(".mfbd_flags = "); + pandecode_log_decoded_flags(mfbd_flag_info, fb->mfbd_flags); + pandecode_log_cont(",\n"); + pandecode_prop("clear_stencil = 0x%x", fb->clear_stencil); pandecode_prop("clear_depth = %f", fb->clear_depth); @@ -697,7 +709,7 @@ pandecode_replay_mfbd_bfr(uint64_t gpu_va, int job_no, bool with_render_targets) gpu_va += sizeof(struct bifrost_framebuffer); - if ((fb->unk3 & MALI_MFBD_EXTRA) && with_render_targets) { + if ((fb->mfbd_flags & MALI_MFBD_EXTRA) && with_render_targets) { mem = pandecode_find_mapped_gpu_mem_containing(gpu_va); const struct bifrost_fb_extra *PANDECODE_PTR_VAR(fbx, mem, (mali_ptr) gpu_va); -- 2.7.4