Avalonia: [OpenGL] Unable to initialize GLX-based rendering

Hi there,

currently im working on an avalonia application using the avalonia template from the apolloX extension. everytime i launch the application i get a message that glx based rendering could not be initialized. is anyone else facing that issue or having an idea what could lead to that behavior?

heres the error:

[OpenGL] Unable to initialize GLX-based rendering: 'System.EntryPointNotFoundException: Unable to find an entry point named 'glXGetProcAddress' in shared library 'libGL.so.1'.
   at Avalonia.X11.Glx.GlxInterface.GlxGetProcAddress(Utf8Buffer buffer)
   at Avalonia.OpenGL.GlInterfaceBase`1.<>c__DisplayClass2_0.<ConvertNative>b__0(String proc) in /_/src/Avalonia.OpenGL/GlInterfaceBase.cs:line 67
   at Avalonia.OpenGL.GlEntryPointAttribute.GetProcAddress(Func`2 getProcAddress) in /_/src/Avalonia.OpenGL/GlEntryPointAttribute.cs:line 40
   at Avalonia.OpenGL.GlInterfaceBase`1..ctor(Func`2 getProcAddress, TContext context) in /_/src/Avalonia.OpenGL/GlInterfaceBase.cs:line 50
   at Avalonia.X11.Glx.GlxDisplay..ctor(X11Info x11, IList`1 probeProfiles) in /_/src/Avalonia.X11/Glx/GlxDisplay.cs:line 20
   at Avalonia.X11.Glx.GlxPlatformOpenGlInterface.TryCreate(X11Info x11, IList`1 glProfiles) in /_/src/Avalonia.X11/Glx/GlxPlatformFeature.cs:line 34'

used hardware:
Colibri IMX8QXP 2GB V1.0D
Iris Carrier Board V2.0
Torizon 6.2.0-build.2

hope anyone can help

best regards
Dominik

after i updated my project to the current version of the avalonia mvvm template the stack changed a bit:

[OpenGL] Unable to initialize GLX-based rendering: 'Avalonia.OpenGL.OpenGlException: Unable to find a suitable GL function for CreateContextAttribsARB
   at Avalonia.OpenGL.GlInterfaceBase`1..ctor(Func`2 getProcAddress, TContext context) in /_/src/Avalonia.OpenGL/GlInterfaceBase.cs:line 58
   at Avalonia.OpenGL.GlInterfaceBase..ctor(Func`2 getProcAddress) in /_/src/Avalonia.OpenGL/GlInterfaceBase.cs:line 11
   at Avalonia.X11.Glx.GlxInterface..ctor() in /_/src/Avalonia.X11/Glx/Glx.cs:line 110
   at Avalonia.X11.Glx.GlxDisplay..ctor(X11Info x11, IList`1 probeProfiles) in /_/src/Avalonia.X11/Glx/GlxDisplay.cs:line 20
   at Avalonia.X11.Glx.GlxPlatformOpenGlInterface.TryCreate(X11Info x11, IList`1 glProfiles) in /_/src/Avalonia.X11/Glx/GlxPlatformFeature.cs:line 34'

Hi @tisis2 !

Could you please share the output of tdx-info (reference: Getting Device Information with Tdx-Info | Toradex Developer Center)?

Also, which exact version of ApolloX are you using?

Does this issue occur with the default template? Or have you made some changes?

Best regards,

hi there,

here is what i got from tdx-info:

Software summary
------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           5.15.77-6.2.0+git.aa0ff7e3554e #1-TorizonCore SMP PREEMPT Wed Mar 29 15:33:40 UTC 2023
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.0/torizon/decdcdd4a4ca02824cd2e34fae717ba7d1b76df4b86a8881b3f5ff83fa8d25fc/0
Distro name:              NAME="TorizonCore"
Distro version:           VERSION_ID=6.2.0-build.2
Hostname:                 colibri-imx8x-07252196
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model:                 Toradex Colibri iMX8QXP on Colibri Evaluation Board V3
Toradex version:          0038 V1.0D
Serial number:            07252196
Processor arch:           aarch64
------------------------------------------------------------

ApolloX is at v2.0.0

i also tried with the default template project without making any changes:

Starting: "ssh" -T -q -p 2223 -i /home/dog/testprojects/ToradexStartupProject200/.conf/id_rsa -o StrictHostKeyChecking=no -o "UserKnownHostsFile /dev/null" torizon@colibri-imx8x-07252196 "/vsdbg/vsdbg --interpreter=vscode"
-------------------------------------------------------------------
You may only use the Microsoft .NET Core Debugger (vsdbg) with
Visual Studio Code, Visual Studio or Visual Studio for Mac software
to help you develop and test your applications.
-------------------------------------------------------------------
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/ToradexStartupProject200.dll'. Symbols loaded.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Avalonia.DesktopRuntime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Avalonia.Controls.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/netstandard.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Avalonia.Base.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.ObjectModel.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Avalonia.Styling.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Avalonia.Input.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Avalonia.Interactivity.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Avalonia.Layout.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Avalonia.Visuals.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Avalonia.Animation.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.ComponentModel.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Collections.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Avalonia.Desktop.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Avalonia.ReactiveUI.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Avalonia.X11.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Runtime.InteropServices.RuntimeInformation.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Avalonia.Skia.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Avalonia.OpenGL.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/System.Reactive.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Threading.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Private.Uri.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Linq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.ComponentModel.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Runtime.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Xml.XDocument.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Private.Xml.Linq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Private.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Memory.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Text.Encoding.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Threading.Thread.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Runtime.InteropServices.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Avalonia.FreeDesktop.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Tmds.DBus.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Collections.Concurrent.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Diagnostics.TraceSource.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
[X11Platform] SMLib/ICELib reported a new error: SESSION_MANAGER environment variable not definedEGL: Warning: No default display support on wayland
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Diagnostics.StackTrace.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Reflection.Metadata.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Collections.Immutable.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.IO.Compression.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
[OpenGL] Unable to initialize EGL-based rendering: 'Avalonia.OpenGL.OpenGlException: eglGetDisplay failed with error EGL_SUCCESS (0x3000)
   at Avalonia.OpenGL.Egl.EglDisplay.CreateDisplay(EglInterface egl, Int32 platformType, IntPtr platformDisplay, Int32[] attrs) in /_/src/Avalonia.OpenGL/Egl/EglDisplay.cs:line 43
   at Avalonia.OpenGL.Egl.EglDisplay..ctor(EglInterface egl, Boolean supportsSharing, Int32 platformType, IntPtr platformDisplay, Int32[] attrs) in /_/src/Avalonia.OpenGL/Egl/EglDisplay.cs:line 48
   at Avalonia.OpenGL.Egl.EglDisplay..ctor(EglInterface egl, Boolean supportsSharing) in /_/src/Avalonia.OpenGL/Egl/EglDisplay.cs:line 22
   at Avalonia.OpenGL.Egl.EglDisplay..ctor(Boolean supportsSharing) in /_/src/Avalonia.OpenGL/Egl/EglDisplay.cs:line 144
   at Avalonia.OpenGL.Egl.EglDisplay..ctor() in /_/src/Avalonia.OpenGL/Egl/EglDisplay.cs:line 139
   at Avalonia.OpenGL.Egl.EglPlatformOpenGlInterface.<>c.<TryCreate>b__15_0() in /_/src/Avalonia.OpenGL/Egl/EglPlatformOpenGlInterface.cs:line 29
   at Avalonia.OpenGL.Egl.EglPlatformOpenGlInterface.TryCreate(Func`1 displayFactory) in /_/src/Avalonia.OpenGL/Egl/EglPlatformOpenGlInterface.cs:line 34'
Loaded '/home/torizon/app/SkiaSharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Splat.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/ReactiveUI.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.ComponentModel.TypeConverter.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
LogHost: Initializing to normal mode (.cctor)
Loaded '/home/torizon/app/Avalonia.Markup.Xaml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Avalonia.Themes.Fluent.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Runtime.CompilerServices.Unsafe.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Avalonia.Markup.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Threading.Tasks.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/Avalonia.Diagnostics.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/dotnet/shared/Microsoft.NETCore.App/6.0.5/System.Buffers.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/home/torizon/app/HarfBuzzSharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

my project differ in a way that i wanted to get my avalonia application separated from the toradex startup confiugrations. so i splitted that into two different project that are referenced

Hi @tisis2 !

Sorry for the delay.

Unfortunately, there is no GLX support.

Have you tried to use the dotnetAvaloniaFrameBuffer (DRM) template instead?

Best regards,

hi @henrique.tx

according to the datasheet, there is opengl support on the module we use:

yes, we tried the framebuffer template in the past but there we were not able to get the touch input to work and with the other template it was working. that was the reason for us to work with that template. and on the other hand, we wanted to take advantage of the 2d acceleration.

best regards
Dominik

Hi @tisis2,

even though there is OpenGL, there is not GLX support in the drivers. Even the tests were removed some time ago piglit: Add PACKAGECONFIG for glx and opencl · Freescale/meta-freescale@1564853 · GitHub.

Moving forward, NXP has dropped support for X[1] in their latest BSP, and that change has reflected in the TorizonCore images (more information: Continued support for X11 and general road map for minimals? - #2 by rafael.tx).

Avalonia has a WIP for supporting Wayland backends, and some members of our team have been in touch with them raising this concern.

were not able to get the touch input to work and with the other template it was working

My recommendation would be to get the input to work and use that template instead. Feel free to reach out about this issue if you haven’t already.

Regards,

[1] XWayland is limited but still available.

1 Like

hi,

thanks for your answer. i also tried to not use glx and use egl instead like it is set up in the avalonia template, but this will also result in init exceptions stated above. so it is not just about glx at this point if i understand it right.

according to 2D/3D Graphics Acceleration (GPU) | Toradex Developer Center i would have expected it to work since the template uses the weston container which is a wayland compositor. so in my understanding wayland should be used?

i also modified my project to use linux framebuffer. it was working in general but it seemed to be even less performant than running the application on weston without a working graphics acceleration.
i am also confused now since i saw the post here (https://community.nxp.com/t5/i-MX-Processors/X11-support-for-iMX8-and-iMX8M/td-p/822981) where the tech support of nxp also stated frame buffer as not supported

best regards
Dominik

Hi @tisis2 ,

sorry for the delay.
We’re working on that, I’ll come back to you as soon as possible.

Best Regards
Kevin

1 Like

Hey @tisis2

unfortunately the problem is not on our Wayland side. Avalonia does not support Wayland backend for now😓: Our own backends for X11/Wayland · Issue #1243 · AvaloniaUI/Avalonia · GitHub

So, when using Wayland the true for Avalonia is that you are using xWayland, that does not support OpengGL ES.

On the Avalonia Framebuffer template, there are two ways:

So, make sure you are using DRM mode, if you are not already. And, if you are already using it let me know, because that’s the mode we’ve tested with the best performance, and we have to look into it if you’re having issues.

Best Regards,

1 Like