[Mesa-dev] [RFC 04/22] isl: Add isl_surf_get_drm_format_mod()
Daniel Stone
daniels at collabora.com
Thu Jun 8 18:44:02 UTC 2017
From: Chad Versace <chadversary at chromium.org>
Signed-off-by: Daniel Stone <daniels at collabora.com>
---
src/intel/isl/isl.c | 35 +++++++++++++++++++++++++++++++++++
src/intel/isl/isl.h | 15 +++++++++++++++
2 files changed, 50 insertions(+)
diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index 330c3d6c87..b78a22df8c 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -2363,3 +2363,38 @@ isl_surf_get_depth_format(const struct isl_device *dev,
return 5; /* D16_UNORM */
}
}
+
+bool
+isl_surf_get_drm_format_mod(const struct isl_surf *main_surf,
+ enum isl_aux_usage aux,
+ uint64_t *mod)
+{
+ if (aux != ISL_AUX_USAGE_NONE) {
+ /* There are no modifiers defined yet for auxiliary surfaces, not even
+ * for CCS.
+ */
+ return false;
+ }
+
+ switch (main_surf->tiling) {
+ case ISL_TILING_LINEAR:
+ *mod = DRM_FORMAT_MOD_LINEAR;
+ break;
+ case ISL_TILING_X:
+ *mod = I915_FORMAT_MOD_X_TILED;
+ break;
+ case ISL_TILING_Y0:
+ *mod = I915_FORMAT_MOD_Y_TILED;
+ break;
+ case ISL_TILING_Yf:
+ *mod = I915_FORMAT_MOD_Yf_TILED;
+ break;
+ case ISL_TILING_Ys:
+ case ISL_TILING_W:
+ case ISL_TILING_HIZ:
+ case ISL_TILING_CCS:
+ return false;
+ }
+
+ return true;
+}
diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index 3b3c04b401..04ba86514b 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -1862,6 +1862,21 @@ uint32_t
isl_surf_get_depth_format(const struct isl_device *dev,
const struct isl_surf *surf);
+/**
+ * The given surface must be a primary surface, not an auxiliary surface;
+ * otherwise behavior is undefined.
+ *
+ * The auxiliary usage must be compatible with the given surface; otherwise
+ * behavior is undefined.
+ *
+ * If no known DRM format modifier applies to the input, then return false.
+ * The output parameter is written only on success.
+ */
+bool ATTRIBUTE_PURE
+isl_surf_get_drm_format_mod(const struct isl_surf *main_surf,
+ enum isl_aux_usage aux,
+ uint64_t *mod);
+
#ifdef __cplusplus
}
#endif
--
2.13.0
More information about the mesa-dev
mailing list