Demystifying Odroid C4 hardware acceleration

Post Reply
odroidn2user
Posts: 249
Joined: Fri Oct 25, 2019 4:14 pm
languages_spoken: english
ODROIDs: N2, C4
Has thanked: 63 times
Been thanked: 66 times
Contact:

Demystifying Odroid C4 hardware acceleration

Post by odroidn2user » Tue Jun 16, 2020 4:55 pm

OK, the topic name is a little wink to a certain other topic, but there is some good news here concerning the hardware acceleration of the C4:

Bifrost meets GNOME: Onward & upward to zero graphics blobs

The lead developer of the open source Panfrost graphics driver posted some awesome news for us C4 users:
In our last blog update for Panfrost, the free and open-source graphics driver for modern Mali GPUs, we announced initial support for the Bifrost architecture. We have since extended this support to all major features of OpenGL ES 2.0 and even some features of desktop OpenGL 2.1. With only free software, a Mali G31 chip can now run Wayland compositors with zero-copy graphics, including GNOME 3. We can run every scene in glmark2-es2, and 3D games like Neverball can be played. In addition, we can support hardware-accelerated video players mpv and Kodi. Screenshots above are from a Mali G31 board running Panfrost.
To decode what it says here, we have to know that there are three Mali graphics chip product lines:
- The Utgard product line: with the low powered Mali 200-4xx graphics chips, which have an open source Lima graphics driver.
- The Midgard product line: the T-line with graphics chips like the T600-T780 chipsets, which have an open source graphics driver named Panfrost
- The Bifrost product line: the G-line with graphics chips like the G31, G52 and G71 for example. The Panfrost driver did not support Bifrost until very, very recently.

Seeing as the C4 has a Mali G31 chip (GPU), which is in the Mali Bifrost product line, this means that effective immediately (??) we should now be able to use the Panfrost driver for GPU hardware acceleration. That is: if you actually know what you are doing, which, to be honest, I really don't. So, the 'we' there is more specifically guru developers that are creating the wonderful images we all use on the C4 and single-board computers alike.

Also, lead dev Alyssa mentions specifically Wayland compositors, so it appears Xorg is not really going just yet? Traditionally Linux desktops work with Xorg graphics software, but the newer work-in-progress Wayland also makes it possible to run Linux desktop software.

And Panfrost's Bifrost support now brings some OpenGL (desktop graphics acceleration, the non-Windows DirectX counterpart if you like) and OpenGL ES (a smaller OpenGL subset for mobile devices) support to Mali Bifrost devices. And the lead developer now says that Gnome 3 on Wayland is now supported! And in the relatively near future: a hardware accelerated Xorg with Gnome 3 :) and KDE Plasma will be available as well, seeing as Panfrost for the Midgard product line already supports multiple desktop environments on Xorg. This is all really exciting stuff! (And no, Vulkan drivers are not available and not part of Panfrost.)

Besides the Panfrost reverse engineering effort, there is also an 'official' ARM Mali driver for Wayland, which is made available to us all by tobetter:
Ubuntu 20.04 (Focal Fossa) + Linux 5.x Headless OS image

The Focal Fossa image from tobetter makes it possible to (relatively easily) install the Mali GPU driver which supports Gnome 3 on Wayland.

So, now for the C4 we are blessed with two (almost?) working solutions for Linux desktops:
- Xorg using Panfrost (this is a work in progress)
- Wayland using the Mali Bifrost Wayland driver

And technically, there is the official C4 minimal image with Ubuntu 20.04, which has both GPU and VPU support. Also, it uses a Hardkernel officially patched kernel 4.9, specifically made for the C4. But that comes without any Linux desktop environment (Xorg or Wayland) support, just a GPU accelerated framebuffer driver. So, ymmv on that one, you might get good use out of this image depending on your use cases.

There is however a second graphics chip (or part of the system on a chip) called the VPU, the video processing unit. And it does just that, it encodes and/or decodes video streams/files into image frames and vice versa. This saves the GPU a lot of work, making the OS and video players run smoother. Now the hardware accelerated video decoding (the VPU, it is not doing vdec yet) is not yet working on normal, mainline Linux kernels. That is still a work in progress, with V4L2 being actively developed. And at some point some of this will come down the line to the C4 as well. Having a hardware accelerated GPU obviously improves playing video tremendously already. And you can read some more on VPUs here.

We know the Mali Bifrost Wayland driver works with Gnome 3, does anyone have the Panfrost driver working on the C4 or seen actual reports of it working on the C4 other than from Collabora?
Last edited by odroidn2user on Thu Jun 18, 2020 3:48 pm, edited 2 times in total.
These users thanked the author odroidn2user for the post (total 2):
tobetter (Tue Jun 16, 2020 4:58 pm) • mad_ady (Wed Jun 17, 2020 3:00 am)

lda4526
Posts: 10
Joined: Mon May 25, 2020 11:17 pm
languages_spoken: english
ODROIDs: 2 XU4s, 3 C2s, N2, C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Demystifying Odroid C4 hardware acceleration

Post by lda4526 » Tue Jun 16, 2020 8:59 pm

I may be wrong, but wouldn't KDE be an option as well? Or is their Wayland experience still a work in progress?

odroidn2user
Posts: 249
Joined: Fri Oct 25, 2019 4:14 pm
languages_spoken: english
ODROIDs: N2, C4
Has thanked: 63 times
Been thanked: 66 times
Contact:

Re: Demystifying Odroid C4 hardware acceleration

Post by odroidn2user » Tue Jun 16, 2020 10:01 pm

lda4526 wrote:
Tue Jun 16, 2020 8:59 pm
I may be wrong, but wouldn't KDE be an option as well? Or is their Wayland experience still a work in progress?
The experience so far is that Wayland and KDE Plasma don't go all that well together, at least on ARM hardware that is.
The official Mali Wayland driver and KDE Plasma with Wayland compositor don't work well.

Now, perhaps with Panfrost things improve, but I wouldn't hold my breath on this.
Panfrost development focuses on Gnome 3. As apparently does the official Mali Wayland driver.
That said, Panfrost with Midgard devices works well with KDE Plasma on Xorg/X11. So with enough patience...

Wayland support for KDE seems to be a work-in-progress, both with the graphics drivers as with KDE Plasma itself.

User avatar
mad_ady
Posts: 8155
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 568 times
Been thanked: 404 times
Contact:

Re: Demystifying Odroid C4 hardware acceleration

Post by mad_ady » Wed Jun 17, 2020 3:02 am

I'm not sure if their implementation would work for x11 acceleration. There might be other missing components (DRI?). I'm sure @crashoverride knows better...

crashoverride
Posts: 5012
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 310 times
Contact:

Re: Demystifying Odroid C4 hardware acceleration

Post by crashoverride » Wed Jun 17, 2020 3:27 am

mad_ady wrote:
Wed Jun 17, 2020 3:02 am
I'm sure @crashoverride knows better...
I'm going to say he doesn't. ;)

My linux desktop plans remain unchanged. I have no plans for Wayland/Weston and no experience with KDE. Instead, I will stick with X11 and MATE.

For "zero copy" to work, everything in the presentation chain has to agree on capabilities. This is not really an issue on a platform like GO-Advance where everything has an IOMMU. However, on Amlogic parts, Mali is the only component in the presentation chain with an IOMMU. Under normal circumstances, this causes an additional "silent" copy to be performed from virtual memory to physically contiguous memory (CMA) for presentation. Alternatively, Mali can be forced to use CMA memory but it must be pre-allocated for scenarios when memory fragmentation makes it impossible to allocate a large contiguous block (such as when a browser has many tabs open). Wayland compounds this issue due its design as a compositor increasing memory and bandwidth requirements.

KDE relies heavily on QT whereas MATE relies on GTK. Historically, the QT license has prevented me from using it. Recent events have reinforced my stance on avoiding the use of QT.
https://www.phoronix.com/scan.php?page= ... w-Releases

lda4526
Posts: 10
Joined: Mon May 25, 2020 11:17 pm
languages_spoken: english
ODROIDs: 2 XU4s, 3 C2s, N2, C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Demystifying Odroid C4 hardware acceleration

Post by lda4526 » Wed Jun 17, 2020 8:31 am

MATE guy myself as well. I thought I was going to have to be totally dependent on Gnome/Wayland if I wanted to use the free drivers so this is good news.

odroidn2user
Posts: 249
Joined: Fri Oct 25, 2019 4:14 pm
languages_spoken: english
ODROIDs: N2, C4
Has thanked: 63 times
Been thanked: 66 times
Contact:

Re: Demystifying Odroid C4 hardware acceleration

Post by odroidn2user » Wed Jun 17, 2020 4:15 pm

The free drivers work with Mate (on Xorg/X11) as well, just not yet for Bifrost / C4.

User avatar
odroid
Site Admin
Posts: 34642
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 824 times
Been thanked: 712 times
Contact:

Re: Demystifying Odroid C4 hardware acceleration

Post by odroid » Wed Jun 17, 2020 4:19 pm

I like that topic name. :)

dante6913
Posts: 105
Joined: Sat Oct 01, 2016 7:16 am
languages_spoken: english, Portuguese
ODROIDs: C2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Demystifying Odroid C4 hardware acceleration

Post by dante6913 » Wed Jun 17, 2020 5:42 pm

how about Sway with bitfrost wayland. I tried to compiled with XU4 (Midgard) miserably failed (my lack of knowledge), because I find gnome very heavy to be run from XU4, so I think gnome would be heavy to with C4. Sway is (I think) a lighter wayland desktop?

User avatar
tobetter
Posts: 5211
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 176 times
Been thanked: 546 times
Contact:

Re: Demystifying Odroid C4 hardware acceleration

Post by tobetter » Wed Jun 17, 2020 5:54 pm

dante6913 wrote:
Wed Jun 17, 2020 5:42 pm
how about Sway with bitfrost wayland. I tried to compiled with XU4 (Midgard) miserably failed (my lack of knowledge), because I find gnome very heavy to be run from XU4, so I think gnome would be heavy to with C4. Sway is (I think) a lighter wayland desktop?
You can refer to the links.
https://youtu.be/4MfHMKcHaUc
https://youtu.be/gEU8xf8uQrs

dante6913
Posts: 105
Joined: Sat Oct 01, 2016 7:16 am
languages_spoken: english, Portuguese
ODROIDs: C2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Demystifying Odroid C4 hardware acceleration

Post by dante6913 » Wed Jun 17, 2020 6:32 pm

tobetter wrote:
Wed Jun 17, 2020 5:54 pm
dante6913 wrote:
Wed Jun 17, 2020 5:42 pm
how about Sway with bitfrost wayland. I tried to compiled with XU4 (Midgard) miserably failed (my lack of knowledge), because I find gnome very heavy to be run from XU4, so I think gnome would be heavy to with C4. Sway is (I think) a lighter wayland desktop?
You can refer to the links.
https://youtu.be/4MfHMKcHaUc
https://youtu.be/gEU8xf8uQrs
No, my only experience is from my XU4 with fedora 32 MastaG image (I'm waiting for the arrival of my C4 that I just bought).
I'm seeing your videos now, I didn't expect so much difference from the XU4 experience.

lda4526
Posts: 10
Joined: Mon May 25, 2020 11:17 pm
languages_spoken: english
ODROIDs: 2 XU4s, 3 C2s, N2, C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Demystifying Odroid C4 hardware acceleration

Post by lda4526 » Wed Jun 17, 2020 9:24 pm

If Bitfrost gets running on the C4/Mate, can we expect to have HW acceleration in Firefox or would that be Wayland only?

dante6913
Posts: 105
Joined: Sat Oct 01, 2016 7:16 am
languages_spoken: english, Portuguese
ODROIDs: C2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Demystifying Odroid C4 hardware acceleration

Post by dante6913 » Wed Jun 17, 2020 11:54 pm

I don't think mate wayland porting is finished https://discourse.ubuntu.com/t/porting- ... d/12670/13
Edit: sorry I misunderstood you, if the bitfrost driver is for x11 (not available now) it will work

odroidn2user
Posts: 249
Joined: Fri Oct 25, 2019 4:14 pm
languages_spoken: english
ODROIDs: N2, C4
Has thanked: 63 times
Been thanked: 66 times
Contact:

Re: Demystifying Odroid C4 hardware acceleration

Post by odroidn2user » Thu Jun 18, 2020 2:48 am

dante6913 wrote:
Wed Jun 17, 2020 11:54 pm
I don't think mate wayland porting is finished https://discourse.ubuntu.com/t/porting- ... d/12670/13
Edit: sorry I misunderstood you, if the bitfrost driver is for x11 (not available now) it will work
Yeah, Mate and Wayland is not the way to go. Panfrost will have x11 for Bifrost sooner or later, and Mate will then be a way to go.
We'll have to have patience...

And Mate is already available for the C4 on Xorg/X11, just not with the graphics acceleration yet.

odroidn2user
Posts: 249
Joined: Fri Oct 25, 2019 4:14 pm
languages_spoken: english
ODROIDs: N2, C4
Has thanked: 63 times
Been thanked: 66 times
Contact:

Re: Demystifying Odroid C4 hardware acceleration

Post by odroidn2user » Thu Jun 18, 2020 3:29 pm

Awesome news via chewitt
viewtopic.php?f=176&p=296331&sid=03b835 ... 3e#p296331

Screenshots from LibreElec showing Kodi (19.0 alpha) running GPU accelerated on Panfrost on the G31!
See: https://twitter.com/LibreELEC/status/12 ... 5900915712

And - if you are adventurous - you can now test it yourself! See:
viewtopic.php?f=202&p=296813#p296779
These users thanked the author odroidn2user for the post:
odroid (Thu Jun 18, 2020 3:32 pm)

Post Reply

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 1 guest