From: Alyssa Rosenzweig Date: Wed, 12 Aug 2020 01:00:47 +0000 (-0400) Subject: panfrost: XMLify Block Format X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c9bdba26b0c16cac05bb14674458da2acd462797;p=mesa.git panfrost: XMLify Block Format Signed-off-by: Alyssa Rosenzweig Reviewed-by: Tomeu Vizoso Part-of: --- diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c index 3dc3a3dd25a..6cbf2f219fe 100644 --- a/src/gallium/drivers/panfrost/pan_mfbd.c +++ b/src/gallium/drivers/panfrost/pan_mfbd.c @@ -233,7 +233,7 @@ panfrost_mfbd_set_cbuf( if (is_bifrost) { rt->format.unk4 = 0x1; } else { - rt->format.block = MALI_BLOCK_LINEAR; + rt->format.block = MALI_BLOCK_FORMAT_LINEAR; } rt->framebuffer = base; @@ -243,14 +243,14 @@ panfrost_mfbd_set_cbuf( if (is_bifrost) { rt->format.unk3 |= 0x8; } else { - rt->format.block = MALI_BLOCK_TILED; + rt->format.block = MALI_BLOCK_FORMAT_TILED; } rt->framebuffer = base; rt->framebuffer_stride = stride; rt->layer_stride = layer_stride; } else if (drm_is_afbc(rsrc->modifier)) { - rt->format.block = MALI_BLOCK_AFBC; + rt->format.block = MALI_BLOCK_FORMAT_AFBC; unsigned header_size = rsrc->slices[level].header_size; @@ -303,7 +303,7 @@ panfrost_mfbd_set_zsbuf( fbx->flags_hi |= MALI_EXTRA_PRESENT; fbx->flags_lo |= MALI_EXTRA_ZS | 0x1; /* unknown */ - fbx->zs_block = MALI_BLOCK_AFBC; + fbx->zs_block = MALI_BLOCK_FORMAT_AFBC; fbx->ds_afbc.depth_stencil = base + header_size; fbx->ds_afbc.depth_stencil_afbc_metadata = base; @@ -326,16 +326,17 @@ panfrost_mfbd_set_zsbuf( fbx->ds_linear.depth = base; if (rsrc->modifier == DRM_FORMAT_MOD_LINEAR) { - fbx->zs_block = MALI_BLOCK_LINEAR; + fbx->zs_block = MALI_BLOCK_FORMAT_LINEAR; fbx->ds_linear.depth_stride = stride / 16; fbx->ds_linear.depth_layer_stride = layer_stride; } else { if (is_bifrost) { - fbx->zs_block = MALI_BLOCK_UNKNOWN; + /* XXX: Bifrost fields are different here */ + fbx->zs_block = 1; fbx->flags_hi |= 0x440; fbx->flags_lo |= 0x1; } else { - fbx->zs_block = MALI_BLOCK_TILED; + fbx->zs_block = MALI_BLOCK_FORMAT_TILED; } fbx->ds_linear.depth_stride = stride; diff --git a/src/gallium/drivers/panfrost/pan_sfbd.c b/src/gallium/drivers/panfrost/pan_sfbd.c index 4f830991531..58d33dcddde 100644 --- a/src/gallium/drivers/panfrost/pan_sfbd.c +++ b/src/gallium/drivers/panfrost/pan_sfbd.c @@ -142,9 +142,9 @@ panfrost_sfbd_set_cbuf( fb->stride = stride; if (rsrc->modifier == DRM_FORMAT_MOD_LINEAR) - fb->format.block = MALI_BLOCK_LINEAR; + fb->format.block = MALI_BLOCK_FORMAT_LINEAR; else if (rsrc->modifier == DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED) { - fb->format.block = MALI_BLOCK_TILED; + fb->format.block = MALI_BLOCK_FORMAT_TILED; fb->stride *= 16; } else { fprintf(stderr, "Invalid render modifier\n"); diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h index 1adfbb2c0dc..48379cce905 100644 --- a/src/panfrost/include/panfrost-job.h +++ b/src/panfrost/include/panfrost-job.h @@ -1267,13 +1267,6 @@ struct midgard_tiler_descriptor { u32 weights[8]; }; -enum mali_block_format { - MALI_BLOCK_TILED = 0x0, - MALI_BLOCK_UNKNOWN = 0x1, - MALI_BLOCK_LINEAR = 0x2, - MALI_BLOCK_AFBC = 0x3, -}; - struct mali_sfbd_format { /* 0x1 */ unsigned unk1 : 6; diff --git a/src/panfrost/lib/decode.c b/src/panfrost/lib/decode.c index b218595560b..c47b8f52b6c 100644 --- a/src/panfrost/lib/decode.c +++ b/src/panfrost/lib/decode.c @@ -510,22 +510,6 @@ pandecode_special_record(uint64_t v, bool* attribute) } } -#define DEFINE_CASE(name) case MALI_BLOCK_## name: return "MALI_BLOCK_" #name -static char * -pandecode_block_format(enum mali_block_format fmt) -{ - switch (fmt) { - DEFINE_CASE(TILED); - DEFINE_CASE(UNKNOWN); - DEFINE_CASE(LINEAR); - DEFINE_CASE(AFBC); - - default: - unreachable("Invalid case"); - } -} -#undef DEFINE_CASE - #define DEFINE_CASE(name) case MALI_EXCEPTION_ACCESS_## name: return ""#name static char * pandecode_exception_access(unsigned access) @@ -718,7 +702,7 @@ pandecode_sfbd_format(struct mali_sfbd_format format) pandecode_log_decoded_flags(sfbd_unk2_info, format.unk2); pandecode_log_cont(",\n"); - pandecode_prop("block = %s", pandecode_block_format(format.block)); + pandecode_prop("block = %s", mali_block_format_as_str(format.block)); pandecode_prop("unk3 = 0x%" PRIx32, format.unk3); @@ -1029,7 +1013,7 @@ pandecode_rt_format(struct mali_rt_format format) pandecode_prop("unk3 = 0x%" PRIx32, format.unk3); pandecode_prop("unk4 = 0x%" PRIx32, format.unk4); - pandecode_prop("block = %s", pandecode_block_format(format.block)); + pandecode_prop("block = %s", mali_block_format_as_str(format.block)); /* TODO: Map formats so we can check swizzles and print nicely */ pandecode_log("swizzle"); @@ -1080,7 +1064,7 @@ pandecode_render_target(uint64_t gpu_va, unsigned job_no, const struct mali_fram pandecode_rt_format(rt->format); - if (rt->format.block == MALI_BLOCK_AFBC) { + if (rt->format.block == MALI_BLOCK_FORMAT_AFBC) { pandecode_log(".afbc = {\n"); pandecode_indent++; @@ -1261,10 +1245,10 @@ pandecode_mfbd_bfr(uint64_t gpu_va, int job_no, bool is_fragment, bool is_comput pandecode_log_decoded_flags(mfbd_extra_flag_lo_info, fbx->flags_lo); pandecode_log_cont(",\n"); - pandecode_prop("zs_block = %s", pandecode_block_format(fbx->zs_block)); + pandecode_prop("zs_block = %s", mali_block_format_as_str(fbx->zs_block)); pandecode_prop("zs_samples = MALI_POSITIVE(%u)", fbx->zs_samples + 1); - if (fbx->zs_block == MALI_BLOCK_AFBC) { + if (fbx->zs_block == MALI_BLOCK_FORMAT_AFBC) { pandecode_log(".ds_afbc = {\n"); pandecode_indent++; diff --git a/src/panfrost/lib/midgard.xml b/src/panfrost/lib/midgard.xml index 5a9acba2c4c..57de518972a 100644 --- a/src/panfrost/lib/midgard.xml +++ b/src/panfrost/lib/midgard.xml @@ -38,6 +38,13 @@ + + + + + + +