From 789b53c5239f37bf0f853bbdd56a8ff5223b438d Mon Sep 17 00:00:00 2001 From: Paulo Zanoni Date: Thu, 25 Apr 2024 17:47:54 -0700 Subject: [PATCH] anv/sparse: fix the image property sizes for multi-sampled images We have to take the number of samples into account when calculating the tile size. If we don't do this, multi-sampled images may end up falling in the "goto out_everything_is_miptail" case, while in reality multi-sampled images don't even have miptails. Also assert that the value is one of the only two values we expect this to be. This assert would have been useful to catch this issue, since with multi-sampled images we were getting values like 16k or 32k depending on the number of samples. This helps move forward progress in some Zink tests, but does not make them fully pass yet, as those tests are full of sub-cases and this only helps some of them: KHR-GL46.sparse_texture2_tests.UncommittedRegionsAccess KHR-GL46.sparse_texture2_tests.SparseTexture2Commitment KHR-GL46.sparse_texture2_tests.SparseTexture2Lookup Fixes: 7ef3d652b251 ("anv/sparse: enable MSAA for Sparse when applicable") Reviewed-by: Lionel Landwerlin Signed-off-by: Paulo Zanoni Part-of: --- src/intel/vulkan/anv_sparse.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/intel/vulkan/anv_sparse.c b/src/intel/vulkan/anv_sparse.c index 5fdf745a53d..a3d23a09141 100644 --- a/src/intel/vulkan/anv_sparse.c +++ b/src/intel/vulkan/anv_sparse.c @@ -988,7 +988,8 @@ anv_sparse_calc_miptail_properties(struct anv_device *device, isl_surf_get_tile_info(surf, &tile_info); uint32_t tile_size = tile_info.logical_extent_el.width * Bpb * tile_info.logical_extent_el.height * - tile_info.logical_extent_el.depth; + tile_info.logical_extent_el.depth * + surf->samples; uint64_t layer1_offset; uint32_t x_off, y_off; @@ -1002,6 +1003,7 @@ anv_sparse_calc_miptail_properties(struct anv_device *device, * nothing and focus our efforts into making things use the appropriate * tiling formats that give us the standard block shapes. */ + assert(tile_size == 64 * 1024 || tile_size == 4096); if (tile_size != ANV_SPARSE_BLOCK_SIZE) goto out_everything_is_miptail;