vulkan/wsi/wayland: Set num_modifier_lists = 0 if num_drm_modifiers == 0

This case was missed in
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18826 ,
resulting in native Wayland apps failing with

 ../src/vulkan/wsi/wsi_common_drm.c:452: wsi_configure_native_image: Assertion `!"Failed to find a supported modifier!  This should never " "happen because LINEAR should always be available"' failed.

if the Wayland compositor advertises only the INVALID modifier.

Fixes: c315e20d61 ("vulkan/wsi/wayland: Configure images via params passed to wsi_swapchain_init()")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19795>
This commit is contained in:
Michel Dänzer
2022-11-17 10:12:59 +01:00
committed by Marge Bot
parent fffc3866fe
commit 8d7aa4279a
+4 -1
View File
@@ -1835,7 +1835,10 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
if (f != NULL) {
num_drm_modifiers = u_vector_length(&f->modifiers);
drm_modifiers = u_vector_tail(&f->modifiers);
drm_image_params.num_modifier_lists = 1;
if (num_drm_modifiers > 0)
drm_image_params.num_modifier_lists = 1;
else
drm_image_params.num_modifier_lists = 0;
drm_image_params.num_modifiers = &num_drm_modifiers;
drm_image_params.modifiers = &drm_modifiers;
}