Draghtnod Posted July 21, 2018 Posted July 21, 2018 Greetings, i want to run some shaders on a headless OrangePI Zero (H2+/Mali 400 running standard Armbian on mainline kernel). I saw there are drivers available now. Is there a binary blob of the driver available somewhere? Or maybe a simple HOWTO? I don't want to mess with driver compilation if I don't have to. I just want to run my shaders on that GPU.
Draghtnod Posted July 21, 2018 Author Posted July 21, 2018 With the help of https://www.cnx-software.com/2017/09/26/allwinner-socs-with-mali-gpu-get-mainline-linux-opengl-es-support/ and $ sudo apt install quilt linux-headers-next-sinxi $ git clone https://github.com/mripard/sunxi-mali.git $ cd sunxi-mali $ export CROSS_COMPILE=arm-linux-gnueabihf- $ export KDIR=/usr/src/linux-headers-4.14.18-sunxi/ $ ./build.sh -r r6p2 -b $ sudo insmod r6p2/src/devicedrv/mali/mali.ko $ lsmod | grep mali mali 184320 0 $ dmesg | tail [ 9056.575770] platform mali-utgard: assigned reserved memory node linux,cma [ 9056.577169] Allwinner sunXi mali glue initialized [ 9056.579102] Mali: [ 9056.579113] Found Mali GPU Mali-400 MP r1p1 [ 9056.579916] Mali: [ 9056.579924] 2+0 PP cores initialized [ 9056.580684] Mali: [ 9056.580688] Mali device driver loaded The question remains: Is there a package that provides a ready to use binary blob of this driver? Or maybe some script that does it automatically, when the kernel changes?
jock Posted July 23, 2018 Posted July 23, 2018 On 7/21/2018 at 5:29 PM, Draghtnod said: The question remains: Is there a package that provides a ready to use binary blob of this driver? Or maybe some script that does it automatically, when the kernel changes? Yes, there is a system that keeps track of kernel changes and recompiles the modules, try to check for DKMS Also notice that the kernel module you built is just a "bridge" between the hardware and the userspace sofware (the whole kernel is, in abstract, a thing like this). The kernel driver does not do anything valuable without the proper userspace drivers (ie: EGL/OpenGL/OpenGL ES libraries, given as BLOBs, referred in the original article you mentioned). To "play with shaders" you have to write some code which uses OpenGL ES and EGL libraries (ie: the userspace blob drivers), which in turn use the kernel module you built, which in turn talks to the hardware. Take a look to es2tri.c example from mesa project, it is the basic for setting up and playing with shaders, but be aware that being profitable in such field requires a lot of base knowledge, and Mali userspace drivers are quite stubborn to work with! If you just want to "play with shaders", I may suggest you an Ubuntu installation on a common x86 computer with an AMD or Intel graphic card which has full opensource drivers and you usually have not to worry about compiling drivers and tinkering with the kernel
Draghtnod Posted July 23, 2018 Author Posted July 23, 2018 Cool, thank you for the explanations. You forgot to mention that the display that EGL talks to, has to be provided by a display server that utilizes the mali drivers. In my case it is X11, which requires the armsoc module, which in turn talks to the mali driver. So the complete chain is: PlayWithShadersProgram -> mali-blobs (implementing EGL & OpenGL ES) -> xserver -> armsoc -> mali-driver -> sun4i-drm -> hardware In case of NVIDIA the X11 part may be skipped, since their userspace blobs provide an EGL extension that support a headless mode. My setup is still not running tho, getting this chain to work is a real pain. :/
Recommended Posts