Repository navigation
Closed
Labels
Description
Your system information
- Steam Runtime Version: Well, RetroArch builds in Soldier.
- Distribution: Flatpak Steam (Flatpak 1.12 on NixOS)
- Link to your full system information: https://gist.github.com/hpfr/af33ef8029b3907a15f91b6bef835ac1
- Have you checked for system updates?: Yes
- What compatibility tool are you using?: None, since it's built-in. Forcing SLR from the compatibility menu causes RetroArch to crash, because it tries to launch Soldier in Soldier.
- If you are using Steam Linux Runtime for native Linux games: What versions are listed in
SteamLinuxRuntime/VERSIONS.txt?
#Name Version Runtime Runtime_Version Comment
depot 0.20210818.35 # Overall version number
LD_LIBRARY_PATH - scout - # see ~/.steam/root/ubuntu12_32/steam-runtime/version.txt
scripts v0.20210818.0-0-gc6be089 # Entry point scripts, etc.
- If you are using Steam Linux Runtime, or Proton 5.13 or newer: What versions are listed in
SteamLinuxRuntime_soldier/VERSIONS.txt?
#Name Version Runtime Runtime_Version Comment
depot 0.20210923.28 # Overall version number
pressure-vessel 0.20210906.2
scripts v0.20210917.0-0-g1cf127d # Entry point scripts, etc.
soldier 0.20210920.0 soldier 0.20210920.0 # soldier_platform_0.20210920.0/
Please describe your issue in as much detail as possible:
Additionally, on Linux, we are moving from the AppImage-based release to using the newer soldier runtime available in Steam to increase the likelihood of RetroArch working out of the box on more Linux distributions.
RetroArch has built in the Soldier runtime in their latest Steam release. The launch script launches RetroArch within pressure-vessel within the Soldier runtime according to a dev (see retroarch.sh in the app's Steam files or below).
I tried GNOME's Xorg and Wayland sessions and only Wayland had this issue, although RetroArch gave a notification twice on launch for both Xorg and Wayland: "Steam Virtual Gamepad not configured, using fallback"
Steps for reproducing this issue:
- Launch RetroArch in a Wayland session and enable SDL2 input and gamepad drivers in RetroArch. Exit RetroArch.
- Connect a Steam Controller or other controller with Steam Input enabled
- Launch RetroArch. Controller input is not recognized.
retroarch.sh
#!/bin/bash
RUNTIME_APPID=1391110 # Soldier
RUNTIME_INSTALL_DIR=$(LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/mist ./mist/app_install_dir $RUNTIME_APPID)
if [ $? -ne 0 ]; then
zenity --error \
--text="Error getting soldier install dir from Steam.
$RUNTIME_INSTALL_DIR"
else
# Check if the runtime is installed
if [ -d $RUNTIME_INSTALL_DIR -a -f $RUNTIME_INSTALL_DIR/run ]; then
export PRESSURE_VESSEL_SHARE_HOME=1
export PRESSURE_VESSEL_FILESYSTEMS_RW="$HOME:/dev" # Force mount home and dev for CD-ROM
mount_path () {
if [ -d $1 ]; then
export PRESSURE_VESSEL_FILESYSTEMS_RW="$PRESSURE_VESSEL_FILESYSTEMS_RW:$1"
fi
}
# /mnt seems to be pretty standard, so mount that if it exists
mount_path /mnt
# /media is pretty common too
mount_path /media
# /run/media media path for udisk
mount_path /run/media
# Let users define custom mounts in a mounts file, one path per line
if [ -f ./mounts ]; then
export PRESSURE_VESSEL_FILESYSTEMS_RW="$PRESSURE_VESSEL_FILESYSTEMS_RW:$(sed -z "s/\n/:/g" ./mounts)"
fi
# Run RA with the runtime
$RUNTIME_INSTALL_DIR/run -- ./retroarch $@
# Tell the user they need to install the runtime, and open the install dialog
else
zenity --info \
--ellipsize \
--text="The Steam Linux Runtime required to run RetroArch on Linux is missing, an install prompt will open."
xdg-open "steam://install/$RUNTIME_APPID" &
fi
fi
Activity
smcv commentedon Oct 28, 2021
This is not really something that's supported yet, so I'm impressed that Retroarch is successfully doing the unsupported thing anyway.
Are you a Retroarch developer? If not, can you point Retroarch people to this issue?
cc @TTimo - I know you had plans about teaching Steam to have a way to officially run native Linux apps/games under the container runtimes. It looks like Retroarch would like to be another early adopter!
smcv commentedon Oct 28, 2021
Where does this come from? This seems like something that either should be exposed as API by Steam, or shouldn't be relied on by apps/games if it isn't part of the Steam API.
This is the default. If the user is deliberately using the experimental functionality to unshare
$HOME, please don't interfere with that.This shouldn't be necessary. pressure-vessel shares
$HOMEby default, and/dev(as much as possible) unconditionally.(Of course, if you're running in a Flatpak environment, the access we have to
/devcomes from Flatpak and we don't get to change it.)smcv commentedon Oct 28, 2021
For the input issue, this is not necessarily something that pressure-vessel can fix for you. The way this works depends on precisely how Retroarch handles input devices; we can help the Retroarch developers to use a container-friendly protocol to detect input devices, but that probably needs code in Retroarch, rather than in pressure-vessel. pressure-vessel does its best to make all devices from the host available in the container, but we can only work with what's implementable, and not everything that you might want is implementable.
One big problem with input devices under both Flatpak and pressure-vessel is that the usual way to detect input devices is with udev, but udev is not designed to work across a container boundary. The protocol that the udevd server uses to communicate with the libudev client is considered private to a particular version of udev, and can change at any time; udevd is part of the OS, but the libudev client library comes from the container runtime, so it's pure luck whether the two are compatible with each other. The protocol used for hotplug detection also relies on being able to recognise netlink messages from root, which can't be done across the boundary of a user namespace created by an unprivileged user - in the Flatpak sandbox or pressure-vessel's equivalent, there are only two valid uids, "me" and "not me", neither of which is root.
The least-bad solution for that problem seems to be to have a non-udev code path, based on inspecting
/devand/sys, with inotify for change-notification; then detect a container environment, and automatically switch to that code path when the container environment is detected. I don't know whether Retroarch already has this. I contributed implementations of this to both SDL2 and Proton in the past, and I know that GNOME's libmanette also has something vaguely compatible.If possible, I'd encourage Retroarch to use SDL for this, instead of reinventing this particular wheel. However, if that's not possible, it will have to reimplement similar logic, like Proton did. There's a reference implementation of a suitable detection code path, using GLib, in the same codebase as pressure-vessel: direct-input-monitor.
Another potential problem that you might be encountering here, particularly when using the Steam Flatpak app rather than an OS-native package, is that Steam Input needs broader permissions on certain device nodes than ordinary game input mechanisms. Specifically, it needs read/write access to
/dev/uinput, to create its emulated game controllers, and it also benefits from access to/dev/hidraw*devices that correspond to game controllers (both your real game controller, and the virtual Xbox controller that Steam emulates). An OS-native Steam package should get these by installing the steam-devices udev rules, but a Flatpak app cannot do that.Myaats commentedon Oct 28, 2021
Hi, I am the person responsible for RetroArch on Steam for Linux and wrote the entrypoint. I am aware it might be a bit too experimental but I never got any response after Steamworks Support said they had forwarded my request, so I just ended making something with what I had.
It is just a simple binary which returns the app install dir using https://partner.steamgames.com/doc/api/ISteamApps#GetAppInstallDir so should work fine anywhere
I believe some users reported that they were unable to access their HOME but setting this somehow fixed it. This has already been out for over a month so I do not remember if this was the exact reason. Worst case if you end up changing the behaivor of it changing it would not be much hassle.
Same as my previous reply.
smcv commentedon Oct 28, 2021
Looks like this is not the problem here, because we have that access:
Myaats commentedon Oct 28, 2021
RetroArch already has a modular driver system where there is a SDL2 input driver that uses the library inside of the soldier runtime. But for some reason it does not seem to work when Steam Input is enabled in the Steam Client, I was able to reproduce it with a Xbox One Elite controller w/ SDL2 for input where no controller input would get detected when Steam Input is enabled but it works fine with it disabled.
@hpfr seems to say that it seems to be the combination of Steam Input and Wayland which causes this condition. I have not tested with Xorg yet myself so I cannot confirm that it would work in an Xorg session.
I have not dug deep into into enumerating devices inside of the container to figure out what changes either. But it seems weird to me that Steam Input forwarding controller input should tied to using Xorg or Wayland. This might even be a client issue and not a runtime issue for all I know.
Myaats commentedon Oct 28, 2021
I just changed into a Xorg session to check and I can confirm that the Steam Virtual Controller device is giving events as expected from SDL2. While it seems to do nothing when running under Wayland. 😓
smcv commentedon Oct 28, 2021
Here is something that might be helpful to get more information:
The container runtime has a diagnostic tool for input devices,
steam-runtime-input-monitor, which has two code paths available:--directuses direct /dev and /sys access with inotify, and--udevuses udev. By default, it will auto-detect which one to use in the same way SDL and Proton do. You can run it either in the container, or in the Steam Flatpak environment, or even on the host system.By default, it will enumerate input devices as blobs of JSON, then print
{"all-for-now": true}and wait for hotplug events; sendSIGINT(press Ctrl+C) to exit. You can run it with--onceto just do the initial enumeration and not wait for hotplug events, if you are not interested in hotplug (yet).There's a copy in
SteamLinuxRuntime_soldier/pressure-vessel/bin, which should be runnable from anywhere.To get an interactive shell in a Flatpak sandbox, run something like:
To get an interactive shell in the soldier environment, the easiest way will probably be to set Retroarch's launch options to
PRESSURE_VESSEL_SHELL=instead %command%, then launch Retroarch. This will give you anxterminside the container, from which you can explore interactively.smcv commentedon Oct 28, 2021
It seems weird to me too - I don't have access to the code for this feature in the proprietary parts of Steam, but I would have expected that it would all be based on
/devaccess that is independent of the windowing system. However, I think the Steam Overlay (aLD_PRELOADobject) is also involved in delivering the emulated controller events to the game - so perhaps GLX vs. EGL vs. Vulkan is also relevant?What exactly do you mean by "Wayland"? Is it an environment like GNOME Shell or KDE Plasma that has both Wayland and X11 (via Xwayland) available, or are you in a pure Wayland environment where X11 isn't possible?
Does the Steam Overlay (popups in the bottom right corner, and ability to press Shift+Tab and get an interactive overlay) work in Retroarch?
Myaats commentedon Oct 28, 2021
I switched between GNOME on Wayland and GNOME on Xorg. Now that you mention it I just noticed the entire thing crashed when trying to access the Steam Overlay under Wayland, there might be something weird happening there. I know there is a codepath for creating the window using Wayland, I guess it might be related to that. https://github.com/libretro/RetroArch/blob/master/gfx/drivers_context/wayland_ctx.c
Going to try to recompile it with only Xorg support present and see if I can reproduce it.
smcv commentedon Oct 28, 2021
It wouldn't surprise me if the Steam Overlay assumed X11.
Does Retroarch have a way to force use of X11 even though Wayland is available, similar to GNOME's
GDK_BACKEND=x11and Qt'sQT_QPA_PLATFORM=xcb?If it does, it would probably be a good idea for the Steam version to use that; or if it doesn't, perhaps add one?
Myaats commentedon Oct 28, 2021
I just checked and it just uses a list of backends sorted by priority where Wayland is over Xorg, but I can easily just disable Wayland support during configure so I should be able to get a build which forces Xorg through Xwayland if you give me a few minutes.
Myaats commentedon Oct 28, 2021
I can confirm disabling the Wayland context code path for window / graphics eliminated the issues on Wayland, the Steam Overlay seems to work too.
I assume that this is unwanted behaivor especially since the Steam Deck has a Wayland compositor if I remember correctly meaning that the current stable build would not have received any input on it.
For now the publicly available
nightlybranch of RetroArch has a build with the Wayland context disabled while the public/stable branch has yet to be updated if anyone wants to play with it until we do another stable build. Reproducing it should not be that hard anyways :PAnyways, thanks for helping finding out the cause of the issue! @smcv
smcv commentedon Oct 28, 2021
The bigger picture here is that until recently, all games/apps had to be built for Steam Runtime 1 'scout', which is so ancient that Wayland support was not really even feasible - technically it does have Wayland libraries, but they're very early Wayland libraries from the proof-of-concept phase of development, and they don't meet the expectations of modern Wayland clients. For example, we explicitly disable the native Wayland backend in scout's copy of SDL, because it will no longer compile successfully against those libraries.
Steam Runtime 2 'soldier' is a lot newer (and so is Steam Runtime 3 'sniper' when that becomes available), so Wayland support becomes something that's feasible to have (and we leave it enabled in libraries like SDL and GTK) - but the proprietary parts of Steam, and notably the Steam Overlay
LD_PRELOADmodule, still have to be built on scout for compatibility reasons, so Wayland support in those parts is probably some way off.It's great that you're getting the benefit of a newer library stack from the soldier runtime, but you're in unexplored territory by doing that, and should be prepared for some early-adopter problems. Targeting any runtime newer than scout is not something that is officially supported by Steam yet. I hope that in future it will become possible to target soldier (and newer runtimes) "officially", by setting a flag in the Steam app metadata and removing your wrapper script.
I believe games on the Steam Deck are expected to talk to Xwayland using X11, at least for now. Native Linux games are still "officially" meant to target scout, and I don't think Proton supports native Wayland either (there has been work on native Wayland in upstream Wine, but I don't think Proton has it).
hpfr commentedon Oct 28, 2021
Thanks for the rapid and thorough investigation to both of you!
I guess it makes sense every other game worked if Wayland is the issue, since basically no games can run Wayland-native yet. But this will be more common in the future, particularly if Wine gets Wayland support. This particular issue can be closed, but there seems to be a new one: the Steam overlay and Steam Input don't work on Wayland. Is that already being tracked somewhere I can subscribe?
smcv commentedon Oct 28, 2021
That seems to exist already as ValveSoftware/steam-for-linux#8020.
ValveSoftware/steam-for-linux#4924 also seems relevant.
When Wine gets native Wayland support, Valve and their partners have control over how soon they want to enable that in Proton, and will presumably not enable it until the rest of the Steam ecosystem is ready for it.
Similarly, when soldier (or sniper) becomes an officially supported runtime environment for native Linux games on Steam, it would make sense for Valve to either resolve ValveSoftware/steam-for-linux#8020 first, or document that game developers need to avoid using native Wayland when targeting those runtimes.
Myaats commentedon Oct 28, 2021
I am fully aware about this and I did initially start with scout, but as RetroArch is a project that is largely developed on Linux, it also contains a bunch of Linux specific code, and there are multiple places where the libraries provided by scout was too old and would require removing or replacing code.
There is also the 20+ external projects that would need to get special scout builds and patches too. Compared to soldier which just compiled everything fine and just works.
In the end this was the closest I was able to come to "If Steam runs, RetroArch should run too" without crippling the build.
Feel free to contact me if anything ever changes or there becomes a better/official way to achieve this.