anv: Disable aux if the explicit modifier lacks it

For dmabuf imports, configure the primary surface without support for
compression if the modifier doesn't specify it. This helps to create VkImages
with memory requirements that are compatible with the buffers apps provide.

Suggested-by: Philip Langdale <philipl@overt.org>
Cc: 22.0 <mesa-stable>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5940
Tested-by: Philip Langdale <philipl@overt.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15181>
This commit is contained in:
Nanley Chery 2022-02-24 17:16:37 -08:00 committed by Marge Bot
parent cada519482
commit c1a7d520f3
1 changed files with 13 additions and 12 deletions

View File

@ -1212,18 +1212,7 @@ add_all_surfaces_explicit_layout(
if (result != VK_SUCCESS)
return result;
if (!mod_has_aux) {
/* Even though the modifier does not support aux, try to create
* a driver-private aux to improve performance.
*/
result = add_aux_surface_if_supported(device, image, plane,
format_plane,
format_list_info,
ANV_OFFSET_IMPLICIT, 0,
isl_extra_usage_flags);
if (result != VK_SUCCESS)
return result;
} else {
if (mod_has_aux) {
const VkSubresourceLayout *aux_layout = &drm_info->pPlaneLayouts[1];
result = add_aux_surface_if_supported(device, image, plane,
format_plane,
@ -1445,6 +1434,18 @@ anv_image_init_from_create_info(struct anv_device *device,
.vk_info = pCreateInfo,
};
/* For dmabuf imports, configure the primary surface without support for
* compression if the modifier doesn't specify it. This helps to create
* VkImages with memory requirements that are compatible with the buffers
* apps provide.
*/
const struct VkImageDrmFormatModifierExplicitCreateInfoEXT *mod_explicit_info =
vk_find_struct_const(pCreateInfo->pNext,
IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXT);
if (mod_explicit_info &&
!isl_drm_modifier_has_aux(mod_explicit_info->drmFormatModifier))
create_info.isl_extra_usage_flags |= ISL_SURF_USAGE_DISABLE_AUX_BIT;
return anv_image_init(device, image, &create_info);
}