Chromium container cannot render 3D content on Verdin iMX8M-Mini

This is a follow-up of this topic.
After having successfully deployed a nodejs container to “Torizon with evaluation containers”, I tried 3D capabilities.
I used this example from github, but when I use Chromium container I get the following exception
Application error: a client-side exception has occurred (see the browser console for more information)

Do you know why 3D content cannot be handled properly on the default Chromium container?
I see that Chromium “Developer tools” item in the menu is grayed out and so I cannot use them.
Do you know how to enable Developer tools on the Chromium container?

Greetings @vix,

I was able to reproduce your issue on my end. Furthermore I tried loading the live demo webpage for this example here: Basic demo - CodeSandbox

I got a bit more descriptive error with Error creating WebGL context. Based on this I think I know what the issue is. This example requires WebGL, and WebGL is not supported with Chromium. Or rather Chromium currently does not have support for i.MX GPUs, and therefore WebGL can’t be used. Basically running Chromium on our modules is all CPU-based rendering due to lack of GPU support.

We do offer an alternative browser option with Cog: Web Browser / Kiosk Mode with TorizonCore | Toradex Developer Center

Cog does support i.MX GPUs, however there are some known issues with Cog. It seems like this still wouldn’t be a solution for you, since when I try to load the live demo with Cog, I just get a rendering error on the entire webpage.

Given that, I don’t have a answer or solution for you at this time. The best I can suggest is to try to workaround or use an alternative solution. I’ll see if I can get any further answers on the Cog front to why there is a rendering issue, but no guarantees.

Best Regards,
Jeremias

Thanks @jeremias.tx
you gave me bad news.

i.MX series is quite popular and a lot of different manufacturers offer SoM based on i.MX chips.
In particular I mean i.MX8.
Do you know a working solution to use i.MX8 GPU from a web browser application?

In your answer you suggest me to try a workaround or an alternative solution.
What do you have in your mind?

Unfortunately, when evaluating various browser solutions for our products. The hardware support was almost always lacking. There are various unofficial “fixes” and patches to add support into chromium, but these aren’t well maintained and have their own issues.

Cog was the only maintained browser that runs on our modules that also supports GPU. But as you’ve seen it also has it’s issues/limitations.

As for workarounds/solutions. I mean more in the line of trying other UI solutions, if possible of course. If you want to use chromium you’ll need to find a solution that can be run without GPU acceleration. If you opt for cog you’ll need to find something other than three.js. Since judging by what we’ve seen cog has issues with three.js.

We have one example of a web UI using ASP.NET and Blazor here: How to Build a GUI with ASP.NET Core and Blazor for TorizonCore | Toradex Developer Center

Another customer has decent success with Angular.

Best Regards,
Jeremias

Do you mean you opened an issue on Cog github?

Well we have a contact with Igalia who maintains Cog, so I meant moreso through that channel of communication. However if you’d like it wouldn’t hurt to also open an issue on the Cog github itself.

Best Regards,
Jeremias

Thanks
I opened this issue in Cog github, in case it helps other people.

@jeremias.tx I’ve just fount this document on Google Chrome hardware acceleration support under Linux (from version 88) - on enabled by default.
It explains some command line switches to enable hardware acceleration.
I don’t know if this can help on Chromium on iMX8M too (because the architecure is different).

/* Edit */
One more thing that came up from my investigation (not an extert at all):
is this meta layer included in Torizon WebBrowser container?
I see it has layers for Chromium, and for Vivante
I hope this has GPU support for iMX8M

Well looking at what you referenced,there’s some issues. The chromium-imx recipe is only compatible with i.MX6 based machines. Furthermore, the the soruce repository for chromium-imx: GitHub - Freescale/chromium-imx

Hasn’t been updated since 2016. Unfortunately it seems no one’s done the work for making chromium GPU accelerated on all i.MX platforms and also keeping it maintained.

Best Regards,
Jeremias

I’ve just found this document from NXP
i.MX Yocto Project User’s Guide
It’s from December 2021, so quite new.

Here below there is section 5.6.5

5.6.5 Chromium Browser on XWayland, and Wayland
The Yocto Project community has Chromium recipes for the Wayland version Chromium Browser for i.MX SoC with GPU
hardware. NXP does not support or test the patches from the community. This section describes how to integrate Chromium into
your rootfs and enable hardware accelerated rendering of WebGL. The Chromium browser requires additional layers such as
meta-browser added in the imx-release-setup.sh script automatically.
In local.conf for XWayland or Wayland, add Chromium into your image. X11 is not supported.
CORE_IMAGE_EXTRA_INSTALL += "chromium-ozone-wayland"

So it seems that hardware accelerated rendering of WebGL can be enabled in this way for i.MX SoC with GPU.

Maybe this can help

/** Edit **/
Based on what I asked here, is it possible that this meta-chromium works on iMX8 with GPU supported? (full credits to O.S. Systems Software LTDA)

That’s interesting I don’t believe the team was aware of GPU support in that meta-layer. I’ve reported this to the team to get their eyes on it. But it will still take a while to investigate, test, and integrate this work into our own BSP and software. I can’t give any timelines since I just reported to the team. But, thank you for bringing this to our attention.

Hi @jeremias.tx
I add another info justr received from NXP tech support

We only support Chromium-ozone-wayland(support GPU acceleration) in yocto.

I’m a newbie in yocto, so I don’t know what is the key point, but based on all these info, I’m quite sure GPU support can be enabled in some way.

Let me know if I can help somehow

/*** EDIT ***/
This document seems interesting too. Full credits to Igalia

Thank you for the additional information I’ll forward this to our development team. By the way our team will be looking into this news and are interested in adding GPU support to our chromium if possible. But please understand this will take time.

Best Regards,
Jeremias

Yes, I understand.
I add new info when I found it so that there they’re not missed.
Maybe this can be useful to someone else.

I appreciate the effort of the whole Toradex team (I’m already a customer for Colibri VF61 modules since years).

1 Like

Hi @jeremias.tx
I want to add some news on this topic.
Based on your suggestion here I modified the startup script

  • removing --disable-gpu
  • adding --enable-features=UseOzonePlatform --ozone-platform=wayland as explained in the Igalia document I mentioned above

In this way the CodeSandbox demo runs inside the container, but the performance are poor.
The performance becomes poorer if I set the parameter --in-process-gpu (I don’t know exactly its purpose, but some online resources suggest to use it).
So I think that basically the road seems promisingly, but some more tuning and test is necessary (to understand which parameters should be passed to Chromium).

A more complex 3D example doesn’t work with client exception (but this can be memory overflow or other issues - investigation needed).

Interesting findings thank you sharing them.

In this way the CodeSandbox demo runs inside the container, but the performance are poor.

I wonder if the poor performance is due to the rendering actually being done on the CPU rather than properly on the GPU. At least that is what it sounds like to me is happening. I guess a test would be to see if trying to render 3D examples causes a spike in CPU usage. Since proper hardware acceleration would use the GPU almost entirely for such processes.

Best Regards,
Jeremias

Hi @jeremias.tx
I’m quite sure you got the point.
I cannot profile the GPU on Verdin iMX8M-Mini (I opened another topic, but it’s under approval) but I can profile the CPU.
And so I can confirm that while rendering the 3D example, Chromium takes almost all the CPU resource on both the A-Cores.

Do you have an idea on how I can force the rendering on the GPU?
Thanks

Do you have an idea on how I can force the rendering on the GPU?

Well this goes back to the initial point in this conversation where I said chromium currently does not have support for i.MX GPUs. This is why we had --disable-gpu in the chromium args. Otherwise chromium would try to render advanced-graphics but due to the lack of proper GPU support it falls back on CPU rendering. Which as you saw isn’t very good.

The issue unfortunately, is not as simple as telling chromium to use the GPU. Chromium needs to know how to use the specific GPU hardware that is found on the i.MX SoCs.

We are currently investigating if recent developments can allow chromium to leverage the GPU, but we don’t have any solid results yet.

Best Regards,
Jeremias

Hi @vix !

I would like to point out that now Chromium container supports GPU acceleration, as you can see from the documentation:

Best regards,

Hi @henrique.tx
Thank you very much.
I’ve been busy in the last few weeks and so I haven’t tried yet.
I’ll give it a try and I let you know.

1 Like

Hi @vix ,

Were you able to try it?

Have a great day.

Best Regards
Kevin