Bluestang
Posts: 69
Joined: Sat May 30, 2020 8:43 pm

Scripts to Install Vulkan on Pi 4

Sat Oct 24, 2020 3:37 pm

A disclaimer of sorts - only install this if you want to test the Vulkan driver for the Pi 4 that is currently in the MESA repo. Otherwise wait until it is released through apt...

The Vulkan driver only works in X11. KMS/DRM will be added later - source folder is missing an entire file of code that implements Vulkan Direct Display extensions.

Kudos to @rpiMike for the original script.

Copy-paste into your own script file with proper permissions in 32-bit RPiOS:

Code: Select all

sudo rm -r /home/pi/mesa_vulkan

echo 1/8 Update
sudo apt update

echo 2/8 Upgrade
sudo apt full-upgrade -y

echo 3/8 Install pre-requisites
sudo apt install -y libxcb-randr0-dev libxrandr-dev \
        libxcb-xinerama0-dev libxinerama-dev libxcursor-dev \
        libxcb-cursor-dev libxkbcommon-dev xutils-dev \
        xutils-dev libpthread-stubs0-dev libpciaccess-dev \
        libffi-dev x11proto-xext-dev libxcb1-dev libxcb-*dev \
        bison flex libssl-dev libgnutls28-dev x11proto-dri2-dev \
        x11proto-dri3-dev libx11-dev libxcb-glx0-dev \
        libx11-xcb-dev libxext-dev libxdamage-dev libxfixes-dev \
        libva-dev x11proto-randr-dev x11proto-present-dev \
        libclc-dev libelf-dev git build-essential mesa-utils \
        libvulkan-dev ninja-build libvulkan1 python-mako \
        libdrm-dev libxshmfence-dev libxxf86vm-dev libunwind-dev \
		valgrind libzstd-dev vulkan-tools

echo 4/8 Install meson
sudo apt purge meson -y
sudo pip3 install meson 

echo 5/8 Install mako
sudo pip3 install mako

echo 6/8 Get v3dv
cd ~
git clone https://gitlab.freedesktop.org/mesa/mesa.git mesa_vulkan

echo 7/8 Build v3dv
cd mesa_vulkan
CFLAGS="-mcpu=cortex-a72 -mfpu=neon-fp-armv8" CXXFLAGS="-mcpu=cortex-a72 -mfpu=neon-fp-armv8" meson --prefix /usr -Dplatforms=x11 -Dvulkan-drivers=broadcom -Ddri-drivers= -Dgallium-drivers=kmsro,v3d,vc4 -Dbuildtype=release build
ninja -C build -j4
sudo ninja -C build install

echo 8/8 Updated Mesa Driver
glxinfo -B
Copy-paste into your own script file with proper permissions in 64-bit RPiOS:

Code: Select all

sudo rm -r /home/pi/mesa_vulkan

echo 1/8 Update
sudo apt update

echo 2/8 Upgrade
sudo apt full-upgrade -y

echo 3/8 Install pre-requisites
sudo apt install -y libxcb-randr0-dev libxrandr-dev \
        libxcb-xinerama0-dev libxinerama-dev libxcursor-dev \
        libxcb-cursor-dev libxkbcommon-dev xutils-dev \
        xutils-dev libpthread-stubs0-dev libpciaccess-dev \
        libffi-dev x11proto-xext-dev libxcb1-dev libxcb-*dev \
        bison flex libssl-dev libgnutls28-dev x11proto-dri2-dev \
        x11proto-dri3-dev libx11-dev libxcb-glx0-dev \
        libx11-xcb-dev libxext-dev libxdamage-dev libxfixes-dev \
        libva-dev x11proto-randr-dev x11proto-present-dev \
        libclc-dev libelf-dev git build-essential mesa-utils \
        libvulkan-dev ninja-build libvulkan1 python-mako \
        libdrm-dev libxshmfence-dev libxxf86vm-dev libunwind-dev \
		valgrind libzstd-dev vulkan-tools

echo 4/8 Install meson
sudo apt purge meson -y
sudo pip3 install meson 

echo 5/8 Install mako
sudo pip3 install mako

echo 6/8 Get v3dv
cd ~
git clone https://gitlab.freedesktop.org/mesa/mesa.git mesa_vulkan

echo 7/8 Build v3dv
cd mesa_vulkan
CFLAGS="-mcpu=cortex-a72" CXXFLAGS="-mcpu=cortex-a72" meson --prefix /usr -Dplatforms=x11 -Dvulkan-drivers=broadcom -Ddri-drivers= -Dgallium-drivers=kmsro,v3d,vc4 -Dbuildtype=release build
ninja -C build -j4
sudo ninja -C build install

echo 8/8 Updated Mesa Driver
glxinfo -B

User avatar
Gavinmc42
Posts: 6177
Joined: Wed Aug 28, 2013 3:31 am

Re: Scripts to Install Vulkan on Pi 4

Sun Oct 25, 2020 8:37 am

Yippee, worked on a 64bit 5.4.72 Raspberry OS :D
Now trying it on my messed up, SSD based Raspberry OS.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 6177
Joined: Wed Aug 28, 2013 3:31 am

Re: Scripts to Install Vulkan on Pi 4

Sun Oct 25, 2020 9:16 am

Rats, mesa won't update on my messed up system..
Everything seems to be building and then it broke at the install stage?
Will backtrack though the script.

Code: Select all

sudo ninja -C build install
ninja: Entering directory `build'
[1/2] Installing files.
Installing src/mapi/shared-glapi/libglapi.so.0.0.0 to /usr/lib/aarch64-linux-gnu
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/mesonbuild/mesonmain.py", line 140, in run
    return options.run_func(options)
  File "/usr/local/lib/python3.7/dist-packages/mesonbuild/minstall.py", line 544, in run
    installer.do_install(datafilename)
  File "/usr/local/lib/python3.7/dist-packages/mesonbuild/minstall.py", line 362, in do_install
    self.install_targets(d)
  File "/usr/local/lib/python3.7/dist-packages/mesonbuild/minstall.py", line 517, in install_targets
    depfixer.fix_rpath(outname, t.rpath_dirs_to_remove, install_rpath, final_path,
AttributeError: 'TargetInstallData' object has no attribute 'rpath_dirs_to_remove'
FAILED: meson-install 
/home/pi/.local/bin/meson install --no-rebuild
ninja: build stopped: subcommand failed.
Been having trouble updating mesa for some time, so not unsurprising.

Code: Select all

glxinfo -B
name of display: :0.0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Broadcom (0x14e4)
    Device: V3D 4.2 (0xffffffff)
    Version: 19.3.2
    Accelerated: yes
    Video memory: 3796MB
    Unified memory: yes
    Preferred profile: compat (0x2)
    Max core profile version: 0.0
    Max compat profile version: 2.1
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.1
OpenGL vendor string: Broadcom
OpenGL renderer string: V3D 4.2
OpenGL version string: 2.1 Mesa 19.3.2
OpenGL shading language version string: 1.20

OpenGL ES profile version string: OpenGL ES 3.1 Mesa 19.3.2
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Bluestang
Posts: 69
Joined: Sat May 30, 2020 8:43 pm

Re: Scripts to Install Vulkan on Pi 4

Sun Oct 25, 2020 8:04 pm

Gavinmc42 wrote:
Sun Oct 25, 2020 9:16 am
Rats, mesa won't update on my messed up system..
Everything seems to be building and then it broke at the install stage?
Will backtrack though the script.

Been having trouble updating mesa for some time, so not unsurprising.
Looks like it's another 64-bit version?

Hard to say what the issue might be without more info, but maybe you might want to start fresh on the SSD?

alpargataman
Posts: 4
Joined: Fri May 11, 2018 10:38 pm

Re: Scripts to Install Vulkan on Pi 4

Sun Oct 25, 2020 9:08 pm

Working as expected on a fresh Raspberry Pi OS 64 bit installation. Thanks for the script

Waldnerr
Posts: 7
Joined: Mon Oct 26, 2020 9:42 am

Re: Scripts to Install Vulkan on Pi 4

Mon Oct 26, 2020 9:48 am

Hi all , installed without problems on my Pi4 ,32 and 64 bit , got some questions :
Extended renderer info (GLX_MESA_query_renderer):
Vendor: VMware, Inc. (0xffffffff)
Device: llvmpipe (LLVM 9.0.1, 128 bits) (0xffffffff)
Version: 19.3.2
Accelerated: no

Accelerated means hardware encoding ?
Is that correct Accelerated=no ?

Hava a good day all

User avatar
Gavinmc42
Posts: 6177
Joined: Wed Aug 28, 2013 3:31 am

Re: Scripts to Install Vulkan on Pi 4

Mon Oct 26, 2020 11:27 am

Vendor: VMware, Inc. (0xffffffff)
Device: llvmpipe (LLVM 9.0.1, 128 bits) (0xffffffff)
That means software rendering

Hardware will give you something like this, it will be updated to 20.3... if this script runs ok
Vendor: Broadcom (0x14e4)
Device: V3D 4.2 (0xffffffff)
Version: 19.3.2
Accelerated: yes
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 6177
Joined: Wed Aug 28, 2013 3:31 am

Re: Scripts to Install Vulkan on Pi 4

Mon Oct 26, 2020 11:43 am

Thanks guys, if you don't have a messed up OS like me, the script works fine :oops:
I have only tested the 64 bit version.
https://vsg-dev.github.io/VulkanSceneGraph/

VulkanScenegraph compiles and works.
The demo myfirstvsgapplication works too :D
Only tested a few vsgExamples so far :D

VSG removes lots of big Vulkan coding issues ;)
The older OpenGL OpenSceneGraph is also the core of some big pieces of code like FlightGear.
OpenMW is porting to VSG?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Waldnerr
Posts: 7
Joined: Mon Oct 26, 2020 9:42 am

Re: Scripts to Install Vulkan on Pi 4

Mon Oct 26, 2020 2:07 pm

Gavinmc42 wrote:
Mon Oct 26, 2020 11:27 am
Vendor: VMware, Inc. (0xffffffff)
Device: llvmpipe (LLVM 9.0.1, 128 bits) (0xffffffff)
That means software rendering

Hardware will give you something like this, it will be updated to 20.3... if this script runs ok
Vendor: Broadcom (0x14e4)
Device: V3D 4.2 (0xffffffff)
Version: 19.3.2
Accelerated: yes
Sorry previous report was with VNC , here's the correct
Extended renderer info (GLX_MESA_query_renderer):
Vendor: Broadcom (0x14e4)
Device: V3D 4.2 (0xffffffff)
Version: 20.3.0
Accelerated: yes

Everything is working : Thanks a lot !

User avatar
Gavinmc42
Posts: 6177
Joined: Wed Aug 28, 2013 3:31 am

Re: Scripts to Install Vulkan on Pi 4

Tue Oct 27, 2020 11:22 am

Vkmark score of 311, not exactly fast but at least it runs the benchmark :D
Very impressed so far with Vulkan.

Just one beef, Warzone2100 needs 1.1.148 and it only detects 1.1.97 :(
One day maybe?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Omicron777
Posts: 3
Joined: Wed Jan 03, 2018 4:03 am

Re: Scripts to Install Vulkan on Pi 4

Wed Oct 28, 2020 4:04 am

Bluestang wrote:
Sat Oct 24, 2020 3:37 pm
A disclaimer of sorts - only install this if you want to test the Vulkan driver for the Pi 4 that is currently in the MESA repo. Otherwise wait until it is released through apt...

The Vulkan driver only works in X11. KMS/DRM will be added later - source folder is missing an entire file of code that implements Vulkan Direct Display extensions.

Kudos to @rpiMike for the original script.

...

Copy-paste into your own script file with proper permissions in 64-bit RPiOS:

Code: Select all

sudo rm -r /home/pi/mesa_vulkan

echo 1/8 Update
sudo apt update

echo 2/8 Upgrade
sudo apt full-upgrade -y

echo 3/8 Install pre-requisites
sudo apt install -y libxcb-randr0-dev libxrandr-dev \
        libxcb-xinerama0-dev libxinerama-dev libxcursor-dev \
        libxcb-cursor-dev libxkbcommon-dev xutils-dev \
        xutils-dev libpthread-stubs0-dev libpciaccess-dev \
        libffi-dev x11proto-xext-dev libxcb1-dev libxcb-*dev \
        bison flex libssl-dev libgnutls28-dev x11proto-dri2-dev \
        x11proto-dri3-dev libx11-dev libxcb-glx0-dev \
        libx11-xcb-dev libxext-dev libxdamage-dev libxfixes-dev \
        libva-dev x11proto-randr-dev x11proto-present-dev \
        libclc-dev libelf-dev git build-essential mesa-utils \
        libvulkan-dev ninja-build libvulkan1 python-mako \
        libdrm-dev libxshmfence-dev libxxf86vm-dev libunwind-dev \
		valgrind libzstd-dev vulkan-tools

echo 4/8 Install meson
sudo apt purge meson -y
sudo pip3 install meson 

echo 5/8 Install mako
sudo pip3 install mako

echo 6/8 Get v3dv
cd ~
git clone https://gitlab.freedesktop.org/mesa/mesa.git mesa_vulkan

echo 7/8 Build v3dv
cd mesa_vulkan
CFLAGS="-mcpu=cortex-a72" CXXFLAGS="-mcpu=cortex-a72" meson --prefix /usr -Dplatforms=x11 -Dvulkan-drivers=broadcom -Ddri-drivers= -Dgallium-drivers=kmsro,v3d,vc4 -Dbuildtype=release build
ninja -C build -j4
sudo ninja -C build install

echo 8/8 Updated Mesa Driver
glxinfo -B
Could you per chance elaborate on step 7 of 8. After entering the "CFLAGS=..." string...? I don't know what to do? "

Code: Select all

sudo ninja -C build Install
" returns with

Code: Select all

Ninja: Entering directory 'build'
Ninja: error: loading 'build.ninja': No such file or directory 
I check with ls, ...there's a 'build' directory...(?)

Code: Select all

cd build
& there are two files, but if I run '

Code: Select all

sudo ninja -C build install
' there...I get a similar error...except with the added:

Code: Select all

fatal: chdir to 'build' - no such file or directory
I'm not getting whatever it is for some reason...(?) To be honest, I'm ~proficient at best on the command line; it could very well be something ridiculous...For God's sake, look at the formatting of this post...!! Definitely don't discount the ridiculous! BUT! I also don't know what other information to provide... The process was very smooth all the way right to there...then...a brick wall! (~for me...?)... Any ideas would be greatly appreciated!

User avatar
Gavinmc42
Posts: 6177
Joined: Wed Aug 28, 2013 3:31 am

Re: Scripts to Install Vulkan on Pi 4

Wed Oct 28, 2020 4:40 am

Code: Select all

uname -a
Are you running 32 or 64 bit OS?
That "CFLAG" tells the compiler which version to make it for.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Omicron777
Posts: 3
Joined: Wed Jan 03, 2018 4:03 am

Re: Scripts to Install Vulkan on Pi 4

Thu Oct 29, 2020 4:20 am

Gavinmc42 wrote:
Wed Oct 28, 2020 4:40 am

Code: Select all

uname -a
Are you running 32 or 64 bit OS?
That "CFLAG" tells the compiler which version to make it for.


It is 64-bit; BUT! No more worries. Your instruction set worked; I got it to compile just a few minutes ago! ...It is a very nice; Thank You!

If it's of help to anyone—?
I installed synaptic so I could literally just see what was missing...basically piecemeal, listed, & searchable...& with boxes to check.

The issue was with the X C Binding Library Files; a few of the libxcb–dev files were unchecked. I just grabbed those with Synaptic, went back to terminal, continued with the instruction set, & away it went!

User avatar
Gavinmc42
Posts: 6177
Joined: Wed Aug 28, 2013 3:31 am

Re: Scripts to Install Vulkan on Pi 4

Mon Jan 18, 2021 11:46 am

Rats, errors on vsginput.
Reading symbols from vsginput...done.
(gdb) run
Starting program: /home/pi/vsgExamples/bin/vsginput
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x000000555560a830 in vsg::ref_ptr<vsg::Options>::operator=(vsg::ref_ptr<vsg::Options> const&) [clone .isra.42] ()
(gdb)
Most of the vsg examples are working including vsgimgui with event record and playback.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

rbafrom
Posts: 1
Joined: Thu Jun 03, 2021 1:21 pm

Re: Scripts to Install Vulkan on Pi 4

Thu Jun 03, 2021 1:28 pm

I ran those on Raspberry Linux raspberrypi 5.4.42-v8+ #1319 SMP PREEMPT aarch64 GNU/Linux and got this error:

Code: Select all

pi@raspberrypi:~ $ glxinfo -l
Error: unable to open display
Although all scripts succeeded.

Any thoughts on what could be causing this? Thanks.

nikal
Posts: 21
Joined: Sat Mar 29, 2014 2:51 pm

Re: Scripts to Install Vulkan on Pi 4

Fri Jul 02, 2021 10:00 am

Hi,

I have done this numerous times trying to get dolphin emulator working with vulkan driver. Of course I tried everything on a fresh install of 64bit raspios.

The main problem is that after a reboot nothing works. The rendering reverts back to software and the dolphin stops working. Why is that happening? Isn't supposed that the installation is something permanent ? How can I fix this issue?

My system is a raspberry pi 4/8GB booting from a M.2 SATA disk with PINN.

Thanks in advance for your time and help.

User avatar
Gavinmc42
Posts: 6177
Joined: Wed Aug 28, 2013 3:31 am

Re: Scripts to Install Vulkan on Pi 4

Tue Jul 13, 2021 1:12 am

Time to rerun/update that script?
https://www.phoronix.com/scan.php?page= ... ry-Shaders

I need to make myself an new 64bit OS and try this new stuff.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

thatchunkylad198966
Posts: 590
Joined: Thu Jul 04, 2019 10:21 am
Location: UK, Birmingham

Re: Scripts to Install Vulkan on Pi 4

Mon Jul 19, 2021 4:30 pm

Gavinmc42 wrote:
Tue Jul 13, 2021 1:12 am
Time to rerun/update that script?
https://www.phoronix.com/scan.php?page= ... ry-Shaders

I need to make myself an new 64bit OS and try this new stuff.
Will you be updating this, OP?
[NEW] Ubuntu - CM4/RPi4B custom image(s)! XFCE4, LXQt, i3-WM, WireGuard, Samba, Kodi, Latest MESA graphics drivers!

Code: Select all

https://www.raspberrypi.org/forums/viewtopic.php?f=131&t=314419

Return to “Advanced users”