Support for mesa with Vulkan update in Raspberry Pi 4

The Vulkan update for RPi 4 (v3dv) was merged to mesa recently, on 20th Oct.

It can also be found in the mesa source history when filtered by v3dv (commits 27th Nov onward).
Sorry, I am unable to include links in my posts.

I was wondering if Manjaro on aarch64 will also get this and do we expect graphics performance improvements because of this?

I see my version is 20.2.3-1 (built on Tue 24 Nov 2020)

at 19:09:45 ❯ pacman -Q --info mesa
Name            : mesa
Version         : 20.2.3-1
Description     : An open-source implementation of the OpenGL specification
Architecture    : aarch64
URL             : https://www.mesa3d.org/
Licenses        : custom
Groups          : None
Provides        : mesa-libgl  opengl-driver
Depends On      : libdrm  wayland  libxxf86vm  libxdamage  libxshmfence  libelf  libomxil-bellagio
                  libunwind  llvm-libs  lm_sensors  libglvnd  zstd  vulkan-icd-loader
Optional Deps   : opengl-man-pages: for the OpenGL API man pages
                  mesa-vdpau: for accelerated video playback
                  libva-mesa-driver: for accelerated video playback
Required By     : gtk3  libglvnd  mpv  qt5-base
Optional For    : None
Conflicts With  : mesa-libgl
Replaces        : mesa-libgl
Installed Size  : 52.66 MiB
Packager        : Arch Linux ARM Build System <builder+n1@archlinuxarm.org>
Build Date      : Tue 24 Nov 2020 11:56:45 PM IST
Install Date    : Wed 09 Dec 2020 08:21:29 PM IST
Install Reason  : Installed as a dependency for another package
Install Script  : No
Validated By    : Signature

Yes, Manjaro will have vulkan support.
It is available now in arm-unstable with the rc kernel and mesa-git.

1 Like

Thanks for the response @0n0w1c. Any way through which I could play with it temporarily?

I could experiment with it on an external USB installation maybe.

On your test boot drive, switch arm-unstable and install the rc kernel and mesa-git.

Follow the instructions in this link and switch to arm-unstable
https://wiki.manjaro.org/index.php?title=Switching_Branches

Then run:

sudo pacman -Syu linux-rpi4-rc linux-rpi4-rc-headers mesa-git

If you have the fbturbo driver installed, uninstall it:

sudo pacman -U xf86-video-fbturbo
1 Like

Thanks! I’ll do that over the weened and update here on what I find. Any good benchmarks you’d recommend?

Do you need to enable vc4 in /boot/config.txt and keep dtoverlay=vc4-fkms-v3d?

I haven’t been able to try it out yet. I found out that I don’t have a USB 3.0 flash drive (its been ages since I used one) and my Mac doesn’t have SD Card port :cry:

Will let you know if I find this out.

You want to use:

dtoverlay=vc4-kms-v3d-pi4

I changed to mesa-20.3 (not the git version) and Vulkan support is not working… it should be. But OpenGL hardware acceleration is working. I am sure the Vulkan support will be restored soon.

To test for OpenGL hardware acceleration:

$ vblank_mode=0 glxgears
ATTENTION: default value of option vblank_mode overridden by environment.
7488 frames in 5.0 seconds = 1497.563 FPS
7693 frames in 5.0 seconds = 1538.531 FPS
7641 frames in 5.0 seconds = 1528.133 FPS
7387 frames in 5.0 seconds = 1477.278 FPS

$ glxinfo | grep OpenGL
OpenGL vendor string: Broadcom
OpenGL renderer string: V3D 4.2
OpenGL version string: 2.1 Mesa 20.3.0
OpenGL shading language version string: 1.20
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 20.3.0
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
OpenGL ES profile extensions:

To test for Vulkan support, the easiest is to install vulkan-tools.
This is what it looks like when no support:

$ vulkaninfo
Cannot create Vulkan instance.
This problem is often caused by a faulty installation of the Vulkan driver or attempting to use a GPU that does not support Vulkan.
ERROR at /build/vulkan-tools/src/Vulkan-Tools-1.2.162/vulkaninfo/vulkaninfo.h:666:vkCreateInstance failed with ERROR_INCOMPATIBLE_DRIVER
1 Like

After the latest round of arm-unstable updates, it appears glxgears has gained 100+ fps.

$ vblank_mode=0 glxgears
ATTENTION: default value of option vblank_mode overridden by environment.
8164 frames in 5.0 seconds = 1632.718 FPS
8228 frames in 5.0 seconds = 1645.555 FPS
8228 frames in 5.0 seconds = 1645.595 FPS
1 Like

Looking through a couple of your posts, was that test done in a wayland environment? Really neat how nice wayland works on the pi’s.

Yes, those tests are on Wayland. I am interested in testing Wayland, it is the future and want to learn more about it.

These little boards do surprising well, I am the first to admit. I was a doubter when I began my work with the RPi4.

I’m using KDE and also switched to Wayland on my RPi 400 since compositing is broken with kwin, at least with all the latest packages (starting with mesa 20.3, kwin X11 doesn’t play nice with it).
Plasma wayland works really great, a fantastic experience.

I compiled mesa-git with zink enabled and tried to force opengl through vulkan this way. The opengl test apps worked great but KDE X11 had some corrupted visuals but that might also be due to the broken compositing.

I’m not sure how kde wayland works because doesn’t wayland use EGL ? The kde display options offer opengl though.

Just updated to mesa 20.3.1-0.1 and still the Vulkan support is missing. Which is surprising, I will try to look further into this.

Edit: I reinstalled mesa-git just to check, and Vulkan support is there. I also note that gxlgears lost 100+ fps.

The fps from glxgears in the above tests were run while using a 1920x1080 monitor.
This is while using a 4K monitor:

$ vblank_mode=0 glxgears
ATTENTION: default value of option vblank_mode overridden by environment.
2922 frames in 5.0 seconds = 584.382 FPS
3314 frames in 5.0 seconds = 662.731 FPS
2849 frames in 5.0 seconds = 569.761 FPS
2875 frames in 5.0 seconds = 574.981 FPS
2885 frames in 5.0 seconds = 576.985 FPS

Much improved from my previous tests, about 20x better. Before these recent updates, it struggled to stay above 30 fps. It still bounces around a bit when I run the test longer, so I think there is more improvement to come.

did not set ‘-D vulkan-drivers=broadcom’?

No, I have not needed to set anything when using the git version. Where do I set that?

He thinks you compiled something.

just want to say I’m running Manjaro sway on my raspberry pi 400 using the rc kernal and mesa git with the following changes to the config.txt:

#enable vc4
dtoverlay=vc4-km4-v3d-pi4
max_framebuffers=2

#overclock
force_turbo=1
over_voltage=15
arm_freq=2350
gpu_freq=800
v3d_freq=800

and firefox 84.0 with layers.acceleration.force-enabled set to true in the about:config, h264ify with 60fps blocked and performance is absolutely nuts. I am absolutely pleased with how it’s handling youtube and what this machine is pulling off.
Note that my overclock settings are really pushing rpi400 to its limits so if you want to adapt similar options USE AT YOUR OWN RISK!!

—glxgears test run in the default window size @ 1920x1080

$ vblank_mode=0 glxgears
ATTENTION: default value of option vblank_mode overridden by environment.
8962 frames in 5.0 seconds = 1792.285 FPS
9068 frames in 5.0 seconds = 1813.500 FPS
8981 frames in 5.0 seconds = 1796.108 FPS
8905 frames in 5.0 seconds = 1780.945 FPS
9118 frames in 5.0 seconds = 1823.481 FPS

If anyone has any other optimization suggestions please let us know!

Appropriate disclaimer on your part.