[Mesa-dev] [PATCH 1/2] radv: rely on ac_compute_cmask() for CMASK info

Samuel Pitoiset samuel.pitoiset at gmail.com
Thu Jun 13 15:17:22 UTC 2019


Instead of re-computing in the driver. The 3d and cube flags
are correctly set, so the same values should returned by
ac_compute_surface().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/vulkan/radv_image.c | 45 +++----------------------------------
 1 file changed, 3 insertions(+), 42 deletions(-)

diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index d8dc2dfabde..909145e1e75 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -885,10 +885,6 @@ radv_image_get_cmask_info(struct radv_device *device,
 			  struct radv_image *image,
 			  struct radv_cmask_info *out)
 {
-	unsigned pipe_interleave_bytes = device->physical_device->rad_info.pipe_interleave_bytes;
-	unsigned num_pipes = device->physical_device->rad_info.num_tile_pipes;
-	unsigned cl_width, cl_height;
-
 	assert(image->plane_count == 1);
 
 	if (device->physical_device->rad_info.chip_class >= GFX9) {
@@ -897,44 +893,9 @@ radv_image_get_cmask_info(struct radv_device *device,
 		return;
 	}
 
-	switch (num_pipes) {
-	case 2:
-		cl_width = 32;
-		cl_height = 16;
-		break;
-	case 4:
-		cl_width = 32;
-		cl_height = 32;
-		break;
-	case 8:
-		cl_width = 64;
-		cl_height = 32;
-		break;
-	case 16: /* Hawaii */
-		cl_width = 64;
-		cl_height = 64;
-		break;
-	default:
-		assert(0);
-		return;
-	}
-
-	unsigned base_align = num_pipes * pipe_interleave_bytes;
-
-	unsigned width = align(image->planes[0].surface.u.legacy.level[0].nblk_x, cl_width*8);
-	unsigned height = align(image->planes[0].surface.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;
-
-	out->slice_tile_max = (width * height) / (128*128);
-	if (out->slice_tile_max)
-		out->slice_tile_max -= 1;
-
-	out->alignment = MAX2(256, base_align);
-	out->size = (image->type == VK_IMAGE_TYPE_3D ? image->info.depth : image->info.array_size) *
-		    align(slice_bytes, base_align);
+	out->slice_tile_max = image->planes[0].surface.u.legacy.cmask_slice_tile_max;
+	out->alignment = image->planes[0].surface.cmask_alignment;
+	out->size = image->planes[0].surface.cmask_size;
 }
 
 static void
-- 
2.22.0



More information about the mesa-dev mailing list