godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.96k stars 21.07k forks source link

Steam Overlay crash on Linux [GLES2 only] #53352

Closed akien-mga closed 2 years ago

akien-mga commented 3 years ago

Godot version

3.3.4.stable, 3.x

System information

Linux, Mageia 9 x86_64

Issue description

I noticed that on my system (specs below), Godot games on Steam crash on start if they use GLES2 (no problem with GLES3) due to the Steam Overlay. Disabling the Steam Overlay in the game's Steam properties solves it.

The crash happens when the Steam Overlay tries to show its notification in the bottom right corner after a couple of seconds. It happens both when I run with my Intel HD 630 or my Radeon RX Vega M (both using Mesa 21.2.3).

Here's the stacktrace I could grab with a build from 3.x (06e02606996d062f978cc9b71ff2962d10c0431d):

(gdb) bt
#0  0x00007ffff3cbe678 in _mesa_PushAttrib () from /usr/lib64/dri/iris_dri.so
#1  0x00007ffff7f9c922 in ?? () from /home/akien/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so
#2  0x00007ffff7fab308 in ?? () from /home/akien/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so
#3  0x00007ffff7fad09d in ?? () from /home/akien/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so
#4  0x00007ffff7f9b0fe in glXSwapBuffers () from /home/akien/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so
#5  0x0000000001794678 in ContextGL_X11::swap_buffers (this=0x6bd7ab0) at platform/x11/context_gl_x11.cpp:61
#6  0x00000000017a49f3 in OS_X11::swap_buffers (this=0x7fffffffb9f0) at platform/x11/os_x11.cpp:3461
#7  0x00000000029ea092 in RasterizerGLES2::end_frame (this=0x6d0b760, p_swap_buffers=true) at drivers/gles2/rasterizer_gles2.cpp:461
#8  0x000000000426c26e in VisualServerRaster::draw (this=0x6c1dff0, p_swap_buffers=true, frame_step=0.01666666753590107) at servers/visual/visual_server_raster.cpp:110
#9  0x00000000042b57bb in VisualServerWrapMT::draw (this=0x6d665e0, p_swap_buffers=true, frame_step=0.01666666753590107) at servers/visual/visual_server_wrap_mt.cpp:90
#10 0x00000000017e0bfb in Main::iteration () at main/main.cpp:2200
#11 0x00000000017a5ad7 in OS_X11::run (this=0x7fffffffb9f0) at platform/x11/os_x11.cpp:3641
#12 0x000000000179381f in main (argc=1, argv=0x7fffffffc338) at platform/x11/godot_x11.cpp:55

The crash is caused by the proprietary gameoverlayrenderer.so Steam library. The above stacktrace is with the Intel Iris driver, but it looks the same with AMD RadeonSI:

(gdb) bt
#0  0x00007ffff3cbe678 in _mesa_PushAttrib () from /usr/lib64/dri/radeonsi_dri.so
#1  0x00007ffff7f9c922 in ?? () from /home/akien/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so
#2  0x00007ffff7fab308 in ?? () from /home/akien/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so
#3  0x00007ffff7fad09d in ?? () from /home/akien/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so
#4  0x00007ffff7f9b0fe in glXSwapBuffers () from /home/akien/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so
#5  0x0000000001794678 in ContextGL_X11::swap_buffers (this=0x6bd7ab0) at platform/x11/context_gl_x11.cpp:61
...

I don't know yet if it's reproducible on other machines. I recently had an update of my distro's graphics stack (bleeding edge Xorg, amdgpu, mesa), so it may well be either a local config issue, or a recent upstream regression.

System specs:

System:    Host: cauldron Kernel: 5.14.9-desktop-2.mga9 x86_64 bits: 64 Desktop: KDE Plasma 5.22.3 Distro: Mageia 9 mga9 
CPU:       Info: Quad Core model: Intel Core i7-8705G bits: 64 type: MT MCP cache: L2: 8 MiB 
           Speed: 800 MHz min/max: 800/3100 MHz Core speeds (MHz): 1: 800 2: 800 3: 841 4: 900 5: 898 6: 891 7: 802 8: 887 
Graphics:  Device-1: Intel HD Graphics 630 driver: i915 v: kernel 
           Device-2: Advanced Micro Devices [AMD/ATI] Polaris 22 XL [Radeon RX Vega M GL] driver: amdgpu v: kernel 
           Device-3: Cheng Uei Precision Industry (Foxlink) HP Wide Vision FHD Camera type: USB driver: uvcvideo 
           Display: x11 server: Mageia X.org 1.21.0.99 driver: loaded: intel,v4l resolution: 1920x1080~60Hz 
           OpenGL: renderer: Mesa Intel HD Graphics 630 (KBL GT2) v: 4.6 Mesa 21.2.3

Saw this issue initially with the Ex-Zodiac demo on Steam: https://store.steampowered.com/app/1249480/ExZodiac/

Steps to reproduce

Minimal reproduction project

Just a trivial scene saying "Hi" and GLES2 enabled. Also includes a run_gdb.sh script which can be used as the target in Steam to run the debug binary through gdb and get a stacktace. gles2_crash_steam_overlay.zip

vnen commented 3 years ago

I also got the crash on Arch Linux. Using Mesa 21.2.3 with an AMD Radeon RX 480

anderlli0053 commented 3 years ago

There is also crash on Linux Mint 20.2 Cinnamon 5.0.5, kernel version 5.11.0-37-generic, processor AMD Ryzen 5 3550H with Radeon Vega Mobile GFX x 4, dual graphics card; Nvidia GeForce GP107M - GeForce GTX 1050 3 GB Max-Q and AMD Picasso ATI

akien-mga commented 3 years ago

Thanks for the confirmation, I reported the issue to Valve: https://github.com/ValveSoftware/steam-for-linux/issues/8122

akien-mga commented 2 years ago

I asked @Calinou to test on Nvidia and at least Ex-Zodiac Demo didn't seem to crash there, so this might well be a Mesa-specific bug.

I also listed more titles which are affected on https://github.com/ValveSoftware/steam-for-linux/issues/8122 - some of those had been working fine for me in the past on the same hardware, and I'm running cutting edge Mesa, so it could well be a Mesa regression.

There is also crash on Linux Mint 20.2 Cinnamon 5.0.5, kernel version 5.11.0-37-generic, processor AMD Ryzen 5 3550H with Radeon Vega Mobile GFX x 4, dual graphics card; Nvidia GeForce GP107M - GeForce GTX 1050 3 GB Max-Q and AMD Picasso ATI

I'm a bit confused since you mention 4 different GPUs or APUs here... could you clarify which GPU/drivers you've tested this on specifically? Godot would only use one of them when it starts (which should be mentioned in the logs).

Gramps commented 2 years ago

That is interesting. This issue comes up every so often with GodotSteam and many times the it can be fixed with a bash script but I hadn't considered it might be GLES 2 vs 3. In the cases it has come up in our issues threads, they all seem to work fine in Ubunbu but Arch and some other were common.

For what it's worth, I test on Nvidia 1070 with Ubuntu 21.10 (hdd install) and Ubuntu 16.04 (in VM).

psy-q commented 2 years ago

I've tested with "satryn deluxe" on Debian sid and openSUSE Tumbleweed, AMD RX 580 and Vega 64. It crashes there, both distros use Mesa 21.2.5.

Works fine on the same hardware with Debian 11, Mesa 20.3.5. Also works on Intel HD 4000 with Mesa 20.3.5.

If it's a Mesa regression, it seems to have appeared somewhere between Mesa 20.3.5 and 21.2.3.

akien-mga commented 2 years ago

This was indeed a Mesa regression, see https://github.com/ValveSoftware/steam-for-linux/issues/8122 and https://gitlab.freedesktop.org/mesa/mesa/-/issues/5621 for details.

The fix is included in the newly released Mesa 21.3.0, so upgrading your distro should solve it once they package the latest Mesa. If they can't/don't want to update to Mesa 21.3.0, and current provide a version between Mesa 21.1.0 and 21.2.5, you can file a bug report with your distro and suggest that they backport this simple patch: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13773

Edit: The fix is also included in Mesa 21.2.6 for those whose distro is not yet upgrade to 21.3.