suijingfeng / vkQuake3

Its based on ioq3,I add a vulkan based modular render back end which originally from https://github.com/kennyalive/Quake-III-Arena-Kenny-Edition
GNU General Public License v2.0
96 stars 28 forks source link

Hangs on wayland with custom resolution #19

Open parov0z opened 6 months ago

parov0z commented 6 months ago

OpenGL works fine on X11 and Wayland, but after I tried to switch to Vulkan, game just got frozen. Also in terminal I can see some repeated errors:

Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkQueueSubmit(vk.queue, 1, &submit_info, VK_NULL_HANDLE) 
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkQueueWaitIdle(vk.queue)

After collecting and comparing the logs I found this:

-------- Create vk.swapchain --------
 Surface capabilities, image_extent.width: 640, image_extent.height: 480
 Swapchain image count: 4
 Create command pool: vk.command_pool 
 Create command buffer: vk.command_buffer 
 Create depth image: vk.depth_image, 1680 x 1050. 
...

I tried changing resolution to 640x480 and it worked.

Here's a part of config that I've changed and which is not working:

seta cl_renderer "vulkan"
seta r_customheight "1680"
seta r_customwidth "1050"
seta r_fullscreen "1"
seta r_mode "-1"

Commandline to launch game with native wayland window: SDL_VIDEODRIVER=wayland quake3

terminal output with 640x480 resolution: lowres.log

terminal output with custom resolution when game freezes: custom.log

inxi-SCG.txt

runlevel5 commented 1 month ago

Could you please provide more details (for example your Linux distro, vulkan headers version, GPU, etc)? Lastly could you please get more backtrace of the crash with gdb?

parov0z commented 1 month ago

Manjaro KDE Nvidia GTX1050ti vulkan headers version 1:1.3.285-1

I don't think that bt will be useful, because it is not a crash, but more likely a render issue. Here what I've got after manually interrupting it in gdb:

...
 Create Image: menu/art/sliderbutt_0
^3menu/art/sliderbutt_1 without a extension, using menu/art/sliderbutt_1.tga instead. 
 Create Image: menu/art/sliderbutt_1

--- Common Initialization Complete ---
IP: 127.0.0.1
IP: 192.168.1.171
IP6: ::1
Opening IP6 socket: [::]:27960
Opening IP socket: 0.0.0.0:27960
HACK: approxmimating cinematic for Rage Pro or Voodoo
w=1680, h=1050, cols=256, rows=256, client=0, prtImage->width=8, prtImage->height=8
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkQueueSubmit(vk.queue, 1, &submit_info, VK_NULL_HANDLE) 
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkQueueWaitIdle(vk.queue) 
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkWaitForFences(vk.device, 1, &fence_renderFinished, VK_FALSE, 1e9) 
^3menu/art/accept_0 without a extension, using menu/art/accept_0.tga instead. 
 Create Image: menu/art/accept_0
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkQueueSubmit(vk.queue, 1, &submit_info, VK_NULL_HANDLE) 
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkQueueWaitIdle(vk.queue) 
^3menu/art/accept_1 without a extension, using menu/art/accept_1.tga instead. 
 Create Image: menu/art/accept_1
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkQueueWaitIdle(vk.queue) 
^3menu/art/back_0 without a extension, using menu/art/back_0.tga instead. 
 Create Image: menu/art/back_0
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkQueueWaitIdle(vk.queue) 
^3menu/art/back_1 without a extension, using menu/art/back_1.tga instead. 
 Create Image: menu/art/back_1
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkQueueWaitIdle(vk.queue) 
^3menu/art/cut_frame without a extension, using menu/art/cut_frame.tga instead. 
 Create Image: menu/art/cut_frame
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkQueueWaitIdle(vk.queue) 
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkWaitForFences(vk.device, 1, &fence_renderFinished, VK_FALSE, 1e9) 
tty] 
tty] 
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkWaitForFences(vk.device, 1, &fence_renderFinished, VK_FALSE, 1e9) 
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkQueueSubmit(vk.queue, 1, &submit_info, fence_renderFinished) 
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkWaitForFences(vk.device, 1, &fence_renderFinished, VK_FALSE, 1e9) 
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkQueueSubmit(vk.queue, 1, &submit_info, fence_renderFinished) 
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkWaitForFences(vk.device, 1, &fence_renderFinished, VK_FALSE, 1e9) 
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkQueueSubmit(vk.queue, 1, &submit_info, fence_renderFinished) 
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkWaitForFences(vk.device, 1, &fence_renderFinished, VK_FALSE, 1e9) 
Vulkan: error VK_ERROR_DEVICE_LOST returned by qvkQueueSubmit(vk.queue, 1, &submit_info, fence_renderFinished) 
tty] 
Thread 1 "quake3" received signal SIGINT, Interrupt.
0x00007ffff740f63d in poll () from /usr/lib/libc.so.6

(gdb) backtrace 
#0  0x00007ffff740f63d in poll () from /usr/lib/libc.so.6
#1  0x00007fffc6f2d9e4 in ?? () from /usr/lib/libnvidia-glcore.so.555.58.02
#2  0x00007fffc6f96edd in ?? () from /usr/lib/libnvidia-glcore.so.555.58.02
#3  0x00007fffc724076d in ?? () from /usr/lib/libnvidia-glcore.so.555.58.02
#4  0x00007fffc7384fe1 in ?? () from /usr/lib/libnvidia-glcore.so.555.58.02
#5  0x00007fffc86a42e0 in ?? () from /usr/lib/libGLX_nvidia.so.0
#6  0x00007fffc2eb6db0 in ?? () from /usr/lib/mangohud/libMangoHud.so
#7  0x00007ffff4a7f53b in ?? () from /opt/quake3/renderer_vulkan_x86_64.so
#8  0x00007ffff4a5e3bd in ?? () from /opt/quake3/renderer_vulkan_x86_64.so
#9  0x00007ffff4a5ebe6 in ?? () from /opt/quake3/renderer_vulkan_x86_64.so
#10 0x0000555555574d16 in ?? ()
#11 0x000055555556d743 in ?? ()
#12 0x0000555555587bf1 in ?? ()
#13 0x000055555555d266 in ?? ()
#14 0x00007ffff7329e08 in ?? () from /usr/lib/libc.so.6
#15 0x00007ffff7329ecc in __libc_start_main () from /usr/lib/libc.so.6
#16 0x000055555555d295 in ?? ()

If I done something wrong - let me know, because I don't have enough manual debugging expirience

As I reported earlier, there is difference in logs between Wayland and X11, where we can see that under wayland the surface size is 640x480, which does not match the size of an image. So after a little googling I found a similar issue in another projects:

https://github.com/ash-rs/ash/issues/690#issuecomment-1349832960 https://github.com/flyinghead/flycast/commit/90e9f70a1adfbdf1bf7233e2cc32d37a135d57b2

I changed default fallback resolution here to my native (and which is set in my q3config.cfg) and it works well. So maybe the right way to fix this is to use user configured resolution as fallback like in that issue above, or somehow get it from SDL? Of course, I have 0 vulkan knowledge, and maybe this is not a right way. Let me know if you need more logs / debug info

runlevel5 commented 1 month ago

I could reproduce the issue locally. Very interesting bug. Let me dig into see if I could provide more details for @suijingfeng to investigate