Some additional details about the Godot part of the stacktrace:
When checking Godot source code, make sure to use either the 3.x or 3.3 branch. The master branch uses Vulkan exclusively so it doesn't trigger this specific issue.
The relevant code for the Linux/X11 platform port is in https://github.com/godotengine/godot/tree/3.x/platform/x11
And specifically the OpenGL 2.1 context is created here using glxCreateNewContext: https://github.com/godotengine/godot/blob/33a42160a02645a6b58874ca008813527e474680/platform/x11/context_gl_x11.cpp#L169-L172
I'm not very familiar with this code but it seems pretty close to the official Khronos tutorial for GLX context creation: https://www.khronos.org/opengl/wiki/Tutorial:_OpenGL_3.0_Context_Creation_(GLX)
Edit: Further debugging, I tested a Windows build with Proton, and it crashes too when using the GLES2 renderer (this can be forced on the command line with --video-driver GLES2).
So the common denominator here would be the actual GLES2 renderer, and not the Linux/X11 GLX context creation.
I went through some Godot games I had installed and found a number of other ones which use GLES2 and are now crashing. Updated the OP with more examples.
I had some existing play time in some of these games so it seems like the crash is a regression from either the Steam Overlay, or Mesa (though I've had crashes confirmed on Nvidia too).
This is pretty critical as developers are already uncomfortable enough around providing Linux support (whether natively, which Godot handles well for them, or via Proton). If the Steam Overlay crashes their games it makes it harder to encourage them to support Linux/SteamOS as it appears unreliable and risky.
Edit: Here's evidence that this was already happening as of late August 2021 with Luck be a Landlord: https://steamcommunity.com/app/1404850/discussions/0/3037102935222977730/
Edit 2: I couldn't confirm that this happens with Nvidia proprietary drivers in the end, so this might be a Mesa-related issue. Could be related to issues discussed in #7889 (though the conclusion of that one seems to point at a radeonsi regression, while I can also reproduce the bug with iris).
Here's an updated reproducer with a Godot binary (3.3.3-stable), so that it can be tested right away. It includes the most minimal Godot project that would still create a window.
I also took a GL API trace with the included run.sh script, and the trace is included in the zip (I used apitrace 10.0).
As per https://github.com/godotengine/godot/issues/53352#issuecomment-966265471 the bug seems to happen with Mesa 21.2.5 on Debian Sid, but not Mesa 20.3.5 in Debian 11, so this appears to have been triggered by a Mesa change.
Edit: Additionally, this seems reproducible with llvmpipe too (LIBGL_ALWAYS_SOFTWARE=1 %command%).
Edit 2: Tested in a Fedora 34 VM on VirtualBox, which includes Mesa 21.1.6, and the crash happens there too. So the regression happened between 20.3.5 and 21.1.6.
Edit 3: I built Mesa 21.0.0 on my Fedora 34 VM (specifically https://src.fedoraproject.org/rpms/mesa/c/d0fc8d9e3e975b10b96034936ee712114ad654df?branch=rawhide) and it seems to work fine, so the regression might be in 21.1.0. That's my next test.
Edit 4: Mesa 21.1.0 crashes.
I've tested a few Mesa versions on a Fedora 34 VM, and found that Mesa 21.1.0 (release notes) seems to be the first stable release where the bug happens. Mesa 21.0.0 runs Godot OpenGL 2.1 projects + Steam Overlay without issue. I haven't tried 21.0.x maintenance releases, so I don't know if the 21.1 regression might have been cherry-picked to 21.0.x.
Thanks. I've bisected the regression in Mesa and created an issue here: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5621
Amazing, thanks a lot! I see you already found a fix candidate too.
Do you know if there would be any chance to get it included in 21.3.0 (doubt so since it's at RC 5 already) or 21.3.1?
It will definitely be in 21.3.1 I can try for 21.3.0 but may not make it. It should also get back ported to 21.2.6.
@tarceri's fix made it in 21.3.0 :tada: https://gitlab.freedesktop.org/mesa/mesa/-/commit/5275563df4086d85f83cf08b9c4c3e734a49c534
I just got the update on Mageia Cauldron and I can confirm the fix, tested with Ex-Zodiac Demo, Luck Be a Landlord, and Hack Grid. All start fine with OpenGL 2.1 on Mesa 21.3.0.
So this is issue can be closed as fixed upstream.
To summarize for affected users, Mesa version between 21.1.0 and 21.2.5 are affected.
The fix is available in:
If your distro Mesa maintainers can't upgrade, you can ask them to cherry-pick https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13773.
LIBGL_ALWAYS_SOFTWARE=1 %command%x1 2021-11
Your system information
Please describe your issue in as much detail as possible:
I'm the maintainer of the open source Godot Engine. We found that Godot games using our OpenGL 2.1 renderer ("GLES2" in Godot's API, as it also maps to OpenGL ES 2.0 on mobile and WebGL 1.0 on web) are triggering a segfault in graphics drivers via the Steam Overlay.
The segfault terminates the whole process. Games using our OpenGL 3.3 renderer work fine with the Steam Overlay. Disabling the Steam Overlay, or running the games outside Steam, also works fine.
The segfault happens on a call to
glXSwapBuffers()one or two seconds after the game starts, around the time where the Steam Overlay would show its bottom-right corner presence notification.Here's a
gdbbacktrace of such a crash using Intel Iris Mesa 21.2.3 drivers and a debug build of Godot's3.xbranch (as of commit https://github.com/godotengine/godot/commit/06e02606996d062f978cc9b71ff2962d10c0431d):The issue appears to be reproducible on multiple distros with both Intel and AMD Mesa drivers, ~and proprietary Nvidia drivers~ (edit: unconfirmed).
See https://github.com/godotengine/godot/issues/53352 for the corresponding Godot bug report.
Godot is open source, so you can easily compile it from source to debug how Godot's GL context triggers an issue in
gameoverlayrenderer.so. See Compiling Godot for Linux, the issue should be reproducible with both the3.3(current stable) and3.x(next OpenGL release) branches.Steam games exhibiting the issue:
Steps for reproducing this issue:
https://github.com/godotengine/godot/issues/53352#issue-1014357858 includes a zip for such a simple Godot project, that can be exported with e.g. Godot 3.3.4 for Linux. Alternatively, just putting a Godot editor binary (including compiled from source with debug symbols) in the project folder is sufficient to run the project, so this can be used to test the crash too.