I'm looking to try an OPi5 for GPGPU. After seeing trunk recently added the patches needed to use the "gofaster" option for panfork, and having seen reports of glmark2 scores of 4000 and 5000 while never coming close to that myself, I decided to pull together the various bits of info out there and just try all of the options. A number of things done below are often described vaguely -- hopefully it's helpful here to lay out a concrete set of steps to follow and what to expect.
There are two options for accelerated video: panfork and ARM's closed source "blob" driver. With either option, it sounds like you should switch from X11 to Wayland. If you are looking at doing OpenCL or Vulkan, you will have to use the blob driver for the foreseeable future. FYI, OpenCL benchmarks at 470 Gflops single precision, 910 Gflops half precision.
Option 1: Installing panfork
This is pretty much explained on the project page for this SBC, but maybe it will help someone to see each step in detail. I started with installing the latest nightly build. Then I ran the following in a terminal:
sudo add-apt-repository ppa:liujianfeng1994/panfork-mesa
wget https://github.com/JeffyCN/rockchip_mirrors/raw/libmali/firmware/g610/mali_csffw.bin
sudo cp mali_csffw.bin /lib/firmware/
sudo chmod 664 /lib/firmware/mali_csffw.bin
sudo add-apt-repository ppa:liujianfeng1994/rockchip-multimedia
sudo vi /etc/apt/preferences.d/rockchip-multimedia-ppu
[save the following three lines in this file]
Package: *
Pin: release o=LP-PPA-liujianfeng1994-rockchip-multimedia
Pin-Priority: 600
sudo vi /etc/apt/preferences.d/panfork-mesa-ppu
[save the following three lines in this file]
Package: *
Pin: release o=LP-PPA-liujianfeng1994-panfork-mesa
Pin-Priority: 600
sudo apt update
sudo apt dist-upgrade
sudo vi /etc/udev/rules.d/98-mali-accel.rules
[save the following four lines in this file]
KERNEL=="mpp_service", MODE="0660", GROUP="video"
KERNEL=="rga", MODE="0660", GROUP="video"
KERNEL=="system-dma32", MODE="0666", GROUP="video"
KERNEL=="system-uncached-dma32", MODE="0666", GROUP="video" RUN+="/usr/bin/chmod a+rw /dev/dma_heap"
sudo apt install chromium-browser=$(apt-cache show chromium-browser|grep Version|grep rkmpp|cut -d " " -f2) chromium-codecs-ffmpeg-extra=$(apt-cache show chromium-browser|grep Version|grep rkmpp|cut -d " " -f2) libv4l-rkmpp v4l-utils
sudo ln -s /lib /usr/lib64
cd /usr/lib64/ && sudo ln -s aarch64-linux-gnu/libv4l2.so.0.0.0 libv4l2.so
sudo vi /etc/rc.local
[add the following six lines to this file]
echo dec > /dev/video-dec0
chown root:video /dev/video-dec0
chmod 0660 /dev/video-dec0
echo enc > /dev/video-enc0
chown root:video /dev/video-enc0
chmod 0660 /dev/video-enc0
sudo vi /etc/chromium-browser/default
CHROMIUM_FLAGS="--use-gl=egl"
sudo apt install gnome-shell ubuntu-gnome-desktop glmark2-es2-wayland
sudo reboot
From there you are running Wayland and the panfork accelerated driver.
glmark2 benchmarking of various options for panfork:
For this, you need to use glmark2-es2-wayland (installed above).
First, I ran glmark2 on the system fresh from the above reboot:
foobar@orangepi5:~/install$ glmark2-es2-wayland
=======================================================
glmark2 2021.02
=======================================================
OpenGL Information
GL_VENDOR: Panfrost
GL_RENDERER: Mali-G610 (Panfrost)
GL_VERSION: OpenGL ES 3.1 Mesa 23.0.0-devel
=======================================================
. . . (test component scores omitted to shorten this post) . . .
=======================================================
glmark2 Score: 943
=======================================================
I was pretty underwhelmed given the scores I'd seen reported, so next I tried using the "gofaster" option for panfork (done by setting an environment variable, as shown below):
foobar@orangepi5:~/install$ PAN_MESA_DEBUG=gofaster glmark2-es2-wayland
=======================================================
glmark2 2021.02
=======================================================
OpenGL Information
GL_VENDOR: Panfrost
GL_RENDERER: Mali-G610 (Panfrost)
GL_VERSION: OpenGL ES 3.1 Mesa 23.0.0-devel
=======================================================
. . . (test component scores omitted to shorten this post) . . .
=======================================================
glmark2 Score: 2299
=======================================================
A significant improvement, but still short of the reports I had seen.
Finally, I adjusted the governors for the CPUs and DMC (Dynamic Memory Controller) to "performance" (example of how to do that shown below). Here things really shined. Adjusting the DMC is an important component of this:
foobar@orangepi5:~/install$ echo performance | sudo tee /sys/bus/cpu/devices/cpu[046]/cpufreq/scaling_governor /sys/class/devfreq/dmc/governor
performance
foobar@orangepi5:~/install$ PAN_MESA_DEBUG=gofaster glmark2-es2-wayland
=======================================================
glmark2 2021.02
=======================================================
OpenGL Information
GL_VENDOR: Panfrost
GL_RENDERER: Mali-G610 (Panfrost)
GL_VERSION: OpenGL ES 3.1 Mesa 23.0.0-devel
=======================================================
. . . (test component scores omitted to shorten this post) . . .
=======================================================
glmark2 Score: 4489
=======================================================
Since the score of 5000 was reported for an overclocked system, I called this done. It beats the out of the box score for the Khadas Edge2.
Option 2: installing the ARM blob driver
I also gave this a try -- partly due to interest in evaluating OpenCL performance, and partly to see if the vendor-provided driver could go even faster. I couldn't find a decent set of instructions for how to install the blob driver, so I took a different approach -- I used the package files produced by Khadas for building their Edge2 Ubuntu images. Maybe there are packages already available through Armbian, and I just couldn't identify them.
The package files can be found in these four repos:
https://github.com/numbqq/mali-debs
https://github.com/numbqq/mpp-rockchip-debs
https://github.com/numbqq/rga-rockchip-debs
https://github.com/numbqq/gstreamer-rockchip-debs
Altogether, I found the following package files:
gstreamer1.0-rockchip1_1.14-5_arm64.deb
rockchip-mpp-dev_1.5.0-8_arm64.deb
rockchip-mpp-sample_1.5.0-8_arm64.deb
rockchip-mpp_1.5.0-8_arm64.deb
rockchip-rga-dev_2.2.0-6_arm64.deb
rockchip-rga-sample_2.2.0-6_arm64.deb
rockchip-rga_2.2.0-6_arm64.deb
linux-gpu-mali-wayland_1.0-g610-20220510_arm64.deb
The last one had to be installed with "--force-overwrite" because of a file duplicated with an existing package. I also installed the ubuntu-desktop package to switch over to Wayland. On my first login, "echo $XDG_SESSION_TYPE" reported x11. I logged back out, and logged in again checking the gear icon to make sure the Wayland-related one was selected. I don't know if the gear icon was needed, but that time Wayland was active.
glmark2 benchmarking of various options for the blob driver:
First, I did a run with the default governor settings:
foobar@orangepi5:~/install$ glmark2-es2-wayland
arm_release_ver of this libmali is 'g6p0-01eac0', rk_so_ver is '6'.
arm_release_ver of this libmali is 'g6p0-01eac0', rk_so_ver is '6'.
=======================================================
glmark2 2021.02
=======================================================
OpenGL Information
GL_VENDOR: ARM
GL_RENDERER: Mali-LODX
GL_VERSION: OpenGL ES 3.2 v1.g6p0-01eac0.ba52c908d926792b8f5fe28f383a2b03
=======================================================
. . . (omitted as above) . . .
=======================================================
glmark2 Score: 2564
=======================================================
Around 11% better than panfork "gofaster."
Then I did a run with the governors set to "performance":
foobar@orangepi5:~/install$ echo performance | sudo tee /sys/bus/cpu/devices/cpu[046]/cpufreq/scaling_governor /sys/class/devfreq/dmc/governor
performance
foobar@orangepi5:~/install$ glmark2-es2-wayland
arm_release_ver of this libmali is 'g6p0-01eac0', rk_so_ver is '6'.
arm_release_ver of this libmali is 'g6p0-01eac0', rk_so_ver is '6'.
=======================================================
glmark2 2021.02
=======================================================
OpenGL Information
GL_VENDOR: ARM
GL_RENDERER: Mali-LODX
GL_VERSION: OpenGL ES 3.2 v1.g6p0-01eac0.ba52c908d926792b8f5fe28f383a2b03
=======================================================
. . . (omitted as above) . . .
=======================================================
glmark2 Score: 3961
=======================================================
So, in performance mode, panfork is the winner by 13%.