Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan fails to autodetect the proper ouput device. #3

Open
KotoWhiskas opened this issue Oct 8, 2021 · 6 comments
Open

Vulkan fails to autodetect the proper ouput device. #3

KotoWhiskas opened this issue Oct 8, 2021 · 6 comments

Comments

@KotoWhiskas
Copy link

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-1pop1163124101021.044ff6817
Candidate: 1:1.0.0.71-1pop1
163124101021.044ff6817
Version table:
*** 1:1.0.0.71-1pop1163124101021.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 bflanagin transferred this issue from pop-os/pop Oct 12, 2021
@bflanagin
Copy link

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
Copy link

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

@KotoWhiskas
Copy link
Author

@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
Copy link

bflanagin commented Oct 13, 2021

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
Copy link
Author

KotoWhiskas commented Oct 13, 2021

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 bflanagin transferred this issue from pop-os/steam Oct 13, 2021
@bflanagin bflanagin changed the title War thunder fails to start because there is no VK_ICD_FILENAMES variable Vulkan fails to autodetect the proper ouput device. Oct 13, 2021
@bflanagin
Copy link

bflanagin commented Oct 13, 2021

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.

mmstick pushed a commit that referenced this issue Mar 28, 2024
For instance, this issue is triggered with
"piglit/bin/ext_framebuffer_multisample-accuracy all_samples color depthstencil -auto -fbo":
Direct leak of 1160 byte(s) in 1 object(s) allocated from:
    #0 0x7fbe8897d7ef in __interceptor_malloc (/usr/lib64/libasan.so.6+0xb17ef)
    #1 0x7fbe7e7abfcc in rc_constants_copy ../src/gallium/drivers/r300/compiler/radeon_code.c:47
    #2 0x7fbe7e7ec902 in r3xx_compile_fragment_program ../src/gallium/drivers/r300/compiler/r3xx_fragprog.c:174
    #3 0x7fbe7e7e1b22 in r300_translate_fragment_shader ../src/gallium/drivers/r300/r300_fs.c:516
    #4 0x7fbe7e7e6373 in r300_pick_fragment_shader ../src/gallium/drivers/r300/r300_fs.c:591
    #5 0x7fbe7e75456e in r300_create_fs_state ../src/gallium/drivers/r300/r300_state.c:1073
    #6 0x7fbe7cd2ebe5 in st_create_fp_variant ../src/mesa/state_tracker/st_program.c:1070
    #7 0x7fbe7cd374b5 in st_get_fp_variant ../src/mesa/state_tracker/st_program.c:1116
    #8 0x7fbe7cd38273 in st_precompile_shader_variant ../src/mesa/state_tracker/st_program.c:1281
    #9 0x7fbe7cd38273 in st_finalize_program ../src/mesa/state_tracker/st_program.c:1345
    #10 0x7fbe7d798ca8 in st_link_glsl_to_nir ../src/mesa/state_tracker/st_glsl_to_nir.cpp:724
    #11 0x7fbe7d798ca8 in st_link_shader ../src/mesa/state_tracker/st_glsl_to_nir.cpp:952
    #12 0x7fbe7d6790d5 in link_program ../src/mesa/main/shaderapi.c:1336
    #13 0x7fbe7d6790d5 in link_program_error ../src/mesa/main/shaderapi.c:1447
...
SUMMARY: AddressSanitizer: 2528456 byte(s) leaked in 1057 allocation(s).

Fixes: 54f6e72 ("r300: better register allocator for vertex shaders")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27792>
(cherry picked from commit 4d00edda00041de0492a5097353407f6d1781df3)
mmstick pushed a commit that referenced this issue Mar 28, 2024
For instance, this issue is triggered with
"piglit/bin/object-namespace-pollution glBitmap program -auto -fbo":
Direct leak of 112 byte(s) in 7 object(s) allocated from:
    #0 0x7f472540e7ef in __interceptor_malloc (/usr/lib64/libasan.so.6+0xb17ef)
    #1 0x7f471a9ce18f in rc_remove_unused_constants ../src/gallium/drivers/r300/compiler/radeon_remove_constants.c:101
    #2 0x7f471a9b0836 in rc_run_compiler_passes ../src/gallium/drivers/r300/compiler/radeon_compiler.c:476
    #3 0x7f471a9b0ad5 in rc_run_compiler ../src/gallium/drivers/r300/compiler/radeon_compiler.c:498
    #4 0x7f471a9ec862 in r3xx_compile_fragment_program ../src/gallium/drivers/r300/compiler/r3xx_fragprog.c:172
    #5 0x7f471a9e1ab2 in r300_translate_fragment_shader ../src/gallium/drivers/r300/r300_fs.c:516
    #6 0x7f471a9e6303 in r300_pick_fragment_shader ../src/gallium/drivers/r300/r300_fs.c:591
    #7 0x7f471a9544fe in r300_create_fs_state ../src/gallium/drivers/r300/r300_state.c:1073
    #8 0x7f4718f2ebe5 in st_create_fp_variant ../src/mesa/state_tracker/st_program.c:1070
    #9 0x7f4718f374b5 in st_get_fp_variant ../src/mesa/state_tracker/st_program.c:1116
    #10 0x7f4718f38273 in st_precompile_shader_variant ../src/mesa/state_tracker/st_program.c:1281
    #11 0x7f4718f38273 in st_finalize_program ../src/mesa/state_tracker/st_program.c:1345
    #12 0x7f4718f389e9 in st_program_string_notify ../src/mesa/state_tracker/st_program.c:1378
    #13 0x7f47199d9f99 in set_program_string ../src/mesa/main/arbprogram.c:413

Fixes: 1c2c4dd ("r300g: copy the compiler from r300c")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27957>
(cherry picked from commit 29df85788a7f122cabce776c38dc6eee79ee0511)
mmstick pushed a commit that referenced this issue Mar 28, 2024
Indeed, main_shader_part_ngg_es was not freed.

For instance, this issue is triggered on a radeonsi/gfx10 gpu with
"piglit/bin/arb_gpu_shader5-tf-wrong-stream-value -auto -fbo":
Direct leak of 1464 byte(s) in 1 object(s) allocated from:
    #0 0x7f17904b99a7 in calloc (/usr/lib64/libasan.so.6+0xb19a7)
    #1 0x7f1785d65ac2 in si_init_shader_selector_async ../src/gallium/drivers/radeonsi/si_state_shaders.cpp:3132
    #2 0x7f1783af67d8 in util_queue_thread_func ../src/util/u_queue.c:309
    #3 0x7f1783b51dfa in impl_thrd_routine ../src/c11/impl/threads_posix.c:67
    #4 0x7f178f69d38a  (/lib64/libc.so.6+0x8438a)

Indirect leak of 2024 byte(s) in 1 object(s) allocated from:
    #0 0x7f17904b97ef in __interceptor_malloc (/usr/lib64/libasan.so.6+0xb17ef)
    #1 0x7f1785d5443a in read_chunk ../src/gallium/drivers/radeonsi/si_state_shaders.cpp:221
    #2 0x7f1785d62cf5 in si_load_shader_binary ../src/gallium/drivers/radeonsi/si_state_shaders.cpp:293
    #3 0x7f1785d65255 in si_shader_cache_load_shader ../src/gallium/drivers/radeonsi/si_state_shaders.cpp:423
    #4 0x7f1785d65ef9 in si_init_shader_selector_async ../src/gallium/drivers/radeonsi/si_state_shaders.cpp:3169
    #5 0x7f1783af67d8 in util_queue_thread_func ../src/util/u_queue.c:309
    #6 0x7f1783b51dfa in impl_thrd_routine ../src/c11/impl/threads_posix.c:67
    #7 0x7f178f69d38a  (/lib64/libc.so.6+0x8438a)

Fixes: 8f72f13 ("radeonsi/gfx10: add as_ngg variant for TES as ES to select Wave32/64")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27958>
(cherry picked from commit f93f215898861154b89691689888122940a97bcb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants