[Mesa-dev] [PATCH 02/13] isl: Add isl_surf_get_drm_format_mod()

Chad Versace chadversary at chromium.org
Mon Mar 6 20:40:11 UTC 2017


---
 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 c70fac8a176..3559c5e4c84 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -1947,3 +1947,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 597819f0a74..222413dc43e 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -1511,6 +1511,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.12.0



More information about the mesa-dev mailing list