mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 04:50:11 +01:00
device-select: only try wayland/x11 if the required vars are set
don't try to infer connections, as this may deadlock compositors Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31738>
This commit is contained in:
parent
f4bb0e74fd
commit
45eb3bfd32
1 changed files with 5 additions and 2 deletions
|
|
@ -146,13 +146,16 @@ static VkResult device_select_CreateInstance(const VkInstanceCreateInfo *pCreate
|
||||||
info->xwayland = !strcmp(applicationName, "Xwayland");
|
info->xwayland = !strcmp(applicationName, "Xwayland");
|
||||||
info->xserver = !strcmp(applicationName, "Xorg") || !strcmp(applicationName, "Xephyr");
|
info->xserver = !strcmp(applicationName, "Xorg") || !strcmp(applicationName, "Xephyr");
|
||||||
|
|
||||||
|
bool has_wayland = getenv("WAYLAND_DISPLAY") || getenv("WAYLAND_SOCKET");
|
||||||
|
bool has_xcb = !!getenv("DISPLAY");
|
||||||
|
|
||||||
for (unsigned i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
|
for (unsigned i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
|
||||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||||
if (!strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME))
|
if (!strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME) && has_wayland)
|
||||||
info->has_wayland = true;
|
info->has_wayland = true;
|
||||||
#endif
|
#endif
|
||||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||||
if (!strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XCB_SURFACE_EXTENSION_NAME))
|
if (!strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XCB_SURFACE_EXTENSION_NAME) && has_xcb)
|
||||||
info->has_xcb = !info->xserver || !info->zink;
|
info->has_xcb = !info->xserver || !info->zink;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue