godotengine / godot

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

Wayland: Godot v4.3 beta3 crashes when running on linux #94204

Closed em-s-h closed 1 month ago

em-s-h commented 1 month ago

Tested versions

System information

Godot v4.3.beta3.official.82cedc83c Arch Linux #1 SMP PREEMPT_DYNAMIC Fri, 05 Jul 2024 22:11:24 +0000 - Wayland - Vulkan (Forward+) - integrated Intel(R) HD Graphics 5500 (BDW GT2) () - Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz (4 Threads)

Issue description

Godot will instantly crash after starting when running under wayland, using --display-driver x11 will make godot start normally.

Error message:

xdg_surface#41: error 3: xdg_surface has never been configured
ERROR: Wayland protocol error 3 on interface xdg_surface@41.
   at: _poll_events_thread (platform/linuxbsd/wayland/wayland_thread.cpp:2739)

================================================================
handle_crash: Program crashed with signal 4
Engine version: Godot Engine v4.3.beta3.official (82cedc83c9069125207c128f9a07ce3d82c317cc)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib/libc.so.6(+0x3cae0) [0x70cbcbe59ae0] (??:0)
[2] godot_v4.3-beta3() [0x487dd7] (??:0)
[3] godot_v4.3-beta3() [0x3e3a645] (??:0)
[4] godot_v4.3-beta3() [0x4adff23] (??:0)
[5] /usr/lib/libc.so.6(+0x92ded) [0x70cbcbeafded] (??:0)
[6] /usr/lib/libc.so.6(+0x1160dc) [0x70cbcbf330dc] (??:0)
-- END OF BACKTRACE --
================================================================
Aborted (core dumped)

Steps to reproduce

Run ./Godot_v4.3-beta3_linux.x86_64 under wayland.

Minimal reproduction project (MRP)

N/A

akien-mga commented 1 month ago

I can reproduce the issue too on Fedora 40 KDE Wayland, this must be a recent regression, as I've been testing Wayland maybe a week ago in the master branch.

akien-mga commented 1 month ago

It seems to be specific to the OpenGL backend, and for me crashes when running on the discrete GPU (AMD Radeon RX 7600M XT), but not the integrated one (AMD Radeon 780M).

I.e. on my device:

DRI_PRIME=0 godot-git --display-driver wayland --rendering-driver opengl3

works fine.

DRI_PRIME=1 godot-git --display-driver wayland --rendering-driver opengl3

crashes with:

(gdb) bt
#0  0x00007fffe6e35575 in dri2_wl_visual_idx_from_pipe_format () at /lib64/libEGL_mesa.so.0
#1  0x00007fffe6e3673c in dri2_wl_add_configs_for_visuals () at /lib64/libEGL_mesa.so.0
#2  0x00007fffe6e39ac2 in dri2_initialize_wayland () at /lib64/libEGL_mesa.so.0
#3  0x00007fffe6e2efb8 in dri2_initialize () at /lib64/libEGL_mesa.so.0
#4  0x00007fffe6e1d778 in eglInitialize () at /lib64/libEGL_mesa.so.0
#5  0x0000000004ca07e4 in EGLManager::initialize (this=this@entry=0x86182e0, p_native_display=0x85f1cb0) at drivers/egl/egl_manager.cpp:385
#6  0x0000000003806253 in DisplayServerWayland::DisplayServerWayland
    (this=0x85e9490, p_rendering_driver=<optimized out>, p_mode=<optimized out>, p_vsync_mode=<optimized out>, p_flags=<optimized out>, p_resolution=<optimized out>, p_context=<optimized out>, r_error=<optimized out>) at platform/linuxbsd/wayland/display_server_wayland.cpp:1424
#7  0x0000000003806da6 in DisplayServerWayland::create_func
    (p_rendering_driver=..., p_mode=DisplayServer::WINDOW_MODE_WINDOWED, p_vsync_mode=DisplayServer::VSYNC_ENABLED, p_flags=0, p_position=<optimized out>, p_resolution=..., p_screen=-2, p_context=DisplayServer::CONTEXT_PROJECTMAN, r_error=@0x7fffffffad60: ERR_UNAVAILABLE) at platform/linuxbsd/wayland/display_server_wayland.cpp:1309
#8  0x000000000383f5b2 in Main::setup2 (p_show_boot_logo=p_show_boot_logo@entry=true) at main/main.cpp:2741
#9  0x000000000384b0fa in Main::setup (execpath=<optimized out>, argc=argc@entry=4, argv=argv@entry=0x7fffffffd6b0, p_second_phase=p_second_phase@entry=true) at main/main.cpp:2463
#10 0x00000000037a05cf in main (argc=5, argv=0x7fffffffd6a8) at platform/linuxbsd/godot_linuxbsd.cpp:74
akien-mga commented 1 month ago

Actually, I can reproduce my crash in earlier betas too, so I think it's problem with my dGPU. It's not the first time it's acting up after resuming from suspend, and usually a reboot fixes it.

It's probably not the same crash that @em-s-h is experiencing (I notably don't have the xdg_surface#41: error 3: xdg_surface has never been configured error).

Riteo commented 1 month ago

Thanks for your report! Could you please attach a verbose log with WAYLAND_DEBUG=1?

The command should look something like this: WAYLAND_DEBUG=1 godot --verbose > wayland.log 2>&1

BasilYes commented 1 month ago

Thanks for your report! Could you please attach a verbose log with WAYLAND_DEBUG=1?

The command should look something like this: WAYLAND_DEBUG=1 godot --verbose > wayland.log 2>&1

Very similar bug, I'm using hyprland crush on two different pc (with nvidia gpu and amd gpu) No crash on earlier beta versions. One with amd gpu: NixOS #1-NixOS ZEN SMP PREEMPT_DYNAMIC Tue Jan 1 00:00:00 UTC 1980 - Wayland - Vulkan (Forward+) - integrated AMD Radeon Graphics (RADV RENOIR) - AMD Ryzen 5 5500U with Radeon Graphics (12 Threads)

Log here wayland.log

(If it's not the same issue, tell me, I will open new issue)

em-s-h commented 1 month ago

Thanks for your report! Could you please attach a verbose log with WAYLAND_DEBUG=1?

The command should look something like this: WAYLAND_DEBUG=1 godot --verbose > wayland.log 2>&1

Here it is: wayland.log

Riteo commented 1 month ago

Thank you folks! You are both having the same issue and I can see it perfectly. A fix is coming soon :)

Riteo commented 1 month ago

Ok, sorry, for the delay, I just gave a look at this.

The issue is still very clear: this is surely a regression caused by #93684, as I forgot to account for the initialization of xdg_surfaces. I'm making a PR as we speak which should fix your case.

Curiously, I can't seem to replicate it on sway (although patched with explicit sync so TIWAGOS) even without libdecor.

@BasilYes reported hyprland; @em-s-h, what are you using instead?

Update: I can replicate this on Weston! No idea what's going on in my sway install, but this will do for testing on my part :D

em-s-h commented 1 month ago

what are you using instead?

I'm using sway

Riteo commented 1 month ago

I'm using sway

All right. I think my sway version is borked then, I should really switch back to the main branch :sweat_smile:

Riteo commented 1 month ago

BTW, I pushed the super-tiny patch. That line got removed by accident as it was commented in a deceiving way. Feel free to try it :D

Riteo commented 1 month ago

Oops, closed this by accident, sorry!