flathub / com.valvesoftware.Steam.Utility.gamescope

https://flathub.org/apps/details/com.valvesoftware.Steam.Utility.gamescope
20 stars 5 forks source link

Create generic gamescope extension? #4

Open vchernin opened 2 years ago

vchernin commented 2 years ago

I've been able to get this working with Minecraft. The only necessary modification to the extension was to adjust the ID and branch.

Is this a good reason to create a generic gamescope extension Steam, Minecraft, and potentially others can use? I'd be happy to help maintain it.

Is org.freedesktop.Runtime.Utility.gamescope a good name?

CyborgDragonFire commented 2 years ago

This gamescope package is at version (3.9.2) and is currently unmaintained. Meaning that it is several versions behind the current stable upstream release (3.9.5)

So at this point, anyone willing to step up and maintain this package is more important than anything else.

However, I support your effort to move this package to a wider scope. I recommend looking at the flatpak versions of MangoHUD & vkBasalt for guidance, If you are planing stepping up to be the lead maintainer for this package.

org.freedesktop.Platform.VulkanLayer.MangoHud org.freedesktop.Platform.VulkanLayer.vkBasalt

You could also ask @gasinvein for help, as he's one of the big people behind getting those two working well with flatpak Steam.

gasinvein commented 2 years ago

To make it a generic runtime extension, the runtime will first need an extension point to attach it. But I doubt that freedesktop-sdk folks will be happy to add it, since it is too generic and pushes Flatpak to be a package manager, what it usually tries to avoid.

However, you probably can reuse the com.valvesoftware.Steam.Utilityextensions as is for other apps by copying the extension point declaration to other apps manifest. It should work as long as the app and the utility are built on the same runtime, and the utility doesn't have dependencies in the Steam app bundle.

vchernin commented 2 years ago

It should work as long as the app and the utility are built on the same runtime, and the utility doesn't have dependencies in the Steam app bundle.

I learned this the hard way before properly reading your message. Yes this utility works as is, provided the runtime is changed to com.mojang.Minecraft (and the branch set to master for testing).

So there will be a seperate utility for Steam and Minecraft then. I'll submit a new Minecraft utility to Flathub.

I decided to use com.mojang.Minecraft.Utility as the extension point anyway, since if Steam extensions won't work since they use the Steam runtime, there is no point declaring the Steam extension point for Minecraft.

But I doubt that freedesktop-sdk folks will be happy to add it, since it is too generic and pushes Flatpak to be a package manager, what it usually tries to avoid.

At least in this case I don't see why Flatpak should avoid being a package manager, but that sounds like another discussion.

Also, I'll update this repo later since it uses older gamescope.

gasinvein commented 2 years ago

It should work as long as the app and the utility are built on the same runtime, and the utility doesn't have dependencies in the Steam app bundle.

I learned this the hard way before properly reading your message. Yes this utility works as is, provided the runtime is changed to com.mojang.Minecraft (and the branch set to master for testing).

So there will be a seperate utility for Steam and Minecraft then. I'll submit a new Minecraft utility to Flathub.

No, I mean, the utility should work if Steam and Minecraft are both built against the same freedesktop-sdk branch, and gamescope doesn't have dependencies outside of the SDK (and its own bundle).

vchernin commented 2 years ago

No, I mean, the utility should work if Steam and Minecraft are both built against the same freedesktop-sdk branch, and gamescope doesn't have dependencies outside of the SDK (and its own bundle).

Both of them use 21.08 org.freedesktop.Platform for runtime, and org.freedesktop.Sdk for SDK.

and gamescope doesn't have dependencies outside of the SDK (and its own bundle).

It seems to only use SDK and bundle dependencies from what I can tell.

So in theory this extension as-is, could work for Minecraft and Steam?

So then I think I am running into a fixable problem when trying to use this repo as is with Minecraft.

When using steam gamescope as is within minecraft complains about: Xwayland: error while loading shared libraries: libbsd.so.0: cannot open shared object file: No such file or directory

This goes away if I build gamescope with the com.mojang.Minecraft runtime. Minecraft doesn't build libbsd or anything (but Steam does).

Poking in the sandbox:

works (extension built with minecraft runtime):

[📦 com.mojang.Minecraft app]$ grep -rFni "libbsd" /app/*

gives above error (extension built with steam runtime):

[📦 com.mojang.Minecraft devel]$ grep -rFni "libbsd" /app/*
grep: /app/utils/gamescope/bin/Xwayland: binary file matches
grep: /app/utils/gamescope/lib/libXfont2.so.2.0.0: binary file matches

I am unsure what is going on here. Why is it libbsd is "present" in the Xwayland binaries for steam, and that's bad?

Edit: I think Steam building libbsd, along with Xwayland in the runtime is confusing gamescope. Gamescope in Minecraft needs to use Xwayland as built in the extension itself.

In the end simple bundling did the trick, this repo works as-is with minecraft.

gasinvein commented 2 years ago

I guess libbsd should be bundled within gamescope, then, maybe even linked statically, to ensure it doesn't depend on Steam app bundle.

CyborgDragonFire commented 2 years ago

Thank you for updating this package!!

Just to note, you forgot to update the com.valvesoftware.Steam.Utility.gamescope.metainfo.xml file. The version displayed in terminal is still 3.9.2

I've created a quick pull request with the fix.

vchernin commented 2 years ago

I guess libbsd should be bundled within gamescope, then, maybe even linked statically, to ensure it doesn't depend on Steam app bundle.

https://github.com/flathub/com.valvesoftware.Steam.Utility.gamescope/pull/6 seems to work fine for me.

vchernin commented 2 years ago

@gasinvein I was going to make a PR to add a bunch of x-checker-data here, but then I realized Steam itself doesn't have x-checker-data for many modules. Is there a reason for that, does this need to use specific versions, or is it just a matter of someone adding it?

gasinvein commented 2 years ago

@vchernin It's a matter of someone doing that, but it should be done carefully, since Steam flatpak has a lot of game dependency modules and just blindly updating them all will likely result in increasing maintenance work instead of reducing it.

xinyazhang commented 2 years ago

org.freedesktop.Platform might be a good place for this utility application, consider the existence of org.freedesktop.Platform.openh264

d-513 commented 2 years ago

To make it a generic runtime extension, the runtime will first need an extension point to attach it. But I doubt that freedesktop-sdk folks will be happy to add it, since it is too generic and pushes Flatpak to be a package manager, what it usually tries to avoid.

However, you probably can reuse the com.valvesoftware.Steam.Utilityextensions as is for other apps by copying the extension point declaration to other apps manifest. It should work as long as the app and the utility are built on the same runtime, and the utility doesn't have dependencies in the Steam app bundle.

I don’t get it. Why should we have a separate extension for each game launcher? Considering flathub has the official Minecraft launcher, PolyMC, and probably others, aswell as other game launchers

Flatpak doesn’t want to be a package manager, but that’s the only way to get gamescope into all launchers. What’s wrong with that?

gasinvein commented 2 years ago

Why should we have a separate extension for each game launcher?

I've said the exact opposite. Reusing the Steam's extension means there is only one extension used by multiple apps.

d-513 commented 2 years ago

Misunderstood then. I still think it should be renamed to org.freedesktop to avoid confusion. Packagers can add-extension it themselves

orowith2os commented 1 year ago

Done, see https://github.com/flathub/com.valvesoftware.Steam.Utility.gamescope