Avalonia App on Verdin iMX8MP (Torizon OS 7) – How to Enable GPU Acceleration?

Hi everyone,

I’m currently testing an Avalonia application on a Verdin iMX8MP running Torizon OS 7, and I’m running into performance issues (slow scrolling and animations). I suspect this is due to GPU acceleration not being enabled in the application container.

Here’s the setup and what I’ve tried so far:

  • Created a new Avalonia project using the Torizon VS Code extension.

  • Built a production image, uploaded it to Torizon Cloud, and deployed it to the device.

  • Attempted to verify GPU acceleration:

    • Running eglinfo inside the app container → Segmentation fault (core dumped)

    • Running glmark2-es2-waylandError: main: Could not initialize canvas

My questions are:

  1. How do I correctly enable hardware acceleration for the application container?

  2. What is the recommended way to run glmark2 on this setup to verify GPU usage?

Any guidance or alternative suggestions would be appreciated.

Software summary
Bootloader:               U-Boot
Kernel version:           6.6.94-7.3.0-g5a62539de8f9 #1-Torizon SMP PREEMPT Wed Jun 25 09:14:55 UTC 2025
Kernel command line:      root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree/boot.1/torizon/8568bef1b4acf89b02595197a2466284bcfc198a3fb59f92ca7236c9f19e7b7d/0
Distro name:              NAME=“Torizon OS”
Distro version:           VERSION_ID=7.3.0-build.18
Distro variant:           VARIANT=“Docker”
Hostname:                 verdin-imx8mp-15698327
Hardware info
HW model:                 Toradex Verdin iMX8M Plus WB on Verdin Development BoardToradex version:          0058 V1.1BSerial number:            15698327Processor arch:           aarch64

Thanks in advance

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Enabling Hardware Acceleration for Avalonia Applications on Verdin iMX8MP

Understanding GPU Acceleration Requirements

For hardware-accelerated graphics on Toradex modules, you need to use OpenGL ES either directly or through a high-level framework (1). The Verdin iMX8M Plus includes a Vivante GPU that supports hardware acceleration through OpenGL ES (1).

.NET Avalonia Framework Configuration

According to the framework comparison documentation, .NET Avalonia supports X11 as its graphical backend (2). For your Avalonia application to utilize GPU acceleration properly, ensure your container configuration includes the necessary graphical backend access.

Hardware Acceleration Considerations

The documentation indicates that there are known performance limitations with certain GPU features on Vivante GPUs. Specifically, MSAA (Multisample Anti-Aliasing) performance may not be optimal on Vivante GPUs, which could affect rendering performance (3).

Container Configuration Requirements

Based on the available documentation, ensure your container has proper access to the graphical subsystem. The container needs access to the display and GPU devices to enable hardware acceleration.

Performance Expectations

The framework comparison shows that .NET Avalonia can achieve “As advanced or as simple as needed” user experiences with “Low” hardware demand (2). However, the actual performance depends on proper GPU access configuration.

Troubleshooting Steps

  1. Verify GPU Device Access: Ensure your container has access to the appropriate GPU devices
  2. Check Display Backend: Confirm X11 is properly configured and accessible within your container
  3. Review Container Permissions: Verify the container has the necessary permissions to access graphics hardware

Alternative Approaches

If performance issues persist, consider evaluating other GUI frameworks that may be better optimized for your specific use case. The documentation provides a comprehensive comparison of various frameworks including Qt, GTK, and others that support hardware acceleration (2).

I don’t have specific container configuration examples for Avalonia GPU acceleration in the available documentation. For detailed container configuration steps specific to your Avalonia setup, you may need to consult the Torizon IDE Extension documentation or community resources for .NET-specific GPU acceleration configurations.

Best regards, Toradex AI Assistant.

Greetings @mauroUX,

Just to be sure, are you using the “.NET 8 C# Avalonia GTK MVVM” template from our VSCode extension?

Best Regards,
Jeremias

Hi @jeremias.tx ,

Yes, I’m using the project template from the VS Code extension.

As an additional test, I tried deploying the default template app directly to the device. However, it crashes immediately at startup with the following exception:

Unhandled exception. System.Exception: XOpenDisplay failed at Avalonia.X11.AvaloniaX11Platform.Initialize(X11PlatformOptions options) at Avalonia.AvaloniaX11PlatformExtensions.<>c.<UseX11>b__0_0() at Avalonia.AppBuilder.SetupUnsafe() at Avalonia.AppBuilder.Setup() at Avalonia.AppBuilder.SetupWithLifetime(IApplicationLifetime lifetime) at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, Action`1 lifetimeBuilder) at TestApp.Program.Main(String[] args) in /home/torizon/app/Program.cs:line 15

Best,
Mauro

So the issue is that Avalonia does not have graphics acceleration. Let me explain.

Avalonia has no support for the Wayland backend. It really only has support for running on X/X11. However, NXP does not support X/X11 on the i.MX8M Plus SoC, which is why we use Wayland. We use XWayland to get an Avalonia based app to run, but this is with software rendering and not with the GPU.

Which is why you see poor/slow performance with Avalonia since the CPU is being used instead.

So the short answer is that there’s not really a way to enable GPU acceleration for Avalonia. That is unless Avalonia is changed/updated to properly support a Wayland backend. Though the discussion has been ongoing for a while in the Avalonia community with no notable progress from what I can see: Does Avalonia not support Wayland · AvaloniaUI/Avalonia · Discussion #18404 · GitHub

Best Regards,
Jeremias

Hi Jeremias,

Thanks a lot for the explanation, that really helps. We’ll take a closer look at Avalonia’s roadmap regarding Wayland support. In the meantime, do you know if there are any SoCs that still provide native X11 support? That could be useful for us to consider as an alternative.

Best,
Mauro

do you know if there are any SoCs that still provide native X11 support?

At this point not much. You’d probably have to look at older SoCs like the i.MX6 or earlier. But beyond this you’d even have to look at old software to run on these old SoCs as well. Most SoC suppliers have completely dropped or put little to no effort into providing proper X11 support on their hardware.

These days in terms of graphics Wayland with Weston, or other Wayland based compositors are being favored generally.

X11 with hardware acceleration may be possible, but it would probably be something experimental that is not supported or tested anymore.

Are you locked into using Avalonia as your graphical framework?

Best Regards,
Jeremias