[LINUX] Technical Report for Black Screen bug and/or crash on Linux

Overview
A few people on the forum including myself are having issues with Vital having a black screen and/or crashing from it. After doing some debugging I think I have found the root cause.

This is caused because the bgfx library’s setRenderContextSize function is receiving corrupted height and width dimensions due to outdated memory mapping.

Workaround by Discord member Slart at the bottom.

Error

/home/runner/work/vital/vital/plugin_framework/third_party/bgfx.cmake/bgfx/src/glcontext_egl.cpp (425): BGFX FATAL 0x00000002: Failed to create surface.

Test Parameters

  • Vital Standalone & VST3 (Reaper)
  • Vital Version 1.6.4
  • Fedora 44
  • Wayland
  • NVIDIA GPU
  • Mesa 26.X+
  • GDB Debugger

Technical Breakdown
Looking at the backtrace, we can see the application reaches this point before crashing:

#5  0x0000555555c0b1b9 in bgfx::fatal(char const*, unsigned short, bgfx::Fatal::Enum, char const*, ...) ()
#6  0x0000555555c94031 in bgfx::gl::RendererContextGL::setRenderContextSize(unsigned int, unsigned int, unsigned int) ()

By inspecting Frame 6, we can see the canvas dimensions being passed to the graphics engine.

On Wayland, the function receives:

232298
233343

Upon further investigation, it appears these values are actually the PID and LWP ID’s (as shown in the thread exit logs below), rather than actual pixel dimensions.

On the other hand, if we attempt to force X11 at the application/window layer with GDK_BACKEND=x11 we get:

140736884377728
0

These are a memory address (0x7fffdc000880) and a null pointer.

In either scenario the values are invalid for a canvas size, causing the application or VST to crash.

The Reason
The reason it’s receiving these values is because Vital is expecting to receive this information in a specific structure in memory, but due to using outdated tools, the structure is not matching with what the host is providing.

Vital expects to receive an X11 Window Struct but the host is providing a Wayland/EGL Surface struct. From my limited understanding X11 provides the width and height in the first bytes, while Wayland provides the PID & LWP.

The reason forcing X11 didn’t work is because the bgfx library bypasses XWayland and talks to the lower level graphics layers directly. So the resulting values are what the XWayland translation layer is giving, that is also incorrectly mapped.

Further Proof
As shown in the next sections workaround, you can directly override the use of Wayland by forcing X11 at a lower graphic level by specifying the use of an older Mesa configuration. The fact that forcing these low-level driver rules completely solves the crash proves that Vital’s interface stabilizes once the underlying memory maps are forced back into a legacy layout.

Workaround Scripts (By Slart on Discord)
To fix the crash, you must target the Graphics API and Hardware Driver layers directly, forcing the entire rendering pipeline to drop back to legacy X11 memory mapping layouts where the variables align correctly.

You can implement this by creating a custom launcher script for your Standalone application or your DAW host (e.g., Reaper).

NOTE: You may need to change the path to your DAW and the mesa.json version (see below for how to find your version).

#!/bin/sh
export __GL_THREADED_OPTIMIZATIONS=0
export EGL_PLATFORM=x11
export __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json
unset WAYLAND_DISPLAY
exec "/usr/bin/reaper" "$@"

Your distribution may use a different priority value for your Mesa configuration, to check; run and replace the __EGL_VENDOR_LIBRARY_FILENAMES if necessary:

ls /usr/share/glvnd/egl_vendor.d/

For Flatpaks you can run the following command (replace com.bitwig.BitwigStudio with your specific DAW’s Flatpak ID):

flatpak override --user \
  --env=__GL_THREADED_OPTIMIZATIONS=0 \
  --env=EGL_PLATFORM=x11 \
  --env=__EGL_VENDOR_LIBRARY_FILENAMES=/run/host/usr/share/glvnd/egl_vendor.d/50_mesa.json \
  --unset-env=WAYLAND_DISPLAY \
  com.bitwig.BitwigStudio

And use this to undo it at a later point:

flatpak override --user --reset com.bitwig.BitwigStudio

Full Backtrace

#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007ffff79168d3 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:89
#2  0x00007ffff78bb48e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff78a27b3 in __GI_abort () at abort.c:77
#4  0x0000555555c8d90b in bgfx::CallbackStub::fatal(char const*, unsigned short, bgfx::Fatal::Enum, char const*) ()
#5  0x0000555555c0b1b9 in bgfx::fatal(char const*, unsigned short, bgfx::Fatal::Enum, char const*, ...) ()
#6  0x0000555555c94031 in bgfx::gl::RendererContextGL::setRenderContextSize(unsigned int, unsigned int, unsigned int) ()
#7  0x0000555555c49ce0 in bgfx::gl::RendererContextGL::init(bgfx::Init const&) ()
#8  0x0000555555c49be8 in bgfx::gl::rendererCreate(bgfx::Init const&) ()
#9  0x0000555555c12383 in bgfx::rendererCreate(bgfx::Init const&) ()
#10 0x0000555555c12ede in bgfx::Context::rendererExecCommands(bgfx::CommandBuffer&) ()
#11 0x0000555555c0f279 in bgfx::Context::renderFrame(int) ()
#12 0x0000555555c0f86e in bgfx::Context::renderThread(bx::Thread*, void*) ()
#13 0x0000555555cb8a6a in bx::ThreadInternal::threadFunc(void*) ()
#14 0x00007ffff7914759 in start_thread (arg=<optimized out>) at pthread_create.c:454
#15 0x00007ffff799890c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Exit Threads

[Thread 0x7ffff5e006c0 (LWP 232334) exited]
[Thread 0x7ffff7d29c80 (LWP 232298) exited]
3 Likes

Awesome findings man :ok_hand:
If it’s any help for others, i ended up switching to bitwig as standard install (to keep yabridge support) instead of flatpak.
Included this line in my desktop shortcut to bypass the issue :
Exec=env EGL_PLATFORM=x11 __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json /opt/bitwig-studio/bitwig-studio %U

2 Likes

I came here to the forum after 3 years just for this bug lol.

Similar problem here.

Black GUI flashes for half a second → Hard crash

EndeavourOS x86_64 - Wayland
Linux 7.0.9-zen1-1-zen
Nvidia RTX 5060

/home/runner/work/vital/vital/plugin_framework/third_party/bgfx.cmake/bgfx/src/glcontext_egl.cpp (425): BGFX FATAL 0x00000002: Failed to create surface.
Aborted (core dumped) Vital

The workaround in this thread worked for me.

Just passing by to thank you all.

unset WAYLAND_DISPLAY

export __GL_THREADED_OPTIMIZATIONS=0
export EGL_PLATFORM=x11
export __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json

Vital
libEGL warning: pci id for fd 27: 10de:2d05, driver (null)

pci id for fd 28: 10de:2d05, driver (null)

This will do until a proper fix :slight_smile:

PS: There is a small caveat: GUI sometimes flashes rapidly until I close and re-open it. Also happens with floating values from the knobs.

PS 2: Another issue (which is more relevant) is that the workaround can break some plugins running under yabridge, causing instant hard crash (tested in Reaper):

jack: activated client
13:32:39 [truebalance-GIMTbchy] Initializing yabridge version 5.1.1-54-g48ea9749
13:32:39 [truebalance-GIMTbchy] library:       '/usr/lib/libyabridge-vst3.so'
13:32:39 [truebalance-GIMTbchy] host:          '/usr/bin/yabridge-host.exe'
13:32:39 [truebalance-GIMTbchy] plugin:        '/home/gonk/.wine/drive_c/Program Files/Common Files/VST3/Sonible/truebalance.vst3'
13:32:39 [truebalance-GIMTbchy] plugin type:   'VST3'
13:32:39 [truebalance-GIMTbchy] realtime:      'yes'
13:32:39 [truebalance-GIMTbchy] sockets:       '/run/user/1000/yabridge-truebalance-GIMTbchy'
13:32:39 [truebalance-GIMTbchy] wine prefix:   '/home/gonk/.wine <overridden>'
13:32:39 [truebalance-GIMTbchy] wine version:  '10.20'
13:32:39 [truebalance-GIMTbchy]
13:32:39 [truebalance-GIMTbchy] config from:   '/home/gonk/.vst3/yabridge/yabridge.toml, section "*"'
13:32:39 [truebalance-GIMTbchy] hosting mode:  'plugin group "all", 64-bit'
13:32:39 [truebalance-GIMTbchy] other options: '<none>'
13:32:39 [truebalance-GIMTbchy]
13:32:39 [truebalance-GIMTbchy] Enabled features:
13:32:39 [truebalance-GIMTbchy] - bitbridge support
13:32:39 [truebalance-GIMTbchy] - CLAP support
13:32:39 [truebalance-GIMTbchy] - VST3 support
13:32:39 [truebalance-GIMTbchy]
13:32:39 [truebalance-GIMTbchy] [Wine STDERR] 0088:err:environ:init_peb starting L"C:\\Program Files (x86)\\Common Files\\Adobe\\AdobeGCClient\\AGSService.exe" in experimental wow64 mode
13:32:39 [truebalance-GIMTbchy] [Wine STDERR] 0094:fixme:advapi:RegisterEventSourceW ((null),L"AGSService"): stub
13:32:39 [truebalance-GIMTbchy] [Wine STDERR] 0094:fixme:advapi:ReportEventW (CAFE4242,0x0004,0x0000,0x00000000,00000000,0x0002,0x00000000,00F7FED0,00000000): stub
13:32:39 [truebalance-GIMTbchy] [Wine STDERR] 0094:fixme:advapi:DeregisterEventSource (CAFE4242) stub
13:32:39 [truebalance-GIMTbchy] [Wine STDERR] 00a8:fixme:ver:GetCurrentPackageId (0127F494 00000000): stub
13:32:39 [truebalance-GIMTbchy] [Wine STDERR] 00a8:fixme:file:NtLockFile I/O completion on lock not implemented yet
13:32:40 [truebalance-GIMTbchy] [Wine STDERR] 00c8:err:environ:init_peb starting L"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ElevationManager\\AdobeUpdateService.exe" in experimental wow64 mode
13:32:40 [truebalance-GIMTbchy] [Wine STDERR] 00c8:fixme:ntdll:EtwEventSetInformation (deadbeef, 2, 00493C08, 43) stub
13:32:40 [truebalance-GIMTbchy] [Wine STDERR] 0104:fixme:wineusb:query_id Unhandled ID query type 0x5.
13:32:40 [truebalance-GIMTbchy] [Wine STDERR] 0104:fixme:wineusb:query_id Unhandled ID query type 0x5.
13:32:40 [truebalance-GIMTbchy] [Wine STDERR] 0104:fixme:wineusb:query_id Unhandled ID query type 0x5.
13:32:40 [truebalance-GIMTbchy] [Wine STDERR] 0104:fixme:wineusb:query_id Unhandled ID query type 0x5.
13:32:40 [truebalance-GIMTbchy] [Wine STDERR] 0104:fixme:wineusb:query_id Unhandled ID query type 0x5.
13:32:40 [truebalance-GIMTbchy] [Wine STDERR] 0104:fixme:wineusb:query_id Unhandled ID query type 0x5.
13:32:40 [truebalance-GIMTbchy] [Wine STDERR] 0104:fixme:wineusb:query_id Unhandled ID query type 0x5.
13:32:40 [truebalance-GIMTbchy] [Wine STDERR] Initializing yabridge host version 5.1.1-54-g48ea9749
13:32:40 [truebalance-GIMTbchy] [Wine STDERR] 13:32:40 [all] Group host is up and running, now accepting incoming connections
13:32:40 [truebalance-GIMTbchy] [Wine STDERR] 13:32:40 [all] Received request to host VST3 plugin at '/home/gonk/.wine/drive_c/Program Files/Common Files/VST3/Sonible/truebalance.vst3' using socket endpoint base directory '/run/user/1000/yabridge-truebalance-GIMTbchy'
13:32:40 [truebalance-GIMTbchy] [Wine STDERR] 13:32:40 [all] Finished initializing '/home/gonk/.wine/drive_c/Program Files/Common Files/VST3/Sonible/truebalance.vst3'
13:32:40 [TrackMeter-8GRbmotw] Initializing yabridge version 5.1.1-54-g48ea9749
13:32:40 [TrackMeter-8GRbmotw] library:       '/usr/lib/libyabridge-vst3.so'
13:32:40 [TrackMeter-8GRbmotw] host:          '/usr/bin/yabridge-host.exe'
13:32:40 [TrackMeter-8GRbmotw] plugin:        '/home/gonk/.wine/drive_c/Program Files/Common Files/VST3/DMG Audio/TrackMeter.vst3/Contents/x86_64-win/TrackMeter.vst3'
13:32:40 [TrackMeter-8GRbmotw] plugin type:   'VST3'
13:32:40 [TrackMeter-8GRbmotw] realtime:      'yes'
13:32:40 [TrackMeter-8GRbmotw] sockets:       '/run/user/1000/yabridge-TrackMeter-8GRbmotw'
13:32:40 [TrackMeter-8GRbmotw] wine prefix:   '/home/gonk/.wine <overridden>'
13:32:40 [TrackMeter-8GRbmotw] wine version:  '10.20'
13:32:40 [TrackMeter-8GRbmotw]
13:32:40 [TrackMeter-8GRbmotw] config from:   '/home/gonk/.vst3/yabridge/yabridge.toml, section "DMG Audio/*.vst3"'
13:32:40 [TrackMeter-8GRbmotw] hosting mode:  'plugin group "dmgaudio", 64-bit'
13:32:40 [TrackMeter-8GRbmotw] other options: 'editor: no host DPI scaling', 'editor: force drag-and-drop'
13:32:40 [TrackMeter-8GRbmotw]
13:32:40 [TrackMeter-8GRbmotw] Enabled features:
13:32:40 [TrackMeter-8GRbmotw] - bitbridge support
13:32:40 [TrackMeter-8GRbmotw] - CLAP support
13:32:40 [TrackMeter-8GRbmotw] - VST3 support
13:32:40 [TrackMeter-8GRbmotw]
13:32:40 [TrackMeter-8GRbmotw] [Wine STDERR] Initializing yabridge host version 5.1.1-54-g48ea9749
13:32:40 [TrackMeter-8GRbmotw] [Wine STDERR] 13:32:40 [dmgaudio] Group host is up and running, now accepting incoming connections
13:32:40 [TrackMeter-8GRbmotw] [Wine STDERR] 13:32:40 [dmgaudio] Received request to host VST3 plugin at '/home/gonk/.wine/drive_c/Program Files/Common Files/VST3/DMG Audio/TrackMeter.vst3/Contents/x86_64-win/TrackMeter.vst3' using socket endpoint base directory '/run/user/1000/yabridge-TrackMeter-8GRbmotw'
13:32:40 [TrackMeter-8GRbmotw] [Wine STDERR] 13:32:40 [dmgaudio] Finished initializing '/home/gonk/.wine/drive_c/Program Files/Common Files/VST3/DMG Audio/TrackMeter.vst3/Contents/x86_64-win/TrackMeter.vst3'
libEGL warning: pci id for fd 55: 10de:2d05, driver (null)

pci id for fd 56: 10de:2d05, driver (null)
libEGL warning: pci id for fd 7: 10de:2d05, driver (null)

pci id for fd 15: 10de:2d05, driver (null)
!! killing thread by force !!
Segmentation fault         (core dumped) reaper-x11

Removing the new env vars and running Reaper normally fixes the crash.

I believe this is related:

Exept I’m on NVIDIA 595.71.05

In short:

The fix works fine for Standalone Vital BUT MAY produce unintended side effects on Wine.

Reverting to 1.6.0 completely fixes these issues and it loads normally, both VST, CLAP and Standalone.

2 Likes

Thanks for the reply and added info!

I’m specifically trying to see how much I can get done without yabridge, so I would never have stumbled on this, so the info is greatly appreciated!