3 3
Nazar Gerasymchuk

Is Mali GPU driver available in Mainline for H3?

Recommended Posts

Sorry if this is silly question, but I can't find any straight-forward documentation on this topic.

 

I've seen that Mali drivers was available for older kernel, but what about mainline?

 

Asking this especially in context with this finding -- Maxime Ripard's article "Mali OpenGL support on Allwinner platforms with mainline Linux".

 

Currently on clean Armbian install on NanoPi Neo Air I can't load mali:

 

$ modinfo mali
modinfo: ERROR: Module mali not found.

 

Share this post


Link to post
Share on other sites

it's complicated - and I'm not sure that Allwinner can do this - it's really down to ARM and the license...

 

Quote

However, we are happy to announce that Allwinner gave us clearance to publish the userspace binary blobs that allows to get OpenGL supported on Allwinner platforms that use a Mali GPU from ARM using a recent mainline Linux kernel

 

It would be great - and nothing against Bootlin's efforts on the AW Cedar VPU... and some of that might be in Linux 4.20

 

I think many in the ARM FOSS community would like to see a real open source GPU driver from one of the many vendors...

 

(and no - RPI's Broadcom VC4 is still not open, just in case someone brings that up)

Share this post


Link to post
Share on other sites
12 hours ago, sfx2000 said:

I'm not sure that Allwinner can do this

It looks like you read the article, but did you understand  - they (bootlin) have to spend time to get it working under a recent mainline Linux kernel (they were not looking at his SoC H3, but A23 & A33).  While not being payed for this work,  unless they have a customer who has a need for that.

 

@Nazar Gerasymchuk if you can fund their efforts,  and you may get it sooner. However, if not you may be able to help the open LIMA development here for H3 T400/450  https://gitlab.freedesktop.org/lima/linux     

 

On the other hand you maybe also interested to read this about Midgard (Mali T6xx, T7xx, T8xx) and Bifrost (G7x)   https://rosenzweig.io/blog/panfrost-on-the-rk3399-meow.html  

 

in conclusion ARM Mali driver is not available in Mainline. If you depend on that and do not/cannot support development of it in any way. You want to look at Android.

Share this post


Link to post
Share on other sites

@Tido Thank you for your quick answer.

 

I've heard about Lima, and I can see that it is in deep development right now (at least as it is stated on Sunxi site http://linux-sunxi.org/Mali).

 

My main confusion came from situation that there are lots of H3 boards that works quite well with mainline kernel, and there is no option to use GPU. from customer side it looks very strange.

 

---

 

One more (silly) question, what does it means that there is dts already in mainline kernel -- https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/sun8i-h3.dtsi#n156? Doesn't it make usable Mali driver?

 

Share this post


Link to post
Share on other sites
1 hour ago, Nazar Gerasymchuk said:

My main confusion came from situation that there are lots of H3 boards that works quite well with mainline kernel, and there is no option to use GPU. from customer side it looks very strange.

Who is the customer of who here?

 

AFAIK most Chinese makers sell these boards not much above the BOM cost, and even Allwinner tries to cut their cost as much as possible, i.e. by not purchasing Mali driver licenses that are useless for them with Android: https://irclog.whitequark.org/linux-sunxi/2017-12-07#20730568; (timestamp 07:39)

 

1 hour ago, Nazar Gerasymchuk said:

Doesn't it make usable Mali driver?

It only helps running the kernel-side driver. It still requires a userspace closed-source driver of a specific type (framebuffer, Xorg, Wayland) and applications that can use this driver, i.e. you need a special shim (xf86-video-armsoc) to make use of Mali with X.org.

Share this post


Link to post
Share on other sites
49 minutes ago, zador.blood.stained said:

Who is the customer of who here?

Customers: for example me and you (I suppose), since we both purchased H3 boards, and its GPU can't be used with mainline. 

 

54 minutes ago, zador.blood.stained said:

It only helps running the kernel-side driver. It still requires a userspace closed-source driver of a specific type (framebuffer, Xorg, Wayland) and applications that can use this driver, i.e. you need a special shim (xf86-video-armsoc) to make use of Mali with X.org.

I'm Ok with running closed-sourced or partially open-sourced drivers, but how can I do it on H3 with mainline? If this is possible, I'd like to ask you to share any useful documentation here. Thanks.

Share this post


Link to post
Share on other sites
18 hours ago, Nazar Gerasymchuk said:

Sorry if this is silly question, but I can't find any straight-forward documentation on this topic.

 

I've seen that Mali drivers was available for older kernel, but what about mainline?

 

Asking this especially in context with this finding -- Maxime Ripard's article "Mali OpenGL support on Allwinner platforms with mainline Linux".

 

Currently on clean Armbian install on NanoPi Neo Air I can't load mali:

 


$ modinfo mali
modinfo: ERROR: Module mali not found.

 

The answer is yes, it can be done, but you need a bit of knowledge about compiling kernel modules.

I made it on an Orange PI PC (Allwinner H3) to test my armsoc drivers and it worked, although Mali-400 MP2 embedded into H3 was quite slow.

 

You should be able to take everything you need (both the kernel driver and the userland EGL+OpenGL ES drivers) from https://github.com/mripard/sunxi-mali

Kernel and userland libraries should match their versions to be sure that they work correctly together: if you use r6p2 kernel driver, use r6p2 for userland too.

Instructions are easy but here are some hints:

  • You need the kernel headers package installed, you won't get far without this; you should be able to use apt-get to install the appropriate package for your armbian version
  • You can compile the kernel driver on your very same board (I strongly suggest this), so you don't need to export the CROSS_COMPILE environment variable
  • export the KDIR env variable to point to your kernel headers. Typically: export KDIR=/lib/modules/$(uname -r)/build
  • export INSTALL_MOD_PATH env variable to point to your kernel modules:. Typically: export INSTALL_MOD_PATH=/lib/modules/$(uname -r)/kernel
  • follow the instructions as described, but expect some patch won't work or compile fail. Just don't be scared to get your hands dirty, it is common that you may need to do some little manual adjustments (a missing kernel file here, a missing header there...)

Once the driver is compiled and installed, you should be already able to modprobe it.

 

Follow the instructions to install the userland EGL and OpenGL ES libraries too.

If you are using the X server, you need the x11_dma_buf flavour and you also need to compile this armsoc driver too (maybe you can try the already compiled version I published on this post, it should work for your SoC too. Ignore the media script part which is for rockchip socs).

If you don't use X you can use the fbdev flavour, in this case add extraargs=drm_kms_helper.drm_fbdev_overalloc=200 to /boot/armbianEnv.txt as per-instructions.

 

 

 

 

Share this post


Link to post
Share on other sites
13 hours ago, Tido said:

It looks like you read the article, but did you understand  - they (bootlin) have to spend time to get it working under a recent mainline Linux kernel (they were not looking at his SoC H3, but A23 & A33).  While not being payed for this work,  unless they have a customer who has a need for that.

 

My point is Allwinner is not the only licensee for Mali in various flavors - It would have been more beneficial to the community for Bootlin to approach ARM directly and make it more open friendly - which would be a win for ARM and a win for developers and end users...

Share this post


Link to post
Share on other sites

I remember reading the history of the Lima project a while ago, and it basically comes down to that ARM doesn't WANT an open-source implementation of the graphics drivers, as they make a not-insignificant amount of money licensing theirs.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
3 3