NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.36k stars 14.31k forks source link

gamescope 3.14.23 broken #326591

Closed danilevy1212 closed 4 months ago

danilevy1212 commented 4 months ago

Describe the bug

gamescope 3.14.23 seems to be packaged incorrectly, https://github.com/NixOS/nixpkgs/pull/325245 looks like this automatic upgrade missed some new runtime dependency, as the command now fails when run.

Steps To Reproduce

Steps to reproduce the behavior:

  1. gamescope -- vkcube

Expected behavior

A window is displayed

Screenshots

image

Additional context

I am running on KDE Plasma 6.1, but this issue seems to happen on a standalone session as well. I'm also running Nvidia hardware, RTX 4090, on driver 555.58.02

Written logs:

[gamescope] [Info]  console: gamescope version undefined
No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
DRM kernel driver 'nvidia-drm' in use. NVK requires nouveau.
[gamescope] [Info]  vulkan: selecting physical device 'NVIDIA GeForce RTX 4090': queue family 2 (general queue family 0)
[gamescope] [Info]  vulkan: physical device supports DRM format modifiers
[gamescope] [Info]  wlserver: [backend/headless/backend.c:67] Creating headless backend
[gamescope] [Info]  xdg_backend: Seat name:
[gamescope] [Error] vulkan: vkGetPhysicalDeviceFormatProperties2 returned zero modifiers for DRM format 0x38344241 (VkResult: 0)
[gamescope] [Error] vulkan: vkGetPhysicalDeviceFormatProperties2 returned zero modifiers for DRM format 0x38344258 (VkResult: 0)
[gamescope] [Info]  vulkan: supported DRM formats for sampling usage:
[gamescope] [Info]  vulkan:   AR24 (0x34325241)
[gamescope] [Info]  vulkan:   XR24 (0x34325258)
[gamescope] [Info]  vulkan:   AB24 (0x34324241)
[gamescope] [Info]  vulkan:   XB24 (0x34324258)
[gamescope] [Info]  vulkan:   RG16 (0x36314752)
[gamescope] [Info]  vulkan:   NV12 (0x3231564E)
[gamescope] [Info]  vulkan:   AB4H (0x48344241)
[gamescope] [Info]  vulkan:   XB4H (0x48344258)
[gamescope] [Info]  vulkan:   AB30 (0x30334241)
[gamescope] [Info]  vulkan:   XB30 (0x30334258)
[gamescope] [Info]  vulkan:   AR30 (0x30335241)
[gamescope] [Info]  vulkan:   XR30 (0x30335258)
[gamescope] [Info]  wlserver: Running compositor on wayland display 'gamescope-0'
[gamescope] [Info]  wlserver: [backend/headless/backend.c:17] Starting headless backend
[gamescope] [Info]  wlserver: Successfully initialized libei for input emulation!
[gamescope] [Info]  wlserver: [xwayland/server.c:107] Starting Xwayland on :1
[gamescope] [Debug] wlserver: [types/wlr_compositor.c:771] New wlr_surface 0x1a576470 (res 0x1a57d8e0)
[gamescope] [Debug] wlserver: [xwayland/server.c:272] Xserver is ready
[gamescope] [Info]  pipewire: stream state changed: connecting
[gamescope] [Info]  pipewire: stream state changed: paused
[gamescope] [Info]  pipewire: stream available on node ID: 104
[gamescope] [Info]  xwm: Embedded, no cursor set. Using left_ptr by default.
[gamescope] [Info]  vblank: Using timerfd.
[gamescope] [Info]  xdg_backend: PreferredMetadata: Red: 0.64 0.33, Green: 0.3 0.6, Blue: 0.15 0.06, White: 0.3127 0.329, Max Luminance: 630 nits, Min Luminance: 0 nits, Max Full Frame Luminance: 630 nits
[gamescope] [Info]  josh edid: Patching res 800x1280 -> 1280x720
[gamescope] [Debug] pipewire: renegotiating stream params (size: 2560x1440)
[gamescope] [Error] process: Failed to start process "gamescopereaper": No such file or directory
[gamescope] [Info]  launch: Primary child shut down!
(EE) failed to read Wayland events: Broken pipe

Notify maintainers

@nrdxp @pedrohlc @Scrumplex @zhaofengli @k900

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

this path will be fetched (0.00 MiB download, 0.00 MiB unpacked):
  /nix/store/c9axlajaj54kvvlx6nn701g5jx43ia7w-nix-info
copying path '/nix/store/c9axlajaj54kvvlx6nn701g5jx43ia7w-nix-info' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 6.9.8, NixOS, 24.11 (Vicuna), 24.11.20240709.feb2849`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.4`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos````

Add a :+1: reaction to issues you find important.

danilevy1212 commented 4 months ago

Did a quick test to tryout the previous gamescope version, 3.14.22:

  gamescope-pkg = pkgs.gamescope.overrideAttrs {
    version = "3.14.22";
    src = pkgs.fetchFromGitHub {
      owner = "ValveSoftware";
      repo = "gamescope";
      rev = "refs/tags/3.14.22";
      fetchSubmodules = true;
      hash = "sha256-/muitEE3LCU6Xnjbpczb/zy2JRvUbBPT5L13T/v3MvE=";
    };
  };
....
  system.packages = [ gamescope-pkg ]

Seems like the issue was definitely introduced in 3.14.23.

image

K900 commented 4 months ago

Are you running it from nix-shell or something? gamescopereaper should be in the package and thus on your PATH.

danilevy1212 commented 4 months ago

No, it's part of my system configuration flake. Sharing the relevant host file for context, is the only part of my configuration that is related to gamescope (https://github.com/danilevy1212/nixos/blob/main/hosts/bootse/default.nix):

{
  pkgs,
  config,
  stable,
  unstable,
  ...
}: let
  gamescope-pkg = unstable.gamescope;
  # gamescope-pkg = pkgs.gamescope.overrideAttrs {
  #   version = "3.14.22";
  #   src = pkgs.fetchFromGitHub {
  #     owner = "ValveSoftware";
  #     repo = "gamescope";
  #     rev = "refs/tags/3.14.22";
  #     fetchSubmodules = true;
  #     hash = "sha256-/muitEE3LCU6Xnjbpczb/zy2JRvUbBPT5L13T/v3MvE=";
  #   };
  # };
in {
  imports = [
    # Include the results of the hardware scan.
    ./hardware-configuration.nix
  ];

  # Bootloader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.kernelParams = [
    "module_blacklist=i915"
    "nvidia_drm.fbdev=1"
    # NOTE See https://forums.developer.nvidia.com/t/555-release-feedback-discussion/293652/32
    "nvidia.NVreg_EnableGpuFirmware=0"
  ];

  # Enable networking
  networking.networkmanager.enable = true;

  environment.systemPackages = with pkgs; [
    # Monitor GPU usage
    nvtopPackages.full
    drm_info
    # Monitor FPS
    mangohud
    # Additional tools for Windows compatibility
    protontricks
    (lutris.override {
      extraPkgs = pkgs:
        with pkgs; [
          winetricks
          wineWowPackages.waylandFull
        ];
    })
    gamescope-wsi
    vulkan-loader
  ];

  # Performance boost
  programs.gamemode = {
    enable = true;
    settings = {
      general = {
        inhibit_screensaver = true;
      };
    };
  };

  # NVIDIA crazyness
  services.xserver = {
    enable = true;
    videoDrivers = [
      "nvidia"
    ];
  };
  hardware.nvidia = {
    modesetting.enable = true;
    # Fixes graphical glitches after suspend
    powerManagement.enable = true;
    nvidiaSettings = true;
    package = config.boot.kernelPackages.nvidiaPackages.latest;
  };
  hardware.graphics = {
    enable = true;
    enable32Bit = true;
    extraPackages = with pkgs; [
      vaapiVdpau
    ];
    extraPackages32 = with pkgs; [
      pkgsi686Linux.vaapiVdpau
    ];
  };
  virtualisation.docker.enableNvidia = true;

  # Minimum requirements for Steam
  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
          gamescope-pkg
          gamescope-wsi
          vulkan-loader
          zenity
          wayland
        ];
    };
  };

  # Gaming
  programs.steam = {
    enable = true;
    remotePlay.openFirewall = true;
    dedicatedServer.openFirewall = true;
    gamescopeSession = {
      enable = true;
      args = [
        "-w"
        "3840"
        "-h"
        "2160"
        "-r"
        "144"
        "--hdr-enabled"
        "--hdr-debug-force-output"
        "--hdr-sdr-content-nits"
        "630"
      ];
    };
    extraCompatPackages = with pkgs; [
      vkd3d-proton
      vkd3d
      dxvk_2
      proton-ge-bin
      freetype
      openjdk21_headless
      wineWowPackages.waylandFull
      gamescope-wsi
      vulkan-loader
    ];
  };
  programs.gamescope = {
    enable = true;
    package = gamescope-pkg;
  };

  # Game-streaming
  services.sunshine = {
    enable = true;
    openFirewall = true;
    capSysAdmin = true;
    # NOTE: This is a temporary workaround, fix hasn't made it to unstable yet. See https://github.com/NixOS/nixpkgs/issues/326299
    package = stable.sunshine;
  };

  # Enable the KDE Plasma Desktop Environment.
  services.displayManager.sddm.enable = true;

  # Enable CUPS to print documents.
  services.printing.enable = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.dlevym = {
    isNormalUser = true;
    description = "Daniel Levy Moreno";
    extraGroups = ["networkmanager" "wheel"];
  };

  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;

  # List services that you want to enable:
  hardware.bluetooth.enable = true;
  services.blueman.enable = true;

  # Enable the OpenSSH daemon.
  services.openssh.enable = true;
}

My configuration lives here: https://github.com/danilevy1212/nixos. Some changes I haven't pushed yet. You can see by my flake.nix that 'unstable' referes to nixos-unstable channel, and stable to the latest stable release, 24.05. https://github.com/danilevy1212/nixos/blob/main/flake.nix.

K900 commented 4 months ago

At the very least you can't mix unstable gamescope and stable WSI.

danilevy1212 commented 4 months ago

Thank you for pointing that out, I changed it to both be on "unstable" but the issue persists.

[dlevym@bootse] ~ gamescope -- vkcube
[gamescope] [Info]  console: gamescope version undefined
No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
DRM kernel driver 'nvidia-drm' in use. NVK requires nouveau.
[gamescope] [Info]  vulkan: selecting physical device 'NVIDIA GeForce RTX 4090': queue family 2 (general queue family 0)
[gamescope] [Info]  vulkan: physical device supports DRM format modifiers
[gamescope] [Info]  wlserver: [backend/headless/backend.c:67] Creating headless backend
[gamescope] [Info]  xdg_backend: Seat name:
[gamescope] [Error] vulkan: vkGetPhysicalDeviceFormatProperties2 returned zero modifiers for DRM format 0x38344241 (VkResult: 0)
[gamescope] [Error] vulkan: vkGetPhysicalDeviceFormatProperties2 returned zero modifiers for DRM format 0x38344258 (VkResult: 0)
[gamescope] [Info]  vulkan: supported DRM formats for sampling usage:
[gamescope] [Info]  vulkan:   AR24 (0x34325241)
[gamescope] [Info]  vulkan:   XR24 (0x34325258)
[gamescope] [Info]  vulkan:   AB24 (0x34324241)
[gamescope] [Info]  vulkan:   XB24 (0x34324258)
[gamescope] [Info]  vulkan:   RG16 (0x36314752)
[gamescope] [Info]  vulkan:   NV12 (0x3231564E)
[gamescope] [Info]  vulkan:   AB4H (0x48344241)
[gamescope] [Info]  vulkan:   XB4H (0x48344258)
[gamescope] [Info]  vulkan:   AB30 (0x30334241)
[gamescope] [Info]  vulkan:   XB30 (0x30334258)
[gamescope] [Info]  vulkan:   AR30 (0x30335241)
[gamescope] [Info]  vulkan:   XR30 (0x30335258)
[gamescope] [Info]  wlserver: Running compositor on wayland display 'gamescope-0'
[gamescope] [Info]  wlserver: [backend/headless/backend.c:17] Starting headless backend
[gamescope] [Info]  wlserver: Successfully initialized libei for input emulation!
[gamescope] [Info]  wlserver: [xwayland/server.c:107] Starting Xwayland on :1
[gamescope] [Debug] wlserver: [types/wlr_compositor.c:771] New wlr_surface 0xe4c8d20 (res 0xe4cecf0)
[gamescope] [Debug] wlserver: [xwayland/server.c:272] Xserver is ready
[gamescope] [Info]  pipewire: stream state changed: connecting
[gamescope] [Info]  pipewire: stream state changed: paused
[gamescope] [Info]  pipewire: stream available on node ID: 81
[gamescope] [Info]  xwm: Embedded, no cursor set. Using left_ptr by default.
[gamescope] [Info]  vblank: Using timerfd.
[gamescope] [Info]  xdg_backend: PreferredMetadata: Red: 0.64 0.33, Green: 0.3 0.6, Blue: 0.15 0.06, White: 0.3127 0.329, Max Luminance: 630 nits, Min Luminance: 0 nits, Max Full Frame Luminance: 630 nits
[gamescope] [Info]  josh edid: Patching res 800x1280 -> 1280x720
[gamescope] [Debug] pipewire: renegotiating stream params (size: 2560x1440)
[gamescope] [Error] process: Failed to start process "gamescopereaper": No such file or directory
[gamescope] [Info]  launch: Primary child shut down!
(EE) failed to read Wayland events: Broken pipe
danilevy1212 commented 4 months ago

It looks to me like "gamescoperreaper" is a new binary that Valve added recently with 3.14.23 that gamescope calls at some point. I was looking into their releases https://github.com/ValveSoftware/gamescope/tags . Not a CPP developer so I am making a some assumptions about the nature of gamescopereaper and the layout of their project.

Perhaps gamescopereaper needs to be packaged as part of the gamescope derivation? It doesn't look like it does that currently.

K900 commented 4 months ago

The binary is there in our gamescope package, though?

danilevy1212 commented 4 months ago

Agh, seems like adding gamescope though the programs.gamescope.package was not enough to add gamescoperreaper into the path. I solved the issue by adding the package explicitly inside of environment.systemPackages.

devusb commented 4 months ago

I think the issue is with the module -- looks like it doesn't actually add the gamescope package into environment.systemPackages, but instead a wrapper. https://github.com/NixOS/nixpkgs/blob/a046c1202e11b62cbede5385ba64908feb7bfac4/nixos/modules/programs/gamescope.nix#L18

AlephNought0 commented 4 months ago

I can confirm that adding the package through the gamescope module makes gamescope not work. Adding it through other means such as environment.systemPackages does work.

PedroHLC commented 4 months ago

Ok, so possible solutions: 1 - simple but less optimal: add a symlink below this line: https://github.com/NixOS/nixpkgs/blob/4d9989e5a54d81f5112c58d84c131348f182f940/nixos/modules/programs/gamescope.nix#L19 2 - complex but more Nix-friendly: find the exec portion in C code and patch it to find the executable in $out/bin/ 3 - alternative similar to (1): add $out/bin to wrapper's PATH (using makeWrapper argument)

Good opportunity to open a PR with any of these solutions, tag the module and package's maintainers, and make the requested changes (which might be even a change of which strategy). Don't worry, the worst thing that could happen is your PR being closed to favorite a committer's PR, it's still seen as a good contribution (and good opportunity to learn).

devusb commented 4 months ago

Opened #326868 to attempt to resolve.