felixdoerre / primus_vk

Vulkan GPU-offloading layer
BSD 2-Clause "Simplified" License
229 stars 17 forks source link

Dota2 does not work if Steam is on #42

Closed silikeite closed 4 months ago

silikeite commented 5 years ago

I have primus_vk running on my Arch install. I installed both primus_vk and lib32-primus_vk from the official repositories and edited nvidia_icd.json to point to nv_vulkan_wrapper.so to make it work. I was able to test it using pvkrun vkcube with no problem. Running pvkrun ./dota.sh while Steam is off launches Dota2 properly without issues, except for Dota complaining that it lost connection to Steam. Running pvkrun ./dota.sh while Steam is on causes the game to segfault immediately. I have tried this with both steam-native and steam-runtime. I have also tried running both steam-native and steam-runtime with the pvkrun command, and I still get the same error.

The following is printed on the command prompt:

$ pvkrun ./dota.sh
Using breakpad crash handler
[S_API] SteamAPI_Init(): Loaded '/data/USER/Steam/linux64/steamclient.so' OK.
Setting breakpad minidump AppID = 570
Forcing breakpad minidump interfaces to load
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
Steam_SetMinidumpSteamID:  Caching Steam ID:  76561198278574882 [API loaded yes]
Steam_SetMinidumpSteamID:  Setting Steam ID:  76561198278574882
Setting breakpad minidump AppID = 373300
PrimusVK: CreateInstance
PrimusVK: Getting devices
PrimusVK: Searching for display GPU:
PrimusVK: 0xdc743d8b000: 
PrimusVK: 0xdc743d8b000: 
PrimusVK: 0xdc743d8b000: 
PrimusVK: Got integrated gpu!
PrimusVK: Device: Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2)
PrimusVK:   Type: 1
PrimusVK: Searching for render GPU:
PrimusVK: 0xdc743d8b000: 
PrimusVK: Got discrete gpu!
PrimusVK: Device: GeForce GTX 1050 Ti
PrimusVK:   Type: 2
crash_20190617232845_1.dmp[26979]: Uploading dump (out-of-process)
/tmp/dumps/crash_20190617232845_1.dmp
./dota.sh: line 104: 26965 Segmentation fault      (core dumped) ${STEAM_RUNTIME_PREFIX} ${GAME_DEBUGGER} "${GAMEROOT}"/${GAMEEXE} "$@"
crash_20190617232845_1.dmp[26979]: Finished uploading minidump (out-of-process): success = yes                                                                                  :(
crash_20190617232845_1.dmp[26979]: response: Discarded=1
crash_20190617232845_1.dmp[26979]: file ''/tmp/dumps/crash_20190617232845_1.dmp'', upload yes: ''Discarded=1''
felixdoerre commented 5 years ago

I've managed to get dota2 running on my system flawlessly (see https://github.com/felixdoerre/primus_vk/issues/15#issuecomment-442394361). Those tests were definitely with steam running. From the output, it seems, you got up until here: https://github.com/felixdoerre/primus_vk/blob/master/primus_vk.cpp#L236 we need an exact location of the crash to determine what is happening. I'd suggest you build primus_vk from source and run it with a debugger or add debug print statements to determine where exactly the crash is happening.

silikeite commented 5 years ago

I'm sorry but I'm not that much of a developer (well, for native apps at least) myself. I tried building directly from the latest git and I still get the exact same error as with the packaged version from Arch. May I ask how to run with a debugger/what debugger should I use?

silikeite commented 5 years ago

Results of ENABLE_PRIMUS_LAYER=1 gdb optirun -b primus ./dota.sh:

(gdb) run -b primus ./dota.sh
Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Detaching after fork from child process 6510]
Using breakpad crash handler
[S_API] SteamAPI_Init(): Loaded '/data/USER/Steam/linux64/steamclient.so' OK.
Setting breakpad minidump AppID = 570
Forcing breakpad minidump interfaces to load
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
Steam_SetMinidumpSteamID:  Caching Steam ID:  76561198278574882 [API loaded yes]
Steam_SetMinidumpSteamID:  Setting Steam ID:  76561198278574882
Setting breakpad minidump AppID = 373300
PrimusVK: CreateInstance
PrimusVK: Getting devices
PrimusVK: Searching for display GPU:
PrimusVK: 0x10214dc00: 
PrimusVK: 0x10214dc00: 
PrimusVK: 0x10214dc00: 
PrimusVK: Got integrated gpu!
PrimusVK: Device: Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2)
PrimusVK:   Type: 1
PrimusVK: Searching for render GPU:
PrimusVK: 0x10214dc00: 
PrimusVK: Got discrete gpu!
PrimusVK: Device: GeForce GTX 1050 Ti
PrimusVK:   Type: 2
crash_20190618120607_1.dmp[6527]: Uploading dump (out-of-process)
/tmp/dumps/crash_20190618120607_1.dmp
./dota.sh: line 104:  6513 Segmentation fault      (core dumped) ${STEAM_RUNTIME_PREFIX} ${GAME_DEBUGGER} "${GAMEROOT}"/${GAMEEXE} "$@"
[Inferior 1 (process 6500) exited with code 0213]
(gdb) crash_20190618120607_1.dmp[6527]: Finished uploading minidump (out-of-process): success = yes
crash_20190618120607_1.dmp[6527]: response: Discarded=1
crash_20190618120607_1.dmp[6527]: file ''/tmp/dumps/crash_20190618120607_1.dmp'', upload yes: ''Discarded=1''

I presume to actually debug I'm supposed to do something else?

silikeite commented 5 years ago

Steam prints this out to console

Game update: AppID 570 "", ProcID 5182, IP 0.0.0.0:0
Starting app 570
>>> Adding process 5182 for game ID 570
Game removed: AppID 570 "", ProcID 5182 
Exiting app 570
felixdoerre commented 5 years ago

for debugging that segfault gdb should be perfectly fine, when the executable you want to debug has command line args, you need to invoke gdb --args ./executable arg1 arg2. In your case Dota seems to be wrapped by a shell script. So you would need to look inside the shell script and see where the actual game executable is started and add gdb --args there.

silikeite commented 5 years ago

I got this

 % ENABLE_PRIMUS_LAYER=1 gdb --args ./bin/linuxsteamrt64/dota2 
Reading symbols from ./bin/linuxsteamrt64/dota2...
(No debugging symbols found in ./bin/linuxsteamrt64/dota2)
(gdb) run
Starting program: /data/USER/Steam/steamapps/common/dota 2 beta/game/bin/linuxsteamrt64/dota2 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Detaching after vfork from child process 10699]
Steam AppId(570), BreakpadId(373300)
Using breakpad crash handler
[S_API] SteamAPI_Init(): Loaded '/data/USER/Steam/linux64/steamclient.so' OK.
Setting breakpad minidump AppID = 570
Forcing breakpad minidump interfaces to load
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
Steam_SetMinidumpSteamID:  Caching Steam ID:  76561198278574882 [API loaded yes]
Steam_SetMinidumpSteamID:  Setting Steam ID:  76561198278574882
SteamAPI_Init succeeded.  SteamID is [U:1:318309154] (76561198278574882), AppID is 570
Setting breakpad minidump AppID = 373300
CSteam3Client::Activate succeeded.  SteamID is [U:1:318309154] (76561198278574882), AppID is 570
[New Thread 0x7ffff3b83700 (LWP 10700)]
[New Thread 0x7ffff3b02700 (LWP 10701)]
[New Thread 0x7ffff3a81700 (LWP 10702)]
[New Thread 0x7ffff144c700 (LWP 10704)]
[New Thread 0x7ffff3699700 (LWP 10705)]
WARNING: CDirWatcher not implemented
Enabling instance extension: VK_KHR_get_physical_device_properties2.
PrimusVK: CreateInstance
PrimusVK: Getting devices
[New Thread 0x7fffe6f0d700 (LWP 10707)]
[New Thread 0x7fffe65cb700 (LWP 10708)]
PrimusVK: Searching for display GPU:
PrimusVK: 0x1018c0c00: 
PrimusVK: Got integrated gpu!
PrimusVK: Device: Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2)
PrimusVK:   Type: 1
PrimusVK: Searching for render GPU:
PrimusVK: 0x1018c0c00: 
PrimusVK: 0x1018c0c00: 
PrimusVK: Got discrete gpu!
PrimusVK: Device: GeForce GTX 1050 Ti
PrimusVK:   Type: 2

Thread 1 "dota2" received signal SIGSEGV, Segmentation fault.
0x00007fffef6b9ee3 in vkGetPhysicalDeviceProperties () from /usr/lib/libvulkan.so.1

For reference, here is the console output when running Dota2 without Steam (which launches the game but has it complain about losing connection to Steam)

Using breakpad crash handler
[S_API] SteamAPI_Init(): SteamAPI_IsSteamRunning() did not locate a running instance of Steam.
[S_API] SteamAPI_Init(): Loaded '/data/USER/Steam/linux64/steamclient.so' OK.
[S_API FAIL] SteamAPI_Init() failed; create pipe failed.Setting breakpad minidump AppID = 373300
Forcing breakpad minidump interfaces to load
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
[S_API] SteamAPI_Init(): SteamAPI_IsSteamRunning() did not locate a running instance of Steam.
[S_API] SteamAPI_Init(): Loaded '/data/USER/Steam/linux64/steamclient.so' OK.
[S_API FAIL] SteamAPI_Init() failed; create pipe failed.PrimusVK: CreateInstance
PrimusVK: Getting devices
PrimusVK: Searching for display GPU:
PrimusVK: 0x9dbc10a3400: 
PrimusVK: Got integrated gpu!
PrimusVK: Device: Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2)
PrimusVK:   Type: 1
PrimusVK: Searching for render GPU:
PrimusVK: 0x9dbc10a3400: 
PrimusVK: 0x9dbc10a3400: 
PrimusVK: Got discrete gpu!
PrimusVK: Device: GeForce GTX 1050 Ti
PrimusVK:   Type: 2
PrimusVK: in function: creating device
PrimusVK: Extension: 3
PrimusVK: Extension: 48
PrimusVK: Extension: 48
PrimusVK: spawning secondary device creation: 0x9dbbfa57ed8
PrimusVK: After reset:0
PrimusVK: fetching dispatch for 0x9dbc0ce0200
PrimusVK: GetDeviceProcAddr is: 0x68c5a4d2ae70
PrimusVK: Create Swapchain KHR is: 0x68c5a4d3db60
PrimusVK: Thread running
PrimusVK: getting rendering suff: 0x9dbc10a3400
PrimusVK: CreateDevice done
PrimusVK: Gpus: 2
PrimusVK: phys[1]: 0x9dbc2024c00
PrimusVK: render queues: 1
PrimusVK:  flags: 7
PrimusVK: in function: creating device
PrimusVK: Extension: 3
PrimusVK: Extension: 48
PrimusVK: Extension: 48
PrimusVK: fetching dispatch for 0x9dbc0cdb300
PrimusVK: GetDeviceProcAddr is: 0x68c5a4d2ae70
PrimusVK: Create Swapchain KHR is: 0x68c5a4d3db60
PrimusVK: CreateDevice done
PrimusVK: Create Graphics FINISHED!: 0
PrimusVK: Display: 0x9dbc0cdb300
PrimusVK: storing as reference to: 0x9dbc0ce0200
PrimusVK: joining secondary device creation
PrimusVK: When startup hangs here, you have probably hit the initialization deadlock
PrimusVK: joining succeeded. Luckily initialization deadlock did not occur.
PrimusVK: Application requested 4 images.
PrimusVK: Creating Swapchain for size: 1920x1080
PrimusVK: MinImageCount: 4
PrimusVK: fetching device for: 0x9dbc0ce0200
PrimusVK: found: 0x9dbc0cdb300
PrimusVK: FamilyIndexCount: 0
PrimusVK: Dev: 0x9dbc0cdb300
PrimusVK: Swapchainfunc: 0x68c5a4d3db60
PrimusVK: >> Swapchain create done 0;0x9dbc2375480
PrimusVK: Image aquiring: 4
PrimusVK: Selected render mem: 9;7 display: 0
PrimusVK: Creating image: 1920x1080
PrimusVK: Creating image: 1920x1080
PrimusVK: Creating image: 1920x1080
PrimusVK: Creating image: 1920x1080
PrimusVK: Creating image: 1920x1080
PrimusVK: Creating image: 1920x1080
PrimusVK: Creating image: 1920x1080
PrimusVK: Creating image: 1920x1080
PrimusVK: Creating image: 1920x1080
PrimusVK: Creating image: 1920x1080
PrimusVK: Creating image: 1920x1080
PrimusVK: Creating image: 1920x1080
PrimusVK: Creating a Swapchain thread.
PrimusVK: Get Swapchain Images buffer: 0x7964293d4cc0
PrimusVK: Count: 4
Fontconfig warning: "/data/ian/Steam/steamapps/common/dota 2 beta/game/core/panorama/fonts/conf.d/41-repl-os-win.conf", line 148: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/data/ian/Steam/steamapps/common/dota 2 beta/game/core/panorama/fonts/conf.d/41-repl-os-win.conf", line 160: Having multiple values in <test> isn't supported and may not work as expected
[S_API] SteamAPI_Init(): SteamAPI_IsSteamRunning() did not locate a running instance of Steam.
[S_API] SteamAPI_Init(): Loaded '/data/USER/Steam/linux64/steamclient.so' OK.
[S_API FAIL] SteamAPI_Init() failed; create pipe failed.[S_API] SteamAPI_Init(): SteamAPI_IsSteamRunning() did not locate a running instance of Steam.
[S_API] SteamAPI_Init(): Loaded '/data/USER/Steam/linux64/steamclient.so' OK.
[S_API FAIL] SteamAPI_Init() failed; create pipe failed.[S_API FAIL] Tried to access Steam interface STEAMREMOTESTORAGE_INTERFACE_VERSION014 before SteamAPI_Init succeeded.
[S_API] SteamAPI_Init(): SteamAPI_IsSteamRunning() did not locate a running instance of Steam.
[S_API] SteamAPI_Init(): Loaded '/data/USER/Steam/linux64/steamclient.so' OK.
[S_API FAIL] SteamAPI_Init() failed; create pipe failed. failed to dlopen "libtensorflow.so" error=libtensorflow.so: cannot open shared object file: No such file or directory
[S_API] SteamAPI_Init(): SteamAPI_IsSteamRunning() did not locate a running instance of Steam.
[S_API] SteamAPI_Init(): Loaded '/data/USER/Steam/linux64/steamclient.so' OK.
[S_API FAIL] SteamAPI_Init() failed; create pipe failed.[S_API FAIL] Tried to access Steam interface STEAMREMOTESTORAGE_INTERFACE_VERSION014 before SteamAPI_Init succeeded.
[S_API FAIL] Tried to access Steam interface SteamUtils009 before SteamAPI_Init succeeded.
../common/video/videoplayer.cpp (235) : Assertion Failed: !m_strURL.IsEmpty() || m_bufFromMemory.TellPut() > 0
../common/video/videoplayer.cpp (235) : Assertion Failed: !m_strURL.IsEmpty() || m_bufFromMemory.TellPut() > 0
Video playback error (1): Failed to initialize manifest
Video playback error (1): Failed to initialize manifest
[S_API FAIL] Tried to access Steam interface SteamFriends017 before SteamAPI_Init succeeded.
[S_API FAIL] Tried to access Steam interface STEAMHTTP_INTERFACE_VERSION003 before SteamAPI_Init succeeded.
[S_API FAIL] Tried to access Steam interface STEAMUSERSTATS_INTERFACE_VERSION011 before SteamAPI_Init succeeded.
[S_API FAIL] Tried to access Steam interface SteamUser020 before SteamAPI_Init succeeded.
../common/video/videoplayer.cpp (235) : Assertion Failed: !m_strURL.IsEmpty() || m_bufFromMemory.TellPut() > 0
Video playback error (1): Failed to initialize manifest
PrimusVK: >> Destroy swapchain: 0x9dbc2375480
LuaDbg - Debugging stopped
ENABLE_PRIMUS_LAYER=1 ./dota.sh  24.81s user 2.06s system 69% cpu 38.587 total

And here is me running vkcube (which works)

PrimusVK: CreateInstance
PrimusVK: Getting devices
PrimusVK: Searching for display GPU:
PrimusVK: 0x729eb1b8960: 
PrimusVK: Got integrated gpu!
PrimusVK: Device: Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2)
PrimusVK:   Type: 1
PrimusVK: Searching for render GPU:
PrimusVK: 0x729eb1b8960: 
PrimusVK: 0x729eb1b8960: 
PrimusVK: Got discrete gpu!
PrimusVK: Device: GeForce GTX 1050 Ti
PrimusVK:   Type: 2
PrimusVK: in function: creating device
PrimusVK: Extension: 3
PrimusVK: Extension: 48
PrimusVK: Extension: 48
PrimusVK: spawning secondary device creation: 0x729eb4adb18
PrimusVK: After reset:0
PrimusVK: fetching dispatch for 0x729eb5cfec0
PrimusVK: GetDeviceProcAddr is: 0x623c86c23e70
PrimusVK: Create Swapchain KHR is: 0x623c86c36b60
PrimusVK: CreateDevice done
PrimusVK: Thread running
PrimusVK: getting rendering suff: 0x729eb1b8960
PrimusVK: Gpus: 2
PrimusVK: phys[1]: 0x623c6c000c20
PrimusVK: render queues: 1
PrimusVK:  flags: 7
PrimusVK: in function: creating device
PrimusVK: Extension: 3
PrimusVK: Extension: 48
PrimusVK: Extension: 48
PrimusVK: joining secondary device creation
PrimusVK: When startup hangs here, you have probably hit the initialization deadlock
PrimusVK: fetching dispatch for 0x623c6c004d90
PrimusVK: GetDeviceProcAddr is: 0x623c86c23e70
PrimusVK: Create Swapchain KHR is: 0x623c86c36b60
PrimusVK: CreateDevice done
PrimusVK: Create Graphics FINISHED!: 0
PrimusVK: Display: 0x623c6c004d90
PrimusVK: storing as reference to: 0x729eb5cfec0
PrimusVK: joining succeeded. Luckily initialization deadlock did not occur.
PrimusVK: Application requested 3 images.
PrimusVK: Creating Swapchain for size: 500x500
PrimusVK: MinImageCount: 3
PrimusVK: fetching device for: 0x729eb5cfec0
PrimusVK: found: 0x623c6c004d90
PrimusVK: FamilyIndexCount: 0
PrimusVK: Dev: 0x623c6c004d90
PrimusVK: Swapchainfunc: 0x623c86c36b60
PrimusVK: >> Swapchain create done 0;0x729eb68e1e0
PrimusVK: Image aquiring: 3
PrimusVK: Selected render mem: 9;7 display: 0
PrimusVK: Creating image: 500x500
PrimusVK: Creating image: 500x500
PrimusVK: Creating image: 500x500
PrimusVK: Creating image: 500x500
PrimusVK: Creating image: 500x500
PrimusVK: Creating image: 500x500
PrimusVK: Creating image: 500x500
PrimusVK: Creating image: 500x500
PrimusVK: Creating image: 500x500
PrimusVK: Creating a Swapchain thread.
PrimusVK: Get Swapchain Images buffer: 0x729eb788e70
PrimusVK: Count: 3
PrimusVK: >> Destroy swapchain: 0x729eb68e1e0

From my limited understanding, vkGetPhysicalDeviceProperties() in Vulkan itself fails if and only if Steam is running while playing a game that connects to Steam?

felixdoerre commented 5 years ago

Yup, that is what it looks like. Can you please obtain a backtrace (gdb command bt) when gdb pauses after the segfault?

silikeite commented 5 years ago
(gdb) bt
#0  0x00007fffef6b9ee3 in vkGetPhysicalDeviceProperties () from /usr/lib/libvulkan.so.1
#1  0x00007fffefcda784 in ?? () from /data/ian/Steam/steamapps/common/dota 2 beta/game/bin/linuxsteamrt64/librendersystemvulkan.so
#2  0x00007ffff72bd553 in ?? () from /data/ian/Steam/steamapps/common/dota 2 beta/game/bin/linuxsteamrt64/libengine2.so
#3  0x00007fffffffb6d8 in ?? ()
#4  0x00007fffffffb6dc in ?? ()
#5  0x00007fffffffb768 in ?? ()
#6  0x0000000000000000 in ?? ()

i get the same thing on both steam-native and steam-runtime (both with and without ENABLE_PRIMUS_LAYER=1)

On my system Dota launches on Vulkan if i uninstall primus_vk (though obviously on the intel card)

felixdoerre commented 5 years ago

it's not that surprising that the problem is in vkGetPhysicalDeviceProperties. Without primus_vk installed the application has only the Intel physicalDevice to put into vkGetPhysicalDeviceProperties. With primus_vk installed, the application has both physical devices at it's disposal, and is reponsible for choosing the intel device (as the dedicated device will not be able to create a surface). With primus_vk enabled, the application only gets the dedicated device and probably will put that into vkGetPhysicalDeviceProperties.

The next step would probably to install debug symbols for libvulkan and find the exact location where it crashes (https://github.com/KhronosGroup/Vulkan-Loader/blob/master/loader/trampoline.c#L728 ). Then we'd know which arguments are wrongly put into this vulkan function, and who is responsible for the crash.

silikeite commented 5 years ago

I guess that would also explain why I can't launch any vulkan apps directly to run on my Intel gpu, instead having to specify VK_ICD_FILENAMES.

How would you "install debug symbols for libvulkan"? (Sorry, I'm not used to this) Is there some package that I 'm supposed to install, or am I supposed to recompile vulkan-icd-loader or something?

felixdoerre commented 5 years ago

It seems that on arch you need to recompile the package with options (debug !strip) see here: https://wiki.archlinux.org/index.php/Debug_-_Getting_Traces#General

silikeite commented 5 years ago

I can't seem to find a non-precompiled version of vulkan-icd-loader in AUR. In that case would I need to somehow write a custom package for it (...which I don't know how to do) or use a different method?

On Fri, Jun 21, 2019, 07:47 felixdoerre notifications@github.com wrote:

It seems that on arch you need to recompile the package with options (debug !strip) see here: https://wiki.archlinux.org/index.php/Debug_-_Getting_Traces#General

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/felixdoerre/primus_vk/issues/42?email_source=notifications&email_token=AA6TFUWRSYGFYGLNN6Y3JUTP3QJKVA5CNFSM4HYXZVE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYHBAEY#issuecomment-504238099, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6TFURQSSUKOIRLX3QVCUDP3QJKVANCNFSM4HYXZVEQ .

silikeite commented 5 years ago

Nevermind I somehow did it... I got this

(gdb) run
Starting program: /data/ian/Steam/steamapps/common/dota 2 beta/game/bin/linuxsteamrt64/dota2 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Detaching after vfork from child process 3336]
Steam AppId(570), BreakpadId(373300)
Using breakpad crash handler
[S_API] SteamAPI_Init(): Loaded '/data/ian/Steam/linux64/steamclient.so' OK.
Setting breakpad minidump AppID = 570
Forcing breakpad minidump interfaces to load
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
Steam_SetMinidumpSteamID:  Caching Steam ID:  76561198278574882 [API loaded yes]
Steam_SetMinidumpSteamID:  Setting Steam ID:  76561198278574882
SteamAPI_Init succeeded.  SteamID is [U:1:318309154] (76561198278574882), AppID is 570
Setting breakpad minidump AppID = 373300
CSteam3Client::Activate succeeded.  SteamID is [U:1:318309154] (76561198278574882), AppID is 570
[New Thread 0x7ffff3b82700 (LWP 3337)]
[New Thread 0x7ffff3b01700 (LWP 3338)]
[New Thread 0x7ffff3a80700 (LWP 3339)]
[New Thread 0x7ffff141d700 (LWP 3341)]
[New Thread 0x7ffff3696700 (LWP 3342)]
WARNING: CDirWatcher not implemented
Enabling instance extension: VK_KHR_get_physical_device_properties2.
PrimusVK: CreateInstance
PrimusVK: Getting devices
[New Thread 0x7fffe6e9d700 (LWP 3343)]
[New Thread 0x7fffe655b700 (LWP 3344)]
PrimusVK: Searching for display GPU:
PrimusVK: 0x1018c0c00: 
PrimusVK: Got integrated gpu!
PrimusVK: Device: Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2)
PrimusVK:   Type: 1
PrimusVK: Searching for render GPU:
PrimusVK: 0x1018c0c00: 
PrimusVK: 0x1018c0c00: 
PrimusVK: Got discrete gpu!
PrimusVK: Device: GeForce GTX 1050 Ti
PrimusVK:   Type: 2

Thread 1 "dota2" received signal SIGSEGV, Segmentation fault.
vkGetPhysicalDeviceProperties (physicalDevice=0x1, pProperties=0x7fffffffb8b0) at /usr/src/debug/Vulkan-Loader-1.1.108/loader/trampoline.c:733
733     /usr/src/debug/Vulkan-Loader-1.1.108/loader/trampoline.c: No such file or directory.
(gdb) bt
#0  vkGetPhysicalDeviceProperties (physicalDevice=0x1, pProperties=0x7fffffffb8b0) at /usr/src/debug/Vulkan-Loader-1.1.108/loader/trampoline.c:733
#1  0x00007fffefcaa784 in ?? () from /data/ian/Steam/steamapps/common/dota 2 beta/game/bin/linuxsteamrt64/librendersystemvulkan.so
#2  0x00007ffff72bc553 in ?? () from /data/ian/Steam/steamapps/common/dota 2 beta/game/bin/linuxsteamrt64/libengine2.so
#3  0x00007fffffffbcb8 in ?? ()
#4  0x00007fffffffbcbc in ?? ()
#5  0x00007fffffffbd48 in ?? ()
#6  0x0000000000000000 in ?? ()
(gdb) 

Running without steam still works The output from gdb for the working (without steam) dota2 is a bit too long to fit here so I posted it to pastebin https://pastebin.com/7v9DWB3e

felixdoerre commented 5 years ago

As this seems to get increasingly weird I've installed dota2 on my system and tested it. It runs flawlessly, also with steam (and even if started from within steam).

To the backtrace: (physicalDevice=0x1, pProperties=0x7fffffffb8b0) it seems the first parameter passed to vkGetPhysicalDeviceProperties is wrong. That should be a memory address of a VkPhysicalDevice-object, which 0x1 definitively isn't.

silikeite commented 5 years ago

Maybe there is something wrong with how I installed primus_vk? I switched back to the official package for Arch. For primus_vk to work for me i have to symlink nvidia_icd.json to nv_vulkan_wrapper.json (maybe this is the source of the bug?)

This time I got a different value for physicalDevice

physicalDevice=0x4400, pProperties=0x7fffffffbb20

in gdb

felixdoerre commented 5 years ago

0x4400 probably isn't a valid address either. What do you currently have in /usr/share/vulkan/icd.d? Have you tried removing nvidia_icd.json instead of replacing it with a symlink?

silikeite commented 5 years ago

Contents of icd.d would be intel_icd.i686.json intel_icd.x86_64.json
nvidia_icd.json (symlink to nv_vulkan_wrapper.json) nvidia_icd.json.bak nv_vulkan_wrapper.json

I deleted nvidia_icd.json and got physicalDevice=0x0, pProperties=0x7fffffffbca0 while steam is on. Steam off still works

When testing dota2 on your system, what hardware/distro/icd setup did you use?

silikeite commented 5 years ago

For kicks I tried running vulkaninfo.... and I got a segfault

Thread 1 "vulkaninfo" received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007ffff39c29f0 in ?? () from /usr/lib/libnvidia-eglcore.so.430.26
#2  0x00007ffff39b708a in ?? () from /usr/lib/libnvidia-eglcore.so.430.26
#3  0x00007ffff39b70ad in ?? () from /usr/lib/libnvidia-eglcore.so.430.26
#4  0x00007ffff7dc1408 in terminator_GetPhysicalDeviceSurfaceFormats2KHR (physicalDevice=0x100608c80, pSurfaceInfo=0x7fffffffd4e0, pSurfaceFormatCount=0x7fffffffd4a0, pSurfaceFormats=0x0)
    at /usr/src/debug/Vulkan-Loader-1.1.108/loader/extension_manual.c:176
#5  0x000000010000c7d7 in ?? ()
#6  0x0000000100003997 in ?? ()
#7  0x00007ffff7c10ee3 in __libc_start_main () from /usr/lib/libc.so.6
#8  0x0000000100004f7e in ?? ()

What I still don't understand is why having Steam running in the background would make any difference

felixdoerre commented 5 years ago

Ooh sorry, I missed your question about my setup, where Dota2 runs:

silikeite commented 5 years ago

I am on:

Could the default package being built with libGLX_nvidia.so.0 be the issue?

silikeite commented 5 years ago

I recompiled with libGL.so.1 but unfortunately the problem persists

silikeite commented 5 years ago

I just thought of something Does Steam have its own icd.d?

felixdoerre commented 5 years ago

No, steam only brings a few layers: ~/.local/share/vulkan/implicit_layer.d/steam*

silikeite commented 5 years ago

I tried running Fallout New Vegaa on Proton as well Running it with Intel works... with Nvidia it crashes right afrer the intro (dmesg reporrs a vulkan segfault as well)

I can't test Fallout NV without Steam because DRM but it seems to me that something really wrong happens once Steam is involved

felixdoerre commented 5 years ago

you cold try to delete those implicit layers to forcefully disable them (and hope to be fast enough before steam puts them back in there).

adrfantini commented 5 years ago

I would like to test on my setup as well. I also run bumblebee on an nvidia card (960M) on Arch. It's not clear to me: once I installed primus_vk and lib32_primus_vk and added ENABLE_PRIMUS_LAYER=1 optirun %command% -vulkan, is there any other step I should take? I'm also trying to run Dota2 and I also get segfaults in this way, both with native and runtime steam.

greyltc commented 5 years ago

In case it helps you here, I've had good success with running proton steam stuff (in Arch) with this launch method:

ENABLE_PRIMUS_LAYER=1 VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nv_vulkan_wrapper.json:/usr/share/vulkan/icd.d/intel_icd.x86_64.json optirun steam-native
vernwinkle commented 4 months ago

I'm having difficulties running steam on my discrete GPU, https://github.com/ValveSoftware/Proton/issues/150#issuecomment-2198117039

felixdoerre commented 4 months ago

@vernwinkle I don't believe your issue has anything to do with the symptoms mentioned here. Also in the comment in the Proton repository I don't see any indication that primus_vk is running (only that the layer is installed). With that information I cannot help you. Does primus_vk work generally on your system? Did you try launching steam with gamemoderun instead of running a single game with it? A simple check to see if gamemoderun is actually launching primus_vk might be vulkaninfo | grep deviceName and check if the name of the discrete GPU is printed. Please create a new issue and describe what you were doing, and what the expected and observed behavior is.