Rock 3A/3B RK3568 GPU Drivers

Have trialed and error many different methods but I cannot get either OpenGL or OpenGL ES acceleration working on my Rock 3B or my Rock 3A(have tested both) with my personal Armbian images. I have tried setting up both libmali(from JeffyCN) and panfrost using rkr 4.1 kernel source(Linux 5.10.160) from radxa but neither works.

For libmali, I tested both the g13p0 x11 libraries(for Mali G52) and g2p0 x11 libraries(gor Mali G52) on Debian 12 XFCE desktop(Armbian). With g13p0, I boot to a non-blinking cursor on a black screen, no progress after several minutes. With g2p0, I am able to boot into XFCE desktop and login, but colours are funny(what is supposed to be red colour is rendered blue, e.g. Armbian’s logo). Also, with g2p0, once I launch anything with GL ES 2, e.g. es2_info or es2gears-x11, the desktop crashes and logs me out so I have to log in with my password again. So obviously OpenGL ES with libmali is not working.

For panfrost, I set CONFIG_PANFROST=m and disabled CONFIG_DRM_IGNORE_IOTCL_PERMIT in kernel config, but when booting, the kernel gets stuck on ‘panfrost: finding power supply in device tree’(boot animation with Armbian logo gets stuck too, the spinning circle stops spinning and freezes). Is there an issue with panfrost on rkr4.1 kernel source? I’m booting panfrost-enabled kernel with Debian 12 image that has Mesa 22.3, which supports panfrost, so it’s not the same issue as this thread about Rock 3B CLI build.

To test further, I compiled Armbian Debian 12 with Armbian’s rockchip kernel source and Armbian’s rk35xx kernel config and panfrost works just fine(boots into desktop, glxinfo -B shows panfrost as the OpenGL renderer). So is this panfrost broken on rkr4.1 kernel source? I see that Armbian rockchip repo uses rkr6, could that be the difference?

I’ve also tested radxa’s official b18 image for Rock 3B and I can see that libmali is set up properly and works, es2_info shows Mali g2p0 as the OpenGL ES renderer and I can run es2gears-x11 successfully. Can anyone explain how the b18 image setup libmali? Seems like I didn’t set up libmali correctly(I generated deb packages using ‘debuild -uc -us’ and installed the g52-g2p0-x11-gbm deb).

TLDR: Anyone has a guide on how to setup libmali properly with radxa’s Linux 5.10 rkr4.1 kernel source? Must I be on Debian 11(I’m on Debian 12)? Also, does anyone know why panfrost on radxa’s Linux 5.10 rkr 4.1 kernel source causes kernel to freeze during boot?

Figured this out. Here’s a guide on getting GPU acceleration on Linux 5.10 radxa’s rkr 4.1 kernel:

*Clone Armbian’s build system
*Change the kernel source for rk35xx legacy to radxa’s rkr 4.1:
–> In build/config/sources/families/rk35xx.conf, change these lines:

KERNELSOURCE='' KERNELBRANCH='branch:rk-5.10-rkr6'

–> To these lines:

KERNELSOURCE='' KERNELBRANCH='branch:linux-5.10-gen-rkr4.1'

*Add this file rk356x-panfrost-fix.patch to the folder build/userpatches/kernel/rk35xx-legacy:

 diff --git a/arch/arm64/boot/dts/rockchip/rk3568-rock-3b.dts b/arch/arm64/boot/dts/rockchip/rk3568-rock-3b.dts
 index 20d2b5f..06f022f 100644
 --- a/arch/arm64/boot/dts/rockchip/rk3568-rock-3b.dts
 +++ b/arch/arm64/boot/dts/rockchip/rk3568-rock-3b.dts
 @@ -295,6 +295,8 @@
  &gpu {
  	mali-supply = <&vdd_gpu>;
  	status = "okay";
 +	interrupt-names = "gpu", "mmu", "job";
 +	clock-names = "gpu", "bus";
 &hdmi {
  • Execute ./ BOARD=rock-3a BRANCH=legacy kernel-config and in the configuration menu that shows up, disable(by pressing the n key on your keyboard) the CONFIG_DRM_IGNORE_IOTCL_PERMIT option under Device Drivers->GPU Support->DRM->Ignore iotcl permit and make sure Panfrost is enabled
  • Compile the kernel with the command ./ BOARD=rock-3a BRANCH=legacy kernel
  • You’ll now find radxa’s rkr 4.1 kernel with panfrost working and all other hardware features working in the folder build/output/debs/linux-image-*.deb

When you boot up with the patched kernel and have mesa 21.2+(with panfrost driver compiled) installed, you’ll find ‘Panfrost’ as the GL rendenrer when you execute the command glxinfo -B

Personally I use radxa’s rkr 4.1 kernel source instead of Armbian since MIPI DSI still doesn’t work on Armbian’s linux-rockchip rkr6 kernel source, but besides panfrost all hardware features work on radxa’s rkr 4.1 kernel source.

Credits: Odroid M1 panfrost fix

TDLR: Fix panfrost by making these changes in the rock-3a/rock-3b device tree source, disabling CONFIG_DRM_IGNORE_IOTCL_PERMIT kernel config and enabling CONFIG_PANFROST kernel config and recompile kernel

Still would like to figure out how to get libmali working on Linux 5.10 radxa’s rkr 4.1 kernel source though. If anyone has a working setup do let me know. Since Panfrost’s vulkan implementation is still WIP(as is its OpenCL support), while libmali already has a working Vulkan driver(along with OpenCL 2.1)

As I understand, libmali requires rockchip’s patched libdrm, libdrm-cursor, xserver, librga-multi in order to achieve DE GPU acceleration? I’m currently using JeffyCN’s libmali repo, if there’s a better/working repo elsewhere, let me know. Preferably with source code so I can compile myself since the prebuilt debs from rockchip only work with Debian Bullseye(I’m on Debian Bookworm)

I see that it’s possible to get libmali working with panfork on the same system for RK3588, is it possible to get libmali working with panfrost on RK3568? Tried that just now, but libmali keeps complaining about the kbase kernel module not being loaded(it is, I checked with lsmod)

How do you test the Vulkan driver?

*Anyway, i have libmali (without panfrost) running on Ubuntu 22.04.3, rkr4.1, Wayland, and not X11.

Just built a rock3a image with armbian legacy kernel(rk-5.10-rkr6), panfrost driver is working well. Rock3b is not supported by armbian’s 5.10 kernel devicetree, but you don’t need to modify armbian’s kernel config because panfrost is enabled by default for mali g52 and arm’s mali DDK kernel driver is disabled. You only need to modify devicetree of rock3b to make it work with panfrost kernel driver.

1 Like

Oh I ran the command ‘vkcube’ from Debian/Ubuntu package ‘vulkan-tools’, but I haven’t managed to test Vulkan with libmali since I never managed to get it to work lol. Only tested panvk(which can’t run vkcube properly

That’s amazing, may I ask which .deb package you use or what steps did you take to set up all the *.so? I tried building the .deb package from JeffyCN/mirrors and installing the libmali-g52-bifrost-g2p0-x11-gbm.deb but it doesn’t work. glmark2-es2 crashes the whole desktop(XFCE with X11) and even es2_info crashes the whole desktop.

Do I have to install Rockchip’s patched xserver and libdrm to get libmali working?

Thank you! Have managed to get panfrost working :slight_smile: Now left with getting libmali to work

Yes, you need the patched xserver or you get a blank screen and the cursor on the left. I used libdrm from the distro. I did not enable panfrost on the kernel. The instructions are correct, the only difference is i compiled natively.

Oh by this do you mean rockchip’s patched libdrm or the libdrm from Ubuntu’s git? From what I saw on JeffyCN/meta-yocto it seems like there’s a rockchip-libdrm deb package, but I couldn’t find the source code to compile it myself.

No wonder lol, I always got that when I installed the newer libmali g13p0 libraries, I thought that meant that libmali wasn’t working, seems like the opposite, it’s a sign that libmali is working(I just didn’t install patched rockchip xserver)

Thanks for the info!

I mean from Ubuntu.

ii  libdrm-common                          2.4.113-2~ubuntu0.22.04.1                   all          Userspace interface to kernel DRM services -- common files
    ii  libdrm-dev:arm64                       2.4.113-2~ubuntu0.22.04.1                   arm64        Userspace interface to kernel DRM services -- development files
    ii  libdrm-etnaviv1:arm64                  2.4.113-2~ubuntu0.22.04.1                   arm64        Userspace interface to etnaviv-specific kernel DRM services -- runtime
    ii  libdrm-freedreno1:arm64                2.4.113-2~ubuntu0.22.04.1                   arm64        Userspace interface to msm/kgsl kernel DRM services -- runtime
    ii  libdrm-nouveau2:arm64                  2.4.113-2~ubuntu0.22.04.1                   arm64        Userspace interface to nouveau-specific kernel DRM services -- runtime
    ii  libdrm-radeon1:arm64                   2.4.113-2~ubuntu0.22.04.1                   arm64        Userspace interface to radeon-specific kernel DRM services -- runtime
    ii  libdrm-tegra0:arm64                    2.4.113-2~ubuntu0.22.04.1                   arm64        Userspace interface to tegra-specific kernel DRM services -- runtime
    ii  libdrm2:arm64                          2.4.113-2~ubuntu0.22.04.1                   arm64        Userspace interface to kernel DRM services -- runtime
1 Like

Wow wait how did you get libmali working on Wayland? I finally managed to get libmali working on X11 by installing rockchip’s patched xserver, haven’t tried Wayland yet. Do I simply install the wayland-gbm deb package of libmali and also install xserver like before?

Also, is it normal that glxinfo -B still shows ‘llvmpipe’ as the OpenGL renderer after getting libmali working(es2_info shows Mali G52 as the OpenGL ES renderer)? I’m able to run glxgears with libmali using gl4es, but is there any way to get the desktop accelerated by gl4es by default or is that a bad idea? Just find the desktop kinda laggy compared to Panfrost-accelerated desktop, although when I check Xorg.log I can see that desktop is successfully accelerated by Rockchip’s glamor hacks already.

Thank you for your help!