diff options
author | Thomas Tuegel <ttuegel@secure.mailbox.org> | 2017-03-04 15:05:30 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-04 15:05:30 -0600 |
commit | ff8f2b87e8d15fe2ddc000b115c0d7f632999b61 (patch) | |
tree | 5a5c86039aec5898082f9e5e071ac522ff0e8d25 /pkgs/development | |
parent | 9aed6ccb4b2ee16b898973572e4b6ed7d56ddfe0 (diff) | |
parent | eccc1fa9bb2fd5baea960d55f81708637cfd8ff0 (diff) |
Merge pull request #23451 from ttuegel/mesa-drivers
mesa: allow overriding driver compilation
Diffstat (limited to 'pkgs/development')
-rw-r--r-- | pkgs/development/libraries/mesa/default.nix | 61 |
1 files changed, 50 insertions, 11 deletions
diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index b36316f72f4e..f5e716d212c7 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, fetchpatch +{ stdenv, fetchurl, fetchpatch, lib , pkgconfig, intltool, autoreconfHook, substituteAll , file, expat, libdrm, xorg, wayland, openssl , llvmPackages, libffi, libomxil-bellagio, libva @@ -6,9 +6,11 @@ , grsecEnabled ? false , enableRadv ? false , enableTextureFloats ? false # Texture floats are patented, see docs/patents.txt +, galliumDrivers ? null +, driDrivers ? null +, vulkanDrivers ? null }: - /** Packaging design: - The basic mesa ($out) contains headers and libraries (GLU is in mesa_glu now). This or the mesa attribute (which also contains GLU) are small (~ 2 MB, mostly headers) @@ -27,6 +29,40 @@ if ! lists.elem stdenv.system platforms.mesaPlatforms then else let + defaultGalliumDrivers = + if (stdenv.isArm || stdenv.isAarch64) + then ["nouveau" "freedreno" "vc4" "etnaviv"] + else ["i915" "ilo" "r300" "r600" "radeonsi" "nouveau"]; + defaultDriDrivers = + if (stdenv.isArm || stdenv.isAarch64) + then ["nouveau"] + else ["i915" "i965" "nouveau" "radeon" "r200"]; + defaultVulkanDrivers = + if (stdenv.isArm || stdenv.isAarch64) + then [] + else ["intel"] ++ lib.optional enableRadv "radeon"; +in + +let gallium_ = galliumDrivers; dri_ = driDrivers; vulkan_ = vulkanDrivers; in + +let + galliumDrivers = + ["svga"] + ++ (if gallium_ == null + then defaultGalliumDrivers + else gallium_) + ++ ["swrast"]; + driDrivers = + (if dri_ == null + then defaultDriDrivers + else dri_) ++ ["swrast"]; + vulkanDrivers = + if vulkan_ == null + then defaultVulkanDrivers + else vulkan_; +in + +let version = "17.0.0"; branch = head (splitString "." version); driverLink = "/run/opengl-driver" + optionalString stdenv.isi686 "-32"; @@ -63,14 +99,17 @@ stdenv.mkDerivation { "--with-dri-driverdir=$(drivers)/lib/dri" "--with-dri-searchpath=${driverLink}/lib/dri" "--with-egl-platforms=x11,wayland,drm" - ] ++ (if stdenv.isArm || stdenv.isAarch64 then [ - "--with-gallium-drivers=nouveau,freedreno,vc4,etnaviv,swrast" - "--with-dri-drivers=nouveau,swrast" - ] else [ - "--with-gallium-drivers=svga,i915,ilo,r300,r600,radeonsi,nouveau,swrast" - "--with-dri-drivers=i915,i965,nouveau,radeon,r200,swrast" - ("--with-vulkan-drivers=intel" + optionalString enableRadv ",radeon") - ]) ++ [ + ] + ++ (optional (galliumDrivers != []) + ("--with-gallium-drivers=" + + builtins.concatStringsSep "," galliumDrivers)) + ++ (optional (driDrivers != []) + ("--with-dri-drivers=" + + builtins.concatStringsSep "," driDrivers)) + ++ (optional (vulkanDrivers != []) + ("--with-vulkan-drivers=" + + builtins.concatStringsSep "," vulkanDrivers)) + ++ [ (enableFeature enableTextureFloats "texture-float") (enableFeature grsecEnabled "glx-rts") (enableFeature stdenv.isLinux "dri3") @@ -143,7 +182,7 @@ stdenv.mkDerivation { # set the default search path for DRI drivers; used e.g. by X server substituteInPlace "$dev/lib/pkgconfig/dri.pc" --replace '$(drivers)' "${driverLink}" - '' + optionalString (!(stdenv.isArm || stdenv.isAarch64)) '' + '' + optionalString (builtins.elem "intel" vulkanDrivers) '' # move share/vulkan/icd.d/ mv $out/share/ $drivers/ # Update search path used by Vulkan (it's pointing to $out but |