From 035be8e042fc4b98af9a9e8136db6dd39cd57a5b 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 (cherry picked from commit 37a1986691ff62fcc1ed88e3dc1038591f183a59) Part-of: --- .pick_status.json | 2 +- src/vulkan/wsi/wsi_common_display.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index f667b4062f6..9a1b105b5df 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1324,7 +1324,7 @@ "description": "wsi/display: initialize Xlib display connector property IDs in all cases", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "513ffea1d366c82e50975fd430d012ff8e652a79", "notes": null diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c index 978ea0d1362..586db9ce32f 100644 --- a/src/vulkan/wsi/wsi_common_display.c +++ b/src/vulkan/wsi/wsi_common_display.c @@ -3802,6 +3802,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