vulkan/wsi/wayland: make needs_color_surface_old check if surface exists
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Otherwise we end up removing refcount even when we don't have a color
surface already for applications going from SRGB_NONLINEAR to
PASS_THROUGH dring runtime.

To reproduce the bug, start mpv with "--target-colorspace-hint=yes" then
set it to "no" during runtime with a keybind

Fixes: 789507c99c ("vulkan/wsi: implement the Wayland color management protocol")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34708>
This commit is contained in:
llyyr 2025-04-25 10:41:06 +05:30 committed by Marge Bot
parent 2212865ce0
commit 033ce1bae1

View file

@ -1238,8 +1238,9 @@ wsi_wl_swapchain_update_colorspace(struct wsi_wl_swapchain *chain)
bool new_color_surface = !surface->color.color_surface;
bool needs_color_surface_new = needs_color_surface(display, chain->color.colorspace);
bool needs_color_surface_old = needs_color_surface(display, surface->color.colorspace);
if ((new_color_surface || !needs_color_surface_old) && needs_color_surface_new) {
bool needs_color_surface_old = surface->color.color_surface &&
needs_color_surface(display, surface->color.colorspace);
if (!needs_color_surface_old && needs_color_surface_new) {
wsi_wl_surface_add_color_refcount(surface);
} else if (needs_color_surface_old && !needs_color_surface_new) {
wsi_wl_surface_remove_color_refcount(surface);