-
Notifications
You must be signed in to change notification settings - Fork 212
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
Game is not visible in SteamOS gamescope session when using Steam Runtime in Flatpak #1341
Comments
When you say "Steam Runtime", do you mean the container runtime that involves In the logs attached to this report, it seems that you're using I don't see any error messages in the logs you attached that would indicate that If you use a ssh session to inspect the process tree while the "game" is running, do you see a If you do, please get its process ID (let's say 12345) and look at I suspect this might be a problem with the logic in Gamescope that aims to only display the main game window (full-screen), and not display anything that is not the main game window. If that logic relies on the Am I correct to think that the truth table goes like this?
If that's the case, then I think the first obvious things to try would be to eliminate
because that will help to narrow down whether this problem is unique to
How is this compiled? What does it contain, and what Flatpak sandboxing parameters does it have? |
Yes, by Steam Runtime, I mean only the contents contained within the steamrt3 image binary release at this endpoint. The application (umu-launcher) does not use the Scout runtime and only uses the runtime contents of SteamLinuxRuntime_sniper.tar.xz, which includes files such as
That's correct.
Yes, I see the Also, the above log was generated after building the Flatpak application on the Steam Deck via
Though, for that tarball I had referenced, I do not know the exact command GloriousEggroll had used to build it nor the system that it was built on. However, you should still run into the same issue.
That's correct. For comparison, here's the Of course, the window still does not display. Now, here's the contents of maps and an SLR log using the native umu-launcher application for Please let me know if I can assist you with any more information or testing, and if there's a possible workaround or solution for this in the Steam Runtime. However, if a workaround within the Runtime is not possible and it's gamescope like you suspected, then do you have an idea what the appropriate logic would be? |
I'm not seeing why you say "of course" here: it was not obvious to me whether this one would display a window or not. Is there a reason why it was obvious to you that it would not work? If this one did not work, but should have worked, then that's really useful information, because it probably means we can eliminate Proton from consideration, and maybe SLR too. That considerably reduces the number of moving parts involved (although there are still a lot). Every time Steam runs a game (whether it's a Steam or non-Steam game), you should see something that looks like this being logged somewhere, except instead of being broken across multiple lines like this, it will be one very long line (this one came from me adding gnome-calculator as a non-Steam game on Ubuntu):
It would be useful if you could match up each of the interesting test scenarios with the command-line that gets logged, starting with Also, for any test scenario that involves umu-launcher running anything, if you can make it log the command-line or argv that it launches (including any I can't immediately see what this test scenario is, in terms similar to what I said in #1341 (comment). It might be one of:
or
or it might be something else? Please clarify? |
I think that this is:
Proton is a mechanism for running Windows executables, so I'm surprised that it succeeds when asked to launch a native Linux executable... but apparently it does, so that's nice? And in this case you say that the
What was the command that was run by Steam (logged starting with |
Sorry, no, I am not a Gamescope developer. |
To get a comparison vs. the scenario discussed in #1341 (comment), it could be useful to try it with a version of umu-launcher that has been hacked so that it does not add any SteamLinuxRuntime_sniper or Proton components to the command-line, but instead just launches your Obviously this would break umu-launcher's ability to run Windows games under Proton, so you would want to roll back to a more normal version immediately (unless you added a check to make this code path be guarded by an environment variable or something): but it would be a useful step to either confirm that SLR and Proton are significant, or find that they are irrelevant. Either way, we will have gained important information. |
I've managed to resolve this. It's not a problem with the runtime so much as it was a problem with the window properties missing the ID that gamescope and steam expect. In combination with the layer order going out of whack when focus is lost. When a non-steam application is launched in steam, steam assigns it a specific value for its window property. For example we'll say 12345. It also does this same process for steam games, but for steam games it assigns a window property STEAM_GAME=12345. It then informs gamescope of this ID, and gamescope stores it in a few variables. This means a main application would get assigned window property 12345 -- but anything launched underneath in flatpak for some reason would not, thus whatever was launched from say lutris flatpak would never be brought into focus. The variable in gamescope that controls the layer ordering is GAMESCOPECTRL_BASELAYER_APPID, and the layer order should typically be "number, 12345, number, 769" with 12345 being our app and 769 being steam. When focus is lost, the order changes to "number, number, 769, 12345" So the first step is to correct the layer order. The second step is to make sure the game window gets assigned STEAM_GAME=12345 window property. Additionally, there are two displays, :0 is the main steam window and :1 is where our game window is generated). 1: Get the layer order from display :0 : ex output:
This is the incorrect order when a window is out of focus. To bring it in focus we need to change this order to:
For reference you can launch a steam game and check again to verify this is the correct order used.
In our case the window ID is here:
And this should bring your game in focus with steam overlays working. IMPORTANT NOTE: The ID HAS to be the original one steam assigned. If you use a random ID then gamescope will focus it fine, but steam will not recognize it since steam expects the one it generated and there's no way to tell steam it has changed, and therefore your steam overlays will not work because they will be underneath the game window. It should also be noted that if games have their own configuration tool that launches before the game, sometimes this can re-set the invalid layer order. I had to add a monitor thread to umu to check periodically if the order is incorrect and to re-correct it. I also added another check to find if the display :1 window id list has changed and if so to re-apply the STEAM_GAME id. An example of this would be the configuration tool for Akiba's Trip which launches before the game itself. |
This seems to be it indeed #1341 (comment). Looks like a hassle though to do this for each game. This needs automation or a fix imo, especially if that value could change with patches or restarts (not sure how it's generated). |
we've automated it in umu, so flatpaks like lutris and heroic can use it without further action needed. right now the main kicker is it needs xwininfo and xprop to do so. I tried using python-xlib but it was problematic when fetching window IDs. (anyway that's off topic for this issue) -edit- I managed to get this working using python-xlib alone, which is much faster than relying on subprocess command calls. |
It might be clearer what is going on if someone with suitable permissions retitles this bug from "Game will not launch" to "Game window not visible" - as far as I can see, it's launching and executing code fine, but the problem is all about whether Gamescope brings it to the foreground or not. |
Anything for people test? If binaries and instuctions on how to get the proper logs are provided I could test with wow (lutris steam library link and started game ui). Right now I am suckt on 8-26 and would happily try out a potential fix |
Your system information
Please describe your issue in as much detail as possible:
Game launchers like Heroic and Lutris distribute their applications to the Steam Deck as a Flatpak, and users add those launchers as a non-Steam game to utilize the SteamOS gamecope session features before running their games. However, when running games in Flatpak that uses its own bundle of the Steam Runtime within the SteamOS gamescope session, the game window will not be displayed and the client will just hang with the Steam logo spinner spinning indefinitely. On the other hand, when running the game in Desktop Mode, the game window will be displayed as expected. The same applies when distributing the game launcher as a native application instead as a Flatpak, where the window will be displayed in both sessions. Currently, this is a big issue for users of those launchers, causing them to revert to Wine instead of Proton to run their games.
SLR log when running the application (Flatpak) in the SteamOS gamescope session:
https://gist.github.com/R1kaB3rN/f27ec679c4ed6d1250c979a4ea33e84f
SLR log when running the application (native) in the SteamOS gamescope session:
https://gist.github.com/R1kaB3rN/abe95b52d11eef25269cc21e1175db64
Steps for reproducing this issue:
tar -xaf umu-flatpak-test.tar.gz
flatpak --user remote-add --no-gpg-verify umu-repo umu-repo
flatpak --user install umu-repo org.openwinecomponents.umu.umu-launcher
The text was updated successfully, but these errors were encountered: