intel/isl: Allow creating non-Y-tiled ASTC surfaces
authorNanley Chery <nanley.g.chery@intel.com>
Fri, 12 Nov 2021 14:42:22 +0000 (09:42 -0500)
committerMarge Bot <emma+marge@anholt.net>
Tue, 30 Nov 2021 13:36:35 +0000 (13:36 +0000)
The sampler can only decode ASTC surfaces that are Y-tiled. ISL has
been asserting this restriction at surface creation time.

However, some drivers want to create a surface that is only used for
copying compressed data. And during the copy, the surface won't have a
compressed format.

To enable this behavior, we choose to move the tiling assertion to the
moment a surface state is created for the sampler.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13881>

src/intel/isl/isl_gfx7.c
src/intel/isl/isl_surface_state.c

index f3c5562..e949110 100644 (file)
@@ -237,12 +237,6 @@ isl_gfx6_filter_tiling(const struct isl_device *dev,
       *flags &= ~ISL_TILING_W_BIT;
    }
 
-   /* From the SKL+ PRMs, RENDER_SURFACE_STATE:TileMode,
-    *    If Surface Format is ASTC*, this field must be TILEMODE_YMAJOR.
-    */
-   if (isl_format_get_layout(info->format)->txc == ISL_TXC_ASTC)
-      *flags &= ISL_TILING_Y0_BIT;
-
    /* MCS buffers are always Y-tiled */
    if (isl_format_get_layout(info->format)->txc == ISL_TXC_MCS)
       *flags &= ISL_TILING_Y0_BIT;
index aa946f1..fcfb4c5 100644 (file)
@@ -532,6 +532,14 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
 
 #if GFX_VER >= 8
    assert(GFX_VER < 12 || info->surf->tiling != ISL_TILING_W);
+
+   /* From the SKL+ PRMs, RENDER_SURFACE_STATE:TileMode,
+    *
+    *    If Surface Format is ASTC*, this field must be TILEMODE_YMAJOR.
+    */
+   if (isl_format_get_layout(info->view->format)->txc == ISL_TXC_ASTC)
+      assert(info->surf->tiling == ISL_TILING_Y0);
+
    s.TileMode = isl_encode_tiling[info->surf->tiling];
 #else
    s.TiledSurface = info->surf->tiling != ISL_TILING_LINEAR,