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: 7ef3d652b2 ("anv/sparse: enable MSAA for Sparse when applicable")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29337>
This commit is contained in:
Paulo Zanoni 2024-04-25 17:47:54 -07:00 committed by Marge Bot
parent 5c18ccd2d3
commit 789b53c523

View file

@ -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;