1
0
Fork 0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-11-01 08:39:41 +01:00

common/gpu/intel: add vaapi configuration options

This commit is contained in:
Gavin John 2024-10-18 14:16:04 -07:00 committed by mergify[bot]
parent 0ccdd27056
commit 184091915d

View file

@ -22,34 +22,57 @@
// { // {
default = true; default = true;
}; };
vaapiDriver = lib.mkOption {
description = "Intel VAAPI driver to use (use null to use both)";
type = lib.types.nullOr (
lib.types.enum [
"intel-vaapi-driver"
"intel-media-driver"
]
);
default = null; # Use both drivers when we don't know which one to use
};
enableHybridCodec = lib.mkEnableOption "hybrid codec support for Intel GPUs";
}; };
config = config =
let let
cfg = config.hardware.intelgpu; cfg = config.hardware.intelgpu;
useIntelVaapiDriver = cfg.vaapiDriver == "intel-vaapi-driver" || cfg.vaapiDriver == null;
intel-vaapi-driver = (pkgs.intel-vaapi-driver or pkgs.vaapiIntel).override {
enableHybridCodec = cfg.enableHybridCodec;
};
intel-vaapi-driver-32 = (pkgs.driversi686Linux.intel-vaapi-driver or pkgs.driversi686Linux.vaapiIntel).override {
enableHybridCodec = cfg.enableHybridCodec;
};
useIntelOcl = useIntelVaapiDriver && (config.hardware.enableAllFirmware or config.nixpkgs.config.allowUnfree or false);
intel-ocl = pkgs.intel-ocl;
useIntelMediaDriver = cfg.vaapiDriver == "intel-media-driver" || cfg.vaapiDriver == null;
intel-media-driver = pkgs.intel-media-driver;
intel-media-driver-32 = pkgs.driversi686Linux.intel-media-driver;
intel-compute-runtime = pkgs.intel-compute-runtime;
vpl-gpu-rt = pkgs.vpl-gpu-rt or pkgs.onevpl-intel-gpu;
in in
{ {
boot.initrd.kernelModules = lib.optionals cfg.loadInInitrd [ cfg.driver ]; boot.initrd.kernelModules = lib.optionals cfg.loadInInitrd [ cfg.driver ];
hardware.graphics.extraPackages = with pkgs; [ hardware.graphics.extraPackages =
( lib.optionals useIntelVaapiDriver [ intel-vaapi-driver ]
if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then ++ lib.optionals useIntelOcl [ intel-ocl ]
vaapiIntel ++ lib.optionals useIntelMediaDriver [
else
intel-vaapi-driver.override { enableHybridCodec = true; }
)
intel-media-driver intel-media-driver
intel-compute-runtime
vpl-gpu-rt
]; ];
hardware.graphics.extraPackages32 = with pkgs.driversi686Linux; [ hardware.graphics.extraPackages32 =
( lib.optionals useIntelVaapiDriver [ intel-vaapi-driver-32 ]
if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then ++ lib.optionals useIntelMediaDriver [ intel-media-driver-32 ];
vaapiIntel
else
intel-vaapi-driver.override { enableHybridCodec = true; }
)
intel-media-driver
];
assertions = [ assertions = [
{ {