-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wayland backend: high chance of aborting on subsequent attempts to create the gamescope window #1456
Comments
@layercak3 |
The SDL backend doesn't have the same symptoms in the OP, but after testing more it has its own related issues. I wouldn't be surprised if the behaviour in both backends emerge from the same synchronization issues. In the eglgears_x11 example, instead of the random chance of aborting there is a random chance that it simply does not open a window and never opens a window again. I stop seeing these log messages pop up once the window stops opening:
But when using --expose-wayland and eglgears_wayland, it runs all 10 cycles successfully. Keep in mind when using the wayland backend instead of SDL, --expose-wayland and eglgears_wayland doesn't prevent aborts from happening. In the "game that rapidly opens and closes a window before opening the main window" example (using proton's winex11.drv), there is a random chance of gamescope either opening properly or not opening (and there is no sound, so it's not like it's rendering successfully offscreen), similar to the eglgears_x11 example. Edit: this is with SDL_VIDEODRIVER=wayland. With SDL_VIDEODRIVER=x11, this behaviour doesn't occur in the SDL backend. It's also possible that I just got lucky. The SDL backend + SDL_VIDEODRIVER=x11 also has graphical corruption issues which are unrelated to this issue. |
I also have this issue. This is particularly problematic, as some games (specifically, Warframe) have a launcher that closes right before opening the game, which triggers this bug (confirmed by analyzing the coredump). |
A workaround for games that do this is to start something like eglgears_x11, then your application, so that gamescope returns to displaying eglgears_x11 instead of removing the window when the application briefly goes between displaying a window -> not displaying a window -> displaying a window. |
The fd wasn't available because the host compositor (sway/wlroots) actually just threw a protocol error (xdg_surface unconfigured_buffer, message="xdg_surface has never been configured") so the connection died. Sometimes the gamescope window re-opens but without the app_id and sometimes without both the app_id and title. |
Log but with WAYLAND_DEBUG=client and an Xwayland wrapper to unset WAYLAND_DEBUG for Xwayland, so only the wayland backend <-> host compostor messages are shown. In count 2 the compositor sends wm_capabilities/configure and the gamescope window opens, but without app_id/title. For some reason the host compositor is forgetting it? Then in count 3 it doesn't send wm_capabilities/configure and so when gamescope tries to commit on the corresponding wl_surface it's a protocol error. |
So after Maybe gamescope needs to either never unmap the surface (just keep a dummy window up instead of unmapping/attaching null buffer), or properly remap and set the title/app_id again. |
When becoming invisible, a NULL buffer is attached to the toplevel's surface which unmaps it. The compositor resets their state and the surface may also be considered unconfigured. Upon becoming visible, the surface must be re-mapped using the same process during initialization (commit without a buffer and wait for configure) before we begin attaching an actual buffer. The default properties should also be recovered. Fixes: ValveSoftware#1456 Fixes: ValveSoftware#1451 (probably) Fixes: ValveSoftware#1488 (probably) Fixes: ValveSoftware#1533
When becoming invisible, a NULL buffer is attached to the toplevel's surface which unmaps it. The compositor resets their state and the surface may also be considered unconfigured. Upon becoming visible, the surface must be re-mapped using the same process during initialization (commit without a buffer and wait for configure) before we begin attaching an actual buffer. The default properties should also be recovered. Fixes: ValveSoftware#1456 Fixes: ValveSoftware#1451 (probably) Fixes: ValveSoftware#1488 (probably) Fixes: ValveSoftware#1533
Gamescope: f1963e9 (
-Dforce_fallback_for=glm,stb,libdisplay-info,libliftoff,vkroots,wlroots
)Host compositor: sway (7e74a4914) wlroots (f9199bb), also tested sway 1.9/wlroots from Arch extra repository
Reproduce:
With
gamescope --backend wayland
.Either outside of gamescope with DISPLAY correctly set to gamescope's X server or passed as the command to gamescope like
gamescope --backend wayland -- sh -c 'for count in {1..10}; do echo cycle $count; timeout 1 eglgears_x11; sleep 1; done; echo done'
Expected behaviour: gamescope window closes after one second, comes back after another second, and so on.
Actual behaviour: There is a high chance of gamescope aborting when attempting to launch a window for the second time (after printing 'cycle 2'). After a few attempts I can get to cycle 2 without a crash but it would crash after printing cycle 3.
(gdb) bt
Specifically here inside
CWaylandInputThread::ThreadFunc()
it aborted:I have had the abort in real-world cases like during wineboot's series of dialogs. (Proton can wineboot without spawning windows, which is nice.)
In games/game engines which cause gamescope to open and close a window very quickly before opening the main window (I could not replicate this scenario using the eglgears_x11 example above), there is a random chance that gamescope will abort like described above, but if it does launch, it launches into a seemingly usable state except the xdg-shell app id is not set and when turning the window from tiled into floating ('floating toggle' in sway), gamescope does not resize itself to the user specified dimensions (-W -H) but instead to whatever the window size was initially when starting gamescope (i.e. roughly half the screen in a tiling window manager when launching from a workspace with a single teriminal). I was able to avoid this behaviour using a package from an older commit (e.g. 0b492ad) but the random chance of gamescope aborting still existed. Also, using --synchronous-x11 has a random chance of avoiding this weird incomplete state on launch too (it still happens sometimes, but not always), but it doesn't stop the random chance of gamescope aborting. Anyway, the behaviour in this paragraph probably emerged from the wider issue.
Running gamescope with
--debug-layers --debug-focus --debug-hud --debug-events --composite-debug
somewhat/slightly increases the chances of avoiding an abort or launching with weird state in the scenario in the above paragraph.The text was updated successfully, but these errors were encountered: