Gamescope will always drop low fps after 30 minutes

Hello here are my specs:
Note that I have VRR enabled on that 165 hz monitor

This is my gaming configuration:

{
  pkgs,
  ...
}:

{
  environment.systemPackages = with pkgs; [
    protonup-qt
    cabextract # Needed for ^

    wineWowPackages.full
    winetricks
    faudio
  ];

  environment.sessionVariables = {
    # Default 64-bit Wine prefix for modern games
    WINEPREFIX = "$HOME/.wine";
    WINEARCH = "win64";
  };

  users.users.silk.packages = with pkgs; [
    unstable.heroic
    unstable.lutris
    unstable.dolphin-emu
    unstable.mcpelauncher-ui-qt
    melonDS
    steam-rom-manager
    srb2
    rpcs3
    ringracers

    unstable.prismlauncher
    # Minecraft Java JRE's for all versions
    temurin-jre-bin
    temurin-jre-bin-17
    temurin-jre-bin-8
  ];

  services = {
    scx = {
      enable = true;
      scheduler = "scx_cosmos";
      package = pkgs.scx.rustscheds;
    };
    ananicy = {
      enable = true;
      package = pkgs.ananicy-cpp;
      rulesProvider = pkgs.ananicy-rules-cachyos;
    };
  };

  programs = {
    gamescope = {
      enable = true;
      package = pkgs.gamescope_git.overrideAttrs (_: {
        NIX_CFLAGS_COMPILE = [ "-fno-fast-math" ];
      });
      capSysNice = false;
    };
    steam = {
      enable = true;
      localNetworkGameTransfers.openFirewall = true;
      protontricks.enable = true;
      gamescopeSession = {
        enable = true;
        steamArgs = [
          "-pipewire-dmabuf"
        ];
      };
      extest.enable = true;
      extraCompatPackages = [
        pkgs.steamtinkerlaunch
        pkgs.proton-ge-bin
        pkgs.proton-cachyos
      ];
    };
  };
}

Some things i tried: Running non-git version (via chaotic-nyx) has never worked. Running git with respective WSI fails. SCX and ANANICY coexisting or with only SCX doesnt cause it. If anyone could help it would be appreciated as I honestly don’t know what exactly is causing it.

Thank you

It’s a known bug, valve need to fix this: https://github.com/ValveSoftware/gamescope/issues/697#issuecomment-2564875728

You can work around it with by setting game commands to this:

LD_PRELOAD= gamescope -- env LD_PRELOAD="$LD_PRELOAD" %command%
3 Likes

While I’m here:

This is wrong, if you wanted to replace the nix-built JRE with temurin you would do this:

{
  environment.systemPackages = [
    (unstable.prismlauncher.override {
      jdks = [
        temurin-jre-bin
        temurin-jre-bin-17
        temurin-jre-bin-8
      ];
    })
  ];
}

But that said, prismlauncher comes with jdk21, 17 and 8 pre-installed, so I’d just remove those packages, you don’t need them.

2 Likes

Thank you! I’ll try this when I am home :woman_bowing: !

Some things to note that I forgot to mention for whatever reason.
I just saw on the Arch wiki that this problem could be fixed either by adding your suggestion or by adding steam overlay via -e. I already had that done

DXVK_HDR=1 gamescope -W 2560 -H 1440 -w 2560 -h 1440 -r 165 --force-grab-cursor --hdr-enabled --hdr-itm-enabled --expose-wayland -b -C -e --immediate-flips -- %command%

So I was wondering if maybe it could be something else. Regardless, I will test your suggestion anyhow and write back if it fixed it ^^

BTW do you happen to know how steam/proton args (such as LD_PRELOAD or DXVK_HDR) could be written to be declaritive the same way that you can add gamescope arguments to launch on gamescopes startup?

Personally, adding the -e flag makes gamescope crash for me :smiley: That said, the arch wiki advice may well be outdated, this bug was added by the game recording update, and apparently caused by the presence of the game overlay with certain libraries.

Not really possible. The reason it works for gamescope is that the gamescope binary is controlled by nix. What steam executes is entirely in steam’s domain.

You could perhaps muck with stuff in your steam library directory, but since that stuff is downloaded ad-hoc by steam (and updated randomly) it’s inherently impossible to do that declaratively. At best you could write some kinda wonky script that keeps overwriting binaries in your steam library directories.

Or perhaps a steam launcher launcher. Maybe playnite has features like this? Nevermind, never looked closely enough to realize it’s windows-only. Idk, video game folk don’t tend to care much about reproducibility or declarativeness.

1 Like