Etnaviv drm driver for AM57x GC320

Hi,

I recently bought a BeagleBoard X15 and started playing with it, the first thing I noticed is despite there is three GPU on AM57x SOC, there is no hardware acceleration in X11
I searched and found that the 3D GPUs are not only proprietary, but TI actually does not support X11 at all … it is bad because I actually love X11 and want to use it.
Then I tried the GC320 2D GPU with TI galcore driver (https://git.ti.com/graphics/ti-gc320-driver) and armada X driver (https://github.com/xobs/xserver-xorg-video-armada with galcore/libGAL) : it works, but sometimes it freezes : actually it freezes everytimes when quitting X. I made some tests with proprietary libGAL (https://git.ti.com/graphics/ti-gc320-libs), and I finally found that either the driver or the userspace lib make the computer freezing.

I decided to look further and discovered that project that aim to open-sourcing Vivante GPU chips Etnaviv is pretty well advanced (https://github.com/etnaviv). The project initially support GCxxx chips in IMX6 and Armada SOC, and I wondered if it could works on AM57x. It appears that it works ! I backported the etnaviv from mainline kernel to use it with the linux 4.4 kernel provided with the default board Debian (http://repos.rcn-ee.com/debian/), and with very little changes, it can be used with Beagleboard X15.

More details on how it works in this repository :
https://github.com/julbouln/etnaviv_x15

I think it can be really easy to add the support in mainline kernel (some minor changes to DTS + etnadiv driver compatibility)

I hope this can be useful !
Regards

Hi,

I recently bought a BeagleBoard X15 and started playing with it, the first
thing I noticed is despite there is three GPU on AM57x SOC, there is no
hardware acceleration in X11
I searched and found that the 3D GPUs are not only proprietary, but TI
actually does not support X11 at all ... it is bad because I actually love
X11 and want to use it.
Then I tried the GC320 2D GPU with TI galcore driver
(graphics/ti-gc320-driver - Graphics related projects on TI platforms - GC320 kernel module on TI DRA7xx SoC.) and armada X driver
(GitHub - xobs/xserver-xorg-video-armada: imx6 accelerated xserver, forked from rmk with galcore/libGAL) : it
works, but sometimes it freezes : actually it freezes everytimes when
quitting X. I made some tests with proprietary libGAL
(graphics/ti-gc320-libs - Graphics related projects on TI platforms - TI GC320 user mode libraries.), and I finally found that either
the driver or the userspace lib make the computer freezing.

I decided to look further and discovered that project that aim to
open-sourcing Vivante GPU chips Etnaviv is pretty well advanced
(Etnaviv · GitHub). The project initially support GCxxx chips in
IMX6 and Armada SOC, and I wondered if it could works on AM57x. It appears
that it works ! I backported the etnaviv from mainline kernel to use it with
the linux 4.4 kernel provided with the default board Debian
(Index of /debian), and with very little changes, it can be
used with Beagleboard X15.

More details on how it works in this repository :
GitHub - julbouln/etnaviv_x15: Etnaviv GC320 drm driver for Beagleboard X15 (AM572x)

Nice Work!!! :wink:

I think it can be really easy to add the support in mainline kernel (some
minor changes to DTS + etnadiv driver compatibility)

Regards,

This is now pushed:

https://github.com/RobertCNelson/ti-linux-kernel-dev/commit/745855e6c0d728c1245ed4f4768b51046d5adb39

Ran out of time today to test it.. Will do that tomorrow. :wink:

Regards,

Hi Robert,

Thanks you for that express integration :slight_smile: I just discovered that I have pushed the wrong fork (a first try I made that did not work properly), I just fixed that and commited the correct one https://github.com/julbouln/etnaviv_x15/commit/72759d9b41d3bc1bcdd3bfb389afbf135d8a20d3

Sorry about that

Hi,

I recently bought a BeagleBoard X15 and started playing with it, the first
thing I noticed is despite there is three GPU on AM57x SOC, there is no
hardware acceleration in X11
I searched and found that the 3D GPUs are not only proprietary, but TI
actually does not support X11 at all ... it is bad because I actually love
X11 and want to use it.
Then I tried the GC320 2D GPU with TI galcore driver
(graphics/ti-gc320-driver - Graphics related projects on TI platforms - GC320 kernel module on TI DRA7xx SoC.) and armada X driver
(GitHub - xobs/xserver-xorg-video-armada: imx6 accelerated xserver, forked from rmk with galcore/libGAL) : it
works, but sometimes it freezes : actually it freezes everytimes when
quitting X. I made some tests with proprietary libGAL
(graphics/ti-gc320-libs - Graphics related projects on TI platforms - TI GC320 user mode libraries.), and I finally found that either
the driver or the userspace lib make the computer freezing.

I decided to look further and discovered that project that aim to
open-sourcing Vivante GPU chips Etnaviv is pretty well advanced
(Etnaviv · GitHub). The project initially support GCxxx chips in
IMX6 and Armada SOC, and I wondered if it could works on AM57x. It appears
that it works ! I backported the etnaviv from mainline kernel to use it with
the linux 4.4 kernel provided with the default board Debian
(Index of /debian), and with very little changes, it can be
used with Beagleboard X15.

This is fantastic! Thanks for doing the research and backport on this. It is a real benefit to the community.

No worries! Yeah that looks a lot closer to v4.9-rc5.. :wink:

Resync'ed and pushed out..

https://github.com/RobertCNelson/ti-linux-kernel-dev/commit/396ed5da36066858f06640f1cc665d8bf84f1093

Regards,

build tested now taged and pushed out:

4.4.32-ti-r68/4.4.32-ti-rt-r68

Should hopefully have a *.deb in the apt repo sometime shortly tomorrow..

Regards,

Okay these are now in the repo:

debian@beagle-x15:~$ uname -r ; dmesg | grep gpu
4.4.32-ti-r68
[ 9.354296] etnaviv gpu-subsystem: bound 59000000.bb2d (ops gpu_ops
[etnaviv])
[ 9.354311] etnaviv-gpu 59000000.bb2d: model: GC320, revision: 5301

For most x15 users, just run:

cd /opt/scripts/tools/ ; git pull ; sudo ./update_kernel.sh

and reboot

* now to package the userspace side.. :wink:

Regards,

This is awesome Julien!!!

2d is soooo much smoother...

debian@beaglebone:~$ uname -r ; dmesg | grep etnaviv
4.4.32-ti-r68
[ 10.101371] etnaviv gpu-subsystem: bound 59000000.bb2d (ops gpu_ops
[etnaviv])
[ 10.101392] etnaviv-gpu 59000000.bb2d: model: GC320, revision: 5301

Here's my current step-by-step

https://gist.github.com/RobertCNelson/fc6d07157b0fcc13b9c28c5832fdc74b

I'll start packing those git repo's so that this sunday we'll have 2d
acceleration out of the box!!

Regards,

I am curious to know if there are plans of sending the kernel patches upstream to k.org (if not already there)

dumb question: What about the userspace - is this from some variant of official repository?

This is awesome Julien!!!

2d is soooo much smoother...

debian@beaglebone:~$ uname -r ; dmesg | grep etnaviv
4.4.32-ti-r68
[ 10.101371] etnaviv gpu-subsystem: bound 59000000.bb2d (ops gpu_ops
[etnaviv])
[ 10.101392] etnaviv-gpu 59000000.bb2d: model: GC320, revision: 5301

Here's my current step-by-step

BeagleBoard-x15: Vivante GC320 GPU revision 5301 (etnaviv) 2d PE2.0 · GitHub

I'll start packing those git repo's so that this sunday we'll have 2d
acceleration out of the box!!

Regards,

I am curious to know if there are plans of sending the kernel patches
upstream to k.org (if not already there)

I think we should :wink:

Here's the current patchset:

patches 1/2 are just a backport of etnaviv

3rd patch enables etnaviv for omap2plus

4th patch is Julien work in pprogress

For the dts:

https://github.com/RobertCNelson/ti-linux-kernel-dev/blob/ti-linux-4.4.y/patches/x15/fixes/0005-x15-gpu-2d-vivante-gc.patch

dumb question: What about the userspace - is this from some variant of
official repository?

One issue with the current working userspace, the developers behind
etnaviv want users to move to libdrm instead of galcore-headers

Regards,

Thanks Robert, I will test the new kernel!

For kernel part, I don’t know about omap2plus, but except backport the only thing I modified is the compatible list in etnaviv driver to add “ti,dra7-gpu-subsystem”, and the dts to enable bb2d and etnaviv required gpu-subsystem.

For userspace, armada xorg driver contains a lot of things. As I understand it :

  • vivante part is an older driver using gal headers and libGAL proprietary lib.
  • etnaviv is a driver using libGAL as well, but through the libetnaviv which was I guess intended to help etnaviv folks to reverse engineering and now deprecated
  • etnadrm is actually the driver used, and for some reason (know what to pass to etnaviv kernel for optimizatio) it use libetnaviv which need gal headers. It is apparently just a shim and in fact only use open source drm driver.

Okay this all packaged. :wink:

Do you really want to enable X11 by default? I would prefer Wayland as the default windows manager.

Regards,
John

Well, we have X11 now with a usable desktop... Wayland on Debian is
still a few months out at the minimal..

For the x15, there's always been a noticeable delay when moving
windows around, by enabling the 2D core via etnaviv, we now have dri2
support and desktop is fast.

With all the development going on with the etnaviv project for
Marvel/IMX based soc's (they have 2D & 3D Vivantee Cores), it's nice
to take advantage of their 2D core support

Regards,

Few months, or years to have something truly competitive : reinventing the wheel of the 25 year old xf86 software is something that takes times …
And the Beagleboard X15 is a very powerfull machine that can be used for desktop, and today X is the best at it.

I think what really miss is an improved xorg driver for etnaviv drm with standard optimizations extension (EXA), I m looking at that, but can’t say the complexity of the task for now.

and it works great on v4.9-rc5:

Here's the 28 line diff patch:

https://github.com/RobertCNelson/linux-dev/blob/master/patches/drivers/ti/etnaviv/0001-ti-dra7-etnaviv-2d-acceleration.patch

I believe Tony, said the "ti,hwmods" are on the chopping block, for
something more dt-ish. So the dra7.dtsi change will have to be
modified down the road again..

Regards,

Few months, or years to have something truly competitive : reinventing the wheel of the 25 year old xf86 software is something that takes times …
And the Beagleboard X15 is a very powerfull machine that can be used for desktop, and today X is the best at it.

My main concern with X11 are the security flaws. Anyway, thank you for getting this driver working. This was really good work.

Regards,
John

Yes, I agree. xorg armada driver is very confusing, after a close up looking it seems that libdrm-etnaviv is not used at all and a sort of backport of it is integrated directly in armada (https://github.com/xobs/xserver-xorg-video-armada/blob/novena-r2/etnaviv/etnadrm.c). Optizations is not used via a standard way like EXA, but in every places around.

I saw some problems too when playing video, vlc rendering is undoubtedly faster, but etnaviv driver complains (can’t remember messages right now).

As I said previously, it seems relevant to have an updated driver, I’m looking at a way of implementing an EXA acceleration in omap driver, but I think it is a lot of work :slight_smile:

btw, Russell's unstable-devel branch has a few more patches over xobs's repo:

http://git.arm.linux.org.uk/cgit/xf86-video-armada.git/?h=unstable-devel

Regards,