Closed wchao96 closed 6 months ago
Seems to be an issue with VSync. Testing with RE Village, the start-up screen has VSync enabled which works. Once it loads into the main menu though, it will use your VSync setting. If you have it set to off, the screen freezes. Enabling VSync will work. Similarly, if you toggle VSync off in-game (if it was on), will immediately freeze the screen.
Changing line 1505 of swapchain.c
/* Just start out in FIFO, we will change it at-will later. */
present_mode = VK_PRESENT_MODE_FIFO_KHR;
to this
present_mode = chain->request.swap_interval > 0 ? VK_PRESENT_MODE_FIFO_KHR : VK_PRESENT_MODE_IMMEDIATE_KHR;
fixes the issue.
I'm guessing always setting it to FIFO means the present_mode will only support VSync ON? (or the "change it at-will later" part isn't happening)
Which mesa commit are you on exactly? I cannot reproduce this on mesa main or 23.3.4 (which does not expose the present mode group).
It should not be possible for that diff you suggested to fix anything.
I'm currrently on 24.0.0-git.20240203.d32d010 through Nobara. I believe the previous version 24.0.0-git-20240131.e3c2dc2 wasn't working as well, but the driver from before that was working...
I tried:
Tested on KDE and GNOME and I cannot reproduce any of this :\
Guess I'll need to add more trace logging to figure out where it's deadlocking.
@wchao96 can you try running with https://github.com/HansKristian-Work/vkd3d-proton/tree/swapchain-logging and paste the log?
witcher 3 with labwc with Mangohud.
failed-with-mangohud.log
without Mangohud
success-without-mangohud.log
update: ignore my comment, I was wrong. my problem is related immediate present mode (I have settings in dxvk.conf and mangohud.conf, old mesa has broken wsi, and i had hacky config. now mesa (bd2375399180198b777d0dc9da4eba660b5e2afb) has correct wsi image_count, so I can use fifo mode. also can enable fifo by dxgi.syncInterval = 1 ... anyway, my issue is solved. thanks themaister!)
@yuiiio I don't see a deadlock in the "failed" log. Are you sure this is reproducible? I.e. mangohud hangs 100% of the time and no mangohud always works?
When mangohud is enabled,
open the map in game and it stuck.
for me, it's 100% reproducible
(in discord atbjyk is me.)
and sorry. my issue is not related EXT_swapchain_maintenance1.
maybe not same problem.
my issue was rerated immediate present mode. see above comment.
Hey @HansKristian-Work thanks for looking into it. Here is the log as requested using swapchain-logging. steam-1778820.log Seems like a very specific issue... Hope it helps!
19522.008:0134:0240:info:vkd3d-proton:dxgi_vk_swap_chain_recreate_swapchain_in_present_task: Got 5 swapchain images.
19522.009:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_try_acquire_next_image: Begin vkAcquireNextImageKHR.
19522.009:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_try_acquire_next_image: End vkAcquireNextImageKHR.
19522.009:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_present_iteration: Begin vkQueuePresentKHR, ID = 0, swap interval 0.
19522.009:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_present_iteration: End vkQueuePresentKHR
19522.009:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_ensure_unsignaled_swapchain_fence: Begin wait on swapchain fence.
19522.010:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_ensure_unsignaled_swapchain_fence: End wait on swapchain fence.
19522.033:0134:0240:info:vkd3d-proton:dxgi_vk_swap_chain_recreate_swapchain_in_present_task: Got 5 swapchain images.
19522.033:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_try_acquire_next_image: Begin vkAcquireNextImageKHR.
19522.033:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_try_acquire_next_image: End vkAcquireNextImageKHR.
19522.033:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_present_iteration: Begin vkQueuePresentKHR, ID = 0, swap interval 0.
19522.034:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_present_iteration: End vkQueuePresentKHR
19522.034:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_ensure_unsignaled_swapchain_fence: Begin wait on swapchain fence.
19522.034:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_ensure_unsignaled_swapchain_fence: End wait on swapchain fence.
19522.068:0134:0240:info:vkd3d-proton:dxgi_vk_swap_chain_recreate_swapchain_in_present_task: Got 5 swapchain images.
19522.068:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_try_acquire_next_image: Begin vkAcquireNextImageKHR.
19522.068:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_try_acquire_next_image: End vkAcquireNextImageKHR.
19522.068:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_present_iteration: Begin vkQueuePresentKHR, ID = 0, swap interval 0.
19522.072:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_present_iteration: End vkQueuePresentKHR
19522.072:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_ensure_unsignaled_swapchain_fence: Begin wait on swapchain fence.
19522.072:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_ensure_unsignaled_swapchain_fence: End wait on swapchain fence.
19522.096:0134:0240:info:vkd3d-proton:dxgi_vk_swap_chain_recreate_swapchain_in_present_task: Got 5 swapchain images.
19522.096:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_try_acquire_next_image: Begin vkAcquireNextImageKHR.
19522.096:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_try_acquire_next_image: End vkAcquireNextImageKHR.
19522.096:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_present_iteration: Begin vkQueuePresentKHR, ID = 0, swap interval 0.
19522.096:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_present_iteration: End vkQueuePresentKHR
19522.096:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_ensure_unsignaled_swapchain_fence: Begin wait on swapchain fence.
19522.097:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_ensure_unsignaled_swapchain_fence: End wait on swapchain fence.
19522.121:0134:0240:info:vkd3d-proton:dxgi_vk_swap_chain_recreate_swapchain_in_present_task: Got 5 swapchain images.
19522.121:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_try_acquire_next_image: Begin vkAcquireNextImageKHR.
19522.121:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_try_acquire_next_image: End vkAcquireNextImageKHR.
19522.121:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_present_iteration: Begin vkQueuePresentKHR, ID = 0, swap interval 0.
19522.122:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_present_iteration: End vkQueuePresentKHR
19522.122:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_ensure_unsignaled_swapchain_fence: Begin wait on swapchain fence.
19522.122:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_ensure_unsignaled_swapchain_fence: End wait on swapchain fence.
19522.147:0134:0240:info:vkd3d-proton:dxgi_vk_swap_chain_recreate_swapchain_in_present_task: Got 5 swapchain images.
19522.147:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_try_acquire_next_image: Begin vkAcquireNextImageKHR.
19522.147:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_try_acquire_next_image: End vkAcquireNextImageKHR.
19522.147:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_present_iteration: Begin vkQueuePresentKHR, ID = 0, swap interval 0.
19522.148:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_present_iteration: End vkQueuePresentKHR
19522.148:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_ensure_unsignaled_swapchain_fence: Begin wait on swapchain fence.
19522.148:0134:0240:err:vkd3d-proton:dxgi_vk_swap_chain_ensure_unsignaled_swapchain_fence: End wait on swapchain fence.
seems like it's ending up in a continuous loop where it's recreating the swapchain for whatever reason. I'll add some extra logging.
@wchao96 I pushed a new commit with more debug info.
Recently vkd3d-proton added support for EXT_SWAPCHAIN_MAINTENANCE_1
https://github.com/HansKristian-Work/vkd3d-proton/commit/3061d3d959b45adb6559fdec26dce3c771caa7fc
Some distros such as ours (Nobara), Chimera, and Bazzite (probably others) add this patch from Valve to allow the framerate limiter in gamescope to work:
https://gitlab.com/evlaV/mesa/-/commit/47788aa34557f9aa79959a710fd34f7a0de13a63
The combination of these two introduced a bug where video playback would break in games using EXT_SWAPCHAIN_MAINTENANCE_1 because of this portion of the gamescope framelimiter patch being triggered:
After discussion with the vkd3d-proton devs it was determined that the vulkan/wsi/wsi_common_x11.c
portion of the patch actually is no longer needed and can be removed, because gamescope's WSI layer now handles that, and this patch was added before the WSI layer existed.
In Nobara we've gone ahead and removed that portion of the patch and verified video playback in upstream vkd3d-proton with vulkan from upstream mesa-git is now working again ( mesa-vulkan-drivers-24.1.0-git.20240209.11465e4.fc39.rpm )
I've also informed the devs for Chimera and Bazzite, who use the same patchset, so changes on their sides should follow.
For now the bug will exist in any distros who are using this patch that haven't updated it/haven't removed the affected portion of the patch.
Thanks @GloriousEggroll for the quick update (and great distro!) and @HansKristian-Work for helping to investigate. Can confirm the issues are now fixed on my side as well.
Closing issue.
Just wanted to say, I'm new to Linux and this has been an awesome ride. Have learnt a little bit about Vulkan (which is interesting!) trying to diagnose the issue and that the community is amazing here. Keep up the good work all :+1:
Disabling EXT_swapchain_maintenance1 in device.c like b282fd3 allows the games to run properly.
Software information
Tekken 8 - screen freezes after intro screen (press any button to continue) Cyberpunk 2077 - launches into a black screen REVillage - screen freezes after intro scenes Possibly other DX12 games too. Note that the games are still running as I can hear the game sounds in the background and can press buttons.
System information
Log files
Tekken 8 log file using proton-GE30 steam-1778820-GE30.log