- /* Allow CCS for single-sampled stencil buffers Gen12+. */
- if (isl_surf_usage_is_stencil(surf->usage) &&
- (ISL_DEV_GEN(dev) < 12 || surf->samples > 1))
- return false;
-
- /* [TGL+] CCS can only be added to a non-D16-formatted depth buffer if it
- * has HiZ. If not for GEN:BUG:1406512483 "deprecate compression enable
- * states", D16 would be supported. Supporting D16 requires being able to
- * specify that the control surface is present and simultaneously disabling
- * compression. The above bug makes it so that it's not possible to specify
- * this configuration.
- */
- if (isl_surf_usage_is_depth(surf->usage) && (aux_surf->size_B == 0 ||
- ISL_DEV_GEN(dev) < 12 || surf->format == ISL_FORMAT_R16_UNORM)) {
- return false;
- }
-
- /* The PRM doesn't say this explicitly, but fast-clears don't appear to
- * work for 3D textures until gen9 where the layout of 3D textures changes
- * to match 2D array textures.
- */
- if (ISL_DEV_GEN(dev) <= 8 && surf->dim != ISL_SURF_DIM_2D)
- return false;
-
- /* From the HSW PRM Volume 7: 3D-Media-GPGPU, page 652 (Color Clear of
- * Non-MultiSampler Render Target Restrictions):
- *
- * "Support is for non-mip-mapped and non-array surface types only."
- *
- * This restriction is lifted on gen8+. Technically, it may be possible to
- * create a CCS for an arrayed or mipmapped image and only enable CCS_D
- * when rendering to the base slice. However, there is no documentation
- * tell us what the hardware would do in that case or what it does if you
- * walk off the bases slice. (Does it ignore CCS or does it start
- * scribbling over random memory?) We play it safe and just follow the
- * docs and don't allow CCS_D for arrayed or mip-mapped surfaces.
- */
- if (ISL_DEV_GEN(dev) <= 7 &&
- (surf->levels > 1 || surf->logical_level0_px.array_len > 1))
- return false;
-
- /* On Gen12, 8BPP surfaces cannot be compressed if any level is not
- * 32Bx4row-aligned. For now, just reject the cases where alignment
- * matters.
- */
- if (ISL_DEV_GEN(dev) >= 12 &&
- isl_format_get_layout(surf->format)->bpb == 8 && surf->levels >= 3) {
- isl_finishme("%s:%s: CCS for 8BPP textures with 3+ miplevels is "
- "disabled, but support for more levels is possible.",
- __FILE__, __func__);
- return false;
- }
-
- /* On Gen12, all CCS-compressed surface pitches must be multiples of 512B.
- */
- if (ISL_DEV_GEN(dev) >= 12 && surf->row_pitch_B % 512 != 0)
- return false;
-