Coder Social home page Coder Social logo

yours3lf / rpi-vk-driver Goto Github PK

View Code? Open in Web Editor NEW
1.2K 85.0 70.0 2.97 MB

VK driver for the Raspberry Pi (Broadcom Videocore IV)

License: MIT License

CMake 0.87% C 48.76% C++ 49.19% Python 1.18%
gpu driver raspberry-pi raspberrypi broadcom videocore-iv rpi-vk-driver broadcom-videocore-iv

rpi-vk-driver's Introduction

RPi-VK-Driver

RPi-VK-Driver is a low level GPU driver for the Broadcom Videocore IV GPU that implements a subset of the Vulkan (registered trademark of The Khronos Group) standard. The implementation is not conformant to the standard (therefore it cannot be called a Vulkan driver, officially) but tries to follow it as closely as the hardware allows for it.
Compared to the available OpenGL drivers it offers superb speed including precise and predictable memory management and multi-threaded command submission. It also offers a wider feature set such as MSAA support, low level assembly shaders and performance counters. On the other hand it currently does not support GLSL shaders.

Building

Please follow the instructions in the Build.md file. https://github.com/Yours3lf/rpi-vk-driver/blob/master/BUILD.md

Wiki

For further information please take a look at the Wiki section: https://github.com/Yours3lf/rpi-vk-driver/wiki

Supported hardware

The driver currently supports the following Raspberry Pi models:

  • Zero
  • Zero W
  • 1 Model A
  • 1 Model A+
  • 1 Model B
  • 1 Model B+
  • 2 Model B
  • 3 Model A+
  • 3 Model B
  • 3 Model B+
  • Compute Module 1
  • Compute Module 3
  • Compute Module 3 lite
  • Compute Module 3+
  • Compute Module 3+ lite

rpi-vk-driver's People

Contributors

jwinarske avatar pjx3 avatar yours3lf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rpi-vk-driver's Issues

Question regarding Performance Recs / Resolution Wiki Section

Hi - first off... this is a really impressive project!

I have a question regarding the Wiki. In the Performance Recomendations, under 'Resolution', you recommend 720p.
Can you elaborate on this? Is there a rough threshold?

What if I'm rendering: video, a compositing desktop, or a full-screen game emulator?
In some of the examples, I suspect that the HVS (hardware video scaler) can do some of the heavy lifting as well.
I haven't dug into the code, but I would bet that you are not interacting with the HVS.

Why not based on Mesa

I am wondering why this does not seem to be based on mesa. At least this would provider a lot of boilerplate.

Rpi4 support

Just wondering if this would still work on the pi with videocore vi or is it incompatible

Should vkcube and rpi-vk-driver tests work

vulkaninfo from vulkan-tools seems to work, but not vkcube:

$ vkcube
vkEnumerateInstanceExtensionProperties failed to find the VK_KHR_xcb_surface extension.

Do you have a compatible Vulkan installable client driver (ICD) installed?
Please look at the Getting Started guide for additional information.

$ cat /usr/local/share/vulkan/icd.d/rpi-vk-driver.json
{
        "file_format_version": "1.0.0",
        "ICD": {
                "library_path": "/usr/local/lib/librpi-vk-driver.so",
                "api_version": "1.1.0"
        }
}

$ ldd /usr/local/lib/librpi-vk-driver.so
        linux-vdso.so.1 (0x7ecc7000)
        libdrm.so.2 => /usr/local/lib/libdrm.so.2 (0x76e6f000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x76e45000)
        libexpat.so.1 => /usr/local/lib/libexpat.so.1 (0x76e14000)
        libz.so.1 => /usr/lib/libz.so.1 (0x76dff000)
        libc.so.6 => /lib/libc.so.6 (0x76cbd000)
        libm.so.6 => /lib/libm.so.6 (0x76c50000)
        /lib/ld-linux-armhf.so.3 (0x76ed0000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x76c20000)

Also, most of the rpi-vk-driver tests seem to fail in the same way:

$ ./clearTest
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 0
Display name 1280x1024
Display width 380
Display height 310
Display horizontal resolution 1280
Display vertical resolution 1024
created window surface
physical device supports swap chains
physical device has 1 queue families
queue family #0 supports graphics
queue family #0 supports presentation
created logical device
acquired graphics and presentation queues
created semaphores
using 2 images for swap chain
created swap chain
acquired swap chain images
created command pool for presentation queue family
allocated presentation command buffers
Created a render pass
Frame buffers created
Vertex buffer created
Graphics pipeline created
recorded command buffer for image 0
recorded command buffer for image 1
acquired image
submitted draw command buffer
cannot set CRTC for connector 29: Permission denied
submitted presentation command buffer
[hung]

Build fails with error: 'genxml_files_table' undeclared

Compiling the latest git, using tinycorelinux piCore and gcc-9.2:

cmake --build . --target all
...
[  1%] Building C object brcm/CMakeFiles/brcm.dir/cle/v3d_decoder.c.o
cd /usr/src/rpi-vk-driver/build/brcm && /usr/local/bin/cc -DV3D_VERSION=21 -I/usr/src/rpi-vk-driver/external/include -I/usr/src/rpi-vk-driver  -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe   -Wall -std=c99 -march=armv6z -fPIC -o CMakeFiles/brcm.dir/cle/v3d_decoder.c.o   -c /usr/src/rpi-vk-driver/brcm/cle/v3d_decoder.c
...
In file included from /usr/src/rpi-vk-driver/brcm/cle/v3d_decoder.c:34:
/usr/src/rpi-vk-driver/brcm/cle/v3d_decoder.c: In function 'v3d_spec_load':
/usr/src/rpi-vk-driver/brcm/cle/v3d_decoder.c:656:40: error: 'genxml_files_table' undeclared (first use in this function)
  656 |         for (int i = 0; i < ARRAY_SIZE(genxml_files_table); i++) {

full vk seem possible?

Hi and great repo's you have here.

I just thought I should ask for everyone else...how likely does it seem that you will be able to be full vulkan conformant? mainly thinking the status quo of unity 3d LWRP equivalent. (Light Weight Render Pipeline) This even at 10 fps on a pi zero would be a remarkable achievement. Or comparable Armory3D/Cycles/Kha Pi, or new bsframework.io

So... asking have you found anything that seems to be impossible hurdles to be fully vulkan yet?

at install : warning everywhere

Describe the bug
A clear and concise description of what the bug is.
Frequency of occurance. Command line output. Stack trace.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Device information (please complete the following information):

  • Device info (eg. Raspberry Pi 3 Model A+)
  • OS information (cat /proc/version, lsb_release -a)
  • Kernel module information: lsmod
  • Driver version (git commit ID or release info)

Additional context
Add any other context about the problem here.

64bit build succeeded, but all tests segfault

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:

  1. Install previous dependencies:
    sudo apt-get install --no-install-recommends libmtdev-dev libevdev-dev

  2. 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

  1. 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
  1. 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.txt 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

How to install on 64-bit

Hi,
I'm a bit stuck and would appreciate your help.
I don't have experience installing drivers for Linux, not sure if I'm missing something.
I followed the steps in Build.MD:

How to compile on a Raspberry Pi
Clone RPi VK Driver
git clone https://github.com/Yours3lf/rpi-vk-driver.git
cd rpi-vk-driver
mkdir build
cd build

Run CMake
cmake .. -DCMAKE_BUILD_TYPE=Release

Build project
cmake --build . --target all

I executed them successfully, except for "_cmake --build . --target all" had a couple of error compiling armv6.
I get stuck on run Install.sh
install.sh is missing the "librpi-vk-driver.so"
not sure if it's important but either way the driver does not install.

I am using Raspberi Pi OS Beta to run a AArch64 Vulkan app.
Thank you in advance

flipQueueThreadFunction pthread_create passing fd as pointer is dodgy?

Hello,

I've been getting random hangs when calling vkAcquireNextImageKHR due to the device handle passed to vc4_seqno_wait being corrupted in the flipQueueThreadFunction. I think the problem is that the fd argument is passed as a pointer on creation of that thread in modeset_create_surface_for_mode(). fd here is a local variable so when pthread_create eventually fires up the flipQueueThreadFunction it (the local fd) seems to have gone out of scope (i.e. the pointer is invalid).

So, I simply changed the create to pass the value...

	pthread_create(&flipQueueThread, 0, flipQueueThreadFunction, fd);

and the thread function's start up to...

int threadFD = (int)vargp;

and now get consistent fd's and no hangs in vc4_seqno_wait.

Not sure if you want to roll that into trunk or if I've misunderstood the intent?

Cheers,
Pete

[Pi4] Couldn't get V3D IDENT0: Invalid argument

Vulkaninfo:
Couldn't get V3D IDENT0: Invalid argument <-----------------------------------------------
WARNING: [Loader Message] Code 0 : terminator_CreateInstance: Failed to CreateInstance in ICD 0. Skipping ICD.
Cannot create Vulkan instance.
/build/vulkan-tools-hvsg2w/vulkan-tools-1.1.97+dfsg1/vulkaninfo/vulkaninfo.c:918: failed with VK_ERROR_INCOMPATIBLE_DRIVER

PI 4 With FULL KMS[new kernel 5.4]

Does this mean that the externals need updated for VC6[drm headers, brcm headers]

All tests using Vuklan API fail with SEGFAULT

Describe the bug
Once the driver is built and installed following the instructions on the BUILD.md, I can't run any test that makes use of the Vulkan API, all of them fail with a SEGFAULT.

To Reproduce
Execute test/mintest/mintest

Can't open device file: /dev/dri/card0
Error: No such file or directory
Sgmentation fault

Expected behavior
The test should succeed with no error.

Device information (please complete the following information):

  • Device info: Raspberry Pi 3 Model A+)
  • OS information: Linux version 5.4.79-v7+ (Raspbian GNU/Linux10 buster)

Additional context
I guess the assumption at this line is no longer valid

int gpuExists = access( "/dev/dri/card0", F_OK ) != -1; assert(gpuExists);

install.sh and rpi-vk-driver.json

rpi-vk-driver.json has a harcoded username, assuming pi as current username.

install.sh could replace that with acutal curernt user name

If that does matter because I have no idea of the purpose of the file, but with a wrong path ....

Clarification on SPIR-V support status ?

The current README reads:

It also offers a wider feature set such as MSAA support, low level assembly shaders and performance counters. On the other hand it currently does not support GLSL shaders.

That's a weird thing to say since Vulkan itself doesn't know anything about GLSL by default, instead it consumes SPIR-V IR code, which makes it quite unclear if this is what's referred to by "low level assembly shaders".

Wether or not this supports SPIR-V is a pretty big deal and should be said more clearly. If those "low level assembly shaders" actually mean VideoCore specific code (which is my current understanding of this), that too should be said in unambiguous terms.

Cool stuff otherwise !

vkCreateShaderModule() returns VK_ERROR_OUT_OF_HOST_MEMORY due to bad shader magic

Describe the bug
A clear and concise description of what the bug is.
Frequency of occurance. Command line output. Stack trace.

The attached Vulkan application runs on a Raspberry Pi 4, although the Pi4 uses a completely different Vulkan driver.
I was hoping to run it on a 3B+ using rpi-vk-driver, however when vkCreateShaderModule() is called, rpi-vk-driver returns VK_ERROR_OUT_OF_HOST_MEMORY.
Further inspection reveals that VK_ERROR_OUT_OF_HOST_MEMORY is returned because the shader magic for the shader does not add up, as seen here: https://github.com/Yours3lf/rpi-vk-driver/blob/master/driver/shader.c#L25

These same SPIR-V shaders run fine on a Raspberry Pi 4 (v3dv) as well as on mesa's RADV and NVIDIA's proprietary drivers for GTX graphics cards, so I suspect there is a driver issue.
Is there anything that can be done about this?

To Reproduce
Steps to reproduce the behavior:

  1. Extract the attached zip file to some directory- the executable "micro0" and "data" should be in the same directory.
  2. In a terminal, cd to the directory containing "micro0" and "data", then run micro0: ./micro0
  3. The program will error and close due to vkCreateShaderModule() failing, and if you add a printf() statement to the if(magic != 0x14E45250) if statement block in the driver, you will find the driver is returning VK_ERROR_OUT_OF_HOST_MEMORY due to bad shader magic.

Expected behavior
At the very least, vkCreateShaderModule() should complete successfully, because I know these are good/valid SPIR-V shaders.
Given vkCreateShaderModule() completes successfully, the program should probably run fine then-
there could be other non-driver issues running this application on the 3B+ that I have not discovered yet, but probably not since it runs fine on the Pi4 and other Vulkan drivers.

Device information (please complete the following information):

  • Device info (eg. Raspberry Pi 3 Model A+)
  • OS information (cat /proc/version, lsb_release -a)
  • Kernel module information: lsmod
  • Driver version (git commit ID or release info)
    Tested on a Raspberry Pi 3B+ running Raspbian.
    Driver version: git-c95f714
$ cat /proc/version
Linux version 5.4.51-v7+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1333 SMP Mon Aug 10 16:45:19 BST 2020

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 10 (buster)
Release:	10
Codename:	buster

$ lsmod
Module                  Size  Used by
cmac                   16384  1
rfcomm                 45056  4
bnep                   20480  2
hci_uart               40960  1
btbcm                  16384  1 hci_uart
bluetooth             376832  29 hci_uart,bnep,btbcm,rfcomm
ecdh_generic           16384  2 bluetooth
ecc                    32768  1 ecdh_generic
8021q                  32768  0
garp                   16384  1 8021q
stp                    16384  1 garp
llc                    16384  2 garp,stp
evdev                  24576  3
vc4                   233472  3
cec                    49152  1 vc4
hid_apple              16384  0
brcmfmac              319488  0
drm_kms_helper        184320  3 vc4
brcmutil               16384  1 brcmfmac
drm                   446464  3 vc4,drm_kms_helper
sha256_generic         16384  0
libsha256              20480  1 sha256_generic
drm_panel_orientation_quirks    16384  1 drm
snd_soc_core          200704  1 vc4
snd_compress           20480  1 snd_soc_core
cfg80211              679936  1 brcmfmac
snd_pcm_dmaengine      16384  1 snd_soc_core
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
rfkill                 28672  6 bluetooth,cfg80211
raspberrypi_hwmon      16384  0
bcm2835_codec          36864  0
i2c_bcm2835            16384  0
bcm2835_isp            32768  0
bcm2835_v4l2           45056  0
v4l2_mem2mem           32768  1 bcm2835_codec
bcm2835_mmal_vchiq     28672  3 bcm2835_isp,bcm2835_codec,bcm2835_v4l2
videobuf2_dma_contig    20480  2 bcm2835_isp,bcm2835_codec
videobuf2_vmalloc      16384  1 bcm2835_v4l2
videobuf2_memops       16384  2 videobuf2_dma_contig,videobuf2_vmalloc
videobuf2_v4l2         28672  4 bcm2835_isp,bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem
videobuf2_common       57344  5 bcm2835_isp,bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2
snd_bcm2835            24576  1
snd_pcm                94208  4 vc4,snd_pcm_dmaengine,snd_bcm2835,snd_soc_core
videodev              237568  6 bcm2835_isp,bcm2835_codec,videobuf2_common,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2
snd_timer              32768  1 snd_pcm
mc                     45056  6 bcm2835_isp,bcm2835_codec,videobuf2_common,videodev,v4l2_mem2mem,videobuf2_v4l2
snd                    69632  9 snd_compress,snd_timer,snd_bcm2835,snd_soc_core,snd_pcm
vc_sm_cma              32768  2 bcm2835_isp,bcm2835_mmal_vchiq
uio_pdrv_genirq        16384  0
uio                    20480  1 uio_pdrv_genirq
fixed                  16384  0
i2c_dev                16384  0
ip_tables              28672  0
x_tables               32768  1 ip_tables
ipv6                  450560  24
nf_defrag_ipv6         20480  1 ipv6

micro0.zip

just curoiusity

Hi, why not move this development to a vk capable VC6 (which its in some way similar to vc4). you should join mesa development, imo. cheers

missing test case files

Describe the bug

Doing due diligence on my CMake PR. I'm seeing some tests result in segfault, which looks like missing files. Where do I find the files?

cubemapping

openat(AT_FDCWD, "cubemapData/posx.ppm", O_RDONLY) = -1 ENOENT (No such file or directory)

cubeMipmapping

openat(AT_FDCWD, "cubemapData/posx.ppm", O_RDONLY) = -1 ENOENT (No such file or directory)

ETC

openat(AT_FDCWD, "elina.pkm", O_RDONLY) = -1 ENOENT (No such file or directory)

HDR

openat(AT_FDCWD, "image.ppm", O_RDONLY) = -1 ENOENT (No such file or directory)

mipmapping

openat(AT_FDCWD, "image.ppm", O_RDONLY) = -1 ENOENT (No such file or directory)

texturing

openat(AT_FDCWD, "image.ppm", O_RDONLY) = -1 ENOENT (No such file or directory)

Device information (please complete the following information):

  • Device info (eg. Raspberry Pi 3 Model A+)

Raspberry Pi 3+

  • OS information (cat /proc/version, lsb_release -a)

Linux version 4.19.118-v7+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1311 SMP Mon Apr 27 14:21:24 BST 2020

  • Kernel module information: lsmod
    Module                  Size  Used by
    rfcomm                 49152  4
    cmac                   16384  1
    bnep                   20480  2
    hci_uart               40960  1
    btbcm                  16384  1 hci_uart
    serdev                 20480  1 hci_uart
    bluetooth             389120  29 hci_uart,bnep,btbcm,rfcomm
    ecdh_generic           28672  2 bluetooth
    8021q                  32768  0
    garp                   16384  1 8021q
    stp                    16384  1 garp
    llc                    16384  2 garp,stp
    spidev                 20480  0
    vc4                   176128  3
    drm_kms_helper        184320  2 vc4
    drm                   438272  3 vc4,drm_kms_helper
    drm_panel_orientation_quirks    16384  1 drm
    evdev                  24576  3
    brcmfmac              315392  0
    snd_soc_core          192512  1 vc4
    snd_compress           20480  1 snd_soc_core
    brcmutil               16384  1 brcmfmac
    snd_pcm_dmaengine      16384  1 snd_soc_core
    syscopyarea            16384  1 drm_kms_helper
    cfg80211              651264  1 brcmfmac
    sysfillrect            16384  1 drm_kms_helper
    sysimgblt              16384  1 drm_kms_helper
    bcm2835_codec          36864  0
    bcm2835_v4l2           45056  0
    snd_bcm2835            24576  2
    fb_sys_fops            16384  1 drm_kms_helper
    rfkill                 28672  6 bluetooth,cfg80211
    v4l2_mem2mem           24576  1 bcm2835_codec
    snd_pcm               102400  4 vc4,snd_pcm_dmaengine,snd_bcm2835,snd_soc_core
    bcm2835_mmal_vchiq     32768  2 bcm2835_codec,bcm2835_v4l2
    v4l2_common            16384  1 bcm2835_v4l2
    videobuf2_dma_contig    20480  1 bcm2835_codec
    snd_timer              32768  1 snd_pcm
    videobuf2_vmalloc      16384  1 bcm2835_v4l2
    videobuf2_memops       16384  2 videobuf2_dma_contig,videobuf2_vmalloc
    snd                    73728  11 snd_compress,snd_timer,snd_bcm2835,snd_soc_core,snd_pcm
    videobuf2_v4l2         24576  3 bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem
    raspberrypi_hwmon      16384  0
    hwmon                  16384  1 raspberrypi_hwmon
    videobuf2_common       45056  4 bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2
    videodev              200704  6 bcm2835_codec,v4l2_common,videobuf2_common,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2
    i2c_bcm2835            16384  0
    media                  36864  3 bcm2835_codec,videodev,v4l2_mem2mem
    vc_sm_cma              36864  1 bcm2835_mmal_vchiq
    spi_bcm2835            20480  0
    uio_pdrv_genirq        16384  0
    uio                    20480  1 uio_pdrv_genirq
    fixed                  16384  0
    i2c_dev                20480  0
    ip_tables              24576  0
    x_tables               32768  1 ip_tables
    ipv6                  454656  24

  • Driver version (git commit ID or release info)
    Vulkan-Headers sdk-1.2.141
    Vulkan-Loader sdk-1.2.141
    rpi-vk-driver master

query (This is not a bug report)

query (This is not a bug report) hello! this is really cool! I can't imagine how much could be achieved with this driver, unfortunately the people in the Libretro team for example say that there is no one in their right mind who develops an emulator using it, why do they say that? It is very difficult? well, mine is just curiosity, I wish you success in this and the other projects you have!

Unable to generate working shaders

I am trying to get self written shaders to work for days now.
Because we cant use SPRIV or compile GLSL for the driver I need to rely on your documentation about generating shaders.
Unfortunately the provided documentation is very sparse. I tried to dig thru the code of the tests but without any luck.
I tested all your test examples and they all seem to work.

What I am trying at the moment:

  • Build an OpenGL application and insert the GLSL shader I want to use there. Dump the shader with help of Mesa.
  • Copy the 64bit asm hex code to the shaders,h of QPUassembler, change the used shader there and build the QPUassembler application
  • run the QPUassembler application, copy the generated asm code as a shader into my vulkan projects code.
  • edit the mapping of the vertex shader uniforms accordingly.

Unfortunately the shader just randomly lets some kind of geometry flicker sometimes on the screen.

I have a few questions:
a) Why are you passing the viewport X and Y scale to the shader? I looked up all test examples and you are always doing this. Does it have a reason?
b) Why are you using a compute shader in every test example? Even in the triangle test. You are also using the viewport scales there.
c) What versions of GLSL are supported when doing the toolchain I described above. I am guessing you also somehow "compiled" your shaders and not written them by hand in asm. In the Quake3Arena source code I saw the GLSL version used there is 450. Unfortunately on the Pi we are restricted to version 120 with the Mesa driver and so cant dump GLSL shaders using any higher version.
d) In the Quake3Arena project for your driver I saw some plain GLSL shaders. Is there a parser tool in the project which can be used to generate shaders for your driver?
e) Is my toolchain described above correct?
f) is there anything to change in the asm code manually?
g) Are there any additional steps necessary to do to get a shader working?

I really love the driver and its speed. Your work on an own Vulkan driver is outstanding. But I am asking myself if people really use it when its so hard to get shaders working without a real documentation. I think when you are able to answer my questions people could really benefit.

Thank you!

VK_EXT_image_drm_format_modifier

Sorry, this is more like a question & possible feature request.

It seems that for a Vulkan backed Wayland compositor to work the VK_EXT_image_drm_format_modifier should be supported. swaywm/wlroots#1214 (comment)
Having a snappy responsive WM on an old power efficient RPi would be as cool as running games on it.

What is the current state of VK_EXT_image_drm_format_modifier? Any chance it could be supported in the future?

Amazin job btw.

Run without kms

is there any way to get this working through a display manager (x11)?

Suspicious snippet of code inside clInsertConfigurationBits

In file ControlListUtil.c in function clInsertConfigurationBits I've seen:

	memcpy(getCPAptrFromOffset(cl->CPA, cl->nextFreeByteOffset), &tmp, sizeof(uint32_t));
	cl->nextFreeByteOffset += 3;

It looks kinda suspicious.

(if it's bug maybe it's better to use cl->nextFreeByteOffset += sizeof(uint32_t);? )
Edit: or maybe even macro wrapper?

KDM or KMS?

Describe the bug
typo on readme ( maybe )

To Reproduce
KDM on readme, KMS on raspi-config

Expected behavior
I really believe it´s supposed to be KMS as there is no KDM on advanced raspi-config

Screenshots
image

Device information (please complete the following information):

  • Device info: Raspberry Pi Zero W
  • OS information: Raspberry Pi OS 32bit
  • Kernel module information: lsmod
  • Driver version:
    Module Size Used by rfcomm 49152 4 fuse 114688 3 aes_arm 16384 1 aes_generic 40960 1 aes_arm cmac 16384 1 bnep 20480 2 hci_uart 40960 1 btbcm 16384 1 hci_uart bluetooth 376832 29 hci_uart,bnep,btbcm,rfcomm ecdh_generic 16384 2 bluetooth ecc 40960 1 ecdh_generic libaes 16384 3 bluetooth,aes_arm,aes_generic 8021q 32768 0 garp 16384 1 8021q stp 16384 1 garp llc 16384 2 garp,stp brcmfmac 286720 0 brcmutil 20480 1 brcmfmac sha256_generic 16384 0 libsha256 20480 1 sha256_generic cfg80211 667648 1 brcmfmac rfkill 28672 6 bluetooth,cfg80211 raspberrypi_hwmon 16384 0 bcm2835_codec 36864 0 snd_bcm2835 28672 2 v4l2_mem2mem 32768 1 bcm2835_codec bcm2835_v4l2 45056 0 bcm2835_isp 28672 0 bcm2835_mmal_vchiq 28672 3 bcm2835_isp,bcm2835_codec,bcm2835_v4l2 videobuf2_dma_contig 20480 2 bcm2835_isp,bcm2835_codec videobuf2_vmalloc 16384 1 bcm2835_v4l2 videobuf2_memops 16384 2 videobuf2_dma_contig,videobuf2_vmalloc snd_pcm 94208 1 snd_bcm2835 videobuf2_v4l2 28672 4 bcm2835_isp,bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem videobuf2_common 53248 5 bcm2835_isp,bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2 snd_timer 32768 1 snd_pcm snd 73728 7 snd_timer,snd_bcm2835,snd_pcm videodev 225280 6 bcm2835_isp,bcm2835_codec,videobuf2_common,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2 vc_sm_cma 32768 2 bcm2835_isp,bcm2835_mmal_vchiq mc 45056 6 bcm2835_isp,bcm2835_codec,videobuf2_common,videodev,v4l2_mem2mem,videobuf2_v4l2 uio_pdrv_genirq 16384 0 uio 20480 1 uio_pdrv_genirq fixed 16384 0 i2c_dev 16384 0 ip_tables 28672 0 x_tables 32768 1 ip_tables ipv6 446464 38

Additional context
That´s pretty much it, but I really want to thank you deeply, this would give me millions of possibilities as a game developer

Question about Yocto testing/integration.

Hi,

I found in commit history that this driver was tested with Yocto. Can I borrow original recipe from somewhere?

I created one by myself but I ran in problem that cmake cannot find python executable (find_program). Not sure what is wrong, mine recipe looks like this:

DESCRIPTION = "VK driver for the Raspberry Pi (Broadcom Videocore IV)"

inherit cmake python3-dir python3native

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=0e9db807e4f1ed14373059c8499d5f82"

SRC_URI = "git://github.com/Yours3lf/rpi-vk-driver.git"
SRCREV = "39bb5f20e39185bf41a636a238437d55dc6ded5a"

PV = "1.0+git${SRCPV}"
S = "${WORKDIR}/git"

OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "BOTH"

Thanks for making this driver, I'm exited to try it out :-)
Bartłomiej

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.