VulkanCapsViewer
VulkanCapsViewer copied to clipboard
Segfault on Linux when no window back end is chosen at build time
Hi !
I'm using VulkanCapsViewer from time to time to provide the database the last informations about my hardware. Since some days, I can't run it, it crash right after launch with a Segfault. I believe it started to act like this since the last update. I don't have problems running vkcube or vulkaninfo.
Here is the gdb stack trace of the AUR release:
#0 0x00007ffff7f72909 in ?? () from /usr/lib/libvulkan.so.1
#1 0x00005555555b2d5a in ?? ()
#2 0x0000555555589964 in ?? ()
#3 0x00005555555980e9 in ?? ()
#4 0x000055555559921c in ?? ()
#5 0x000055555556d5ad in ?? ()
#6 0x00007ffff6768152 in __libc_start_main () from /usr/lib/libc.so.6
#7 0x000055555557063e in ?? ()
And here is the gdb stack trace of a local build:
#0 0x00007ffff7f728f8 in ?? () from /usr/lib/libvulkan.so.1
#1 0x00005555555b13b9 in VulkanDeviceInfo::readSurfaceInfo(VkSurfaceKHR_T*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) ()
#2 0x000055555558973c in vulkanCapsViewer::getGPUinfo(VulkanDeviceInfo*, unsigned int, VkPhysicalDevice_T*) ()
#3 0x00005555555977d8 in vulkanCapsViewer::getGPUs() ()
#4 0x000055555559888a in vulkanCapsViewer::vulkanCapsViewer(QWidget*) ()
#5 0x000055555556e0d9 in main ()
Here is my system specs: OS: Arch Linux WM: Sway with xorg-wayland for Xorg support CPU: R7 1800X GPU: Fury X Drivers: Mesa RADV and AMDVLK
I am getting the same issue, also on Arch Linux since version 3.
Crashes in vkGetPhysicalDeviceSurfaceCapabilitiesKHR
#0 0x00007fffeaa3f2ba in () at /usr/lib/libvulkan_radeon.so
#1 0x00005555555da368 in VulkanSurfaceInfo::get(VkPhysicalDevice_T*, VkSurfaceKHR_T*)
(this=0x5555560d6860, device=0x555555dc2830, surface=0x7fffffffd900) at vulkansurfaceinfo.hpp:46
#2 0x00005555555d4924 in VulkanDeviceInfo::readSurfaceInfo(VkSurfaceKHR_T*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (this=0x5555560d6110, surface=0x7fffffffd900, surfaceExtension="") at vulkanDeviceInfo.cpp:654
#3 0x000055555558bdb2 in vulkanCapsViewer::getGPUinfo(VulkanDeviceInfo*, unsigned int, VkPhysicalDevice_T*) (this=
0x7fffffffd7c0, GPU=0x5555560d6110, id=0, device=0x555555dc2830) at vulkancapsviewer.cpp:714
#4 0x000055555558c40f in vulkanCapsViewer::getGPUs() (this=0x7fffffffd7c0) at vulkancapsviewer.cpp:791
#5 0x0000555555588a1e in vulkanCapsViewer::vulkanCapsViewer(QWidget*) (this=0x7fffffffd7c0, parent=0x0) at vulkancapsviewer.cpp:238
#6 0x000055555556448b in main(int, char**) (argc=1, argv=0x7fffffffdf28) at main.cpp:50
Turns out a similar wayland related issue exists since version 2.04
. I was not able to run any vulkanCapsViewer since then not crashing in readSurfaceInfo
.
38da3e8f63c38ce249860c9dbaab21536d60e0ad is the first bad commit
commit 38da3e8f63c38ce249860c9dbaab21536d60e0ad
Author: Eric Engestrom <[email protected]>
Date: Sat May 30 14:55:27 2020 +0200
add wayland support
vulkanCapsViewer.pro | 6 +++---
vulkancapsviewer.cpp | 15 ++++++++++++++-
2 files changed, 17 insertions(+), 4 deletions(-)
git tag --contains 38da3e8f63c38ce249860c9dbaab21536d60e0ad
2.04
2.2
2.21
3.0
The crash looks slightly different though back on the first bad commit, happening in vkGetPhysicalDeviceSurfaceFormatsKHR
:
#0 0x00007ffff68e0052 in wl_proxy_create_wrapper () at /usr/lib/libwayland-client.so.0
#1 0x00007fffea868cf5 in () at /usr/lib/libvulkan_radeon.so
#2 0x00007fffea868f83 in () at /usr/lib/libvulkan_radeon.so
#3 0x00005555555c7abb in VulkanSurfaceInfo::get(VkPhysicalDevice_T*, VkSurfaceKHR_T*)
(this=0x5555561ad508, device=0x555555ca7340, surface=0x555555a782e0) at vulkansurfaceinfo.hpp:63
#4 0x00005555555c30d8 in VulkanDeviceInfo::readSurfaceInfo(VkSurfaceKHR_T*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (this=0x5555561acde0, surface=0x555555a782e0, surfaceExtension="VK_KHR_wayland_surface")
at vulkanDeviceInfo.cpp:450
#5 0x00005555555846b8 in vulkanCapsViewer::getGPUinfo(VulkanDeviceInfo*, unsigned int, VkPhysicalDevice_T*) (this=
0x7fffffffd9d0, GPU=0x5555561acde0, id=0, device=0x555555ca7340) at vulkancapsviewer.cpp:644
#6 0x0000555555584d35 in vulkanCapsViewer::getGPUs() (this=0x7fffffffd9d0) at vulkancapsviewer.cpp:724
#7 0x000055555558165e in vulkanCapsViewer::vulkanCapsViewer(QWidget*) (this=0x7fffffffd9d0, parent=0x0) at vulkancapsviewer.cpp:200
#8 0x00005555555642d0 in main(int, char**) (argc=1, argv=0x7fffffffdf28) at main.cpp:48
The solution to this crash is to either remove qt5-wayland
or
diff --git a/vulkanCapsViewer.pro b/vulkanCapsViewer.pro
index 8092fdd..9ab00ad 100644
--- a/vulkanCapsViewer.pro
+++ b/vulkanCapsViewer.pro
@@ -22,10 +22,6 @@ win32 {
}
linux:!android {
LIBS += -lvulkan
- qtHaveModule(waylandclient) {
- QT += waylandclient
- DEFINES += VK_USE_PLATFORM_WAYLAND_KHR
- }
qtHaveModule(x11extras) {
QT += x11extras
DEFINES += VK_USE_PLATFORM_XCB_KHR
Now that the other versions worked, I was able to isolate the first bad commit for the crash since 3.0
:
4b541db2ab9c4d01a7f7f893e1598c847f5997d5 is the first bad commit
commit 4b541db2ab9c4d01a7f7f893e1598c847f5997d5
Merge: aee7a24 dc35e50
Author: Sascha Willems <[email protected]>
Date: Fri Dec 25 18:53:55 2020 +0100
Merge remote-tracking branch 'origin' into vulkan_11_12_features_props
.github/workflows/build.yml | 131 ++++++++++++++++++++++++++++++++++++++++++++
.travis.yml | 103 ----------------------------------
vulkanCapsViewer.pro | 14 ++---
3 files changed, 138 insertions(+), 110 deletions(-)
create mode 100644 .github/workflows/build.yml
delete mode 100644 .travis.yml
Rebasing the master branch to get rid of the merge commits results in the proper faulty patch:
640910bc2c3c2f6a5f11fc9d85ec2f77a80d5a1f is the first bad commit
commit 640910bc2c3c2f6a5f11fc9d85ec2f77a80d5a1f
Author: Sascha Willems <[email protected]>
Date: Fri Dec 25 18:16:05 2020 +0100
Testing github actions (#104)
Replace Travis with github actions
Create Builds for:
- Linux X11
- Linux Wayland
- Mac OS 10
- Windows
.github/workflows/build.yml | 129 ++++++++++++++++++++++++++++++++++++++++++++
.travis.yml | 103 -----------------------------------
vulkanCapsViewer.pro | 14 ++---
3 files changed, 136 insertions(+), 110 deletions(-)
create mode 100644 .github/workflows/build.yml
delete mode 100644 .travis.yml
The solution is to add the X11
define, how is also done in the CI.
qmake DEFINES+=X11
This is not selected by default.
I ran the release AUR executable with forced validation, and here is what it sayed.
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation /usr/bin/vulkanCapsViewer
VUID-vkGetPhysicalDeviceSurfaceCapabilitiesKHR-surface-parameter(ERROR / SPEC): msgNum: -566353962 - Validation Error: [ VUID-vkGetPhysicalDeviceSurfaceCapabilitiesKHR-surface-parameter ] Object 0: VK_NULL_HANDLE, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0xde3e1fd6 | Invalid VkSurfaceKHR Object 0x7fc6321337a8. The Vulkan spec states: surface must be a valid VkSurfaceKHR handle (https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VUID-vkGetPhysicalDeviceSurfaceCapabilitiesKHR-surface-parameter)
Objects: 1
[0] 0, type: 1, name: NULL
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 1567320034 - Validation Error: [ UNASSIGNED-Threading-Info ] Object 0: handle = 0x7fc6321337a8, type = VK_OBJECT_TYPE_SURFACE_KHR; | MessageID = 0x5d6b67e2 | Couldn't find VkSurfaceKHR Object 0x7fc6321337a8. This should not happen and may indicate a bug in the application.
Objects: 1
[0] 0x7fc6321337a8, type: 1000000000, name: NULL
[1] 75629 segmentation fault (core dumped) VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation /usr/bin/vulkanCapsViewer
I also ran the master branch locally built in gdb, and saw that for the two drivers I have installed (Mesa RADV, and AMD amdvlk), one doesn't trigger the segfault, but the other does. Uninstalling one of the drivers make it segfault, no matter what driver is installed.
@Krenodeno this fixed the AUR package for me. You need to delete the src folder (do a completely clean build) for it to work.
commit 26f837bb2a4a13713b94c2d33e7893d1de9e0a2e (HEAD -> master)
Author: Lubosz Sarnecki <[email protected]>
Date: Tue Feb 2 17:07:10 2021 +0100
Define X11 backend, since it's not done by default.
diff --git a/PKGBUILD b/PKGBUILD
index 2b31fee..3c5481a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -27,6 +27,7 @@ build() {
cd VulkanCapsViewer
qmake \
+ DEFINES+=X11 \
QMAKE_CFLAGS="$CFLAGS" \
QMAKE_CXXFLAGS="$CXXFLAGS" \
QMAKE_LFLAGS="$LDFLAGS" \
That will do the trick, but definitely not a solution, the issue still need to be addressed.
Thank you for the quick fix !
The wayland support was provided by a contributor. I'm not that deep into the whole Linux compositor thing, so a PR would be appreciated.
Related to #93
Got myself the AUR vulkan-caps-viewer-bin that is a prebuilt executable using X11 and is working.
I'll try too look into this issue.
@Krenodeno Could you please rename the issue to "Segfault on Linux when no window back end is chosen at build time".
I also updated the AUR git package to use only X11. https://aur.archlinux.org/packages/vulkan-caps-viewer-git
@SaschaWillems The proper solution would be to build all available back ends and chose the correct one (wayland or X11) at runtime. Hopefully somebody will come up with a proper patch for that, otherwise I will look into it.
Closing due to inactivity. If the issue still persists, feel free to open a new issue.