intel/isl: Use a fixed alignment for single slices

We're going to start changing the surface format during blorp_copy().
Changing the surface format could lead to incorrect image alignment
parameters, so return a fixed halign and valign for images with a single
subresource. That's all that will be needed for the upcoming
blorp_copy() changes.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39974>
This commit is contained in:
Nanley Chery 2026-02-18 08:47:51 -05:00 committed by Marge Bot
parent b16b9b5591
commit e0859f5ca1
2 changed files with 7 additions and 21 deletions

View file

@ -1750,15 +1750,6 @@ blorp_surf_retile_w_to_y(const struct isl_device *isl_dev,
blorp_surf_fake_interleaved_msaa(isl_dev, info);
}
if (isl_dev->info->ver == 6 || isl_dev->info->ver == 7) {
/* Gfx6-7 stencil buffers have a very large alignment coming in from the
* miptree. It's out-of-bounds for what the surface state can handle.
* Since we have a single layer and level, it doesn't really matter as
* long as we don't pass a bogus value into isl_surf_fill_state().
*/
info->surf.image_alignment_el = isl_extent3d(4, 2, 1);
}
/* Now that we've converted everything to a simple 2-D surface with only
* one miplevel, we can go about retiling it.
*/
@ -1885,18 +1876,6 @@ surf_fake_rgb_with_red(const struct isl_device *isl_dev,
isl_format_get_layout(info->view.format)->channels.r.bits);
info->surf.format = info->view.format = red_format;
if (isl_dev->info->verx10 >= 125) {
/* The horizontal alignment is in units of texels for NPOT formats, and
* bytes for other formats. Since the only allowed alignment units are
* powers of two, there's no way to convert the alignment.
*
* Thankfully, the value doesn't matter since we're only a single slice.
* Pick one allowed by isl_gfx125_choose_image_alignment_el.
*/
info->surf.image_alignment_el.w =
128 / (isl_format_get_layout(red_format)->bpb / 8);
}
}
enum blit_shrink_status {

View file

@ -81,6 +81,13 @@ isl_encode_valign(uint8_t valign)
UNUSED static struct isl_extent3d
isl_get_image_alignment(const struct isl_surf *surf)
{
if (surf->levels == 1 &&
surf->logical_level0_px.depth == 1 &&
surf->logical_level0_px.array_len == 1) {
/* This alignment value is unused for single slice surfaces. */
return isl_extent3d(GFX_VERx10 >= 125 ? 128 : 4, 4, 1);
}
if (GFX_VERx10 >= 125) {
if (isl_tiling_is_64(surf->tiling)) {
/* The hardware ignores the alignment values. Anyway, the surface's