From f4efa9b1fc00ea010dda8e214d78fb9680b93b21 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sat, 11 Feb 2023 22:53:54 +0100 Subject: [PATCH] hitagi: Switch to Intel Arc A770 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Things are not very smooth yet. Hwmon only works with Kernel 6.2 and only supports energy monitoring (and even that doesn’t look too good). Fan control and temperature is not supported. To get at least usage statistics, intel_gpu_top can be used. Mangohud in its newest unreleased version also supports getting stats from it. However, intel_gpu_top needs cap_perfmon, which is a pain to get working inside the double bubblewrap sandbox for steam, therefore it is not yet available. On the positive side, OpenCL works well and oneAPI also works with blender-bin from nix-warez (nixpkgs doesn’t yet have blender with oneAPI support). --- machines/hitagi/hardware-configuration.nix | 46 +++++++++++++++++++--- pkgs/default.nix | 18 +++++++++ users/simon/modules/games.nix | 8 ++-- 3 files changed, 62 insertions(+), 10 deletions(-) diff --git a/machines/hitagi/hardware-configuration.nix b/machines/hitagi/hardware-configuration.nix index 33ecf6b..43bd8b0 100644 --- a/machines/hitagi/hardware-configuration.nix +++ b/machines/hitagi/hardware-configuration.nix @@ -6,6 +6,23 @@ ]; boot = { + # Intel arc + #kernelPackages = pkgs.linuxPackages_latest; + kernelPackages = pkgs.unstable.recurseIntoAttrs (pkgs.unstable.linuxPackagesFor (pkgs.unstable.callPackage + ({ fetchurl, buildLinux, ... } @ args: buildLinux (args // rec { + version = "6.2.0-rc7"; + modDirVersion = version; + + src = fetchurl { + url = "https://git.kernel.org/torvalds/t/linux-6.2-rc7.tar.gz"; + sha256 = "sha256-6klAGw+J0usyY55dTMb/reUbAobJdheG/6YvNGz7SwM="; + }; + + kernelPatches = [ ]; + + extraMeta.branch = "6.2"; + } // (args.argsOverride or { }))) + { })); # fan control configuration from https://gist.github.com/bakman2/e801f342aaa7cade62d7bd54fd3eabd8 kernelModules = [ "kvm-amd" "it87" ]; kernelParams = [ "acpi_enforce_resources=lax" ]; # allow it87 to load @@ -75,16 +92,33 @@ ]; # GPU - hardware.opengl.extraPackages = with pkgs; [ - rocm-opencl-icd - ]; + hardware.opengl = { + package = pkgs.unstable.mesa.drivers; + package32 = pkgs.unstable.pkgsi686Linux.mesa.drivers; + extraPackages = with pkgs; [ + intel-media-driver + libvdpau-va-gl + vaapiIntel + vaapiVdpau + ] ++ (with pkgs.unstable; [ + intel-compute-runtime + intel-compute-runtime.drivers + level-zero + ]); + }; environment.systemPackages = with pkgs; [ clinfo - radeontop - rocm-smi + nvtop-amd # also returns basic stats for intel ]; + security.wrappers."intel_gpu_top" = { + owner = "root"; + group = "root"; + capabilities = "cap_perfmon+p"; + source = "${pkgs.unstable.intel-gpu-tools}/bin/intel_gpu_top"; + }; + # https://www.reddit.com/r/gigabyte/comments/p5ewjn/b550i_pro_ax_f13_bios_sleep_issue_on_linux/ systemd.services.suspend-fix = { wantedBy = [ "multi-user.target" ]; @@ -105,7 +139,7 @@ }; sbruder.fancontrol = { - enable = true; + enable = false; # no hwmon for intel arc (yet) enableDefaultMapping = true; fans = { front = { diff --git a/pkgs/default.nix b/pkgs/default.nix index 6d19a67..e4190bf 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -30,6 +30,24 @@ in ''; }); + # FIXME: remove once manghud > 0.6.8 is in nixpkgs/intel arc works + mangohud = prev.mangohud.overrideAttrs (o: { + version = "unstable-2023-02-05"; + + src = prev.fetchFromGitHub { + owner = "flightlessmango"; + repo = "MangoHud"; + rev = "319077808668c589523853313d028cf81837ce72"; + fetchSubmodules = true; + sha256 = "sha256-FHm5CcLKpD6R2XmGvlQrIU/OlkX1TGEN/ld3vrms2Lk="; + }; + + mesonFlags = o.mesonFlags ++ [ + "-Dappend_libdir_mangohud=false" # new default incompatible with current packaging + "-Dtests=disabled" # tests require new subproject + ]; + }); + vimPlugins = prev.vimPlugins // { # TODO: Remove once (if?) https://github.com/LnL7/vim-nix/pull/28 lands vim-nix = prev.vimPlugins.vim-nix.overrideAttrs (o: { diff --git a/users/simon/modules/games.nix b/users/simon/modules/games.nix index 6f81376..915afe0 100644 --- a/users/simon/modules/games.nix +++ b/users/simon/modules/games.nix @@ -91,8 +91,9 @@ let ''; in lib.mkIf cfg.enable { - home.packages = with pkgs; [ ] - ++ lib.optionals (cfg.performanceIndex >= 2) [ + home.packages = with pkgs; [ + unstable.mangohud + ] ++ lib.optionals (cfg.performanceIndex >= 2) [ mgba ] ++ lib.optionals (cfg.performanceIndex >= 4) [ desmume @@ -100,8 +101,7 @@ lib.mkIf cfg.enable { ] ++ lib.optionals (cfg.performanceIndex >= 8) [ unstable.ryujinx unstable.yuzu-mainline - ] - ++ lib.optionals unfree.allowSoftware [ + ] ++ lib.optionals unfree.allowSoftware [ unstable.osu-lazer-sandbox steam-sandbox-with-icons ];