anv: Fix some usage flags not propagated to ISL for explicit layouts

Some vulkancts tests rely on vkGetImageMemoryRequirements to return the same
exact size after exporting and importing an image. This broke when we started
adding padding to sampled surfaces to manage overfetch, because the texture
usage flag does not get applied to the ISL surface when the image is recreated
using an explicit layout.

Fixes: 8d13628f7 ("isl: Add additional alignment/padding requirements to prevent overfetch")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
(cherry picked from commit efc6a3053d)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41540>
This commit is contained in:
Calder Young 2026-05-05 21:24:30 -07:00 committed by Eric Engestrom
parent 97ce385200
commit 826281a2f6
2 changed files with 11 additions and 3 deletions

View file

@ -2814,7 +2814,7 @@
"description": "anv: Fix some usage flags not propagated to ISL for explicit layouts",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "8d13628f7f4a7ae139fc91521c2bb7be1571004e",
"notes": null

View file

@ -1538,12 +1538,20 @@ add_all_surfaces_explicit_layout(
plane, image->vk.tiling);
const VkSubresourceLayout *primary_layout = &drm_info->pPlaneLayouts[plane];
VkImageUsageFlags vk_usage = vk_image_usage(&image->vk, aspect);
isl_surf_usage_flags_t isl_usage =
anv_image_choose_isl_surf_usage(device->physical,
image->vk.format,
format_list_info,
image->vk.create_flags, vk_usage,
isl_extra_usage_flags, aspect,
image->vk.compr_flags);
result = add_primary_surface(device, image, plane,
format_plane,
primary_layout->offset,
primary_layout->rowPitch,
isl_tiling_flags,
isl_extra_usage_flags);
isl_tiling_flags, isl_usage);
if (result != VK_SUCCESS)
return result;