aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNanley Chery <[email protected]>2019-01-14 11:32:21 -0800
committerNanley Chery <[email protected]>2019-10-28 10:47:05 -0700
commit1e91280242d266758a0c59b5c2575d7d78ebfb91 (patch)
tree6806c297707b0c6b987488f582dbc63324cde362 /src
parent82822bc5497c2cf4643204d12cd0ed3f96ae72e1 (diff)
isl: Add and use isl_tiling_flag_to_enum()
Use a helper that will automatically handle Gen12's CCS tiling when creating a CCS isl_surf. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/intel/isl/isl.c4
-rw-r--r--src/intel/isl/isl.h7
2 files changed, 9 insertions, 2 deletions
diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index 39e5dca5307..a91c7204f66 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -384,7 +384,7 @@ isl_surf_choose_tiling(const struct isl_device *dev,
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;
}
@@ -392,7 +392,7 @@ isl_surf_choose_tiling(const struct isl_device *dev,
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;
}
diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index 757d5fb0ae8..5b7458a2285 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -1636,6 +1636,13 @@ bool
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)
{