[Mesa-dev] [PATCH] ac/surface: fix CMASK fast clear for NPOT textures with mipmapping on SI/CI/VI

Marek Olšák maraeo at gmail.com
Tue Aug 28 18:41:03 UTC 2018


From: Marek Olšák <marek.olsak at amd.com>

This fixes VM faults and corruption.

Cc: 18.1 18.2 <mesa-stable at lists.freedesktop.org>
---
 src/amd/common/ac_surface.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c
index 2f4f0f8884f..94723dc9c09 100644
--- a/src/amd/common/ac_surface.c
+++ b/src/amd/common/ac_surface.c
@@ -581,22 +581,22 @@ void ac_compute_cmask(const struct radeon_info *info,
 		cl_width = 64;
 		cl_height = 64;
 		break;
 	default:
 		assert(0);
 		return;
 	}
 
 	unsigned base_align = num_pipes * pipe_interleave_bytes;
 
-	unsigned width = align(config->info.width, cl_width*8);
-	unsigned height = align(config->info.height, cl_height*8);
+	unsigned width = align(surf->u.legacy.level[0].nblk_x, cl_width*8);
+	unsigned height = align(surf->u.legacy.level[0].nblk_y, cl_height*8);
 	unsigned slice_elements = (width * height) / (8*8);
 
 	/* Each element of CMASK is a nibble. */
 	unsigned slice_bytes = slice_elements / 2;
 
 	surf->u.legacy.cmask_slice_tile_max = (width * height) / (128*128);
 	if (surf->u.legacy.cmask_slice_tile_max)
 		surf->u.legacy.cmask_slice_tile_max -= 1;
 
 	unsigned num_layers;
-- 
2.17.1



More information about the mesa-dev mailing list