felixdoerre / primus_vk

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

World of Tanks hangs on startup. #8

Closed leonmaxx closed 5 years ago

leonmaxx commented 6 years ago

When starting it creates a window and shows WoT logo and then hangs. Without Primus-vk it works on integrated Intel UHD.

Full wine + dxvk + primus-vk log: wot_log.txt

Ask for any additional information.

leonmaxx commented 6 years ago

Seems like it hangs in PrimusVK_CreateSwapchainKHR at line 689.

Just in case, this log is with Intel UHD: wot_log_intel.txt

felixdoerre commented 6 years ago

So it hangs inside the intel ICD? That seems strange. Could you provide a backtrace for all threads? (i.e. thread apply all bt in gdb). What seems also strange (from wot_log.txt):

PrimusVK: Getting devices
PrimusVK: 0x7c0f16b0: 
PrimusVK: got display!
PrimusVK: Device: Intel(R) UHD Graphics 620 (Kabylake GT2)
PrimusVK:   Type: 1
PrimusVK: 0x7c0f16b0: 
PrimusVK: got render!
PrimusVK: Device: GeForce GTX 1050
PrimusVK:   Type: 2
PrimusVK: 0x7c0f16b0: 
PrimusVK: got display!
PrimusVK: Device: Intel(R) UHD Graphics 620 (Kabylake GT2)
PrimusVK:   Type: 1

Your system seams to report two VkDevices for the Intel GPU. Could you provide the output of optirun vulkaninfo?

leonmaxx commented 6 years ago

Vulkaninfo with optirun: vulkaninfo.txt

leonmaxx commented 6 years ago

Can't run it within gdb, it crashes before window is created.
Or I'm doing something wrong. I tried pvkrun gdb ./WorldOfTanks.exe.

felixdoerre commented 6 years ago

doesn't look wrong to me. No stdout from gdb? It should always catch crashes and report at least something. For the result from vulkaninfo: Yes you get two intel GPUs. PrimusVK currently chooses the last one. Just a quick guess would be to take the other one. So could you try to change: if(props.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU){ to if(props.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU && display == VK_NULL_HANDLE){ in primus_vk.cpp#L131?

However I have no idea at all why vulkan-smoketest is not affected.

felixdoerre commented 6 years ago

In general: do you have any idea, why your intel-ICD reports two GPUs?

leonmaxx commented 6 years ago

No idea.
In /usr/share/vulkan/icd.d there is only two files intel_icd.i686.json and intel_icd.x86_64.json with different library paths (i.e. 32-bit and 64-bit). In /etc/vulkan/icd.d there is only nvidia's json file.

I'll take a look later at what vulkaninfo does and where it finds second Intel GPU.

leonmaxx commented 6 years ago

vulkan-smoketest log: vulkan-smoketest_log.txt

leonmaxx commented 6 years ago

I found a problem, libvulkan searches for icd's twice in /usr/share/vulkan/icd.d direcory.
First time it searches in: /usr/share/vulkan/icd.d/ Second time: /usr/share//vulkan/icd.d/

This vulkan package is from EPEL repository so it can contain bugs.

leonmaxx commented 6 years ago

I just tried this change:

if(props.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU && display == VK_NULL_HANDLE){

Exact same result, hang on logo.

leonmaxx commented 6 years ago

No stdout from gdb? It should always catch crashes and report at least something.

With gdb it crashes earlier, even before WoT creates a window.

leonmaxx commented 6 years ago

Have no luck trying to debug it.
Maybe You can try: https://worldoftanks.com/
It's free-to-play, only need to register account and download it.

For wine: winetricks corefonts vcrun2008 d3dx9 xact and DXVK.

leonmaxx commented 6 years ago

I found a way to debug it. WoT have several faults during startup but they are handled by exception handlers, so just using 'c' gdb command it can continue running. But to get proper backtraces I need to do some rebuilds:

This will take some time.

felixdoerre commented 6 years ago

Hmm. I've tried and it does not work on my system:

$ wine WorldOfTanks.exe 
0009:err:seh:raise_exception Unhandled exception code c0000005 flags 0 addr 0xc683006a

I've installed:

corefonts
w_workaround_wine_bug-30713
vcrun2008
dxvk70
d3dx9
xact

Also starting through the Launcher does not work. It just ends. So I don't even get it running on the Intel GPU.

As for stacktraces you could collect: Even without vulkan, mesa and wine debug symbols they might already be useful.

leonmaxx commented 6 years ago

With gdb backtrace it's only addresses w/o any symbol information full log.
And this is with debug infos installed for Wine, Mesa, LLVM, etc.

I tried With winedbg - crashes shows symbol information but WoT in winedbg crashes much earlier.

felixdoerre commented 6 years ago

The backtraces you provided are of a segfault not of the game hanging in CreateSwapchainKHR. As you mentioned in https://github.com/felixdoerre/primus_vk/issues/8#issuecomment-430236682 you can step forward (with c) until the game hangs. Then press Ctrl+C to halt the execution while the game is hanging and generate a backtrace (that hopefully includes the trace where the execution is hanging in the intel driver). Hopefully some of the debug symbols should then show up (at least PrimusVK_CreateSwapchainKHR should be on one of the stack traces)

Am I right in my assumption and can you try to get that stack trace?

leonmaxx commented 6 years ago

Ok, a hang is actually a crash, but window somehow survives main application crash and stays open - that's why I thought it is a hang. Further "c" causes application to exit in gdb.

leonmaxx commented 5 years ago

With latest build of Primus-Vk it works!
Full start log: https://pastebin.com/cNNWDC3s

List of software versions used (if someone interested):
Wine: Proton 3.16-6
DXVK: 0.95
Mesa: 18.3.2
Nvidia Driver: 410.93
Primus-Vk: v20190119

felixdoerre commented 5 years ago

That's great news! I think it's this line https://github.com/felixdoerre/primus_vk/commit/61f41762bbdac58cafcf8974107b18141eae3de7#diff-cf601ee105293a802fec0bbf935eced1R191 that makes the game run. I left that line out because it caused a segfault previously, but that issue seems to be fixed elsewhere. I added it because to prevent a use-after-free which lead to a memory violation when starting Shadow of War. So Primus-Vk now works perfectly for you?

leonmaxx commented 5 years ago

Yes it does. Thanks a lot!

leonmaxx commented 5 years ago

Felix, is it possible than when V-Sync is enabled frames are presented out of order? It does looks like that.