radxa-build / rock-5b

ROCK 5B
https://radxa-build.github.io/rock-5b/
Other
78 stars 9 forks source link

Trouble with OpenGL setup #9

Closed anchor76 closed 8 months ago

anchor76 commented 8 months ago

hello,

my goal is opengl rendering on a headless linux server. i bought a rockpi5b board.

tried this two images: rock-5b_ubuntu_jammy_cli_b39.img and rock-5b_debian_bullseye_cli_b39.img

steps to reproduce:

1 - download and write the image to rockpi5b emmc 2 - boot, apt update, apt upgrade 3 - apt install -y xorg openbox mesa-utils build-essential libx11-dev freeglut3-dev zlib1g-dev git 4 - compile this headless example: https://github.com/erwincoumans/egl_example 5 - nohup startx & 6 - export DISPLAY=:0 7 - run the binary, observe the output.

i see two problems: 1 - glxinfo shows only llvmpipe. seems no hw accelerated rendering. 2 - running the example above, getting the following error: 'libEGL warning: MESA-LOADER: failed to open rknpu: /usr/lib/dri/rknpu_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/aarch64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)'

rknpu_dri.so file is not exist in these distros.

additional info: i tried Joshua-Riek's ubuntu server image, and there glxinfo can see the Mali G610 GPU. but the npu driver also missing. ( repo: https://github.com/Joshua-Riek/ubuntu-rockchip.git )

any help would be appreciated ;)

RadxaYuntian commented 8 months ago

Rockchip requires vendor patched packages for various hardware functions, and one of them is GPU. Their SDK uses Arm Mali driver, which only supports OpenGL ES, not the normal OpenGL. As such, OpenGL is software rendered.

Since the packages are prebuilt by Rockchip targetting a specific Debian release, the resulting packages may not be installed on Ubuntu systems due to unmet library dependencies. This Rockchip specific package archive is also configured differently in CLI image compared to Desktop image. This is because the patched package mush have the same package name as the upstream one to satisfy the dependency requirement, and they also must be configured in specific way to work properly. There is also some compatibility issues when used with upstream kernel.

As such, on CLI image, the upstream packages are preferred by default. This is to prevent user bricks their system by accident. Only on the Desktop image we set the Rockchip packages archive as the default, where we set up everything for you. This is the reason we only support Debian Desktop image since that configuration is the only one we verified to work.

If you can see glxinfo reporting GPU model, then you are using upstream Linux with opensource GPU driver, not Arm Mali driver. Upstream Linux does not support NPU.

anchor76 commented 8 months ago

@RadxaYuntian thank you very much for clarifying this! OpenGL ES totally fine for me ;) One last question: Do Radxa planning a non upstream debian server (CLI) build with Arm Mali GPU driver pre installed?

RadxaYuntian commented 8 months ago

Currently it is not planned because we are trying to enable opensource GPU driver in CLI image, so when the user install some other desktop environment it will just work. But we are not there yet.

Here is how to install the Rockchip prebuilt packages though:

First make sure you have the Rockchip archive installed. It is configured as /etc/apt/sources.list.d/radxa-rockchip.list. Our older CLI images does not contain this file, so you can recreate it with this guide.

You can then follow the instruction listed below to install task-rk3588 instead of task-rockchip. This will pull every related Rockchip prebuilt packages, and set up with proper system configs. This is a kitchen-sink package since Rockchip is not strictly following Debian policies, so we feel like selectively installation might be unsafe due to hidden unannounced inter-dependencies. This however will give you Arm Mali driver and RKNN2 supporting packages.

anchor76 commented 8 months ago

@RadxaYuntian - Thanks for your help. I followed the instructions, but got the same result. glxinfo see only llvmpipe. I'll wait for the new CLI build where opensource GPU driver is enabled ;)

RadxaYuntian commented 8 months ago

This is to install Arm Mali driver to have OpenGL ES support. Please check the reported OpenGL ES driver.

anchor76 commented 5 months ago

Finally i found the solution: on RK3588 EGL see multiple render devices, and the first is the NPU for some reason. I just need to use device #1 instead of device #0. Problem solved ;)