ValveSoftware / steam-runtime

A runtime environment for Steam applications
Other
1.17k stars 86 forks source link

Native Brigador fails to launch on KDE Wayland #636

Open DonKatsu opened 6 months ago

DonKatsu commented 6 months ago

Your system information

Please describe your issue in as much detail as possible:

Not sure if this is the right place to report this. When attempting to launch the native version of Brigador on a Wayland session, it fails to create the window and quits. Game log. Checking the force compatibility checkbox and selecting Steam Linux Runtime (scout) allows the game to launch. Switching to an x11 session allows the game to launch without forcing compatibility.

However, launching the game outside of Steam through a terminal on Wayland works.

I last played Brigador in October, but it ran on Wayland through Steam without changing compatibility.

Steps for reproducing this issue:

  1. Attempt to launch native Brigador without forced compatibility on KDE Wayland
  2. Game attempts to launch, immediately goes back to Play
smcv commented 6 months ago

Distribution: Fedora 39 KDE

Is Fedora still patching SDL 2 to make it default to native Wayland? The upstream default for SDL 2 is to prefer X11 via Xwayland. Using native Wayland for game windows triggers other issues, such as https://github.com/ValveSoftware/steam-for-linux/issues/8020.

If that guess is correct, a possible workaround is to set the game's launch options in Steam to SDL_VIDEODRIVER=x11 %command%.

It looks as though this particular game is using GLEW, which hasn't had significant updates since 2017, and assumes that OpenGL on Linux should always use GLX, which is an X11-specific protocol. This is not compatible with using a version of SDL that defaults to native Wayland and therefore does not create an X11 window.

When the Steam Runtime gets a version of SDL that is strictly newer than the one in Fedora (likely to happen somewhat soon because SDL 2.30.0 is on the way), that would probably also work around this, by preferring the Steam Runtime's version of SDL over Fedora's.

Checking the force compatibility checkbox and selecting Steam Linux Runtime (scout) allows the game to launch

That's consistent with what I've said above. When you use the Steam Linux Runtime compatibility tool, you're getting a version of SDL 2 from (a later branch of) the Steam Runtime, and not Fedora's version.

Switching to an x11 session allows the game to launch without forcing compatibility

That's also consistent with what I've said above.

launching the game outside of Steam through a terminal on Wayland works

This surprises me. Is it creating an X11 window or a Wayland window in this case?

smcv commented 6 months ago

@kisak-valve, please could you tag this as a game-specific issue?

This isn't really a Steam Runtime bug, as such: as far as I can see, the Steam Runtime isn't doing anything specifically wrong here, it just isn't working around this particular game's limitations.

smcv commented 6 months ago

Is Fedora still patching SDL 2 to make it default to native Wayland?

Looks like yes: https://src.fedoraproject.org/rpms/SDL2/blob/rawhide/f/SDL2-2.0.22-prefer-wayland.patch.

If that guess is correct, a possible workaround is to set the game's launch options in Steam to SDL_VIDEODRIVER=x11 %command%.

Please try that.

DonKatsu commented 6 months ago

launching the game outside of Steam through a terminal on Wayland works

This surprises me. Is it creating an X11 window or a Wayland window in this case?

The output still doesn't mention either x11 or wayland, but it's using the generic x11 icon for the panel entry.

Launching through steam without Steam runtime forced with SDL_VIDEODRIVER=x11 %command% works, and still has the generic x11 icon. As well as when forced to use the Steam runtime.

smcv commented 6 months ago

Launching through steam without Steam runtime forced

What do you mean by "without Steam runtime forced"? Do you mean: Properties -> Compatibility -> uncheck "Force use of..."? Or something else?

As well as when forced to use the Steam runtime

Do you mean: Properties -> Compatibility -> "Force use of..." -> "Steam Linux Runtime 1.0 (scout)"? Or something else?

(The reason I ask for clarification is that all Steam games are normally run via some sort of version of the Steam Runtime, but that might be either the Steam Linux Runtime container or the older LD_LIBRARY_PATH runtime.)

DonKatsu commented 6 months ago

Do you mean: Properties -> Compatibility -> uncheck "Force use of..."

Do you mean: Properties -> Compatibility -> "Force use of..." -> "Steam Linux Runtime 1.0 (scout)"

Yes to both.

smcv commented 5 months ago

A future version of SDL2 will automatically switch to X11 if it detects that the application is linked to GLEW (https://github.com/libsdl-org/SDL/issues/8812) which I believe should solve this for you.

DonKatsu commented 5 months ago

Good to know. But I'm still not entirely sure why it runs outside of Steam if Fedora's SDL2 is supposed to be defaulting to Wayland which causes the crash?

smcv commented 5 months ago

It looks as though maybe it has a bundled version of SDL which is used when you run it outside Steam, but is not used when running within Steam? When running it outside Steam, your log says:

Compiled with SDL version 2.0.3
Linked with SDL version 2.0.3

and that version is far too old to have any concept of Wayland, which accidentally works around the limitation.

DonKatsu commented 5 months ago

Oh, I didn't notice that. But when I force the scout runtime without launch options and it successfully launches, the log lists the same linked version as when it crashes without scout forced:

Compiled with SDL version 2.0.3
Linked with SDL version 2.28.5
smcv commented 5 months ago

Yes, except no :-) It's the same upstream release, but compiled differently.

When you're forcing Steam Linux Runtime 1.0 (scout) (which is a Steam Runtime 2 (soldier) container plus some ABI-compat glue for the default LD_LIBRARY_PATH runtime), you get Steam Runtime 2 (soldier)'s build of SDL 2.28.5, which has not been patched to prefer native Wayland, so on a Wayland desktop it defaults to X11 via Xwayland unless forced otherwise.

When you're using the default LD_LIBRARY_PATH runtime, you (currently) get Fedora's build of SDL 2.28.5, which has been patched by Fedora to prefer native Wayland, so it defaults to Wayland unless forced otherwise - and that doesn't work for this specific game.