Use a helper that will automatically handle Gen12's CCS tiling when
creating a CCS isl_surf.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
if (info->usage & ISL_SURF_USAGE_HIZ_BIT) {
assert(info->format == ISL_FORMAT_HIZ);
assert(tiling_flags == ISL_TILING_HIZ_BIT);
- *tiling = ISL_TILING_HIZ;
+ *tiling = isl_tiling_flag_to_enum(tiling_flags);
return true;
}
if (info->usage & ISL_SURF_USAGE_CCS_BIT) {
assert(isl_format_get_layout(info->format)->txc == ISL_TXC_CCS);
assert(tiling_flags == ISL_TILING_CCS_BIT);
- *tiling = ISL_TILING_CCS;
+ *tiling = isl_tiling_flag_to_enum(tiling_flags);
return true;
}
isl_has_matching_typed_storage_image_format(const struct gen_device_info *devinfo,
enum isl_format fmt);
+static inline enum isl_tiling
+isl_tiling_flag_to_enum(isl_tiling_flags_t flag)
+{
+ assert(__builtin_popcount(flag) == 1);
+ return (enum isl_tiling) (__builtin_ffs(flag) - 1);
+}
+
static inline bool
isl_tiling_is_any_y(enum isl_tiling tiling)
{