radv: rely on ac_compute_cmask() for CMASK info
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 13 Jun 2019 15:17:22 +0000 (17:17 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 17 Jun 2019 09:30:44 +0000 (11:30 +0200)
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@gmail.com>
Reviewed-By: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_image.c

index d8dc2dfabde16d98ab27ee26dc7810e25fd8c269..909145e1e756b20d17241b4615b43de945382718 100644 (file)
@@ -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