From 4112eb2b0f3a7c240fd5141ccdcc4d813b4046d3 Mon Sep 17 00:00:00 2001 From: Francois Coulombe Date: Thu, 5 Mar 2026 17:57:30 -0500 Subject: [PATCH] vulkan/wsi/headless: add sRGB swapchain format support Headless surfaces when queried return that they only support RGBA UNORM and BGRA UNORM. Adding those lines enables RGBA SRGB and BGRA SRGB support to headless surfaces. Part-of: --- src/vulkan/wsi/wsi_common_headless.c | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/vulkan/wsi/wsi_common_headless.c b/src/vulkan/wsi/wsi_common_headless.c index d410cd9aa50..41143268cfa 100644 --- a/src/vulkan/wsi/wsi_common_headless.c +++ b/src/vulkan/wsi/wsi_common_headless.c @@ -178,6 +178,14 @@ wsi_headless_surface_get_formats(VkIcdSurfaceBase *icd_surface, out_fmt->format = VK_FORMAT_R8G8B8A8_UNORM; out_fmt->colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; } + vk_outarray_append_typed(VkSurfaceFormatKHR, &out, out_fmt) { + out_fmt->format = VK_FORMAT_B8G8R8A8_SRGB; + out_fmt->colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; + } + vk_outarray_append_typed(VkSurfaceFormatKHR, &out, out_fmt) { + out_fmt->format = VK_FORMAT_R8G8B8A8_SRGB; + out_fmt->colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; + } } else { vk_outarray_append_typed(VkSurfaceFormatKHR, &out, out_fmt) { out_fmt->format = VK_FORMAT_R8G8B8A8_UNORM; @@ -187,6 +195,14 @@ wsi_headless_surface_get_formats(VkIcdSurfaceBase *icd_surface, out_fmt->format = VK_FORMAT_B8G8R8A8_UNORM; out_fmt->colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; } + vk_outarray_append_typed(VkSurfaceFormatKHR, &out, out_fmt) { + out_fmt->format = VK_FORMAT_R8G8B8A8_SRGB; + out_fmt->colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; + } + vk_outarray_append_typed(VkSurfaceFormatKHR, &out, out_fmt) { + out_fmt->format = VK_FORMAT_B8G8R8A8_SRGB; + out_fmt->colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; + } } return vk_outarray_status(&out); @@ -210,6 +226,14 @@ wsi_headless_surface_get_formats2(VkIcdSurfaceBase *icd_surface, out_fmt->surfaceFormat.format = VK_FORMAT_R8G8B8A8_UNORM; out_fmt->surfaceFormat.colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; } + vk_outarray_append_typed(VkSurfaceFormat2KHR, &out, out_fmt) { + out_fmt->surfaceFormat.format = VK_FORMAT_B8G8R8A8_SRGB; + out_fmt->surfaceFormat.colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; + } + vk_outarray_append_typed(VkSurfaceFormat2KHR, &out, out_fmt) { + out_fmt->surfaceFormat.format = VK_FORMAT_R8G8B8A8_SRGB; + out_fmt->surfaceFormat.colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; + } } else { vk_outarray_append_typed(VkSurfaceFormat2KHR, &out, out_fmt) { out_fmt->surfaceFormat.format = VK_FORMAT_R8G8B8A8_UNORM; @@ -219,6 +243,14 @@ wsi_headless_surface_get_formats2(VkIcdSurfaceBase *icd_surface, out_fmt->surfaceFormat.format = VK_FORMAT_B8G8R8A8_UNORM; out_fmt->surfaceFormat.colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; } + vk_outarray_append_typed(VkSurfaceFormat2KHR, &out, out_fmt) { + out_fmt->surfaceFormat.format = VK_FORMAT_R8G8B8A8_SRGB; + out_fmt->surfaceFormat.colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; + } + vk_outarray_append_typed(VkSurfaceFormat2KHR, &out, out_fmt) { + out_fmt->surfaceFormat.format = VK_FORMAT_B8G8R8A8_SRGB; + out_fmt->surfaceFormat.colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; + } } return vk_outarray_status(&out);