From a1f57027551caac627c56f085233744533576f11 Mon Sep 17 00:00:00 2001 From: Jona Stubbe Date: Wed, 22 Aug 2018 19:27:23 +0200 Subject: mesa: restructure driver selection to be more architecture-neutral This allows Mesa to also build on ppc64le. --- pkgs/development/libraries/mesa/default.nix | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'pkgs/development/libraries/mesa') diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index e1a9477dcd6..2f8a4bda88a 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -24,24 +24,25 @@ with stdenv.lib; if ! lists.elem stdenv.system platforms.mesaPlatforms then - throw "unsupported platform for Mesa" + throw "${stdenv.system}: unsupported platform for Mesa" else let - defaultGalliumDrivers = - if stdenv.isAarch32 - then ["virgl" "nouveau" "freedreno" "vc4" "etnaviv" "imx"] - else if stdenv.isAarch64 - then ["virgl" "nouveau" "vc4" ] - else ["virgl" "svga" "i915" "r300" "r600" "radeonsi" "nouveau"]; - defaultDriDrivers = - if (stdenv.isAarch32 || stdenv.isAarch64) - then ["nouveau"] - else ["i915" "i965" "nouveau" "radeon" "r200"]; + inherit (stdenv) hostPlatform; + defaultGalliumDrivers = [ "virgl" "nouveau" ] + ++ (if hostPlatform.isAarch32 || hostPlatform.isAarch64 then + [ "vc4" ] + ++ lib.optionals hostPlatform.isAarch64 [ "freedreno" "etnaviv" "imx" ] + else + [ "r300" "r600" "radeonsi"] + ++ lib.optionals hostPlatform.isx86 [ "i915" "svga" ] + ); + defaultDriDrivers = [ "nouveau" ] + ++ lib.optionals (!hostPlatform.isAarch32 && !hostPlatform.isAarch64) [ "radeon" "r200" ] + ++ lib.optionals hostPlatform.isx86 [ "i915" "i965" ]; defaultVulkanDrivers = - if (stdenv.isAarch32 || stdenv.isAarch64) - then [] - else ["intel"] ++ lib.optional enableRadv "radeon"; + lib.optional hostPlatform.isx86 "intel" + ++ lib.optional enableRadv "radeon"; in let gallium_ = galliumDrivers; dri_ = driDrivers; vulkan_ = vulkanDrivers; in -- cgit 1.4.1 From 4688f4078fa655fa3e56a8a4b2591fb195a7eceb Mon Sep 17 00:00:00 2001 From: Jona Stubbe Date: Wed, 22 Aug 2018 23:48:38 +0200 Subject: restructure driver selection to show conditions for which each driver is selected --- pkgs/development/libraries/mesa/default.nix | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'pkgs/development/libraries/mesa') diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index 2f8a4bda88a..6787a4dddbb 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -29,16 +29,18 @@ else let inherit (stdenv) hostPlatform; - defaultGalliumDrivers = [ "virgl" "nouveau" ] - ++ (if hostPlatform.isAarch32 || hostPlatform.isAarch64 then - [ "vc4" ] - ++ lib.optionals hostPlatform.isAarch64 [ "freedreno" "etnaviv" "imx" ] - else - [ "r300" "r600" "radeonsi"] - ++ lib.optionals hostPlatform.isx86 [ "i915" "svga" ] - ); - defaultDriDrivers = [ "nouveau" ] - ++ lib.optionals (!hostPlatform.isAarch32 && !hostPlatform.isAarch64) [ "radeon" "r200" ] + # platforms that have PCIe slots and thus can use most non-integrated GPUs + pciePlatform = !hostPlatform.isAarch32 && !hostPlatform.isAarch64; + defaultGalliumDrivers = [ "virgl" ] + ++ lib.optionals pciePlatform [ "r300" "r600" "radeonsi" ] + ++ lib.optionals (pciePlatform || hostPlatform.isAarch32 || hostPlatform.isAarch64) [ "nouveau" ] + ++ lib.optionals hostPlatform.isx86 [ "i915" "svga" ] + ++ lib.optionals (hostPlatform.isAarch32 || hostPlatform.isAarch64) [ "vc4" ] + ++ lib.optionals hostPlatform.isAarch64 [ "freedreno" "etnaviv" "imx" ] + ; + defaultDriDrivers = [ ] + ++ lib.optionals pciePlatform [ "radeon" "r200" ] + ++ lib.optionals (pciePlatform || hostPlatform.isAarch32 || hostPlatform.isAarch64) [ "nouveau" ] ++ lib.optionals hostPlatform.isx86 [ "i915" "i965" ]; defaultVulkanDrivers = lib.optional hostPlatform.isx86 "intel" -- cgit 1.4.1