Describe the bug
After building and installing rpi-vk-driver on a 64bit RaspberryPi OS, trying to run any test will result in a segfault. It happens always.
Backtrace in cubemapping, for example:
pi@raspberrypi:~/src/vulkan/rpi-vk-driver/b3/test/cubemapping $ gdb ./cubemapping
GNU gdb (Debian 8.2.1-2+b3) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "aarch64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./cubemapping...(no debugging symbols found)...done.
(gdb) r
Starting program: /home/pi/src/vulkan/rpi-vk-driver/b3/test/cubemapping/cubemapping
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
supported extensions:
VK_KHR_surface
VK_KHR_display
VK_EXT_debug_report
VK_EXT_debug_utils
created vulkan instance
physical device with vulkan support found
physical device supports version 1.1.0
Enumerated displays
Display ID 32
Display name 1920x1080
Display width 530
Display height 300
Display horizontal resolution 1920
Display vertical resolution 1080
[New Thread 0x7ff7a5c1b0 (LWP 864)]
created window surface
physical device supports swap chains
physical device has 1 queue families
queue family #0 supports graphics
queue family #0 supports presentation
Thread 1 "cubemapping" received signal SIGSEGV, Segmentation fault.
0x0000007ff7b09298 in rpi_vkCreateShaderModule () from /usr/local/lib/librpi-vk-driver.so
(gdb) bt
#0 0x0000007ff7b09298 in rpi_vkCreateShaderModule () from /usr/local/lib/librpi-vk-driver.so
#1 0x0000007ff7afe6ac in createBufferToTextureShaderModule () from /usr/local/lib/librpi-vk-driver.so
#2 0x0000007ff7afe95c in setupEmulationResources () from /usr/local/lib/librpi-vk-driver.so
#3 0x0000007ff7b00618 in rpi_vkCreateDevice () from /usr/local/lib/librpi-vk-driver.so
#4 0x0000007ff7f7cf7c in terminator_CreateDevice ()
from /home/pi/src/vulkan/rpi-vk-driver/b3/vulkan-loader-prefix/src/vulkan-loader-build/loader/libvulkan.so.1
#5 0x0000007ff7f85680 in loader_create_device_chain ()
from /home/pi/src/vulkan/rpi-vk-driver/b3/vulkan-loader-prefix/src/vulkan-loader-build/loader/libvulkan.so.1
#6 0x0000007ff7f8618c in loader_layer_create_device ()
from /home/pi/src/vulkan/rpi-vk-driver/b3/vulkan-loader-prefix/src/vulkan-loader-build/loader/libvulkan.so.1
#7 0x0000007ff7f89510 in vkCreateDevice ()
from /home/pi/src/vulkan/rpi-vk-driver/b3/vulkan-loader-prefix/src/vulkan-loader-build/loader/libvulkan.so.1
#8 0x000000555555a768 in createLogicalDevice() ()
#9 0x000000555555d1c8 in setupVulkan() ()
#10 0x0000005555558f24 in main ()
To Reproduce
Build the vulkan driver and it's tests, and try to run the tests, resulting in segfault in every test:
pi@raspberrypi:~/src/vulkan/rpi-vk-driver/b3 $ make test
Running tests...
Test project /home/pi/src/vulkan/rpi-vk-driver/b3
Start 1: clear
1/22 Test #1: clear ............................***Exception: SegFault 0.18 sec
Start 2: triangle
2/22 Test #2: triangle .........................***Exception: SegFault 0.03 sec
Start 3: texturing
3/22 Test #3: texturing ........................***Exception: SegFault 0.15 sec
Start 4: varyings
4/22 Test #4: varyings .........................***Exception: SegFault 0.15 sec
Start 5: depthTest
5/22 Test #5: depthTest ........................***Exception: SegFault 0.15 sec
Start 6: stencilTest
6/22 Test #6: stencilTest ......................***Exception: SegFault 0.15 sec
Start 7: indexedTriangle
7/22 Test #7: indexedTriangle ..................***Exception: SegFault 0.15 sec
Start 8: blending
8/22 Test #8: blending .........................***Exception: SegFault 0.15 sec
Start 9: depthTex
9/22 Test #9: depthTex .........................***Exception: SegFault 0.17 sec
Start 10: MSAA
10/22 Test #10: MSAA .............................***Exception: SegFault 0.15 sec
Start 11: HDR
11/22 Test #11: HDR ..............................***Exception: SegFault 0.15 sec
Start 12: ETC
12/22 Test #12: ETC ..............................***Exception: SegFault 0.15 sec
Start 13: query
13/22 Test #13: query ............................***Exception: SegFault 0.15 sec
Start 14: mipmapping
14/22 Test #14: mipmapping .......................***Exception: SegFault 0.15 sec
Start 15: CPAtest
15/22 Test #15: CPAtest ..........................***Exception: SegFault 0.02 sec
Start 16: cubemapping
16/22 Test #16: cubemapping ......................***Exception: SegFault 0.15 sec
Start 17: attribTest
17/22 Test #17: attribTest .......................***Exception: SegFault 0.15 sec
Start 18: clearTest
18/22 Test #18: clearTest ........................***Exception: SegFault 0.15 sec
Start 19: mintest
19/22 Test #19: mintest .......................... Passed 0.12 sec
Start 20: FifoTest
20/22 Test #20: FifoTest .........................***Exception: SegFault 0.01 sec
Start 21: cubeMipmapping
21/22 Test #21: cubeMipmapping ...................***Exception: SegFault 0.16 sec
Start 22: multithreading
22/22 Test #22: multithreading ...................***Exception: SegFault 0.03 sec
5% tests passed, 21 tests failed out of 22
Total Test time (real) = 2.83 sec
The following tests FAILED:
1 - clear (SEGFAULT)
2 - triangle (SEGFAULT)
3 - texturing (SEGFAULT)
4 - varyings (SEGFAULT)
5 - depthTest (SEGFAULT)
6 - stencilTest (SEGFAULT)
7 - indexedTriangle (SEGFAULT)
8 - blending (SEGFAULT)
9 - depthTex (SEGFAULT)
10 - MSAA (SEGFAULT)
11 - HDR (SEGFAULT)
12 - ETC (SEGFAULT)
13 - query (SEGFAULT)
14 - mipmapping (SEGFAULT)
15 - CPAtest (SEGFAULT)
16 - cubemapping (SEGFAULT)
17 - attribTest (SEGFAULT)
18 - clearTest (SEGFAULT)
20 - FifoTest (SEGFAULT)
21 - cubeMipmapping (SEGFAULT)
22 - multithreading (SEGFAULT)
Expected behavior
I would expect that the tests actually ran. Instead, they all segfault.
Device information:
- Device info (eg. Raspberry Pi 3 Model A+) :
Raspberry Pi 3b+
- OS information (cat /proc/version, lsb_release -a)
Linux version 5.4.51-v8+ (dom@buildbot) (gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9)) #1325 SMP PREEMPT Mon Jul 13 13:54:12 BST 2020
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
- Kernel module information: lsmod
Module Size Used by
hid_logitech_hidpp 45056 0
evdev 24576 0
joydev 28672 0
hid_logitech_dj 24576 0
vc4 245760 3
cec 49152 1 vc4
drm_kms_helper 192512 3 vc4
drm 491520 3 drm_kms_helper,vc4
drm_panel_orientation_quirks 20480 1 drm
snd_soc_core 208896 1 vc4
snd_compress 20480 1 snd_soc_core
snd_pcm_dmaengine 20480 1 snd_soc_core
snd_pcm 122880 3 vc4,snd_soc_core,snd_pcm_dmaengine
snd_timer 40960 1 snd_pcm
snd 90112 4 snd_timer,snd_compress,snd_soc_core,snd_pcm
syscopyarea 16384 1 drm_kms_helper
sysfillrect 16384 1 drm_kms_helper
sysimgblt 16384 1 drm_kms_helper
fb_sys_fops 16384 1 drm_kms_helper
raspberrypi_hwmon 16384 0
i2c_bcm2835 16384 0
bcm2835_codec 49152 0
bcm2835_v4l2 45056 0
bcm2835_isp 32768 0
v4l2_mem2mem 32768 1 bcm2835_codec
videobuf2_dma_contig 20480 2 bcm2835_codec,bcm2835_isp
bcm2835_mmal_vchiq 32768 3 bcm2835_codec,bcm2835_v4l2,bcm2835_isp
videobuf2_vmalloc 20480 1 bcm2835_v4l2
videobuf2_memops 16384 2 videobuf2_vmalloc,videobuf2_dma_contig
videobuf2_v4l2 28672 4 bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem,bcm2835_isp
videobuf2_common 57344 5 bcm2835_codec,videobuf2_v4l2,bcm2835_v4l2,v4l2_mem2mem,bcm2835_isp
videodev 270336 6 bcm2835_codec,videobuf2_v4l2,bcm2835_v4l2,videobuf2_common,v4l2_mem2mem,bcm2835_isp
mc 53248 6 videodev,bcm2835_codec,videobuf2_v4l2,videobuf2_common,v4l2_mem2mem,bcm2835_isp
vc_sm_cma 40960 1 bcm2835_mmal_vchiq
uio_pdrv_genirq 16384 0
uio 24576 1 uio_pdrv_genirq
i2c_dev 20480 0
- Driver version (git commit ID or release info)
Latest GIT available version:
528da3ad10410377f8c87cf7bc32c48788e913fe
Additional context
I have built and installed the Vulkan driver on my Pi3b+ running 64bit Raspberry Pi OS without X11 like this:
-
Install previous dependencies:
sudo apt-get install --no-install-recommends libmtdev-dev libevdev-dev
-
Install VULKAN-HEADERS:
git clone --depth 1 https://github.com/KhronosGroup/Vulkan-Headers.git
mkdir build
cd build
cmake ..
sudo make install
export VULKAN_HEADERS_INSTALL_DIR=/usr/local
- Install VULKAN-LOADER (X11 support has been disabled: only KMS/DRM is needed)
git clone --depth 1 https://github.com/KhronosGroup/Vulkan-Loader.git
mkdir build
cd build
cmake -DBUILD_WSI_WAYLAND_SUPPORT=OFF -DBUILD_WSI_XLIB_SUPPORT=OFF -DBUILD_WSI_XCB_SUPPORT=OFF ..
make -j4
sudo make install
- Build and install the vulkan driver itself:
-Clone the repo and enter it:
git clone --depth 1 https://github.com/Yours3lf/rpi-vk-driver.git
cd rpi-vk-driver
-Edit the CMakeLists.tx
t and add the -fpermissive
flag, and the armv8-a
RPI_ARCH:
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
SET(RPI_ARCH "armv8-a")
-Edit test/CMakeLists.txt and remove the line add_subdirectory(inputTest)
so libinput and it's many dependencies is not needed.
-Create build dir, configure, build (changing depthImageView for depthImage when a test complains) and install:
mkdir build
cd build
cmake -DRPI_ARCH=armv8-a ..
make
sudo make install