Open a73s opened 1 year ago
This is an issue with Flatpak itself, not this extension; it would be better to make an issue with Flatpak.
per @doraskayo, https://github.com/flathub/com.valvesoftware.Steam.Utility.gamescope/issues/7#issuecomment-1277991549
gamescope launches its own Xwayland instance(s) inside the sandbox and expects games to use them as their X server. However, when the Flatpak portal is used internally by Proton's pressure-vessel to launch a Flatpak subsandbox for a game, Flatpak only exposes the host's X11 socket to the subsandbox, and not the X11 socket created by gamescope's Xwayland instance in the main sandbox. This is why the game window opens as a separate window in the desktop and not inside the gamescope window, and why we effectively lose the "gamescope functionality" as mentioned in this thread with official Proton versions.
The unofficial Proton versions provided in Flathub do not package or use pressure-vessel. In this case there's no subsandbox involved and games have access to gamescope's X11 socket because they run in the same sandbox. This is why using unofficial Proton versions "works around" the issue.
Some directories are already shared between Steam and the subsandbox, so there are multiple places where gamescope could create a socket that the subsandbox will be able to see (/tmp and $XDG_RUNTIME_DIR among others), but doing this for /tmp/.X11-unix is complicated by various things:
- Flatpak has to special-case the X11 sockets so that they can be inherited from the host (when permissions allow it, which they have to for Steam)
- Flatpak unconditionally puts a tmpfs on /tmp/.X11-unix to protect unrelated X11 sockets
- I think the way the subsandbox is launched means that the DISPLAY environment variable normally gets inherited from the host, not copied across IPC from the first Steam sandbox
If gamescope could somehow be taught to create its socket in $XDG_RUNTIME_DIR, and just put a symlink to it in /tmp/.X11-unix, then the process that's launched in the subsandbox could be a wrapper that creates a similar symlink in the subsandbox's /tmp/.X11-unix and then execs the actual game? (But the wrapper would have to be either a shell script, a python3 script or a statically-linked binary, because it will be run in a library stack that is not the Flatpak runtime.)
It could be possible for Gamescope to do this workaround, but I'll need to ask a developer about it first.
Gamescope has no impact on where the XWayland socket is created fwiu, that's down to the X11 server that's spawned.
I don't think there's a way to move it from /tmp?
Ah, yeah, apparently it's hardcoded in the various X11 libraries.... so either this is fixed in Flatpak, or X11/its libraries gets some changes so that it works how we want. The latter should probably work, since that's hopefully where everyone handles it.
So how to actually make this work with Steam? I have installed com.valvesoftware.Steam.CompatibilityTool.Proton-GE selected it for my game, but nothing happens (ie game just closes) when trying to launch it using:
gamescope -W 3440 -H 1440 -f -- %command%
So how to actually make this work with Steam? I have installed com.valvesoftware.Steam.CompatibilityTool.Proton-GE selected it for my game, but nothing happens (ie game just closes) when trying to launch it using:
gamescope -W 3440 -H 1440 -f -- %command%
In the console it just says the gamescope
command isn't found even though the gamescope
Flatpak is installed.
I think this part of the README might be relevant:
Here, we include a script that automatically adds the appropriate paths, so all you need to do is add
/usr/lib/extensions/vulkan/gamescope/bin
to your Flatpak'sPATH
variable (--env=PATH=$PATH:/usr/lib/extensions/vulkan/gamescope/bin
).
I tried this, and it still didn't work though. The game launches and everything, but it just seems to ignore my launch argument.
I can't get either this or the older Gamescope package to work.
I think this part of the README might be relevant:
Here, we include a script that automatically adds the appropriate paths, so all you need to do is add
/usr/lib/extensions/vulkan/gamescope/bin
to your Flatpak'sPATH
variable (--env=PATH=$PATH:/usr/lib/extensions/vulkan/gamescope/bin
).
I've added this to the Steam Flatpak path. It adds to the PATH correctly, but the gamescope directory seems to be missing even with this package installed:
flatpak run --command=/bin/sh com.valvesoftware.Steam
[📦 com.valvesoftware.Steam ~]$ echo $PATH /app/bin:/app/utils/bin:/usr/bin:/usr/lib/extensions/vulkan/gamescope/bin [📦 com.valvesoftware.Steam ~]$ ls /usr/lib/extensions/vulkan/ -al total 8 drwxr-xr-x. 2 nfsnobody nfsnobody 4096 Jan 1 1970 . drwxr-xr-x. 4 nfsnobody nfsnobody 4096 Jan 1 1970 ..
You don't need to edit the flatpak version of steams PATH
.
You need the version of the flatpak gamescope package that matches the freedesktop platform steam is currently built against. (currently 23.08
, but also install 24.08
).
In order to run it with a game under proton you need the flatpak proton version. Currently proton-ge is the only version getting updates so download it and set your game to use it.
Good luck
Thanks for your help. Apologies for my mistake. I only had 24.08 installed; installing 23.08 did the trick. Using Proton-GE, as you said, seems to let Gamescope launch successfully. Thanks!
I noticed that Gamescope still doesn't show up in echo $PATH
or command -v gamescope
inside the Flatpak, but somehow it does still work anyway when set in the launch args. Interesting. Thanks again.
I can confirm that installing com.valvesoftware.Steam.CompatibilityTool.Proton-GE
and switching the game to it (right click > Properties > Compatibility > Check "Force the use of a specific Steam Play compatibility tool" > Select "GE-Proton9-14 (Flatpak)") allowed Gamescope to do its job and create a working HDR environment for the game. Thanks!
ID: com.valvesoftware.Steam.CompatibilityTool.Proton-GE
Ref: runtime/com.valvesoftware.Steam.CompatibilityTool.Proton-GE/x86_64/stable
Arch: x86_64
Branch: stable
Version: 9.14
License: BSD-3-Clause and LGPL-2.1 and zlib-acknowledgement and Zlib and OFL-1.1 and MIT and MPL-2.0 and LicenseRef-proprietary
Origin: flathub
Collection: org.flathub.Stable
Installation: system
Installed: 1,3 GB
Commit: fa31066758b80c16dbeee4945118ed1a09e1e830ed2fdc25592baf10cac72006
Parent: 1b2be4dc01514edc6a14c8b6efd62fd13f247d09660842569e4203143c05da37
Subject: Update Proton-GE to 9.14 (e04007c7)
Date: 2024-09-24 16:52:46 +0000
This issue appears to have duplicates:
Just throwing it out there, the issue is mostly with XWayland. With the changes (when it arrives) for Wine/Proton to use Wayland instead of XWayland, would that basically skip over the current issue?
Probably good idea to have XWayland setup for backwards supports for ole' proton versions.
Can confirm it's working for com.valvesoftware.Steam.CompatibilityTool.Proton-GE
and org.freedesktop.Platform.VulkanLayer.gamescope/x86_64/23.08
Migrated from https://github.com/flathub/com.valvesoftware.Steam.Utility.gamescope/issues/7
This is still an issue with my testing.