From 37a1986691ff62fcc1ed88e3dc1038591f183a59 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Mon, 5 Jan 2026 19:03:21 +0000 Subject: [PATCH] wsi/display: initialize Xlib display connector property IDs in all cases Usually connector property IDs are acquired in wsi_display_get_connector, which is called by wsi_get_connectors, and in turn by vkGetPhysicalDeviceDisplayProperties2KHR and vkGetPhysicalDeviceDisplayPlanePropertiesKHR. Except if the drm fd is not available when these functions are called. Which will be the case if vkAcquireXlibDisplayEXT is not called first. So it goes like this. First, the display is created in vkGetRandROutputDisplayEXT. Then it's used in vkGetPhysicalDeviceDisplayPlanePropertiesKHR, but since the drm fd is not available at this point, connector property IDs are not initialized. Later, this display is used in vkAcquireXlibDisplayEXT, which also doesn't touch the property IDs. Finally in drm_atomic_commit, the atomic commit fails with EINVAL, specifically because of the uninitialized ID of the "CRTC_ID" property. Since it's one of the properties drm_atomic_commit tries to set. This commit makes sure that find_connector_properties is called in vkAcquireXlibDisplayEXT to initialize the property IDs. Fixes: 513ffea1d366 ("wsi/display: use atomic mode setting") Signed-off-by: Yuxuan Shui Part-of: --- src/vulkan/wsi/wsi_common_display.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c index 7fec15308ca..e18c71b9c15 100644 --- a/src/vulkan/wsi/wsi_common_display.c +++ b/src/vulkan/wsi/wsi_common_display.c @@ -4198,6 +4198,22 @@ wsi_AcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice, return VK_ERROR_INITIALIZATION_FAILED; drmSetClientCap(fd, DRM_CLIENT_CAP_ATOMIC, 1); + + drmModeConnectorPtr drm_connector = + drmModeGetConnector(fd, connector->id); + + if (!drm_connector) { + close(fd); + return VK_ERROR_INITIALIZATION_FAILED; + } + + bool success = find_connector_properties(connector, drm_connector, fd); + drmModeFreeConnector(drm_connector); + if (!success) { + close(fd); + return VK_ERROR_INITIALIZATION_FAILED; + } + wsi->fd = fd; #endif