ac/surface: fix CMASK fast clear for NPOT textures with mipmapping on SI/CI/VI
authorMarek Olšák <marek.olsak@amd.com>
Tue, 28 Aug 2018 18:39:09 +0000 (14:39 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 28 Aug 2018 23:51:51 +0000 (19:51 -0400)
This fixes VM faults and corruption.

Cc: 18.1 18.2 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/common/ac_surface.c

index 2f4f0f8884f3749b8bd4049b2828e14c4fab134c..94723dc9c09d563f50e6c2c3d5db70c707829fd7 100644 (file)
@@ -588,8 +588,8 @@ void ac_compute_cmask(const struct radeon_info *info,
 
        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. */