ValveSoftware / gamescope

SteamOS session compositing window manager
Other
2.94k stars 197 forks source link

Steam input broken #1180

Open zany130 opened 5 months ago

zany130 commented 5 months ago

Gamescope seems to break steam input

To reproduce

  1. Plug in a controller ( I tried a dualsense)
  2. add gamescope %command% to the launch option for your game (tested a hat in time and trails into reverie)
  3. run your game
  4. Notice that you cant control the game with your controller. The steam overlay also seems to be broken
    inxi -b
    System:
    Host: Garuda-Linux Kernel: 6.7.8-2-cachyos arch: x86_64 bits: 64
    Desktop: KDE Plasma v: 6.0.0 Distro: Garuda Linux
    Machine:
    Type: Desktop Mobo: ASRock model: X470 Taichi serial: <superuser required>
    UEFI: American Megatrends v: P5.10 date: 10/20/2022
    CPU:
    Info: 6-core AMD Ryzen 5 5600X [MT MCP] speed (MHz): avg: 3769
    min/max: 550/4687
    Graphics:
    Device-1: AMD Navi 22 [Radeon RX 6700/6700 XT/6750 XT / 6800M/6850M XT]
    driver: amdgpu v: kernel
    Display: wayland server: X.org v: 1.21.1.11 with: Xwayland v: 23.2.4
    compositor: kwin_wayland driver: X: loaded: amdgpu
    unloaded: modesetting,radeon dri: radeonsi gpu: amdgpu resolution:
    1: 2048x864 2: 1396x785 3: 1536x864
    API: OpenGL v: 4.6 compat-v: 4.5 vendor: amd mesa v: 24.0.2-arch1.1
    renderer: AMD Radeon RX 6700 XT (radeonsi navi22 LLVM 16.0.6 DRM 3.57
    6.7.8-2-cachyos)
    Network:
    Device-1: Intel Dual Band Wireless-AC 3168NGW [Stone Peak] driver: iwlwifi
    Device-2: Intel I211 Gigabit Network driver: igb
    Drives:
    Local Storage: total: 3.64 TiB used: 3.8 TiB (104.3%)
    Info:
    Memory: total: 32 GiB available: 31.26 GiB used: 13.05 GiB (41.8%)
    Processes: 636 Uptime: 8m Shell: fish inxi: 3.3.33
sonic2kk commented 5 months ago

Could be related to the new Wayland backend. Steam Overlay does not support Wayland (see ValveSoftware/steam-for-linux#8020) and afaik Steam Input relies on the Steam Overlay.

Running from ValveSoftware/gamescope@14a1db3a57612e5cfbba6d4c19688eafdc6c4043 may fix the issue.

zany130 commented 5 months ago

Happens on the arch stable package as well though which is before the new back end I believe

EDIT: it is before that commit https://github.com/ValveSoftware/gamescope/tree/3.14.2

aiudirog commented 5 months ago

I have this same problem and I also tried downgrading gamescope to the previous minor release (3.13.19) but the problem persists.

I also switched over to Plasma 6 today from Gnome, so that could factor in. I typically didn't use gamescope on Gnome (currently testing KDE's HDR support) but I do remember the controller working properly under Wayland recently. I'll probably quickly switch back later and check.

System Details ``` System: Host: Ryzen-Arch Kernel: 6.7.8-zen1-1-zen arch: x86_64 bits: 64 Desktop: KDE Plasma v: 6.0.1 Distro: Arch Linux Machine: Type: Desktop System: Micro-Star product: MS-7C37 v: 2.0 serial: Mobo: Micro-Star model: MPG X570 GAMING PLUS (MS-7C37) v: 2.0 serial: UEFI: American Megatrends LLC. v: A.D1 date: 03/03/2021 CPU: Info: 12-core AMD Ryzen 9 5900X [MT MCP] speed (MHz): avg: 4197 min/max: 2200/4950 Graphics: Device-1: AMD Navi 21 [Radeon RX 6950 XT] driver: amdgpu v: kernel Display: wayland server: X.org v: 1.21.1.11 with: Xwayland v: 23.2.4 compositors: 1: Gamescope 2: kwin_wayland driver: X: loaded: amdgpu dri: radeonsi gpu: amdgpu resolution: 2560x1440 API: OpenGL v: 4.6 compat-v: 4.5 vendor: amd mesa v: 24.0.2-arch1.1 renderer: AMD Radeon RX 6950 XT (radeonsi navi21 LLVM 16.0.6 DRM 3.57 6.7.8-zen1-1-zen) Network: Device-1: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet driver: r8169 Info: Memory: total: 32 GiB available: 31.26 GiB used: 10.58 GiB (33.8%) Processes: 680 Uptime: 2h 1m Shell: Zsh inxi: 3.3.33 ```
IDeathByte commented 5 months ago

Same issue on Plasma 6 Also, happened on latest 5.27 a couple days ago, but been fixed after reboot or system update (before plasma 6)

System ```System: Host: deathbyte-pc Kernel: 6.7.8-273-tkg-bore arch: x86_64 bits: 64 Desktop: KDE Plasma v: 6.0.1 Distro: Manjaro Linux Machine: Type: Desktop Mobo: ASUSTeK model: ROG STRIX B350-F GAMING v: Rev X.0x serial: UEFI: American Megatrends v: 6042 date: 04/28/2022 CPU: Info: 6-core AMD Ryzen 5 5600X [MT MCP] speed (MHz): avg: 3398 min/max: 2200/5781 Graphics: Device-1: AMD Navi 23 [Radeon RX 6600/6600 XT/6600M] driver: amdgpu v: kernel Device-2: Logitech HD Webcam C910 driver: snd-usb-audio,uvcvideo type: USB Display: wayland server: X.org v: 1.21.1.11 with: Xwayland v: 23.2.4 compositor: kwin_wayland driver: X: loaded: modesetting dri: radeonsi gpu: amdgpu resolution: 1: 2560x1080 2: 900x1600 API: OpenGL v: 4.6 compat-v: 4.5 vendor: amd v: N/A renderer: AMD Radeon RX 6600 XT (radeonsi navi23 LLVM 17.0.6 DRM 3.57 6.7.8-273-tkg-bore) Network: Device-1: Intel I211 Gigabit Network driver: igb Device-2: Intel Wireless 8260 driver: iwlwifi Drives: Local Storage: total: 4.09 TiB used: 1.33 TiB (32.5%) Info: Memory: total: 32 GiB available: 31.25 GiB used: 6.39 GiB (20.4%) Processes: 494 Uptime: 4h 22m Shell: Zsh inxi: 3.3.33 ```
zany130 commented 5 months ago

@Joshua-Ashton could this be a plasma bug? Is it better to report there?

aiudirog commented 5 months ago

I haven't swapped back to Gnome yet to check, but Steam Input does work in Plasma if Steam itself is run in Gamescope or if Gamescope isn't used. It seems to specifically be an issue when Gamescope is in-between Steam and the game.

aiudirog commented 5 months ago

Just tested on Gnome (Wayland) and found that it worked when using gamescope -- %command% in regular desktop Steam. However, switching to Big Picture Mode presented the issue. I then switched back to Plasma and observed the same thing - works outside of BPM, not inside it. It does not appear to matter if I start directly in BPM using the -gamepadui flag or if I swap back and forth using the button in the desktop Steam interface. So this seems to be some weird interaction there, maybe with the Steam Overlay? I do have "Use the Big Picture Overlay when using a controller" checked in the settings, but something is clearly different.

Joshua-Ashton commented 5 months ago

It's probably the Wayland backend not having stuff play nicely with xtest stuff Steam is doing. I'll investigate.

VeilSilence commented 5 months ago

I also found an issue related to Steam input + gamescope. Step 1: connect controller ( PlayStation 4 Controller for me ) . Step 2: run Elden Ring with gamescope -w 2560 -h 1440 -f gamemoderun mangohud %command% Step 3: When enemy hit me, my controller "rumble" ( as it should ), but my fps drops from 60 to 30-20fps for a second. More hits -> the longer fps stay at low. Inputs from controller not working with gamescope also. Tested on plasma 6 and Hyprland. Starting game without gamescope make inputs from controller working and "fps issue" go away.

zany130 commented 5 months ago

FWIW, I tried https://github.com/ValveSoftware/gamescope/commit/14a1db3a57612e5cfbba6d4c19688eafdc6c4043 (the commit right before the Wayland backend) and https://github.com/ValveSoftware/gamescope/releases/tag/3.14.2 both in Steam big picture and desktop mode.

Also tried messing with the steam overlay and steam input settings.

I am unable to use gamescope with a controller when running Steam games

zany130 commented 5 months ago

found 2 workarounds for this bug

first, launching a game scope window and then pointing the game to that window, as described here https://github.com/ValveSoftware/gamescope/issues/835#issuecomment-1661360202 fixes the issue

I have also been just running all of Steam in a nested Gamescope session like this.

gamescope -e -- steam

that also works.

DunkanMcLeod commented 4 months ago

In my case, input on steam does not work only in the -bigpicture mode. Running Steam through gamescope in desktop mode does not cause any input problems.

zany130 commented 4 months ago

In my case, input on steam does not work only in the -bigpicture mode. Running Steam through gamescope in desktop mode does not cause any input problems.

launching steam in big picture within gamescope doesn't work for you? That how I am currently playing P3R with gamescope and a controller

DunkanMcLeod commented 4 months ago

This solved my input problems with gamepad (i use dualsense):

steam -gamepadui -steamos3 -steampal -steamdeck

aiudirog commented 4 months ago

This solved my input problems with gamepad (i use dualsense):

steam -gamepadui -steamos3 -steampal -steamdeck

Are you running Steam inside gamescope or gamescope inside Steam for individual games via launch options? We know that the former works, this ticket is about the latter.

ScrambledLogic commented 3 months ago

This solved my input problems with gamepad (i use dualsense): steam -gamepadui -steamos3 -steampal -steamdeck

Are you running Steam inside gamescope or gamescope inside Steam for individual games via launch options? We know that the former works, this ticket is about the latter.

For me, a simple "steam -steamos3" from a terminal in a wayland plasma6 session fixes this issue on Tumbleweed. So Steam is running outside of gamescope, but I launch a game within gamescope using launch options, then DualSense input works perfectly fine (at least with Armored Core VI). I can't seem to find any detailed info on -steamos3 however, so I have no idea what it actually does or why it fixes this problem (or if it might cause other issues).

RodoMa92 commented 3 months ago

I think I'm also affected by this. If I run my game from Desktop mode enabling gamescope as a launch option in a Lutris installed game everything works fine, Steam input works. However if I do the same from game mode I can't get any Steam Input events in these third party games. It seems that steam input is not passing events through to the nested gamescope session and I can't control the game.

Joshua-Ashton commented 3 months ago

You need an XWayland compiled with libei support.

valgusk commented 3 months ago

You need an XWayland compiled with libei support.

Hi, care to elaborate? Just tried v21.1.99 Xwayland with both xwayland_ei set to socket and portal. Nothing changed - nested gamescope(git) does not seem to have have controller available

SmurgBurglar commented 3 months ago

You need an XWayland compiled with libei support.

cold you go into more detail?

SmurgBurglar commented 3 months ago

Really hope this is fixed before Shadow Of The Erdtree.

stiligFox commented 2 months ago

Commenting to add that this is happening to me as well, using latest version of Manjaro or Bazzite as of the time of posting. I have to use gamescope to get Forza Horizon 5 to work, but enabling it causes my Dual Sense to not work, unless I start steam from with steam -steamos3. It's only moderately annoying at most but would be nice to fix.

On a side note, while Steam Input works by doing this, Steam Overlay does not work with shift+tab. I think this is related?

Light034 commented 2 months ago

Commenting here to note a current workaround I found to this issue. Based on the issue #1225 I was able to have steam input and overlay work, what I did was create a systemd user service at ~\.local\share\systemd\user\ which starts a gamescope session in the background every time I log in and systemd keeps it alive in case that it crashes for whatever reason, then I added the option DISPLAY=:2 to the games where I had issues with the input and now when I launch the games they properly have the Overlay and Steam Input applied.

However there are some issues with this approach.

  1. The DISPLAY option changes sometimes and it doesn't seem to be constant, I have not found a way of having it be constant all the time so it varies between 1 and 2, which if it's different than the launch option on steam the games will not launch or they will launch without gamescope. I thought of adding a post launch script for the gamescope service that reads journalctl --user, gets the number that gamescope created for the display, and export it as a variable. Then just have the launch options call that variable instead of having to manually enter it.
  2. Gamescope will run all the time as a background service which will consume resources, I tried dynamically launching gamescope with gamemode custom scripts but it seems gamescope gets killed after gamemode is done with the custom scripts, so for now it runs all the time, it doesn't consume that many resources so this might not so big of a deal.
  3. If gamescope crashes while playing, the game keeps on running and there is no way to relaunch gamescope and have it re-take the output of the game, meaning that you either need gracefully close the game with only the menu sounds, or force close it via steam which can cause progress loss in games without auto-save.

I also found out that games that natively support the controller you are playing with and where you can disable Steam Input work perfectly fine with gamescope, as they take the inputs directly from the controller, however steam overlay doesn't attach properly.

valgusk commented 1 month ago

Replying to https://github.com/ValveSoftware/gamescope/issues/1180#issuecomment-2164038007

expanding on what you mentioned, here is a ruby script as a reference implementation to try it out. For me controller worked via this method https://github.com/valgusk/standalone-gamescope