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?
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.
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.
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.
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.
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.
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.
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.
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.
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).
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.
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.