From ae27d7faae490ab7680fb059071d667d7261dca6 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Sat, 21 Nov 2020 16:03:32 +0100 Subject: [PATCH] panfrost: Fix stride calculation for Z32_S8X24/X32_S8X24 formats Z32_S8X24 variants are actually stored in 2 planes (one per component), we have to adjust the bytes_per_pixel value accordingly. Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_resource.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index c7c8976dd7d..c96546398f1 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -302,6 +302,13 @@ panfrost_setup_slices(struct panfrost_device *dev, unsigned depth = res->depth0; unsigned bytes_per_pixel = util_format_get_blocksize(pres->internal_format); + /* Z32_S8X24 variants are actually stored in 2 planes (one per + * component), we have to adjust the bytes_per_pixel value accordingly. + */ + if (pres->internal_format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT || + pres->internal_format == PIPE_FORMAT_X32_S8X24_UINT) + bytes_per_pixel = 4; + /* MSAA is implemented as a 3D texture with z corresponding to the * sample #, horrifyingly enough */