From caa998ca8ffcae42d85aabba6c1e75f8a65e1ea3 Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Fri, 12 Nov 2021 09:42:22 -0500 Subject: [PATCH] intel/isl: Allow creating non-Y-tiled ASTC surfaces 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 Part-of: --- src/intel/isl/isl_gfx7.c | 6 ------ src/intel/isl/isl_surface_state.c | 8 ++++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/intel/isl/isl_gfx7.c b/src/intel/isl/isl_gfx7.c index f3c55625606..e949110ed52 100644 --- a/src/intel/isl/isl_gfx7.c +++ b/src/intel/isl/isl_gfx7.c @@ -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; diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c index aa946f123a0..fcfb4c5cf87 100644 --- a/src/intel/isl/isl_surface_state.c +++ b/src/intel/isl/isl_surface_state.c @@ -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,