vkcube
vkcube copied to clipboard
WIP: wayland: handle VK_SUBOPTIMAL_KHR returned by vkAcquireNextImageKHR()
With the Vulkan WSI Wayland MR [1] that adds dma-buf hints support, vkcube may receive VK_SUBOPTIMAL_KHR
when calling vkAcquireNextImageKHR()
.
In this case, we should recreate the swapchain and pass the old swapchain as argument. This results in an optimal modifier being selected to recreate the surface's buffers.
[1] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12226
cc: @fooishbar
edit: this issue was related to a patch that I've added to the Vulkan WSI Wayland dma-buf feedback MR. This is fixed now.
Help required! From time to time I see a crash when recreate_swapchain()
is called, this is the trace:
Thread 1 vkcube received signal SIGSEGV, Segmentation fault.
0x00007ffff7f5bdd8 in wl_proxy_marshal () from /usr/lib/libwayland-client.so.0
(gdb) backtrace
#0 0x00007ffff7f5bdd8 in wl_proxy_marshal () from /usr/lib/libwayland-client.so.0
#1 0x00007fffea17d8a0 in wl_buffer_destroy (wl_buffer=0x555555703270) at /usr/include/wayland-client-protocol.h:1990
#2 wsi_wl_swapchain_destroy (wsi_chain=0x5555556fdd20, pAllocator=0x5555556f7030) at ../src/vulkan/wsi/wsi_common_wayland.c:1245
#3 0x000055555555ab60 in recreate_swapchain (vc=0x7fffffffded0) at ../main.c:808
#4 0x000055555555bb5c in mainloop_wayland (vc=0x7fffffffded0) at ../main.c:1271
#5 0x000055555555d34b in mainloop (vc=0x7fffffffded0) at ../main.c:1726
#6 0x000055555555d49c in main (argc=1, argv=0x7fffffffe428) at ../main.c:1761
I'm not sure if I did something wrong in the swapchain destruction in vkcube, as I don't know much about Vulkan clients.
I think vkcube
now lives in https://github.com/KhronosGroup/Vulkan-Tools. It also handles VK_SUBOPTIMAL_KHR
but does not yet recreate the swapchain, see https://github.com/KhronosGroup/Vulkan-Tools/blob/master/cube/cube.c#L1053-L1056