From c31d59f078b70185db4fcbfc24293a025955aff5 Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Mon, 25 Apr 2022 12:35:54 -0700 Subject: [PATCH] intel/isl: Reduce halign for disabled CCS on XeHP Reduce the space consumption of mipmapped images which don't use compression. Based on Bspec 43862 (r52666). Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/isl/isl_gfx12.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/intel/isl/isl_gfx12.c b/src/intel/isl/isl_gfx12.c index c5319788ea5..b92dc6b79d5 100644 --- a/src/intel/isl/isl_gfx12.c +++ b/src/intel/isl/isl_gfx12.c @@ -215,21 +215,39 @@ isl_gfx125_choose_image_alignment_el(const struct isl_device *dev, *image_align_el = tiling == ISL_TILING_LINEAR ? isl_extent3d(128, 4, 1) : isl_extent3d(16, 4, 1); - } else { + } else if (_isl_surf_info_supports_ccs(dev, info->format, info->usage) || + tiling == ISL_TILING_LINEAR) { /* From RENDER_SURFACE_STATE::SurfaceHorizontalAlignment, * * - Losslessly Compressed Surfaces Must be HALIGN=128 for all * supported Bpp - * - 64bpe and 128bpe Surfaces Must Be HALIGN=64Bytes or 128Bytes (4, - * 8 texels or 16 texels) * - Linear Surfaces surfaces must use HALIGN=128, including 1D which * is always Linear. - * - * Even though we could choose a horizontal alignment of 64B for certain - * 64 and 128-bit formats, we want to be able to enable CCS whenever - * possible and CCS requires 128B horizontal alignment. */ *image_align_el = isl_extent3d(128 * 8 / fmtl->bpb, 4, 1); + } else if (fmtl->bpb >= 64) { + assert(fmtl->bpb == 64 || fmtl->bpb == 128); + /* From RENDER_SURFACE_STATE::SurfaceHorizontalAlignment, + * + * - 64bpe and 128bpe Surfaces Must Be HALIGN=64Bytes or 128Bytes (4, + * 8 texels or 16 texels) + * + * HALIGN=128 is used for losslessly compressed or linear surfaces. For + * other surface types, pick the smaller alignment of HALIGN=64 to save + * space. + */ + *image_align_el = isl_extent3d(64 * 8 / fmtl->bpb, 4, 1); + } else { + /* From RENDER_SURFACE_STATE::SurfaceHorizontalAlignment, + * + * HALIGN=16Bytes(8 texels) is allowed only for 16b Depth, Stencil + * Surfaces (8b) and Tiled 24bpp, 48bpp and 96bpp surfaces + * + * HALIGN=16 would save the most space, but it is reserved for the cases + * handled earlier in this if-ladder. Choose the next smallest alignment + * possible, HALIGN=32. + */ + *image_align_el = isl_extent3d(32 * 8 / fmtl->bpb, 4, 1); } }