From 82792ef19fd757bcc5571db875098d2f272f1f86 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 15 May 2020 19:16:56 -0400 Subject: [PATCH] panfrost: Fix Z24 vs Z32 mixup We don't actually support Z32_UNORM; the format we've been using as such is in fact Z24X8 / Z24S8. Fix that and drop Z32_UNORM. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_mfbd.c | 4 +--- src/gallium/drivers/panfrost/pan_sfbd.c | 6 +----- src/panfrost/encoder/pan_format.c | 5 ++--- src/panfrost/include/panfrost-job.h | 2 +- src/panfrost/pandecode/pan_pretty_print.c | 2 +- 5 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c index 723d92b0067..bfb79dd6d3c 100644 --- a/src/gallium/drivers/panfrost/pan_mfbd.c +++ b/src/gallium/drivers/panfrost/pan_mfbd.c @@ -298,8 +298,6 @@ panfrost_mfbd_set_zsbuf( if (panfrost_is_z24s8_variant(surf->format)) { fbx->flags_lo |= 0x1; - } else if (surf->format == PIPE_FORMAT_Z32_UNORM) { - /* default flags (0 in bottom place) */ } else if (surf->format == PIPE_FORMAT_Z32_FLOAT) { fbx->flags_lo |= 0xA; fb->mfbd_flags ^= 0x100; @@ -481,7 +479,7 @@ panfrost_mfbd_fragment(struct panfrost_batch *batch, bool has_draws) /* When scanning out, the depth buffer is immediately invalidated, so * we don't need to waste bandwidth writing it out. This can improve - * performance substantially (Z32_UNORM 1080p @ 60fps is 475 MB/s of + * performance substantially (Z24X8_UNORM 1080p @ 60fps is 475 MB/s of * memory bandwidth!). * * The exception is ReadPixels, but this is not supported on GLES so we diff --git a/src/gallium/drivers/panfrost/pan_sfbd.c b/src/gallium/drivers/panfrost/pan_sfbd.c index 9cbcbcaba4e..7a0deaf4d39 100644 --- a/src/gallium/drivers/panfrost/pan_sfbd.c +++ b/src/gallium/drivers/panfrost/pan_sfbd.c @@ -173,16 +173,12 @@ panfrost_sfbd_set_zsbuf( return; if (panfrost_is_z24s8_variant(surf->format)) { - /* Stencil data is interleaved with depth */ fb->stencil_buffer = fb->depth_buffer; fb->stencil_stride = fb->depth_stride; - } else if (surf->format == PIPE_FORMAT_Z32_UNORM || - surf->format == PIPE_FORMAT_Z32_FLOAT) { - + } else if (surf->format == PIPE_FORMAT_Z32_FLOAT) { /* No stencil, nothing to do */ } else if (surf->format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT) { - /* Stencil data in separate buffer */ struct panfrost_resource *stencil = rsrc->separate_stencil; struct panfrost_slice stencil_slice = stencil->slices[level]; diff --git a/src/panfrost/encoder/pan_format.c b/src/panfrost/encoder/pan_format.c index c14c09758f2..02167275034 100644 --- a/src/panfrost/encoder/pan_format.c +++ b/src/panfrost/encoder/pan_format.c @@ -110,9 +110,8 @@ struct panfrost_format panfrost_pipe_format_table[PIPE_FORMAT_COUNT] = { [PIPE_FORMAT_R3G3B2_UNORM] = { MALI_RGB332_UNORM, _VT }, - [PIPE_FORMAT_Z24_UNORM_S8_UINT] = { MALI_Z32_UNORM, _TZ }, - [PIPE_FORMAT_Z24X8_UNORM] = { MALI_Z32_UNORM, _TZ }, - [PIPE_FORMAT_Z32_UNORM] = { MALI_Z32_UNORM, _TZ }, + [PIPE_FORMAT_Z24_UNORM_S8_UINT] = { MALI_Z24X8_UNORM, _TZ }, + [PIPE_FORMAT_Z24X8_UNORM] = { MALI_Z24X8_UNORM, _TZ }, [PIPE_FORMAT_Z32_FLOAT] = { MALI_R32F, _TZ }, [PIPE_FORMAT_Z32_FLOAT_S8X24_UINT] = { MALI_R32F, _TZ }, diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h index b02d0abcde9..bb835a13b00 100644 --- a/src/panfrost/include/panfrost-job.h +++ b/src/panfrost/include/panfrost-job.h @@ -297,7 +297,7 @@ enum mali_format { MALI_RGB332_UNORM = MALI_FORMAT_SPECIAL | 0xb, MALI_RGB233_UNORM = MALI_FORMAT_SPECIAL | 0xc, - MALI_Z32_UNORM = MALI_FORMAT_SPECIAL | 0xd, + MALI_Z24X8_UNORM = MALI_FORMAT_SPECIAL | 0xd, MALI_R32_FIXED = MALI_FORMAT_SPECIAL | 0x11, MALI_RG32_FIXED = MALI_FORMAT_SPECIAL | 0x12, MALI_RGB32_FIXED = MALI_FORMAT_SPECIAL | 0x13, diff --git a/src/panfrost/pandecode/pan_pretty_print.c b/src/panfrost/pandecode/pan_pretty_print.c index a1a87fa2c2c..05b0d1ae4cb 100644 --- a/src/panfrost/pandecode/pan_pretty_print.c +++ b/src/panfrost/pandecode/pan_pretty_print.c @@ -54,7 +54,7 @@ char *pandecode_format(enum mali_format format) DEFINE_CASE(RGB10_A2I); DEFINE_CASE(RGB332_UNORM); DEFINE_CASE(RGB233_UNORM); - DEFINE_CASE(Z32_UNORM); + DEFINE_CASE(Z24X8_UNORM); DEFINE_CASE(R32_FIXED); DEFINE_CASE(RG32_FIXED); DEFINE_CASE(RGB32_FIXED); -- 2.30.2