osu: Failed to create an SDL2 GL context (Invalid window)

Type

Crash to desktop

Bug description

AppImage version of the game used to run fine on my system and now it opens a black window and hangs (probably after some system update as I’m on a rolling distro). Tried building from source - builds fine, opens a black window and hangs. I rebuilt flatpak image with never version since the flathub one is outdated and it ran fine for a few weeks but now doesn’t even open a window saying:

Unhandled exception. System.InvalidOperationException: Failed to create an SDL2 GL context (Invalid window)
   at osu.Framework.Platform.SDL2.SDL2GraphicsBackend.CreateContext()
   at osu.Framework.Platform.PassthroughGraphicsBackend.Initialise(IWindow window)
   at osu.Framework.Platform.SDL2.SDL2GraphicsBackend.Initialise(IWindow window)
   at osu.Framework.Platform.SDL2DesktopWindow.Create()
   at osu.Framework.Platform.GameHost.Run(Game game)
   at osu.Desktop.Program.Main(String[] args) in /var/lib/buildkite-agent/builds/debian-gnu-linux-vm-1/ppy/osu/osu.Desktop/Program.cs:line 120
$ glxinfo -B
name of display: :1
display: :1  screen: 0
direct rendering: Yes
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 4096 MB
    Total available memory: 4096 MB
    Currently available dedicated video memory: 3342 MB
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 1050 Ti/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 525.60.11
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6.0 NVIDIA 525.60.11
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)

OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 525.60.11
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
$ inxi -SG
System:
  Kernel: 5.19.17-2-MANJARO arch: x86_64 bits: 64
    Desktop: GNOME v: 43.1 Distro: Manjaro Linux
Graphics:
  Device-1: NVIDIA GP107 [GeForce GTX 1050 Ti] driver: nvidia v: 525.60.11
  Display: x11 server: X.org v: 1.21.1.4 with: Xwayland v: 22.1.5
    driver: N/A resolution: 1: 1920x1080~60Hz 2: 1080x1920~60Hz
  API: OpenGL v: 4.6.0 NVIDIA 525.60.11 renderer: NVIDIA GeForce GTX 1050
    Ti/PCIe/SSE2

Screenshots or videos

No response

Version

2022.1208.0 but is present in earlier releases too

Logs

database.log input.log network.log performance.log runtime.log

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

To provide more context to this issue I tried tracing it some more in debugger and caught this exception:

System.ArgumentNullException: Value cannot be null. (Parameter 'source')
   at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at osu.Framework.Platform.SDL2DesktopWindow.get_PrimaryDisplay() in /home/pcktm/clones/osu-framework/osu.Framework/Platform/SDL2DesktopWindow_Windowing.cs:line 370

The osu.Framework.Platform.SDL2DesktopWindow.Displays does indeed equal null when osu.Framework\Platform\SDL2DesktopWindow.cs:202 gets executed.

Tried PrimaryDisplay => (Displays ?? getSDLDisplays()).First(); and while LINQ doesn’t throw now, the issue wasn’t solved…

Could you post the full stack trace?

Is

PrimaryDisplay => (Displays ?? getSDLDisplays()).First();

a good enough fix? If so, I’d submit a PR to osu-framework.

This is not a proper solution. Displays being null here is the underlying issue.

Inspired by @frenzibyte comment I linked /usr/lib/libdl.so.2 to /usr/lib/libdl.so and sure enough the window does open and flash some colors, so that must’ve been it