[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#983390: marked as done (mesa-vulkan-drivers: bad interactions between VkLayer_MESA_device_select and other layers)



Your message dated Thu, 25 Mar 2021 11:46:36 +0000
with message-id <YFx4HMIprPAyZ1e9@horizon>
and subject line Re: Bug#983390: mesa-vulkan-drivers: bad interactions between VkLayer_MESA_device_select and other layers
has caused the Debian Bug report #983390,
regarding mesa-vulkan-drivers: bad interactions between VkLayer_MESA_device_select and other layers
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
983390: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983390
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: mesa-vulkan-drivers
Version: 20.3.4-1
Severity: important
Tags: patch fixed-upstream
Forwarded: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3801
Control: found -1 21.0.0~rc2-1

The device selection layer in Mesa 20.3.x >= 20.3.4 and 21.0.x >= 21.0.0~rc2
has problematic interactions with other Vulkan layers, in particular
MangoHUD. The bad interactions seem to be relatively complicated (dependent
on other components), and particularly likely to be triggered when using
Wine with DXVK.

In Steam's Proton compatibility tool (Wine + DXVK) this seems to manifest
as a game not starting, rather than as a crash - although maybe this is
really a behind-the-scenes component like winedevice.exe crashing.

The attached patch from upstream appears to resolve this. I'm talking to
an upstream Mesa maintainer about getting this into point releases, but
it would also be great if you could make sure this gets into Debian 11.0.

I can reproduce this with 20.3.4-1, and it can be resolved by rebuilding
20.3.4 with this patch and overwriting both word-sizes' versions of
/usr/lib/*-linux-gnu/libVkLayer_MESA_device_select.so. Unfortunately, my
only reliable reproducer is far from minimal:

* Debian testing
* Install mesa-vulkan-drivers:amd64, mesa-vulkan-drivers:i386,
  mangohud:amd64, mangohud:i386 and Steam
* In Steam, install some games, and force them to use the Proton 5.13
  compatibility tool so that you get the Windows version instead of any
  native Linux version that might exist.
  I used Life Is Strange (32-bit) and Life Is Strange 2 (64-bit) which
  are available at no cost.
* Opt in to the beta branch of the "Steam Linux Runtime - soldier"
  container tool. This fixes a bug that hid this one by not always
  enabling MangoHUD successfully.
* Run Steam with MANGOHUD=1 in the environment
* Launch each game in turn
* Good result: The games launch, and have the MangoHUD fps display showing
* Bad result: The games don't start; `top` shows intermittent activity
  from winedevice.exe

I haven't yet verified that the Mesa in experimental also has this bug,
but from the git history, versions >= 21.0.0~rc2-1 are likely to have it,
and I've had reports of the same issue in 21.0.0~rc4 and ~rc5 in
non-Debian distros.

Thanks,
    smcv
From: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Date: Mon, 11 Jan 2021 15:20:40 +0100
Subject: vulkan/device_select: Stop using device properties 2.

We have to choose between:
1) Stop handling two identical GPUs
2) Stop having crashes with other layers active.
3) Fix the Vulkan Loader.

Since nobody seems to want to spend enough effort to do 3 the
effective choice is between 1 and 2. This is choosing 2, as
two identical GPUs is pretty uncommon since crossfire doesn't
work on Linux anyway.

(And it would only work sporadically as the game needs to enable the
 extension)

CC: mesa-stable
Bug: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3801
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8414>
Origin: upstream, 21.1, commit:38ce8d4d00c2b0e567b6dd36876cf171acb1dbc7
---
 .../device-select-layer/device_select_layer.c      | 30 +++++++++++++---------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/src/vulkan/device-select-layer/device_select_layer.c b/src/vulkan/device-select-layer/device_select_layer.c
index c381ac3..134a3bd 100644
--- a/src/vulkan/device-select-layer/device_select_layer.c
+++ b/src/vulkan/device-select-layer/device_select_layer.c
@@ -51,8 +51,8 @@ struct instance_info {
    PFN_GetPhysicalDeviceProcAddr  GetPhysicalDeviceProcAddr;
    PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
    PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
-   PFN_vkGetPhysicalDeviceProperties2KHR GetPhysicalDeviceProperties2KHR;
-   bool has_props2, has_pci_bus;
+   PFN_vkGetPhysicalDeviceProperties2 GetPhysicalDeviceProperties2;
+   bool has_pci_bus, has_vulkan11;
    bool has_wayland, has_xcb;
 };
 
@@ -150,8 +150,6 @@ static VkResult device_select_CreateInstance(const VkInstanceCreateInfo *pCreate
    }
 
    for (unsigned i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
-      if (!strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME))
-         info->has_props2 = true;
 #ifdef VK_USE_PLATFORM_WAYLAND_KHR
       if (!strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME))
          info->has_wayland = true;
@@ -162,6 +160,14 @@ static VkResult device_select_CreateInstance(const VkInstanceCreateInfo *pCreate
 #endif
    }
 
+   /*
+    * The loader is currently not able to handle GetPhysicalDeviceProperties2KHR calls in
+    * EnumeratePhysicalDevices when there are other layers present. To avoid mysterious crashes
+    * for users just use only the vulkan version for now.
+    */
+   info->has_vulkan11 = pCreateInfo->pApplicationInfo &&
+                        pCreateInfo->pApplicationInfo->apiVersion >= VK_MAKE_VERSION(1, 1, 0);
+
    info->GetPhysicalDeviceProcAddr = (PFN_GetPhysicalDeviceProcAddr)info->GetInstanceProcAddr(*pInstance, "vk_layerGetPhysicalDeviceProcAddr");
 #define DEVSEL_GET_CB(func) info->func = (PFN_vk##func)info->GetInstanceProcAddr(*pInstance, "vk" #func)
    DEVSEL_GET_CB(DestroyInstance);
@@ -169,8 +175,8 @@ static VkResult device_select_CreateInstance(const VkInstanceCreateInfo *pCreate
    DEVSEL_GET_CB(EnumeratePhysicalDeviceGroups);
    DEVSEL_GET_CB(GetPhysicalDeviceProperties);
    DEVSEL_GET_CB(EnumerateDeviceExtensionProperties);
-   if (info->has_props2)
-      DEVSEL_GET_CB(GetPhysicalDeviceProperties2KHR);
+   if (info->has_vulkan11)
+      DEVSEL_GET_CB(GetPhysicalDeviceProperties2);
 #undef DEVSEL_GET_CB
 
    device_select_layer_add_instance(*pInstance, info);
@@ -197,10 +203,10 @@ static void print_gpu(const struct instance_info *info, unsigned index, VkPhysic
    VkPhysicalDeviceProperties2KHR properties = (VkPhysicalDeviceProperties2KHR){
       .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR
    };
-   if (info->has_props2 && info->has_pci_bus)
+   if (info->has_vulkan11 && info->has_pci_bus)
       properties.pNext = &ext_pci_properties;
-   if (info->GetPhysicalDeviceProperties2KHR)
-      info->GetPhysicalDeviceProperties2KHR(device, &properties);
+   if (info->GetPhysicalDeviceProperties2)
+      info->GetPhysicalDeviceProperties2(device, &properties);
    else
       info->GetPhysicalDeviceProperties(device, &properties.properties);
 
@@ -243,10 +249,10 @@ static bool fill_drm_device_info(const struct instance_info *info,
       .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR
    };
 
-   if (info->has_props2 && info->has_pci_bus)
+   if (info->has_vulkan11 && info->has_pci_bus)
       properties.pNext = &ext_pci_properties;
-   if (info->GetPhysicalDeviceProperties2KHR)
-     info->GetPhysicalDeviceProperties2KHR(device, &properties);
+   if (info->GetPhysicalDeviceProperties2)
+     info->GetPhysicalDeviceProperties2(device, &properties);
    else
      info->GetPhysicalDeviceProperties(device, &properties.properties);
 

--- End Message ---
--- Begin Message ---
Version: 20.3.5-1

On Tue, 23 Feb 2021 at 12:20:08 +0000, Simon McVittie wrote:
> The device selection layer in Mesa 20.3.x >= 20.3.4 and 21.0.x >= 21.0.0~rc2
> has problematic interactions with other Vulkan layers, in particular
> MangoHUD.

This appears to be fixed in the new upstream 20.3.5 release (and also
in 21.0.0). Are the Mesa maintainers intending 20.3.5-1 to be targeted
for inclusion in bullseye? A release team unblock will be needed.

Thanks,
    smcv

--- End Message ---

Reply to: