How should I enable hardware graphics acceleration in Chromium web-browser running on Ubuntu MATE 21.10 on RPi 4 (armhf)?
I have just installed Ubuntu MATE 21.10 (32-bit, armhf) on my Raspberry Pi 4 with 4 Gb of RAM. Note: I need 32-bit version to have Modelica compiler available. All settings are default. Information about video driver is below:
$ lsmod | grep drm
drm_kms_helper 282624 3 vc4
cec 65536 2 vc4,drm_kms_helper
fb_sys_fops 16384 1 drm_kms_helper
syscopyarea 16384 1 drm_kms_helper
sysfillrect 16384 1 drm_kms_helper
sysimgblt 16384 1 drm_kms_helper
drm 540672 12 v3d,vc4,gpu_sched,drm_kms_helper
$ grep -E "^dtoverlay|^max_framebuffers|^gpu_mem|^hdmi" /boot/firmware/config.txt
max_framebuffers=2
dtoverlay=vc4-fkms-v3d
gpu_mem=128
$ cat /proc/device-tree/soc/firmwarekms@7e600000/status
okay
$ cat /proc/device-tree/v3dbus/v3d@7ec04000/status
okay
$ glxinfo | grep -i opengl
OpenGL vendor string: Broadcom
OpenGL renderer string: V3D 4.2
OpenGL version string: 2.1 Mesa 21.2.2
OpenGL shading language version string: 1.20
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 21.2.2
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
OpenGL ES profile extensions:
Then I installed Chromium browser as simple as sudo apt-get install chromium-browser
, launched it for first time to enable the following options on chrome://flags
:
-
Override software rendering list aka
#ignore-gpu-blocklist
; -
GPU rasterization aka
#enable-gpu-rasterization
; -
Zero-copy rasterizer aka
#enable-zero-copy
; -
Enables Display Compositor to use a new gpu thread. aka
#enable-drdc
; -
Out-of-process 2D canvas rasterization. aka
#canvas-oop-rasterization
.
then relaunched it using chromium --enable-features=VaapiVideoDecoder
command.
Desite all these steps done, on chrome://gpu
Chromium says that GPU acceleration is not enabled:
Graphics Feature Status
- Canvas: Software only. Hardware acceleration disabled
- Canvas out-of-process rasterization: Disabled
- Compositing: Software only. Hardware acceleration disabled
- Multiple Raster Threads: Disabled
- Out-of-process Rasterization: Disabled
- OpenGL: Disabled
- Rasterization: Software only. Hardware acceleration disabled
- Raw Draw: Disabled
- Skia Renderer: Enabled
- Video Decode: Software only. Hardware acceleration disabled
- Vulkan: Disabled
- WebGL: Disabled
- WebGL2: Disabled
So the question is in the title.
Solution 1:
The main problem here is that Chromium is shipped as Snap, so VA-API is not available as we are running on ARM.
So the first step is obvious - remove Snap version of Chromium by sudo snap remove chromium
.
The second step is installation of Chromium as deb-package from RaspberryPi OS repository using below commands:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 82B129927FA3303E
sudo apt-add-repository "deb http://archive.raspberrypi.org/debian/ bullseye main"
cat <<EOF | sudo tee /etc/apt/preferences.d/pin-chromium
Package: *
Pin: release o=Raspberry Pi Foundation
Pin-Priority: -1
Package: chromium*
Pin: release o=Raspberry Pi Foundation
Pin-Priority: 1000
EOF
sudo apt-get update
sudo apt-get install chromium-browser
Then launch Chromium to configure it as usual - enable the following options on chrome://flags
:
-
Override software rendering list aka
#ignore-gpu-blocklist
; -
GPU rasterization aka
#enable-gpu-rasterization
; -
Zero-copy rasterizer aka
#enable-zero-copy
; -
Enables Display Compositor to use a new gpu thread. aka
#enable-drdc
; -
Out-of-process 2D canvas rasterization. aka
#canvas-oop-rasterization
.
Relaunch it using chromium-browser --enable-features=VaapiVideoDecoder
, visit chrome://gpu
to ensure that you have all (excluding Vulkan) options enabled:
Graphics Feature Status
- Canvas: Hardware accelerated
- Canvas out-of-process rasterization: Enabled
- Compositing: Hardware accelerated
- Multiple Raster Threads: Enabled
- Out-of-process Rasterization: Hardware accelerated
- OpenGL: Enabled
- Rasterization: Hardware accelerated on all pages
- Skia Renderer: Enabled
- Video Decode: Hardware accelerated
- Vulkan: Disabled
- WebGL: Hardware accelerated
- WebGL2: Hardware accelerated
To make --enable-features=VaapiVideoDecoder
flag permanent one should edit the relevant config-file programmatically as shown below:
echo 'CHROMIUM_FLAGS="${CHROMIUM_FLAGS} --enable-features=VaapiVideoDecoder"' | sudo tee /etc/chromium.d/92-vaapi-hardware-decoding
As the result all web-players will play 1080p without lags and tearing.