How to enable butter-smooth Hardware-accelerated Graphics on Raspberry Pi

Friday, May 21, 2021

Wayland and faster Firefox FTW!

When I first got the Raspberry Pi 4, I was excited. A pocket-sized desktop computer? I can do so many things with it (like watching Youtube)! On the other hand, I’ve been skeptical regarding Raspberry Pi’s GPU capabilities. Not only is it outdated, but also quite niche to work with.

After actually testing out my brand new Raspberry Pi 4, my disappointments were real. Raspberry Pi 4 was supposed to be suitable for a desktop computer. It is not. It isn’t even CLOSE.

Well, Raspberry Pi 4’s rather slow CPU is not the issue here. A large portion of this slowness comes from the aging X11 window server. It is just not designed for smooth graphics. Enter the alternative: Wayland! Wayland is the faster and lighter alternative for X11. It is fantastic on every modern computer-smooth animation, no frame drop, no weird issues. Except Raspberry Pi Foundation does not officially support it.

The good thing about Pis is its amazing community. There ought to be a distro with Wayland support, I believed. I tried out several distros, and quite a few of them just lack the spirit to Wayland.


  • Raspberry Pi OS (aarch64): I cannot install the desktop environment, let alone Wayland.
  • Ubuntu Desktop: It defaults to Xorg for some reason, and I do not like Snap.
  • Debian: Ugh.
  • Arch Linux ARM: Wayland actually works after installing it manually.
  • Manjaro ARM: Nice Wayland and GNOME support out of the box.

Interestingly, wayland seems to favor Arch-based distros. Or I was just lazy to fix all those broken stuff on Debian.

So the obvious choice is Manjaro ARM . I used the minimal image to install a full GNOME 40 desktop on the Raspberry Pi 4, and it actually worked. Now I just need to figure out how to enable those OpenGL and Vulkan drivers.

Actual steps

Regarding Arch Linux ARM: use Manjaro ARM if you can. Arch Linux ARM is good for headless setup, but replacing the mainline kernel and enabling VC4 driver is just unnecessary work.

Install GNOME

Do this if you has a minimal image, and want to install GNOME. Otherwise just use the prebuilt Manjaro KDE image.

sudo pacman -S gnome gnome-shell gdm networkmanager
sudo systemctl enable gdm
sudo systemctl disable dhcpcd
sudo systemctl enable NetworkManager

Enable VC4 OpenGL driver

This assumes you have a working installation of Manjaro ARM with GNOME. Wayland support is out of the box. KDE is also ok.

First, edit /boot/config.txt on the Pi’s system (or just open it on another computer), and change the line with dtoverlay= to

dtoverlay=vc4-kms-v3d-pi4

While you are at it, change the value of gpu_mem to something larger, like 256.

Reboot the Pi. OpenGL acceleration should already work.

Validate if OpenGL works.

glxinfo | grep VC4

It should output some lines with VC4.

Enable V3D Vulkan driver

Install the necessary Vulkan drivers.

sudo pacman -S vulkan-icd-loader vulkan-broadcom vulkan-tools

Now reboot the Pi. Validate if Vulkan works.

vulkaninfo

It should output a lot of lines with Vulkan info.

I tried out Zink out of boredom(OpenGL-on-Vulkan), and it actually worked.

Test out your hardware-accelerated GNOME

Now your GNOME is both Wayland-powered and with hardware OpenGL. For some reason this feels faster than Ubuntu Desktop, with has animation disabled. Still, it is not the best idea to install GNOME on a resource-constrainted machine.

Enable Webrender and Wayland for Firefox

The bonus of having wayland and OpenGL correctly installed means you can have Firefox render much faster. A while ago Firefox began supporting Wayland, and OpenGL-based WebRender. Both works amazingly.

To enable Wayland for Firefox, execute the following command to add an environment variable:

echo "MOZ_ENABLE_WAYLAND=1" > `~/.config/environment.d/firefox.conf`

Now, in Firefox, open the webpage about:config, and search for gfx.webrender.all. Set the value for gfx.webrender.all to true.

Restart your Raspberry Pi, and enjoy a much faster Firefox.

Enable Wayland backend for Qt apps

For people with a love for Telegram (and all Qt-based apps), enabling wayland support for Qt could make them faster and smoother.

To enable Wayland backend for Qt, execute the following command:

echo "QT_QPA_PLATFORM=wayland" > `~/.config/environment.d/qt.conf`
sudo pacman -S qt5-wayland

Minecraft: Java Edition

It runs at a whooping 10 fps! Amazing!

Some afterthoughts

Unfortunately, Raspberry Pi 4 is still not designed for running GNOME. Actually, I personally believe nothing can run GNOME. Still, this will be a much smoother desktop experience than before, especially for web browsing. I might do some webpage benchmark later, and try overclocking the Pi.

It is still fun to use the Pi this way, especially since it comsumes almost no power. Maybe one day, the Raspberry Pi will become a true desktop computer, not a slow one.

Raspberry PiGPUWaylandManjaroLinux
CC BY-SA 4.0

Fix Missing 5GHz WiFi for Raspberry Pi 4 on Manjaro ARM

How to Install Arch Linux in 2021

comments powered by Disqus