vulkan/wsi/headless: populate VkSurfacePresentModeCompatibilityKHR

Previously, we ignored this struct which caused VVL to treat the
compatible mode list as NULL, causing false positive validation errors
on headless applications.

Closes: #14622

Cc: mesa-stable
Signed-off-by: llyyr <llyyr.public@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
(cherry picked from commit 9cd5a4849a)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
This commit is contained in:
llyyr 2026-01-09 01:34:21 +05:30 committed by Dylan Baker
parent 18cf06a22f
commit a95ee25b13
2 changed files with 21 additions and 1 deletions

View file

@ -1384,7 +1384,7 @@
"description": "vulkan/wsi/headless: populate VkSurfacePresentModeCompatibilityKHR",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -100,6 +100,9 @@ wsi_headless_surface_get_capabilities2(VkIcdSurfaceBase *surface,
{
assert(caps->sType == VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR);
const VkSurfacePresentModeKHR *present_mode =
vk_find_struct_const(info_next, SURFACE_PRESENT_MODE_EXT);
VkResult result =
wsi_headless_surface_get_capabilities(surface, wsi_device,
&caps->surfaceCapabilities);
@ -111,6 +114,23 @@ wsi_headless_surface_get_capabilities2(VkIcdSurfaceBase *surface,
protected->supportsProtected = VK_FALSE;
break;
}
case VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_KHR: {
/* Unsupported */
VkSurfacePresentModeCompatibilityKHR *compat = (void *)ext;
if (compat->pPresentModes == NULL) {
if (!present_mode) {
wsi_common_vk_warn_once("Use of VkSurfacePresentModeCompatibilityKHR "
"without a VkSurfacePresentModeKHR set. This is an "
"application bug.\n");
}
compat->presentModeCount = 1;
} else if (compat->presentModeCount) {
assert(present_mode);
compat->presentModeCount = 1;
compat->pPresentModes[0] = present_mode->presentMode;
}
break;
}
default:
/* Ignored */