From b9d7b5e3f81829ce203a1ea67b55b51dfecae4cd Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Tue, 30 Sep 2025 12:13:06 -0400 Subject: [PATCH] intel/isl: Fix QPitch of arrayed MCS From RENDER_SURFACE_STATE::AuxiliarySurfaceQPitch on BDW+, This field must be set to an integer multiple of the Surface Vertical Alignment Accomplish this by aligning the height of each MCS layer to main surface's vertical alignment. Prevents the following test group from failing on Xe2 when a future commit enables multi-layer fast-clears in anv: dEQP-VK.api.image_clearing.*. clear_color_attachment.multiple_layers. *_clamp_input_sample_count_* The main test I used to debug this: dEQP-VK.api.image_clearing.core. clear_color_attachment.multiple_layers. a8b8g8r8_unorm_pack32_64x11_clamp_input_sample_count_2 Backport-to: 25.3 Reviewed-by: Jianxun Zhang (cherry picked from commit eb4a581e44bf9770fc2d30432914eff9da6802ee) Part-of: --- .pick_status.json | 2 +- src/intel/isl/isl.c | 9 ++++++++- src/intel/isl/isl_surface_state.c | 11 +++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 2c4e171584f..2b326ca16dc 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -174,7 +174,7 @@ "description": "intel/isl: Fix QPitch of arrayed MCS", "nominated": true, "nomination_type": 4, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c index a3e6aafe48f..afcc25f6530 100644 --- a/src/intel/isl/isl.c +++ b/src/intel/isl/isl.c @@ -3844,11 +3844,18 @@ isl_surf_get_mcs_surf(const struct isl_device *dev, UNREACHABLE("Invalid sample count"); } + /* isl_genX(surf_fill_state_s) will assert on us if the QPitch is not + * aligned by the main surface's vertical alignment. Align the height of + * the image so that the QPitch follows. + */ + const uint32_t aligned_height = isl_align(surf->logical_level0_px.height, + surf->image_alignment_el.height); + return isl_surf_init(dev, mcs_surf, .dim = ISL_SURF_DIM_2D, .format = mcs_format, .width = surf->logical_level0_px.width, - .height = surf->logical_level0_px.height, + .height = aligned_height, .depth = 1, .levels = 1, .array_len = surf->logical_level0_px.array_len, diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c index ad847f0e08a..fdd01b73034 100644 --- a/src/intel/isl/isl_surface_state.c +++ b/src/intel/isl/isl_surface_state.c @@ -888,8 +888,15 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state, * doesn't expect our definition of the compression, it expects qpitch * in units of samples on the main surface. */ - s.AuxiliarySurfaceQPitch = - isl_surf_get_array_pitch_sa_rows(info->aux_surf) >> 2; + uint32_t aux_qpitch = isl_surf_get_array_pitch_sa_rows(info->aux_surf); + + /* From RENDER_SURFACE_STATE::AuxiliarySurfaceQPitch on BDW+, + * + * This field must be set to an integer multiple of the Surface + * Vertical Alignment + */ + assert(aux_qpitch % image_align.h == 0); + s.AuxiliarySurfaceQPitch = aux_qpitch >> 2; #endif } #endif