osu icon indicating copy to clipboard operation
osu copied to clipboard

[Linux] Lazer randomly loses viewport, with the game still running in the background

Open zamonary1 opened this issue 1 year ago • 13 comments

Type

Crash to desktop

Bug description

I am not sure why, but after updating flatpak version it started crashing after a couple of seconds after opening, no matter how you interact with the game, and i have no fix for it. Before the update everything worked flawlessly. Tested it out on gnome and everything is exactly the same. If you have a tablet you can still interact with the game when the window is closed

Note: it may seem that the issue occurs when starting the level, but that's a coincidence.

Nixos 24.11 Open-source amd driver Kde 6 + wayland

Screenshots or videos

https://github.com/user-attachments/assets/04257bb4-a36b-4482-9baa-75741013820d

Version

2025-221-0

Logs

compressed-logs.zip

zamonary1 avatar Feb 21 '25 14:02 zamonary1

I am experiencing the exact same. The window disappears and is no longer on the taskbar, but the game keeps running like you tabbed out of the game with the music filter and volume changed. When running the flatpak in a console, once the window disappears, it logs an error: wp_linux_drm_syncobj_surface_v1#56: error 3: explicit sync is used, but no buffer is attached

Mr-Zero88 avatar Feb 21 '25 21:02 Mr-Zero88

I have the same issue, but it seems to only affect native wayland. I start the game with SDL_VIDEODRIVER=wayland and got the problem. If I start it without this and osu runs thru xwayland it seems to be fine. I just use the appimage from the release page.

braeluca avatar Feb 22 '25 11:02 braeluca

please try OSU_SDL3=0 envvar

bdach avatar Feb 22 '25 12:02 bdach

@bdach This seems to fix it, with both SDL_VIDEODRIVER=wayland and OSU_SDL3=0

braeluca avatar Feb 22 '25 12:02 braeluca

Yep, around 5 minutes of gameplay and it's stable

zamonary1 avatar Feb 22 '25 14:02 zamonary1

This seems to be the same issue that I was facing at #26210 though I've had this issue for over a year now so it's probably not related to SDL3 on my end. I have SDL_VIDEODRIVER=wayland set as well.

Stoppedpuma avatar Feb 23 '25 02:02 Stoppedpuma

osu!lazer freezes on Fedora 6.12.13-200.fc41.x86_64 with GNOME 47 Wayland, since version 2025.220.0.

I can reproduce the bug, just keeping click the setting button at top left for a few times, then osu will freeze at foreground. I click the windows(super) key to show activities overview and back, osu back to normal.

run osu with OSU_SDL3=0 environment variable seems to fix it

sb-child avatar Feb 23 '25 06:02 sb-child

It was recently reported that this issue may be fixed.

@zamonary1 Try setting envvar OSU_SDL3=1 and reproducing your original issue again:

  • If you can reproduce the issue, note down your current configuration (if it has changed).
  • If you can't reproduce, close the issue (as completed). Keep playing osu! with OSU_SDL3=1.
  • If you notice a different issue, open a new issue (search first). Link to it in your comment.

Susko3 avatar Jan 01 '26 16:01 Susko3

Good evening,

I recently updated my game and I have started getting this issue (non-issue before). The logs show:

2026-05-14 18:35:57 [verbose]: SDL video log [error]: Wayland display connection closed by server (fatal)

This can happen after a very long session or just after a view minutes. I believe this to be related to: https://github.com/ppy/osu-framework/pull/6746

mikaib avatar May 14 '26 18:05 mikaib

This is posted on behalf of nullptr_osu on Discord:

I believe I found the root cause of the problem. It boils down to concurrently calling SDL_GL_SwapWindow() and SDL_WarpMouseInWindow() from different threads while SDL3 marks both of those function to be thread unsafe:

\threadsafety This function should only be called on the main thread.

The problem happens only when receiving input from a tablet (SDL_WarpMouseInWindow() doesn't seem to be called otherwise on my system) and when the multithreaded mode is enabled (but could still cause frame pacing issues as detailed in the NVIDIA quote at the end of this post).

Detailed mechanism

The exact problem is this:

  • SDL_GL_SwapWindow() eventually calls eglSwapBuffers() which generates several wayland protocol messages:
    • wp_linux_drm_syncobj_surface_v1#54.set_acquire_point & wp_linux_drm_syncobj_surface_v1#54.set_release_point
    • wl_surface#39.attach
    • wl_surface#39.frame
    • wl_surface#39.commit
  • SDL_WarpMouseInWindow() which is implemented in SDL_waylandmouse.c calls wl_surface_commit(window->surface)

When the concurrent execution interleaves in such a way that the surface commit from the mouse warp ends up after the syncobj setup from the swap window but before the attach it errors out:

{Default Queue}  -> wp_linux_drm_syncobj_surface_v1#54.set_acquire_point(wp_linux_drm_syncobj_timeline_v1#65, 0, 40537)
{Default Queue}  -> zwp_pointer_constraints_v1#14.lock_pointer(new id zwp_locked_pointer_v1#78, wl_surface#39, wl_pointer#40, nil, 1)
{Default Queue}  -> zwp_locked_pointer_v1#78.set_cursor_position_hint(1526.55078125, 493.91015625)
{Default Queue}  -> wl_surface#39.commit()
{Default Queue}  -> zwp_locked_pointer_v1#78.destroy()
{Default Queue}  -> zwp_pointer_constraints_v1#14.confine_pointer(new id zwp_confined_pointer_v1#66, wl_surface#39, wl_pointer#40, nil, 2)
{Default Queue}  -> wp_linux_drm_syncobj_surface_v1#54.set_release_point(wp_linux_drm_syncobj_timeline_v1#65, 0, 40538)
{EGLSurface(39)}  -> wl_surface#39.attach(wl_buffer#4278190081, 0, 0)
{EGLSurface(39)}  -> wl_surface#39.frame(new id wl_callback#73)
{EGLSurface(39)}  -> wl_surface#39.commit()
{EGLSurface(39)}  -> wl_display#1.sync(new id wl_callback#59)
{Default Queue} wl_pointer#40.motion(41398484, 1525.60156250, 501.53515625)
{Default Queue} wl_pointer#40.frame()
discarded [unknown]#78.[event 0](0 fd, 8 byte)
{Display Queue} wl_display#1.delete_id(79)
{Display Queue} wl_display#1.error(wp_linux_drm_syncobj_surface_v1#54, 3, "Acquire point set but no buffer attached")
wp_linux_drm_syncobj_surface_v1#54: error 3: Acquire point set but no buffer attached

The NVIDIA implementation of eglSwapBuffers has this to say about it:

In particular, an application MUST NOT send a wl_surface.commit request for a surface concurrently with an eglSwapBuffers call.
Due to the lack of orthogonality between surface changes and the lack of any synchronization across multiple requests, surface commits in Wayland are not thread-safe.

Even with a single thread, due to limitations in the fifo-v1 and presentation-time protocols,
sending a wl_surface.commit request at all outside of eglSwapBuffers will break frame throttling,
and may result in discarded frames.

mtp-lac avatar Aug 05 '26 19:08 mtp-lac

If the above is accurate (which I cannot - or am unwilling to, really - verify) then my understanding is that wayland basically does not allow for tablet input processing via OTD on a separate thread from draw at all, and as such it would basically be required to couple the two (which is just a little less than what setting single threaded does).

wayland - once more - is apparently the only one of multiple OSes and their compositors that has this problem, and I am unsure how the game is to resolve this in a way that would not compromise the point of multithreaded. Which is to say, probably no action will be taken. Maybe aside from forcing wayland users to play single threaded which I bet will go over well! /s

bdach avatar Aug 05 '26 20:08 bdach

As this is effectively a wontfix, I should mention that, at least for NVIDIA devices, a possible workaround is setting __NV_DISABLE_EXPLICIT_SYNC=1. Unfortunately, I don't remember if there is an equivalent envvar for AMD GPUs

Chiffario avatar Aug 06 '26 06:08 Chiffario

There's not much to do from osu! side anyway. SDL behavior explained in https://github.com/ppy/osu/issues/32015#issuecomment-5196451716 is essentially a hack for Wayland compositors, that haven't implemented wp_pointer_warp_v1 protocol.

Major compositors (KDE ≥6.5, GNOME ≥49) seem to already have it, so this shouldn't affect most of linux/wayland players.

urayde avatar Aug 08 '26 16:08 urayde