From a95ee25b1380f5750d6d005900a14967d7eac5d6 Mon Sep 17 00:00:00 2001 From: llyyr Date: Fri, 9 Jan 2026 01:34:21 +0530 Subject: [PATCH] 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 Reviewed-by: Lionel Landwerlin Reviewed-by: Yiwei Zhang (cherry picked from commit 9cd5a4849a1c4060141a99739ffc1aa514e206d5) Part-of: --- .pick_status.json | 2 +- src/vulkan/wsi/wsi_common_headless.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index d6553e7bff0..a806f395b77 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -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 diff --git a/src/vulkan/wsi/wsi_common_headless.c b/src/vulkan/wsi/wsi_common_headless.c index 236e092c522..a7d73e7c3e3 100644 --- a/src/vulkan/wsi/wsi_common_headless.c +++ b/src/vulkan/wsi/wsi_common_headless.c @@ -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 */