NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.41k stars 13.63k forks source link

Packaging Request: GameScope #162562

Closed Krutonium closed 2 years ago

Krutonium commented 2 years ago

Project description This is the Wayland based compositor that Valve is using, that when paired with a running application, can fix minimizing and other such issues, as well as allowing AMD FSR on any application.

Metadata

SuperSamus commented 2 years ago

For those interested, it's available in the NUR: https://github.com/nix-community/nur-combined/blob/master/repos/dukzcry/pkgs/gamescope.nix.

AtilaSaraiva commented 2 years ago

I can take care of porting the NUR derivation to nixpkgs and becoming the official maintainer. Just need a few weeks to understand the codebase a bit before committing to it.

IvarWithoutBones commented 2 years ago

I can take care of porting the NUR derivation to nixpkgs and becoming the official maintainer. Just need a few weeks to understand the codebase a bit before committing to it.

Are you still interested in doing that? Would love to see this in nixpkgs :)

SuperSamus commented 2 years ago

I read on NixOS's discord that https://github.com/Plagman/gamescope/issues/380 is a blocker.

AtilaSaraiva commented 2 years ago

Yeah, that issue kinda upset me. I've been accompanying its progress but not being able to use controller for gamescope games suck. I do intend to free up some time to work on this. The NUR package was very oudated and not so well written at the time I checked it out, so I'd most likely would have to refactor it, which would take some effort.

Atemu commented 2 years ago

@samueldr managed to package it for their project here. They opted to re-build the submodules using the Nix packages' srcs which should be remedied for inclusion into Nixpkgs.

AtilaSaraiva commented 2 years ago

Oh nice, that helps a lot.

samueldr commented 2 years ago

I did it this way as a shortcut.

It would probably be best to have an "updater" script next to the derivation that builds a srcs.nix attrset with the same exact source trees the git submodules point to. Though I haven't seen any weirdness, so I don't think that it would matter currently.

Atemu commented 2 years ago

Of course, yes.

I think it'd be sufficient to make gamescope dependent on the output paths instead of the subproject build result; just like any other dependency.
Should gamescope require special versions of those dependencies in the future, we should be able to easily provide those.

Were you able to make gamescope work from within Steam (as in: /nix/store/blah-gamescope/bin/gamescope %command%)? When I tried that, it was unable to find a free X11 socket for xwayland due to what seems like the bubblewrap container interfering with UIDs?

samueldr commented 2 years ago

I've only used gamescope to run the new steamos interface, so games were in gamescope since steam itself was in gamescope. I haven ot tried any other kind of use.

I tested it nested (within X11) and directly off of KMS.

fufexan commented 2 years ago

I've tried prepending games in steam with gamescope -e --, but as Atemu said, thy don't run, failing with that exact error. So I've tried running the games without steam, by going to their directories and running gamescope -- <game>. That still didn't work (because of binary incompatibility), so I ran gamescope -- steam-run <game>, which actually works outside of steam, but still fails inside.

If anyone knows how to debug this, I'd be happy to help.

maxxnino commented 2 years ago

Add gamescope -e -- %command% in steam launch option.

fufexan commented 2 years ago

Meant to say I also added the e flag but forgot. It was there and still not working.

rapenne-s commented 2 years ago

I tried gamescope in various cases, here are the results:

tested with intel GPU and nvidia dedicated GPU on NixOS unstable

For the intel GPU, sometimes there are corruption in the image, using INTEL_DEBUG=noccs environment variable solve this issue. This is tracked in gamescope repository issues.

felschr commented 2 years ago

I tried to use it in Steam by putting gamescope -e -- %command% into a game's launch options, but it crashes with a segfault (see logs). I'm running an AMD Zen 3 CPU & RDNA2 GPU w/ RADV.

logs ``` Aug 14 14:13:54 home-pc kernel: .gamescope-wrap[117194]: segfault at 70 ip 000000000043c451 sp 00007ffcbedc8c00 error 4 in .gamescope-wrapped[40a000+58000] Aug 14 14:13:54 home-pc kernel: Code: 48 c7 83 a0 00 00 00 00 00 00 00 0f 11 43 10 0f 11 43 68 0f 11 43 78 66 89 44 24 05 c6 44 24 07 01 e8 23 f4 fc ff 48 89 43 08 <48> 8b 78 70 48 8d 73 10 e8 c2 de fc ff 48 8b 44 24 08 64 48 2b 04 Aug 14 14:13:54 home-pc systemd[1]: Started Process Core Dump (PID 117202/UID 0). Aug 14 14:13:54 home-pc systemd-coredump[117203]: [🡕] Process 117194 (.gamescope-wrap) of user 1000 dumped core. Module /nix/store/sxgs416j8z3x9mj97939syyp8cv6064b-openssl-1.1.1q/lib/libcrypto.so.1.1 with build-id 8a831fbeb38ba6ac8d310e51bed2031840039e44 Module /nix/store/sxgs416j8z3x9mj97939syyp8cv6064b-openssl-1.1.1q/lib/libssl.so.1.1 with build-id c48e0b92e05b5d092872fafd275b917adb9efebd Module /home/felschr/.local/share/Steam/ubuntu12_32/steam-runtime/usr/lib/x86_64-linux-gnu/libxml2.so.2.7.8 with build-id 59d7cde3f02a707378ede641b50062889cbc7230 Module /nix/store/i0wwbbvl2mpkjns1r59ndxrphhvfc3dw-libelf-0.8.13/lib/libelf.so.0.8.13 without build-id. Module /nix/store/h3ligmwrcnc2yl744zsjzwnj90m6xdz5-libdrm-2.4.112/lib/libdrm_amdgpu.so.1.0.0 without build-id. Module /nix/store/c5jza96paj5q1g26r7mxqdmm9gdw5hlp-llvm-13.0.1-lib/lib/libLLVM-13.so with build-id 26ea3485bd77c4edc79eb68b1682eede41474235 Module /nix/store/m8fgyi78gghj6nh5ilv3l4cvn6cg126r-libxshmfence-1.3/lib/libxshmfence.so.1.0.0 without build-id. Module /nix/store/zjim3n0dph3zmc6nfbcsldfr3fj4ii19-libxcb-1.14/lib/libxcb-randr.so.0.1.0 without build-id. Module /nix/store/zjim3n0dph3zmc6nfbcsldfr3fj4ii19-libxcb-1.14/lib/libxcb-sync.so.1.0.0 without build-id. Module /nix/store/z18zgvspmxi88ipmk3f3nicvasfq3199-zlib-1.2.12/lib/libz.so.1.2.12 without build-id. Module /home/felschr/.local/share/Steam/ubuntu12_64/steamoverlayvulkanlayer.so with build-id e6b4f2e708967cc6fc8c03575ae7778bb1bf426f Module /home/felschr/.local/share/Steam/ubuntu12_64/libVkLayer_steam_fossilize.so with build-id e93e5d2bb7289523ab92a7258e8e306e9c552641 Module /nix/store/0zs6d6hkmb8z32z2q8f60qv0hx39ql66-dbus-1.14.0-lib/lib/libdbus-1.so.3.32.0 without build-id. Module /nix/store/049dqvsq770v5zgnkqd5mfpjwbl3ng6d-libgcrypt-1.10.1/lib/libgcrypt.so.20.4.1 without build-id. Module /home/felschr/.local/share/Steam/ubuntu12_32/steam-runtime/usr/lib/x86_64-linux-gnu/libgudev-1.0.so.0.1.1 with build-id 8db97454df9972ce6fdd2fe1a4230f3995d7fec0 Module /nix/store/5xf8637nb0gwwr773h71d9iv4bm75lmd-libX11-1.7.2/lib/libX11-xcb.so.1.0.0 without build-id. Module /nix/store/x5v066skgv1gbl8xvrkd5kq230fg2pfi-glib-2.72.3/lib/libglib-2.0.so.0.7200.3 with build-id 0aad93c7b9bd90ba6bd8da73dbad02294c587bb2 Module /home/felschr/.local/share/Steam/ubuntu12_32/steam-runtime/usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0 with build-id 5a6d0a23511264c4a03c0ad8e88beb3f51e899cb Module /nix/store/g93v5klsgqj3wqlmpwf3gm97zmg07wi1-libgpg-error-1.42/lib/libgpg-error.so.0.32.0 without build-id. Module /nix/store/zlmf778kv3whqsizzw9mpjbaz7b5hwbl-libudev0-shim-1/lib/libudev.so.0.0.9999 without build-id. Module /nix/store/1g2bhd3h665y7z9ph01lwsmi7ymiv995-xz-5.2.5/lib/liblzma.so.5.2.5 without build-id. Module /nix/store/x5v066skgv1gbl8xvrkd5kq230fg2pfi-glib-2.72.3/lib/libgobject-2.0.so.0.7200.3 with build-id 66f1dfd19e54143c9d26ff368e12f95fb7f2fcbe Module /nix/store/yzycn28101y9v6disd23r86g1q3n4dsj-systemd-251.3/lib/libsystemd.so.0.34.0 without build-id. Module /nix/store/0xrc4882jv4773yjq39acvg1sxc8x3sd-expat-2.4.8/lib/libexpat.so.1.8.8 without build-id. Module /home/felschr/.local/share/Steam/ubuntu12_32/steam-runtime/usr/lib/x86_64-linux-gnu/libXau.so.6.0.0 with build-id fdb3f2ade4e85c551d0c39a5d963f51a533239b7 Module /nix/store/l677ivx0lpf5wbqr9dk3dk8rxnfqnqyx-libglvnd-1.4.0/lib/libGLdispatch.so.0.0.0 without build-id. Module /nix/store/l677ivx0lpf5wbqr9dk3dk8rxnfqnqyx-libglvnd-1.4.0/lib/libGLX.so.0.0.0 without build-id. Module /nix/store/zjim3n0dph3zmc6nfbcsldfr3fj4ii19-libxcb-1.14/lib/libxcb-res.so.0.0.0 without build-id. Module /nix/store/zjim3n0dph3zmc6nfbcsldfr3fj4ii19-libxcb-1.14/lib/libxcb-composite.so.0.0.0 without build-id. Module /nix/store/cvi2r99z2d4ckdhyx2jrg8yc4csaxhln-wayland-1.21.0/lib/libwayland-client.so.0.21.0 with build-id 6ec660e44c3777f72af1960048940a5a40026b83 Module /nix/store/zjim3n0dph3zmc6nfbcsldfr3fj4ii19-libxcb-1.14/lib/libxcb-xinput.so.0.1.0 without build-id. Module /nix/store/zjim3n0dph3zmc6nfbcsldfr3fj4ii19-libxcb-1.14/lib/libxcb-xfixes.so.0.0.0 without build-id. Module /nix/store/zjim3n0dph3zmc6nfbcsldfr3fj4ii19-libxcb-1.14/lib/libxcb-shm.so.0.0.0 without build-id. Module /nix/store/zjim3n0dph3zmc6nfbcsldfr3fj4ii19-libxcb-1.14/lib/libxcb-render.so.0.0.0 without build-id. Module /nix/store/zjim3n0dph3zmc6nfbcsldfr3fj4ii19-libxcb-1.14/lib/libxcb-present.so.0.0.0 without build-id. Module /nix/store/zjim3n0dph3zmc6nfbcsldfr3fj4ii19-libxcb-1.14/lib/libxcb-dri3.so.0.0.0 without build-id. Module /nix/store/l677ivx0lpf5wbqr9dk3dk8rxnfqnqyx-libglvnd-1.4.0/lib/libGLESv2.so.2.1.0 without build-id. Module /nix/store/l677ivx0lpf5wbqr9dk3dk8rxnfqnqyx-libglvnd-1.4.0/lib/libEGL.so.1.1.0 without build-id. Module /nix/store/65l4r68vgaikqjsxm1a1jwgqf76ryvrn-pixman-0.38.4/lib/libpixman-1.so.0.38.4 with build-id a5992cc8d962098f0f1566f39a64e9c4b579be2b Module /nix/store/yzycn28101y9v6disd23r86g1q3n4dsj-systemd-251.3/lib/libudev.so.1.7.4 without build-id. Module /nix/store/b2ardpnx01rmrrl39f01c5h0nj6pv9wh-mesa-22.1.4/lib/libgbm.so.1.0.0 without build-id. Module /nix/store/1gkfsv7hq3qh6hrd005dm35c9f8vb3cm-libXScrnSaver-1.2.3/lib/libXss.so.1.0.0 without build-id. Module /nix/store/l12q7ljpbkpyfml50v2bf8nlp8q5cmv5-libXrandr-1.5.2/lib/libXrandr.so.2.2.0 without build-id. Module /nix/store/63wnizl0gpn86dphc0lr5qrgqk85rd8n-libXi-1.8/lib/libXi.so.6.1.0 without build-id. Module /nix/store/dn5m02d7pscmnzpwp8a0rp9br10sl1b7-libXinerama-1.1.4/lib/libXinerama.so.1.0.0 without build-id. Module /nix/store/7mlcmhcwhq1x5j0lrx58b2li24wh0lgl-libXcursor-1.2.0/lib/libXcursor.so.1.0.2 without build-id. Module /nix/store/zjim3n0dph3zmc6nfbcsldfr3fj4ii19-libxcb-1.14/lib/libxcb.so.1.1.0 without build-id. Module /nix/store/l677ivx0lpf5wbqr9dk3dk8rxnfqnqyx-libglvnd-1.4.0/lib/libGL.so.1.7.0 without build-id. Module /nix/store/7fz6dhhriwv6n4kdg05qi8cwf7mfqza9-glibc-2.35-163/lib/librt.so.1 with build-id aa557c03cca754037d7989efbbcdb6b48ef5b15a Module /nix/store/7fz6dhhriwv6n4kdg05qi8cwf7mfqza9-glibc-2.35-163/lib/libpthread.so.0 with build-id b59e50cf021fdc872dc49d194c9594fe7ba48906 Module /nix/store/7fz6dhhriwv6n4kdg05qi8cwf7mfqza9-glibc-2.35-163/lib/libdl.so.2 with build-id e24fc32b3f8cf5d7529a7593115ddf69ea879812 Module /nix/store/7fz6dhhriwv6n4kdg05qi8cwf7mfqza9-glibc-2.35-163/lib/libc.so.6 with build-id ea820e0850adf983a2ea0bd0002e33f891cbd95d Module /nix/store/7fz6dhhriwv6n4kdg05qi8cwf7mfqza9-glibc-2.35-163/lib/libgcc_s.so.1 without build-id. Module /nix/store/7fz6dhhriwv6n4kdg05qi8cwf7mfqza9-glibc-2.35-163/lib/libm.so.6 with build-id f158848ecd632c4bedb4dc6389a7d6e889914422 Module /nix/store/k2a429wpxgfwp4jaacl9iaqw4kxqjaxa-gcc-11.3.0-lib/lib/libstdc++.so.6.0.29 without build-id. Module /nix/store/vs9fqz47mgy9pi4d5znz7c8gg962vrs3-pipewire-0.3.56-lib/lib/libpipewire-0.3.so.0.356.0 without build-id. Module /nix/store/rl16p9lmr3sq65w0csmn23jk0w5vqgli-libcap-2.63-lib/lib/libcap.so.2.63 without build-id. Module /nix/store/s3mqnlv1knwrj51yhfxfy2g8bnrpqkqd-libXtst-1.2.3/lib/libXtst.so.6.1.0 without build-id. Module /nix/store/8sm28m48f0s5ciadkd5lldfmclwp3qry-vulkan-loader-1.3.211.0/lib/libvulkan.so.1.3.211 without build-id. Module /nix/store/bp7331523c8x6sl4bdjc8l3l2yxhnqjn-SDL2-2.0.22/lib/libSDL2-2.0.so.0.22.0 without build-id. Module /nix/store/35d0c097rghpi86dn43yv3px2dx4ddvb-libxkbcommon-1.4.1/lib/libxkbcommon.so.0.0.0 without build-id. Module /nix/store/cvi2r99z2d4ckdhyx2jrg8yc4csaxhln-wayland-1.21.0/lib/libwayland-server.so.0.21.0 with build-id 50bc855dd8ec937fbad5592eeccd4ff886de55b4 Module /nix/store/h3ligmwrcnc2yl744zsjzwnj90m6xdz5-libdrm-2.4.112/lib/libdrm.so.2.4.0 without build-id. Module /nix/store/jq1sfakq11mra0hp23ga5yzagz92dhjk-libXxf86vm-1.1.4/lib/libXxf86vm.so.1.0.0 without build-id. Module /nix/store/5r9jxa0mrrhhciq6ppx372rd4qgrzzkj-libXext-1.3.4/lib/libXext.so.6.4.0 without build-id. Module /nix/store/zi7d3ib6aby73pjy5ynlzdd3z45cbz8x-libXrender-0.9.10/lib/libXrender.so.1.3.0 without build-id. Module /nix/store/7a514cn3j0h4k7bip1jv23bfhapyvja0-libXcomposite-0.4.5/lib/libXcomposite.so.1.0.0 without build-id. Module /nix/store/k1n144bxqr8bfbbmzykglw4bxsidr0z7-libXfixes-6.0.0/lib/libXfixes.so.3.1.0 without build-id. Module /nix/store/idj0d2nk9rwdyy7kcwmavbafxyyf420j-libXdamage-1.1.5/lib/libXdamage.so.1.1.0 without build-id. Module /nix/store/5xf8637nb0gwwr773h71d9iv4bm75lmd-libX11-1.7.2/lib/libX11.so.6.4.0 without build-id. Module /home/felschr/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so with build-id 82ee63bc8f1d4d35240f3cd7c8db973cd6d66bc7 Module linux-vdso.so.1 with build-id 00835eda360814a2ee1a8cba259df5c21379fb1a Module libvulkan_radeon.so with build-id be4f43e21455c018549ca84d82579e448afef350 Module libncursesw.so.6 without build-id. Module libvulkan_lvp.so without build-id. Module libvulkan_intel.so with build-id 76f6a08bf0808129d51bac2d22910f64bf9c806a Module amdvlk64.so without build-id. Module libpcre.so.1 without build-id. Module liblz4.so.1 without build-id. Module libzstd.so.1 without build-id. Module libwacom.so.9 without build-id. Module libevdev.so.2 without build-id. Module libmtdev.so.1 without build-id. Module libxcb-errors.so.0 without build-id. Module libxcb-icccm.so.4 without build-id. Module libseat.so.1 without build-id. Module libxcb-render-util.so.0 without build-id. Module libinput.so.10 without build-id. Module libffi.so.8 without build-id. Module ld-linux-x86-64.so.2 with build-id a3d5b12f08868b7c28c4e98ed545a90690dcd7d9 Module libliftoff.so.0 without build-id. Module libwlroots.so.10 without build-id. Module libXRes.so.1 without build-id. Module .gamescope-wrapped without build-id. Stack trace of thread 117194: #0 0x000000000043c451 _ZN27gamescope_xwayland_server_tC1EP10wl_display (.gamescope-wrapped + 0x3c451) #1 0x000000000043c968 _Z13wlserver_initv (.gamescope-wrapped + 0x3c968) #2 0x000000000040d304 main (.gamescope-wrapped + 0xd304) #3 0x00007feab0e6224e __libc_start_call_main (/nix/store/7fz6dhhriwv6n4kdg05qi8cwf7mfqza9-glibc-2.35-163/lib/libc.so.6 + 0x2924e) #4 0x00007feab0e62309 __libc_start_main@@GLIBC_2.34 (/nix/store/7fz6dhhriwv6n4kdg05qi8cwf7mfqza9-glibc-2.35-163/lib/libc.so.6 + 0x29309) #5 0x000000000040e545 _start (.gamescope-wrapped + 0xe545) Stack trace of thread 117199: #0 0x00007feab0ecdf3b malloc_consolidate (/nix/store/7fz6dhhriwv6n4kdg05qi8cwf7mfqza9-glibc-2.35-163/lib/libc.so.6 + 0x94f3b) #1 0x00007feab0ed087c _int_malloc (/nix/store/7fz6dhhriwv6n4kdg05qi8cwf7mfqza9-glibc-2.35-163/lib/libc.so.6 + 0x9787c) #2 0x00007feab0ed1cf7 __libc_malloc (/nix/store/7fz6dhhriwv6n4kdg05qi8cwf7mfqza9-glibc-2.35-163/lib/libc.so.6 + 0x98cf7) #3 0x00007feaa26198d6 radv_compute_pipeline_create (libvulkan_radeon.so + 0xef8d6) #4 0x00007feaa2619a1b radv_CreateComputePipelines (libvulkan_radeon.so + 0xefa1b) #5 0x00007feaae8971f3 n/a (/home/felschr/.local/share/Steam/ubuntu12_64/libVkLayer_steam_fossilize.so + 0x411f3) #6 0x0000000000000000 n/a (n/a + 0x0) ELF object binary architecture: AMD x86-64 ```
Atemu commented 2 years ago

Check the stdout/err log, it's probably the xwayland issue.

AtilaSaraiva commented 2 years ago

I'm able to use the flatpak gamescope with few problems (doens't work well with the vanilla proton, but it works with the recent versions of proton-ge just fine apparently)

nrdxp commented 2 years ago

FWIW, I have to use the patch mentioned here to get it to work on the Intel chip (the Nvidia works fine without it though, in my optimus setup): https://github.com/Plagman/gamescope/issues/508#issuecomment-1201817413

AtilaSaraiva commented 2 years ago

Oh nice!

AtilaSaraiva commented 2 years ago

I tried to run the nixpkgs gamescope to open the 0ad game to test it out, and it failed on swaywm:

~ % gamescope -r 40 -U -f -- 0ad
No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
vulkan: selecting physical device 'AMD RADV POLARIS10': queue family 1
vulkan: physical device does not support DRM format modifiers
vulkan: supported DRM formats for sampling usage:
vulkan:   0x34325241
vulkan:   0x34325258
vulkan:   0x3231564E
wlserver: [backend/headless/backend.c:82] Creating headless backend
wlserver: Running compositor on wayland display 'gamescope-0'
wlserver: [backend/headless/backend.c:18] Starting headless backend
wlserver: [xwayland/server.c:92] Starting Xwayland on :1
wlserver: [xwayland/server.c:247] Xwayland startup failed, not setting up xwm
Atemu commented 2 years ago

It's the xwayland issue as I suspected. I think we should have a separate issue on that.

nrdxp commented 2 years ago

I don't think that's our issue, there is an upstream issue as well as a PR to potentially address it: Plagman/gamescope#571

Atemu commented 2 years ago

When I dug into this a while ago, it was due to it not being able to start its own xwayland session because a directory was owned by nobody rather than root or the current user inside our container IIRC.

IvarWithoutBones commented 2 years ago

When I dug into this a while ago, it was due to it not being able to start its own xwayland session because a directory was owned by nobody rather than root or the current user inside our container IIRC.

I'm hitting a problem when attempting to use the package that sounds similar. It attempts to use the /tmp/.X11-unix socket, which is owned by the currently logged in user.

~ > ls -l /tmp/.X11-unix
total 0
srwxrwxrwx 1 ivv users 0 Aug 16 21:11 X0

Im a bit confused as to why this socket isnt owned by root in the first place, looking at some documentation from Xorgs release notes it seems like that is required:

The socket directories created in /tmp are now required to be owned by root and have their sticky-bit set. If the premissions are not set correctly, the component using this directory will print an error message and fail to start. Common socket directories that are known to be affected include:

/tmp/.font-unix /tmp/.ICE-unix /tmp/.X11-unix

These directories are used by the font server, xfs, applications using the Inter-Client Exchange protocol (ICE) and the X server, respectively.

This issue seems to stem from startx (which I use) from what I can tell. Its nixos module explains that The X server runs under the user's id, not as root, although I havent double checked if the issue occurs with other display managers. @Atemu are you also using startx?

Log:

wlserver: [backend/headless/backend.c:82] Creating headless backend
wlserver: Running compositor on wayland display 'gamescope-0'
wlserver: [backend/headless/backend.c:18] Starting headless backend
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:99] /tmp/.X11-unix not owned by root or us
wlserver: [xwayland/sockets.c:216] No display available in the first 33

Afterwards it exits, so no games launch.

Atemu commented 2 years ago

@IvarWithoutBones I use SDDM in combination with sway or i3.

BillHuang2001 commented 2 years ago

Gdm with gnome wayland here. In my case /tmp/.X11-unix is owned by root, and gamescope just exit with the same error. After I made the current user the owner, gamescope made some progress, and but exit with the follow error:

wlserver: [backend/headless/backend.c:82] Creating headless backend
wlserver: Running compositor on wayland display 'gamescope-0'
wlserver: [backend/headless/backend.c:18] Starting headless backend
wlserver: [xwayland/server.c:92] Starting Xwayland on :2
Xwayland: symbol lookup error: /nix/store/76pa9pv4fkwl68ybl3lphcyrrmwyx45j-libkrb5-1.20/lib/libcom_err.so.3: undefined symbol: k5_os_mutex_destroy, version krb5support_0_MIT
wlserver: [xwayland/server.c:247] Xwayland startup failed, not setting up xwm

Maybe it's xwayland's issue?

IvarWithoutBones commented 2 years ago

Gdm with gnome wayland here. In my case /tmp/.X11-unix is owned by root, and gamescope just exit with the same error. After I made the current user the owner, gamescope made some progress, and but exit with the follow error:

wlserver: [backend/headless/backend.c:82] Creating headless backend
wlserver: Running compositor on wayland display 'gamescope-0'
wlserver: [backend/headless/backend.c:18] Starting headless backend
wlserver: [xwayland/server.c:92] Starting Xwayland on :2
Xwayland: symbol lookup error: /nix/store/76pa9pv4fkwl68ybl3lphcyrrmwyx45j-libkrb5-1.20/lib/libcom_err.so.3: undefined symbol: k5_os_mutex_destroy, version krb5support_0_MIT
wlserver: [xwayland/server.c:247] Xwayland startup failed, not setting up xwm

Maybe it's xwayland's issue?

Is kdr5 propagated into the environment? https://github.com/NixOS/nixpkgs/pull/83645 had a seemingly similar issue fixed with that. Might need to add it to steams chroot env if it isn't already.

nrdxp commented 2 years ago

Might want to give 3.11.43 a try

Also, I have an open PR to allow one to add a gamescope based steam session to your display manager, would appreciate it if some folks here could give it a review: https://github.com/NixOS/nixpkgs/pull/187507

BillHuang2001 commented 2 years ago

After adding libkrb5 and keyutils to steam, with 3.11.39, I tested several native and proton games, they all worked without any further issue.

fufexan commented 2 years ago

@BillHuang2001 mind showing exactly how you did it?

BillHuang2001 commented 2 years ago

Yes, the two packages are added in steam's extraPkgs.

nixpkgs.config.packageOverrides = pkgs: {
    steam = pkgs.steam.override {
      extraPkgs = pkgs: with pkgs; [
        xorg.libXcursor
        xorg.libXi
        xorg.libXinerama
        xorg.libXScrnSaver
        libpng
        libpulseaudio
        libvorbis
        stdenv.cc.cc.lib
        libkrb5
        keyutils
      ];
    };
  };

And launch option in steam

gamescope -h 720 -H 1080 -U -f -- %command%
fufexan commented 2 years ago

Are you running that in Xorg? I tried the same steps on Wayland and it still fails with the /tmp/.X11-unix not owned by root or us errors.

BillHuang2001 commented 2 years ago

I'm on wayland, you still have to manually run sudo chown <username> /tmp/.X11-unix here. I don't know much about how wayland/xorg work, I have to manually set the owner every time after reboot.

jhvst commented 2 years ago

After adding libkrb5 and keyutils to steam, with 3.11.39, I tested several native and proton games, they all worked without any further issue.

FWIW this also works on sway. /tmp/.X11-unix is owned by root, so that must be chowned first.

nrdxp commented 2 years ago

There must be something different, because I have launched gamescope in embedded mode, from a wayland session and from an X session, and I never had to chown anything

samueldr commented 2 years ago

Same, nested (X11) and embedded (VT) worked on my end without anything wonky

Just in case, here's my groups:

users wheel audio video dialout adm networkmanager systemd-journal kvm
fufexan commented 1 year ago

@BillHuang2001 I've tried your suggestion with extraPackages. Doesn't seem to work for me, even when chowning X11-lock:

GameAction [AppID 413150, ActionID 1] : LaunchApp changed task to Completed with ""
vulkan: selecting physical device 'AMD RADV RENOIR': queue family 1
vulkan: physical device supports DRM format modifiers
Fossilize INFO: Overriding serialization path: "/home/mihai/.local/share/Steam/steamapps/shadercache/413150/fozpipelinesv6/steamapprun_pipeline_cache".
vulkan: supported DRM formats for sampling usage:
vulkan:   0x34325241
vulkan:   0x34325258
vulkan:   0x3231564E
wlserver: [wayland] unable to lock lockfile /run/user/1000/gamescope-0.lock, maybe another compositor is running
wlserver: [wayland] unable to lock lockfile /run/user/1000/gamescope-1.lock, maybe another compositor is running
wlserver: Running compositor on wayland display 'gamescope-2'
wlserver: [backend/headless/backend.c:18] Starting headless backend
wlserver: [xwayland/server.c:92] Starting Xwayland on :1
ERROR: ld.so: object '/home/mihai/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
Xwayland: symbol lookup error: /nix/store/jqbgmjrf1466acvbfzs50yp51hkb1xdj-libkrb5-1.20/lib/libcom_err.so.3: undefined symbol: k5_os_mutex_destroy, version krb5support_0_MIT
wlserver: [xwayland/server.c:247] Xwayland startup failed, not setting up xwm
Installing breakpad exception handler for appid(steam)/version(1663887315)

I still get krb5 errors and the game doesn't show up, but steam reports it as running.

Perhaps I missed a step?

Config is here.

EDIT: My bad, I was using nixpkgs.config but I was building my system with an explicit pkgs pass. Moving the override in the pkgs import solved the issue.

Sorry for necro-ing!

Shados commented 1 year ago

Using xorg & SDDM, and I do seem to have to sudo chown shados /tmp/.X11-unix for gamescope launched from within Steam to work. But, that directory is owned by root on my system, so why doesn't it work? Quick check of what things look like within steam's FHS env namespace reveals the issue:

shados@dreamlogic[~] λ ls -lah /tmp/.X11-unix
total 42K
drwxrwxrwt  2 root root  3 Dec 21 00:25 .
drwxrwxrwt 18 root root 30 Dec 21 00:30 ..
srwxrwxrwx  1 root root  0 Dec 20 22:45 X0
shados@dreamlogic[~] λ steam-run ls -lah /tmp/.X11-unix
total 42K
drwxrwxrwt  2 nobody nogroup  3 Dec 21 00:25 .
drwxrwxrwt 18 nobody nogroup 30 Dec 21 00:30 ..
srwxrwxrwx  1 nobody nogroup  0 Dec 20 22:45 X0
shados@dreamlogic[~] λ sudo chown shados /tmp/.X11-unix
[sudo] password for shados:
shados@dreamlogic[~] λ steam-run ls -lah /tmp/.X11-unix
total 42K
drwxrwxrwt  2 shados nogroup  3 Dec 21 00:25 .
drwxrwxrwt 18 nobody nogroup 30 Dec 21 00:30 ..
srwxrwxrwx  1 nobody nogroup  0 Dec 20 22:45 X0

It appears that Steam's namespace maps all instances of users other than the current one in to nobody, and this causes the issue. This is also why it works fine for me if I use it outside of Steam. This behaviour is coming from bubblewrap, which buildFHSUserEnv uses under the hood, but I'm not sure how to fix this. I believe Flatpak also uses bubblewrap for sandboxing, so if this is working with Flatpak Steam, it may be worth taking a look at what it's doing...

Shados commented 1 year ago

gamescope does work in Flatpak Steam, I did some digging and what Flatpak is doing is mostly equivalent to passing

  extraBwrapArgs = [
    "--tmpfs /tmp/.X11-unix"
    "--ro-bind /tmp/.X11-unix/X0 /tmp/.X11-unix/X0"
  ];

in steam-fhsenv's call to buildFHSUserEnv, but with some code to parse $DISPLAY for the appropriate socket name instead of just assuming X0, and some sanity checks on ensuring it actually exists to begin with. I don't think it's currently possible to replicate that code in nixpkgs; I think we'd need the ability to prepend some additional bash to buildFHSUserEnv's bwrapCmd.

GrabbenD commented 1 year ago

Did anyone mange to get past this issue?

wlserver: [xwayland/server.c:108] Starting Xwayland on :1
ERROR: ld.so: object '/home/me/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
Xwayland: symbol lookup error: /nix/store/lkbxlllgchqavfl6ldz60vx0p7gkzc08-libkrb5-1.20.1/lib/libcom_err.so.3: undefined symbol: k5_os_mutex_destroy, version krb5support_0_MIT
wlserver: [xwayland/server.c:270] Xwayland startup failed, not setting up xwm
GrabbenD commented 1 year ago

Workaround:

The solution was a combination of multiple steps:

  1. Disable MangoHud if used globally: programs.mangohud.enableSessionWide = false; _(Alternatively it sounds like it's possible to bypass the segmentation fault with ENABLE_VKBASALT=1 https://github.com/flightlessmango/MangoHud/issues/822)_

  2. Don't force Wayland since GameScope still uses XWayland. The biggest culprit seems to be SDL_VIDEODRIVER, leaving it unset might be the best idea. Here's my envs on Hyprland:

    {
    wayland.windowManager.hyprland.xwayland.enable = true;
    
    home-manager.users.me.home.sessionVariables = {
    GDK_BACKEND = "wayland,x11";
    QT_QPA_PLATFORM = "wayland;xcb";
    #SDL_VIDEODRIVER = "x11";
    CLUTTER_BACKEND = "wayland";
    XDG_CURRENT_DESKTOP = "Hyprland";
    XDG_SESSION_TYPE = "wayland";
    XDG_SESSION_DESKTOP = "Hyprland";
    WLR_NO_HARDWARE_CURSORS = "1";
    };
    }
  3. Fix undefined symbols in X11 session (Thanks @BillHuang2001):

    {
    environment.systemPackages = with pkgs; [ gamescope ];
    nixpkgs.config.packageOverrides = pkgs: {
    steam = pkgs.steam.override {
      extraPkgs = pkgs: with pkgs; [
        xorg.libXcursor
        xorg.libXi
        xorg.libXinerama
        xorg.libXScrnSaver
        libpng
        libpulseaudio
        libvorbis
        stdenv.cc.cc.lib
        libkrb5
        keyutils
      ];
    };
    };
    }
  4. I was able to use GameScope with GameMode and MangoHud like this with my 3840x1600@120 display in Steam. Goto Steam > Game > Properties > Launch Options and add:

    gamescope -W 3840 -H 1600 -r 119 -f -e -- mangohud gamemoderun %command%

Some minor issues that I've encountered with GameScope:

I benchmarked GameScope versus running directly in Wayland with my configuration and I found the Wayland session to be noticeably smoother. Frametimes and FPS were slightly better in Hyprland/Wayland according to MangoHud with Xanmod 6.2 kernel and performance governor. I also found that GameScope performs a lot better when VRR is enabled and direct scanout is disabled: --adaptive-sync --force-composition.

Hope this helps anyone!