intel/isl: Add a helper to convert tilings from ISL to i915
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 13 Jun 2017 00:52:41 +0000 (17:52 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 13 Jul 2017 04:15:46 +0000 (21:15 -0700)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
src/intel/isl/isl.h
src/intel/isl/isl_drm.c

index 563bcfb04d6f82097f3c3f83c3c08ea9f889e588..dd550c349a77d075094b4c5af4522cb02d554af7 100644 (file)
@@ -1513,6 +1513,9 @@ isl_tiling_is_std_y(enum isl_tiling tiling)
    return (1u << tiling) & ISL_TILING_STD_Y_MASK;
 }
 
+uint32_t
+isl_tiling_to_i915_tiling(enum isl_tiling tiling);
+
 const struct isl_drm_modifier_info * ATTRIBUTE_CONST
 isl_drm_modifier_get_info(uint64_t modifier);
 
index 8fccc40862f6367837613e2d4a4b47859b4e43dd..b7a4997d2d00ce1bee87928c60082a8ba2a70848 100644 (file)
 #include <stdlib.h>
 
 #include <drm_fourcc.h>
+#include <i915_drm.h>
 
 #include "isl.h"
 #include "common/gen_device_info.h"
 
+uint32_t
+isl_tiling_to_i915_tiling(enum isl_tiling tiling)
+{
+   switch (tiling) {
+   case ISL_TILING_LINEAR:
+      return I915_TILING_NONE;
+
+   case ISL_TILING_X:
+      return I915_TILING_X;
+
+   case ISL_TILING_Y0:
+      return I915_TILING_Y;
+
+   case ISL_TILING_W:
+   case ISL_TILING_Yf:
+   case ISL_TILING_Ys:
+   case ISL_TILING_HIZ:
+   case ISL_TILING_CCS:
+      return I915_TILING_NONE;
+   }
+
+   unreachable("Invalid ISL tiling");
+}
+
 struct isl_drm_modifier_info modifier_info[] = {
    {
       .modifier = DRM_FORMAT_MOD_NONE,