diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-01-10 13:12:35 -0500 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-01-14 19:42:20 +0000 |
commit | 6bd9c4dc570c062e9160807fdd5ed888af22fced (patch) | |
tree | f01d5b2bc1a5d755653ec2c7c563c1e01445715d /src/panfrost | |
parent | 7c16a1ae4e629ccbae3979ec9be105e6b44e0acf (diff) |
panfrost: Fix linear depth textures
As pointed out by Boris, what we were calling PAN_LINEAR depth textures
was in fact u-interleaved tiled (!), but we never noticed since we
flipped the flag used for sampling, leading to all sorts of fun bugs
when attempting to directly acess depth textures from the CPU. Which
begs the question -- if what we called LINEAR was tiled, how do we
actually render linear depth textures? It turns out the flags for AFBC
form a mali_block_format 2-bit code just like their render-target
counterparts, so we can render to any of the above.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Reported-by: Boris Brezillon <[email protected]>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3393>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3393>
Diffstat (limited to 'src/panfrost')
-rw-r--r-- | src/panfrost/include/panfrost-job.h | 11 | ||||
-rw-r--r-- | src/panfrost/pandecode/decode.c | 27 |
2 files changed, 27 insertions, 11 deletions
diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h index dfc5d83a80d..b9a560911eb 100644 --- a/src/panfrost/include/panfrost-job.h +++ b/src/panfrost/include/panfrost-job.h @@ -1597,11 +1597,10 @@ struct bifrost_render_target { * - TODO: Anything else? */ -/* Flags field: note, these are guesses */ +/* flags_hi */ +#define MALI_EXTRA_PRESENT (0x10) -#define MALI_EXTRA_PRESENT (0x400) -#define MALI_EXTRA_AFBC (0x20) -#define MALI_EXTRA_AFBC_ZS (0x10) +/* flags_lo */ #define MALI_EXTRA_ZS (0x4) struct bifrost_fb_extra { @@ -1609,7 +1608,9 @@ struct bifrost_fb_extra { /* Each tile has an 8 byte checksum, so the stride is "width in tiles * 8" */ u32 checksum_stride; - u32 flags; + unsigned flags_lo : 4; + enum mali_block_format zs_block : 2; + unsigned flags_hi : 26; union { /* Note: AFBC is only allowed for 24/8 combined depth/stencil. */ diff --git a/src/panfrost/pandecode/decode.c b/src/panfrost/pandecode/decode.c index 80b9a66978b..c8d0d34f319 100644 --- a/src/panfrost/pandecode/decode.c +++ b/src/panfrost/pandecode/decode.c @@ -247,9 +247,14 @@ static const struct pandecode_flag_info mfbd_fmt_flag_info[] = { #undef FLAG_INFO #define FLAG_INFO(flag) { MALI_EXTRA_##flag, "MALI_EXTRA_" #flag } -static const struct pandecode_flag_info mfbd_extra_flag_info[] = { +static const struct pandecode_flag_info mfbd_extra_flag_hi_info[] = { FLAG_INFO(PRESENT), - FLAG_INFO(AFBC), + {} +}; +#undef FLAG_INFO + +#define FLAG_INFO(flag) { MALI_EXTRA_##flag, "MALI_EXTRA_" #flag } +static const struct pandecode_flag_info mfbd_extra_flag_lo_info[] = { FLAG_INFO(ZS), {} }; @@ -1128,11 +1133,17 @@ pandecode_mfbd_bfr(uint64_t gpu_va, int job_no, bool is_fragment) if (fbx->checksum_stride) pandecode_prop("checksum_stride = %d", fbx->checksum_stride); - pandecode_log(".flags = "); - pandecode_log_decoded_flags(mfbd_extra_flag_info, fbx->flags); + pandecode_log(".flags_hi = "); + pandecode_log_decoded_flags(mfbd_extra_flag_hi_info, fbx->flags_lo); + pandecode_log_cont(",\n"); + + pandecode_log(".flags_lo = "); + pandecode_log_decoded_flags(mfbd_extra_flag_lo_info, fbx->flags_lo); pandecode_log_cont(",\n"); - if (fbx->flags & MALI_EXTRA_AFBC_ZS) { + pandecode_prop("zs_block = %s\n", pandecode_block_format(fbx->zs_block)); + + if (fbx->zs_block == MALI_BLOCK_AFBC) { pandecode_log(".ds_afbc = {\n"); pandecode_indent++; @@ -1159,12 +1170,16 @@ pandecode_mfbd_bfr(uint64_t gpu_va, int job_no, bool is_fragment) MEMORY_PROP_DIR(fbx->ds_linear, depth); pandecode_prop("depth_stride = %d", fbx->ds_linear.depth_stride); + } else if (fbx->ds_linear.depth_stride) { + pandecode_msg("XXX: depth stride zero tripped %d\n", fbx->ds_linear.depth_stride); } if (fbx->ds_linear.stencil) { MEMORY_PROP_DIR(fbx->ds_linear, stencil); pandecode_prop("stencil_stride = %d", fbx->ds_linear.stencil_stride); + } else if (fbx->ds_linear.stencil_stride) { + pandecode_msg("XXX: stencil stride zero tripped %d\n", fbx->ds_linear.stencil_stride); } if (fbx->ds_linear.depth_stride_zero || @@ -1933,7 +1948,7 @@ pandecode_texture(mali_ptr u, if (f.layout == MALI_TEXTURE_AFBC) pandecode_log_cont("afbc"); else if (f.layout == MALI_TEXTURE_TILED) - pandecode_log_cont(is_zs ? "linear" : "tiled"); + pandecode_log_cont("tiled"); else if (f.layout == MALI_TEXTURE_LINEAR) pandecode_log_cont("linear"); else |