isl: add a helper to report what dimensions a tiling supports

For shader detiling, it's useful to know if we avoid bothering trying
to detile a 1D image.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32676>
This commit is contained in:
Lionel Landwerlin 2025-01-03 15:41:18 +02:00 committed by Marge Bot
parent cfa1d40be5
commit 38fa9e144c
2 changed files with 44 additions and 0 deletions

View file

@ -1075,6 +1075,45 @@ tiling_max_mip_tail(enum isl_tiling tiling,
return num_rows - isl_get_miptail_base_row(tiling);
}
/**
* Returns whether a tiling supports a given dimension.
*
* :param tiling: |in| The tiling format to introspect
* :param dim: |in| The dimensionality of the surface being tiled
*/
bool
isl_tiling_supports_dimensions(const struct intel_device_info *devinfo,
enum isl_tiling tiling,
enum isl_surf_dim dim)
{
switch (dim) {
case ISL_SURF_DIM_1D:
return (tiling != ISL_TILING_SKL_Yf &&
tiling != ISL_TILING_SKL_Ys &&
tiling != ISL_TILING_ICL_Yf &&
tiling != ISL_TILING_ICL_Ys &&
tiling != ISL_TILING_64 &&
tiling != ISL_TILING_64_XE2 &&
tiling != ISL_TILING_X);
case ISL_SURF_DIM_2D:
return true;
case ISL_SURF_DIM_3D:
/* BSpec 57023, RENDER_SURFACE_STATE:Tile Mode:
*
* "TILEMODE_XMAJOR is only allowed if the Surface Type is
* SURFTYPE_2D"
*/
if (devinfo->ver >= 20)
return tiling != ISL_TILING_X;
return true;
default:
unreachable("invalid dimension");
}
}
/**
* Returns an isl_tile_info representation of the given isl_tiling when
* combined when used in the given configuration.

View file

@ -2300,6 +2300,11 @@ bool
isl_has_matching_typed_storage_image_format(const struct intel_device_info *devinfo,
enum isl_format fmt);
bool
isl_tiling_supports_dimensions(const struct intel_device_info *devinfo,
enum isl_tiling tiling,
enum isl_surf_dim dim);
void
isl_tiling_get_info(enum isl_tiling tiling,
enum isl_surf_dim dim,