From 38fa9e144caabbb3b435fd804aacc347270a8a23 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Fri, 3 Jan 2025 15:41:18 +0200 Subject: [PATCH] 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 Reviewed-by: Kenneth Graunke Part-of: --- src/intel/isl/isl.c | 39 +++++++++++++++++++++++++++++++++++++++ src/intel/isl/isl.h | 5 +++++ 2 files changed, 44 insertions(+) diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c index 00f879ebe78..173aecc40fe 100644 --- a/src/intel/isl/isl.c +++ b/src/intel/isl/isl.c @@ -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. diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h index cdfa60073ba..c413b38a8db 100644 --- a/src/intel/isl/isl.h +++ b/src/intel/isl/isl.h @@ -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,