panfrost: XMLify Block Format

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6195>
This commit is contained in:
Alyssa Rosenzweig 2020-08-11 21:00:47 -04:00 committed by Tomeu Vizoso
parent 8c1ac96eb6
commit c9bdba26b0
5 changed files with 22 additions and 37 deletions

View File

@ -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;

View File

@ -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");

View File

@ -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;

View File

@ -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++;

View File

@ -38,6 +38,13 @@
<value name="Always" value="7"/>
</enum>
<enum name="Block Format">
<!--- 16x16 block u-interleaved -->
<value name="Tiled" value="0"/>
<value name="Linear" value="2"/>
<value name="AFBC" value="3"/>
</enum>
<enum name="Mipmap Mode">
<value name="Nearest" value="0"/>
<value name="None" value="1"/>