ValveSoftware / gamescope

SteamOS session compositing window manager
Other
3k stars 198 forks source link

3.14.3 refresh on Apr 9 crashes/freezes flathub apps on Steam Deck #1239

Open hys17 opened 5 months ago

hys17 commented 5 months ago

Hello,

Ever since the refresh version of 3.14.3 (released on Apr 9 I believe) that I've updated in the Discovery store, pretty much all the flathub apps would either crash or freeze a few seconds after opening. For example,

Chiaki4deck would crash as soon as the spinning logo (the one that plays right after you click "Play") finishes.

Shortcuts created by Heroic would crash as soon as the spinning logo (the one that plays right after you click "Play") finishes.

Shortcuts created by Lutris would freeze a few seconds after the spinning logo disappears.

Tried re-installing Gamescope via Terminal but no change. Tried the earlier version (22.08) via Terminal but Lutris or Heroic wouldn't recognize this version for some reason so I'd lose the HDR support on my Steam Deck OLED. Same with the version on Discovery store which is also 3.14.2.

It's been working solidly before this version so not sure if I'm missing anything? Or is there anyway I could install the earlier version of 3.14.3 (23.08)?

Thanks so much!

Alvsar commented 5 months ago

Good morning, I have exactly the same issue. I had to uninstall gamescope flatpak to make several shortcuts created with Lutris or Dolphin to work, if not they crash. In some of those shortcuts failed with Assertion Failed ‘winevulkan/loader.c’ , others just crash. Please fix. Thanks

Joshua-Ashton commented 5 months ago

This is because the Gamescope Layer in the Flatpak does not match the version on the outside. These two things are meant to go together as they are tightly coupled.

I do not have a good way of fixing this for older versions I think :/

Joshua-Ashton commented 5 months ago

I could backport a fix to an older tag that should at least prevent stuff from crashing I guess. Do we know who maintains the flatpak that adds the Gamescope layer?

Alvsar commented 5 months ago

Sorry, but i don’t have that information. I am quite new to Linux world (just after buying Steam Deck OLED) and I only wanted to report the same error

rakonkido commented 5 months ago

I can confirm that this breaks many, many games that run through Flatpak applications on Steam Deck (including through Lutris, Heroic, RetroArch, Dolphin, and others). These Flatpaks all have whitelisted access to the gamescope-0 socket, so any game that tries to use it (e.g. for HDR support) will immediately crash in Steam Deck OLED's Game Mode.

After uninstalling the Gamescope Flatpak, these games launch, but then I lose HDR support.

So is it accurate to say that the Gamescope Flatpak needs to stay pinned to the built-in/system version of Gamescope on Steam Deck? Looks like @ColinKinloch and @orowith2os are previous contributors to the Gamescope Flatpak and that the version upgrade was done automatically based on the upstream version bump.

rakonkido commented 5 months ago

The current system version of Gamescope on SteamOS is 3.13.16.8-1 (as reported by pacman -Ss gamescope).

As a temporary workaround, I got my non-Steam games and HDR working again by downgrading the Gamescope Flatpak to an earlier version. There wasn't an exact commit for 3.13.16 that I found, so I used the known-working commit prior to 3.14.3:

sudo flatpak update --commit=871e619e26646af747705ad1d04f4dbd4b7809b1e45d19ef41dea1a5bf9ba6ba org.freedesktop.Platform.VulkanLayer.gamescope
ColinKinloch commented 5 months ago

Hello. The flathub repo gets PRs automatically whenever there's a new tag on this repo. I test the PRs on mutter and take a quick look at the commits before hitting the merge button. Is there something else I should be doing?

rakonkido commented 5 months ago

I think this issue is mostly only relevant to setups where there's a possibility of conflict between system Gamescope and Flatpak Gamescope -- that is, SteamOS and related immutable distros where you would use Flatpak for installing non-Steam software. Thus, this was bound to happen sooner or later since Gamescope Flatpak follows the development version of Gamescope which is always a bit further ahead of SteamOS Stable system Gamescope package.

So I believe what we need is a way for Steam Deck users to install a special branch of Gamescope Flatpak that stays pinned to the current SteamOS Stable system version of Gamescope.

Note that, as far as I know, the main use case for Gamescope Flatpak on SteamOS is simply to get HDR working in non-Steam games in Game Mode.

Alvsar commented 5 months ago

I tried to use the following instruction provided earlier but it didnt work for me: sudo flatpak update --commit=871e619e26646af747705ad1d04f4dbd4b7809b1e45d19ef41dea1a5bf9ba6ba org.freedesktop.Platform.VulkanLayer.gamescope The error i got is: error: org.freedesktop.Platform.VulkanLayer.gamescope not installed

ColinKinloch commented 5 months ago

One option might be to use --filesystem=host-os:ro to use the compositors gamescope version. That would be a per app permission, not a particularly convenient solution.

Maybe a separate gamescope extension for steam deck. Or a separate build in the one package? Still a bit of a pain.

It depends how savvy we expect the user to be.

How frequently and for how long is this likely to be a problem? How long is the lag in the SteamOS releases?

ColinKinloch commented 5 months ago

@Alvsar it needs to be installed to downgrade

Alvsar commented 5 months ago

But i have it installed: image

ColinKinloch commented 5 months ago

Oh, I see. Its a user install. Add --user after update and remove the sudo.

Alvsar commented 5 months ago

(1)(deck@steamdeck ~)$ flatpak update --user --commit=871e619e26646af747705ad1d04f4dbd4b7809b1e45d19ef41dea1a5bf9ba6ba org.freedesktop.Platform.VulkanLayer.gamescope Looking for updates… error: Commit has no requested ref ‘runtime/org.freedesktop.Platform.VulkanLayer.gamescope/x86_64/22.08’ in ref binding metadata

ColinKinloch commented 5 months ago

The 22.08 version shouldn't have this issue. You want to downgrad 23.08. Add //23.08 after .gamescope

Alvsar commented 5 months ago

Thanks @ColinKinloch and @rakonkido for your comments. I was able to install 23.08 and downgrade to the version where HDR works for Lutris shortcuts and Dolphin.

rakonkido commented 5 months ago

One option might be to use --filesystem=host-os:ro to use the compositors gamescope version.

Adding host-os to the filesystem overrides and /var/run/host/usr/bin to the Flatpak PATH does grant Heroic access to the system-level Gamescope executable. This needs more testing and there are probably more overrides needed for Steam Deck OLED HDR mode.

However, there are complications: what if a user also has the Gamescope Flatpak installed? Setting up the Flatpak applications to ensure they prefer the system Gamescope's shared library and executable (if available) would mean that if you have both system Gamescope and Flatpak Gamescope installed, system Gamescope will always get selected even when you intended to use Flatpak Gamescope. This could easily happen on a desktop Linux distro if you install Lutris via package manager and Heroic+Gamescope via Flatpak. Not a big deal I guess -- it shouldn't lead to crashing, but it's unexpected behavior and a bit messy.

That would be a per app permission, not a particularly convenient solution.

PRs can be made to those Flatpak manifests make this easier for users. That's what I did for giving them access to xdg-run/gamescope-0. But I'm not sure this will get approved, since in addition to the messiness of the above approach, there may be other security and isolation implications to granting host-os access and editing the PATH to include the host's /usr/bin.

Joshua-Ashton commented 5 months ago

The problem here is nothing to do with that -- it's because the version of the layer and the runtime basically need to be the same because they use their own IPC that is versioned.

It's crashing right now because of an oversight in the layer where it assumes the gamescope swapchain interface is available if the socket is. I need to fix that, and potentially backport to the version in latest SteamOS.

Still, it's a problem as then HDR would not work for things in Flatpak. I do not really have a good solution to this other than somehow trying to use the same layer version as the host gamescope in Flatpak, or potentially us committing to some stable versioning there (which I am a bit against)

hys17 commented 5 months ago

Can confirm it worked with the downgrade. Thank @ColinKinloch and @rakonkido so much for your help and it’s a very good workaround!

hys17 commented 5 months ago

Should I close this issue now or wait for a more permanent solution?

sad-goldfish commented 5 months ago

I just ran into this on Gentoo. I had 3.14.2 installed using the package manager and wanted to try 3.14.3 (not in the distro repos yet). My current workaround is just to bind mount the new libraries over the system ones like this:

sudo mount --bind ./build/layer/libVkLayer_FROG_gamescope_wsi_x86_64.so /usr/lib64/libVkLayer_FROG_gamescope_wsi_x86_64.so
sudo mount --bind ./build/layer/VkLayer_FROG_gamescope_wsi.x86_64.json /usr/share/vulkan/implicit_layer.d/VkLayer_FROG_gamescope_wsi.x86_64.json

Something similar might be possible with the flatpak version.

rakonkido commented 5 months ago

there may be other security and isolation implications to granting host-os access and editing the PATH to include the host's /usr/bin.

Tested, this does not work. Although we can grant a Flatpak application access to the host-level Gamescope executable, this does not allow HDR to work. I guess for HDR it needs access to the host's shared libraries (so it can access the Gamescope WSI layer library)? But this breaks Flatpak applications since they'll see the wrong glibc and crash immediately.

So if I'm understanding everything right, Gamescope itself needs a fix to prevent the crash that happens due to version conflict, but to actually get HDR working in Game Mode for Flatpak games we also need a fix in Flatpak Gamescope that somehow ensures the versions are the same between host and Flatpak.

Maybe the latest Gamescope versions can go into the flathub-beta repository, while the main flathub repository can stay pinned to whatever version is current in SteamOS Stable? That way, it stays easy for Steam Deck users to install Gamescope via Discover, while desktop Linux users can add the flathub-beta remote if they want the newest Gamescope.

rakonkido commented 5 months ago

My current workaround is just to bind mount the new libraries over the system ones like this

Probably wouldn't work on Steam Deck, since the system Gamescope is always running in Game Mode

orowith2os commented 5 months ago

The "proper" solution for now, until some form of HDR stability is reached, is most likely just downgrading the Flatpak gamescope so that things work. Anything involving using the host gamescope binaries will end up breaking. Ideally we would have a normal (stable) HDR protocol everyone uses, but we don't, so we end up in this situation.

On Mon, Apr 15, 2024 at 10:52 PM rakonkido @.***> wrote:

My current workaround is just to bind mount the new libraries over the system ones like this

Probably wouldn't work on Steam Deck, since the system Gamescope is always running in Game Mode

— Reply to this email directly, view it on GitHub https://github.com/ValveSoftware/gamescope/issues/1239#issuecomment-2058179569, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWHH7LZRUFOKGJXTWMOBZNLY5SN65AVCNFSM6AAAAABGEFCAOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJYGE3TSNJWHE . You are receiving this because you were mentioned.Message ID: @.***>

hys17 commented 4 months ago

Sorry to bump up on this. Just today the same downgrade command doesn’t work anymore that it gives an error: Error: While pulling runtime/……/23.08 from remote flathub: Server returned HTTP 404 Updates complete.

Could someone take a look at?

Thanks.

ColinKinloch commented 4 months ago

Sounds like it's been deleted, I assume only a few previous versions are kept around.

You could build it using flatpak-builder to build the correct version of the manifest then use flatpak mask to make sure it doesn't get auto updated. Assuming the version you want is 3.14.2 it should be this commit: https://github.com/flathub/org.freedesktop.Platform.VulkanLayer.gamescope/commit/2a8ab98c2881d5a1262712093d051434a1a7d6f4

hys17 commented 4 months ago

Sounds like it's been deleted, I assume only a few previous versions are kept around.

You could build it using flatpak-builder to build the correct version of the manifest then use flatpak mask to make sure it doesn't get auto updated. Assuming the version you want is 3.14.2 it should be this commit: flathub/org.freedesktop.Platform.VulkanLayer.gamescope@2a8ab98

Ah ok thanks for this. Is there some kind of tutorial of how to do this step by step? Sorry I’m really a noob when it comes to this…

ColinKinloch commented 4 months ago

Clone the repo:

git clone https://github.com/flathub/org.freedesktop.Platform.VulkanLayer.gamescope.git

Checkout the correct version:

git checkout 2a8ab98c2881d5a1262712093d051434a1a7d6f4

Install the flatpak-builder flatpak:

flatpak install org.flatpak.Builder

Build and install gamescope:

flatpak run org.flatpak.Builder --user --jobs=4 --install ./_build ./org.freedesktop.Platform.VulkanLayer.gamescope.yml

Stop updates on the org.freedesktop.Platform.VulkanLayer.gamescope package:

flatpak mask --user org.freedesktop.Platform.VulkanLayer.gamescope

Thanks, and have fun.

hys17 commented 4 months ago

Replying to https://github.com/ValveSoftware/gamescope/issues/1239#issuecomment-2114711196

Thanks so much for this! Following this guide, though some error occurred at step 2:

git checkout 2a8ab98c2881d5a1262712093d051434a1a7d6f4 fatal: not a git repository (or any parent up to mount point /) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

If I continue, error happened again at step 4:

flatpak run org.flatpak.Builder --user --jobs=4 --install ./_build ./org.freedesktop.Platform.VulkanLayer.gamescope.yml

F: Not sharing "/esp" with sandbox: Ignoring blocking autofs path "/esp" Can't load './org.freedesktop.Platform.VulkanLayer.gamescope.yml': Failed to open file “/home/deck/org.freedesktop.Platform.VulkanLayer.gamescope.yml”: No such file or directory

Am I missing something? Appreciated your help :)

CarlosVR2 commented 4 months ago

Hello @hys17,

I had exactly the same problem trying to downgrade to the flatpak version 3.14.2 of Gamescope. I followed the excellent instructions of @ColinKinloch and after installation it worked just fine for non-Steam games, including one that supports HDR.

The procedure just needs a "step 1.5": after you use the git clone command, go into the newly created folder with the command

cd org.freedesktop.Platform.VulkanLayer.gamescope

and then execute the git checkout command and the other steps.

Be aware the build and install take a few minutes and it will show a lot of scrolling text while it's running.

Hope this helps!

hys17 commented 4 months ago

Replying to https://github.com/ValveSoftware/gamescope/issues/1239#issuecomment-2116007853

OMG this worked perfectly! Thanks sooooooo much, and also @ColinKinloch!

rakonkido commented 4 months ago

This time let's keep the issue open until the maintainers decide to close it. I'm not sure if the underlying issue with Gamescope crashing has been solved.

The potential issues caused by Gamescope Flatpak getting out of sync with system Gamescope is separately tracked here: https://github.com/flathub/org.freedesktop.Platform.VulkanLayer.gamescope/issues/177

Shanayara commented 3 months ago

This problem has existed for over a month, now effectively requiring users now to build gamescope themselves, which is an advanced solution many users will be intimidated by.

A month ago @rakonkido made the great proposition to only have the properly working version in the flatpak repo, and moving the newer version to flatpak-beta. I see zero downsides to this change: whoever wants to use a never version can do so, but realistically this is maybe 5% of the userbase of the flatpak repo - most will be end users who just wanna be able to use e.g. Chiaki4deck, and don't benefit from any newer version, it just makes all their apps crash.

So please, could you implement this change, whoever has the power to do so? Until this bug is properly fixed at least.

ColinKinloch commented 3 months ago

The main issue I have is how to track which old version is correct? Maybe a git tag could do this? Or marking some releases as stable and some as pre-release?

xenrohachi commented 3 months ago

I've followed the directions given by @ColinKinloch multiple times. Uninstalled all Gamescope version entirely and retried. Deleted the cloned git folder and tried again. I keep unfortunately coming to the same outcome where all the games are failing to launch similar to downloading directly. Is anyone else having this issue? Seems like it's working for others. I'm on the preview branch if it makes any difference.

CarlosVR2 commented 3 months ago

Hello @xenrohachi , are you using the SteamOS preview version 3.5.19, or version 3.6.x?

If you're using 3.5.19, make sure you have Gamescope 3.14.2 installed, using the command flatpak list.

xenrohachi commented 3 months ago

Hi @CarlosVR2 , thank you for your response. I'm currently on 3.6.3 according to my system info. I currently dont have a flatpak version installed due to 22.08 not being recognized by Heroic/Lutris and 23.08 crashing the games on launch. Building it myself doesnt seem to resolve the issue with crashing as well. Not sure if im missing something or maybe these solutions arent intended for 3.6.3

rakonkido commented 3 months ago

SteamOS Preview is probably on a newer version of Gamescope so the Flatpak would need to be built with a different git commit targeting the version that matches the system Gamescope

Alvsar commented 1 month ago

I have been using this solution last months and it was working fine, but after an update in the Steam Client last 16th of July I am getting the original error where the games with Lutris and HDR don’t start anymore.

I reapplied the solution and no success. I see the Steam Client is still the one mentioned by CarlosVR2 (3.5.19).

Is the issue happening to others? What is the version I should use now? And if someone can tell me which instruction needs to be modified exactly it would be really appreciated.

Thanks

ColinKinloch commented 1 month ago

It looks like the steam deck still uses gamescope 3.13.16 so compiling a different version is probably not the fix.

CarlosVR2 commented 1 month ago

Hi @Alvsar! I updated the Steam client on my Steam Deck to the July 16 version, and non-Steam games still work in Game Mode, including Epic Games Store titles in HDR.

The software versions in my system are:

SteamOS: 3.5.19 (Preview) Steam client: July 16, 2024 (Stable) Gamescope: both versions 3.14.24 (Flathub) and 3.14.2 (manually installed).

Maybe you updated to a SteamOS preview version 3.6.x? In that case manually installing Gamescope 3.14.2 won't solve the Gamescope issue.

Alvsar commented 1 month ago

Thanks for your reply.

I saw Dolphin still has HDR, so it is not the issue as before because in those cases Dolphin was also crashing.

I notice the non Steam game that fail were working before but they were in the SSD. Later I moved them to the SD card and a few days later i did this Client update. Those two games start without problems in Desktop but not in Gaming mode.

In the worse scenario i will just add them to Steam instead of using Lutris and try to pass the saves, but I am sure they will work with Steam (i tested with a third one which fails in Gaming mode through Lutris but not in Desktop, DMC 5)

El El mié, 24 jul 2024 a las 16:13, CarlosVR2 @.***> escribió:

Hi @Alvsar https://github.com/Alvsar! I updated the Steam client on my Steam Deck to the July 16 version, and non-Steam games still work in Game Mode, including Epic Games Store titles in HDR.

The software versions in my system are:

SteamOS: 3.5.19 (Preview) Steam client: July 16, 2024 (Stable) Gamescope: both versions 3.14.24 (Flathub) and 3.14.2 (manually installed).

Maybe you updated to a SteamOS preview version 3.6.x? In that case manually installing Gamescope 3.14.2 won't solve the Gamescope issue.

— Reply to this email directly, view it on GitHub https://github.com/ValveSoftware/gamescope/issues/1239#issuecomment-2248085286, or unsubscribe https://github.com/notifications/unsubscribe-auth/APSPZ3ZRWOOBI42R4WIHG63ZN6Y7XAVCNFSM6AAAAABGEFCAOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBYGA4DKMRYGY . You are receiving this because you were mentioned.Message ID: @.***>

ghost commented 1 month ago

Replying to https://github.com/ValveSoftware/gamescope/issues/1239#issuecomment-2114711196

Hello, thank you for writing these steps :) I'm getting a Failed to download sources: module libevdev: SSL: no alternative certificate subject name matches target host name 'freedesktop.org error when trying to build this. I've seen another report on the Dolphin Discord with the same issue so I'm not sure what's going on exactly.

Do you know how to fix this or who I should report this error to?

VladFlorinIlie commented 1 month ago

Replying to https://github.com/ValveSoftware/gamescope/issues/1239#issuecomment-2282218578

You should edit the modules/libedev.yml file from the gamescope source code (that you have just cloned). In that file, add "distributions." before "freedesktop.org" in both urls (so you should have something like https://distributions.freedesktop.org/... )

It seems that they have changed their SSL certificates to only accept that subdomain.

ghost commented 1 month ago

Replying to https://github.com/ValveSoftware/gamescope/issues/1239#issuecomment-2282221049

Worked perfectly, thank you for the quick response!

Slothoncrack commented 1 month ago

Hi, this solution works perfectly fine (tested Cyberpunk GOG HDR on my steam deck oled, steamos 3.5.*)

What would happen if i were to update to 3.6.*, does this break the fix?