vulkan/wsi/wayland: initialize surface colorspace with PASS_THROUGH_EXT

Starting with sRGB meant we would refcount to -1 if an application
chooses PASS_THROUGH. Instead, just initialize with PASS_THROUGH so the
initial refcount of 0 reflects reality.

Previously, we would segfault if an application chose PASS_THROUGH at
swapchain initialization then switched to a color managed colorspace
later in the runtime, because we would increment refcount from -1 -> 0
and this would result in not creating a new color managed surface.

Fixes: 789507c99c ("vulkan/wsi: implement the Wayland color management protocol")
Signed-off-by: llyyr <llyyr.public@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34353>
This commit is contained in:
llyyr
2025-04-03 09:19:42 +05:30
committed by Marge Bot
parent 1610841f0f
commit dc90e33ad2
+1 -1
View File
@@ -2315,7 +2315,7 @@ wsi_CreateWaylandSurfaceKHR(VkInstance _instance,
surface->surface = pCreateInfo->surface;
wsi_wl_surface->instance = instance;
wsi_wl_surface->color.colorspace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
wsi_wl_surface->color.colorspace = VK_COLOR_SPACE_PASS_THROUGH_EXT;
*pSurface = VkIcdSurfaceBase_to_handle(&surface->base);