OpenCL fails with Failed creating base context during opening of kernel driver on reboots for Rockchip RK3558 (Orange Pi 5 Plus)

This is my current setup.
Base OS: Ubuntu 22.04 (Jammy) headless - installed from the official links from orange pi
Packages installed from ppa:rockchip-linux/ppa and ppa:liujianfeng1994/rockchip-multimedia

mali-g610-firmware rockchip-multimedia-config

Lib Mali: libmali-valhall-g610-g13p0-gbm_1.9-1_arm64.deb (v1.9-1-55611b0) (Installed from https://github.com/tsukumijima/libmali-rockchip/releases)

It works fine when I run clinfo for the first time, but on subsequent reboot it fails.
Here is the dmesg logs after reboot: https://pastebin.com/JefPTVuJ

And the error from clinfo is this: https://pastebin.com/cnQKmCdY

Now weird part is, if I again re-install the same deb file with dpkg, it will then start working fine again. Diff of dmesg post running dpkg again:

[ 280.264215] mali fb000000.gpu: Firmware header version 0.2 not understood
[ 280.264251] mali fb000000.gpu: Firmware initialization failed
[ 691.125169] mali fb000000.gpu: Loading Mali firmware 0x1010000
[ 691.127906] mali fb000000.gpu: Mali firmware git_sha: 221d2b3e5f4cf47df6227ccb24c82c4e4baa986e

And clinfo works correctly now:

arm_release_ver: g13p0-01eac0, rk_so_ver: 10
Number of platforms                               2
  Platform Name                                   ARM Platform
  Platform Vendor                                 ARM
  Platform Version                                OpenCL 3.0 v1.g13p0-01eac0.9113fb3d6cbac82527a272992153edf9
  Platform Profile                                FULL_PROFILE

I have verified that the required files are present in the correct location.

 [me@home] ➜ /usr/lib/aarch64-linux-gnu ll | grep mali
drwxr-xr-x    - root 26 Jun 11:08  mali
.rw-r--r-- 1.7k root 29 Jul  2020  libmali-hook-injector.a
lrwxrwxrwx   17 root 29 Jul  2020  libmali-hook.so -> libmali-hook.so.1
lrwxrwxrwx   21 root 29 Jul  2020  libmali-hook.so.1 -> libmali-hook.so.1.9.0
.rw-r--r--  10k root 29 Jul  2020  libmali-hook.so.1.9.0
lrwxrwxrwx   12 root 29 Jul  2020  libmali-valhall-g610-g13p0-gbm.so -> libmali.so.1
lrwxrwxrwx   12 root 29 Jul  2020  libmali.so -> libmali.so.1
lrwxrwxrwx   16 root 29 Jul  2020  libmali.so.1 -> libmali.so.1.9.0
.rw-r--r--  43M root 29 Jul  2020  libmali.so.1.9.0
 [me@home] ➜ lib/firmware ll | grep mali
drwxr-xr-x    - root  6 May 19:34  mali_csffw_g15p0
drwxr-xr-x    - root  6 May 19:34  mali_csffw_g17p0
drwxr-xr-x    - root  6 May 19:34  mali_csffw_g18p0
.rw-r--r-- 274k root 29 Jul  2020  mali_csffw.bin
 [me@home] ➜ /etc/OpenCL/vendors cat mali.icd
/usr/lib/aarch64-linux-gnu/libmali.so.1

What am I missing here? I am not able to figure out the reasoning behind failures post reboots.

While this is a radxa forum, you can just use Joshua‘s latest nightly of ubuntu-rockchip which has OpenCL out of the box.

1 Like