pop-os / mesa

Forked from https://salsa.debian.org/xorg-team/lib/mesa
5 stars 3 forks source link

Vulkan fails to autodetect the proper ouput device. #3

Open KotoWhiskas opened 3 years ago

KotoWhiskas commented 3 years ago

Distribution (run cat /etc/os-release): Pop os 21.04

Related Application and/or Package Version (run apt policy $PACKAGE NAME):

apt policy steam steam:i386: Installed: 1:1.0.0.71-1pop1~1631241010~21.04~4ff6817 Candidate: 1:1.0.0.71-1pop1~1631241010~21.04~4ff6817 Version table: *** 1:1.0.0.71-1pop1~1631241010~21.04~4ff6817 1001 1001 http://ppa.launchpad.net/system76/pop/ubuntu hirsute/main i386 Packages 100 /var/lib/dpkg/status 1:1.0.0.68-1ubuntu1 500 500 http://us.archive.ubuntu.com/ubuntu hirsute/multiverse i386 Packages

Issue/Bug Description: With fresh install, war thunder crashes with gpu timeout error. If I run steam with command "VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/radeon_icd.x86_64.json steam", everything works ok

Steps to reproduce (if you know): Run war thunder

Expected behavior: Game works

Other Notes: AMD RX470 gpu, also it works without tweaks with default ubuntu mesa drivers and on arch

bflanagin commented 2 years ago

Nice find, However, it looks like VK_ICD_FILENAMES is too restrictive for general purposes.

I'll look into how Ubuntu and Arch get around the issue and report back.

bflanagin commented 2 years ago

I can confirm the issue happens here on my rx 5700xt as well and that the suggested fixes in this [issue] (https://github.com/KhronosGroup/Vulkan-Loader/issues/287) don't work. I've found a few places where our configs differ from Ubuntu but will need to do more testing.

KotoWhiskas commented 2 years ago

@bflanagin by the way, I remembered that when I was still using linux mint, I added ppa:graphics-drivers/ppa and then updated mesa, after that, the same thing happened. But I didn't know about that issue and I thought it's cinnamon bug or something

bflanagin commented 2 years ago

Looks like a possible regression in the newest version of Mesa. @KotoWhiskas could you add the output of vulkaninfo --summary to your next reply. I'm now thinking your work around is the right way to circumvent the issue, but I want to see if we can't automate the process.

KotoWhiskas commented 2 years ago

If it's regression, can it be already fixed in Impish? Or 21.04 will be supported even after 21.10 release?

Output of vulkaninfo --summary:


ERROR: [Loader Message] Code 0 : /usr/lib/i386-linux-gnu/libvulkan_intel.so: wrong ELF class: ELFCLASS32
ERROR: [Loader Message] Code 0 : /usr/lib/i386-linux-gnu/libvulkan_radeon.so: wrong ELF class: ELFCLASS32
ERROR: [Loader Message] Code 0 : /usr/lib/i386-linux-gnu/libvulkan_lvp.so: wrong ELF class: ELFCLASS32
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
==========
VULKANINFO
==========

Vulkan Instance Version: 1.2.162

Instance Extensions: count = 18
-------------------------------
VK_EXT_acquire_xlib_display            : extension revision 1
VK_EXT_debug_report                    : extension revision 10
VK_EXT_debug_utils                     : extension revision 2
VK_EXT_direct_mode_display             : extension revision 1
VK_EXT_display_surface_counter         : extension revision 1
VK_KHR_device_group_creation           : extension revision 1
VK_KHR_display                         : extension revision 23
VK_KHR_external_fence_capabilities     : extension revision 1
VK_KHR_external_memory_capabilities    : extension revision 1
VK_KHR_external_semaphore_capabilities : extension revision 1
VK_KHR_get_display_properties2         : extension revision 1
VK_KHR_get_physical_device_properties2 : extension revision 2
VK_KHR_get_surface_capabilities2       : extension revision 1
VK_KHR_surface                         : extension revision 25
VK_KHR_surface_protected_capabilities  : extension revision 1
VK_KHR_wayland_surface                 : extension revision 6
VK_KHR_xcb_surface                     : extension revision 6
VK_KHR_xlib_surface                    : extension revision 6

Instance Layers: count = 6
--------------------------
VK_LAYER_MESA_device_select       Linux device selection layer 1.2.73   version 1
VK_LAYER_MESA_overlay             Mesa Overlay layer           1.1.73   version 1
VK_LAYER_VALVE_steam_fossilize_32 Steam Pipeline Caching Layer 1.2.136  version 1
VK_LAYER_VALVE_steam_fossilize_64 Steam Pipeline Caching Layer 1.2.136  version 1
VK_LAYER_VALVE_steam_overlay_32   Steam Overlay Layer          1.2.136  version 1
VK_LAYER_VALVE_steam_overlay_64   Steam Overlay Layer          1.2.136  version 1

Devices:
========
GPU0:
    apiVersion         = 4202678 (1.2.182)
    driverVersion      = 88088577 (0x5402001)
    vendorID           = 0x1002
    deviceID           = 0x67df
    deviceType         = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
    deviceName         = AMD RADV POLARIS10
    driverID           = DRIVER_ID_MESA_RADV
    driverName         = radv
    driverInfo         = Mesa 21.2.1
    conformanceVersion = 1.2.3.0
GPU1:
    apiVersion         = 4198582 (1.1.182)
    driverVersion      = 1 (0x0001)
    vendorID           = 0x10005
    deviceID           = 0x0000
    deviceType         = PHYSICAL_DEVICE_TYPE_CPU
    deviceName         = llvmpipe (LLVM 12.0.0, 256 bits)
    driverID           = DRIVER_ID_MESA_LLVMPIPE
    driverName         = llvmpipe
    driverInfo         = Mesa 21.2.1 (LLVM 12.0.0)
    conformanceVersion = 1.0.0.0
bflanagin commented 2 years ago

Renamed to reflect my findings.

Issue:

On Mesa 21.2.1 regardless to the GPU the vulkan loader does not automatically set the proper GPU causing performance issues or failures.

How to replicate

Install vulkan-tools sudo apt install vulkan-tools or download War Thunder on Steam (Star conflict is also affected)

vkcube

  1. Launch vkcube without options. If you are on a laptop in hybrid or integrated mode you will see a spinning cube and a warning about the intel driver. If your laptop is in Nvidia mode you will get a black screen.
  2. Launch vkcube --gpu_number=1 (or higher). You will see the spinning cube spinning at various speeds depending on your selected mode.

    To get a list of detected cards run `vulkaninfo --summary' on my gaze15 I have 5 detected devices on a single GPU machine it detects 2 thanks to lavapipe.

Steam games

  1. Launch one of the mentioned steam games without any options. In War Thunder the issue appears right before you get into the game but after the launcher.
  2. Changed the launch option in Settings--> General to VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json %command% (If you are on an AMDGPU change the file name to radeon_icd.x86_64.json)
  3. Launch the game again.

Possible work around:

Setting the VK_ICD_FILENAMES environment for the users session or globally would avoid the issue until the upstream issue is resolved.