From eb799f365b3a42ad35f3347d2a7194fa826a2039 Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 28 Jan 2023 14:25:21 +0300 Subject: [PATCH 01/14] libclc: 14.0.6 -> 15.0.7 --- pkgs/development/libraries/libclc/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/libclc/default.nix b/pkgs/development/libraries/libclc/default.nix index 14a20a957967..647079ae2fb4 100644 --- a/pkgs/development/libraries/libclc/default.nix +++ b/pkgs/development/libraries/libclc/default.nix @@ -7,13 +7,13 @@ in stdenv.mkDerivation rec { pname = "libclc"; - version = "14.0.6"; + version = "15.0.7"; src = fetchFromGitHub { owner = "llvm"; repo = "llvm-project"; rev = "llvmorg-${version}"; - sha256 = "sha256-vffu4HilvYwtzwgq+NlS26m65DGbp6OSSne2aje1yJE="; + sha256 = "sha256-wjuZQyXQ/jsmvy6y1aksCcEDXGBjuhpgngF3XQJ/T4s="; }; sourceRoot = "source/libclc"; From f4a78e4b2cc3c00570a22792bc03c4dad507e241 Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 28 Jan 2023 14:37:45 +0300 Subject: [PATCH 02/14] mesa: fix build --- pkgs/development/libraries/mesa/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index 2225019d1d54..a84f8ab25484 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -253,6 +253,10 @@ self = stdenv.mkDerivation { NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [ "-fno-common" ] ++ lib.optionals enableOpenCL [ "-UPIPE_SEARCH_DIR" "-DPIPE_SEARCH_DIR=\"${placeholder "opencl"}/lib/gallium-pipe\"" + + # Work around regression from https://github.com/NixOS/nixpkgs/pull/210004 + # TODO(trofi): remove + "--sysroot=/" ]; passthru = { From ea8fb54acb304c501d3f164c40c808651f927113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sat, 28 Jan 2023 09:07:46 +0100 Subject: [PATCH 03/14] mesa: use LLVM 15, remove global spirv-translator override --- pkgs/development/libraries/mesa/default.nix | 10 ++++++++-- pkgs/top-level/all-packages.nix | 4 +--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index a84f8ab25484..b875f8252370 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -22,7 +22,7 @@ , cmake , rustc , rust-bindgen -, spirv-llvm-translator_14 +, spirv-llvm-translator }: /** Packaging design: @@ -44,11 +44,17 @@ let withLibdrm = lib.meta.availableOn stdenv.hostPlatform libdrm; + # Align all the Mesa versions used. Required to prevent explosions when + # two different LLVMs are loaded in the same process. + # FIXME: these should really go into some sort of versioned LLVM package set rust-bindgen' = rust-bindgen.override { rust-bindgen-unwrapped = rust-bindgen.unwrapped.override { clang = llvmPackages.clang; }; }; + spirv-llvm-translator' = spirv-llvm-translator.override { + inherit (llvmPackages) llvm; + }; self = stdenv.mkDerivation { pname = "mesa"; @@ -146,7 +152,7 @@ self = stdenv.mkDerivation { ] ++ lib.optionals (lib.elem "wayland" eglPlatforms) [ wayland wayland-protocols ] ++ lib.optionals stdenv.isLinux [ libomxil-bellagio libva-minimal ] ++ lib.optionals stdenv.isDarwin [ libunwind ] - ++ lib.optionals enableOpenCL [ libclc llvmPackages.clang llvmPackages.clang-unwrapped rustc rust-bindgen' spirv-llvm-translator_14 ] + ++ lib.optionals enableOpenCL [ libclc llvmPackages.clang llvmPackages.clang-unwrapped rustc rust-bindgen' spirv-llvm-translator' ] ++ lib.optional withValgrind valgrind-light # Mesa will not build zink when gallium-drivers=auto ++ lib.optional (lib.elem "zink" galliumDrivers) vulkan-loader; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 63a91e4aa0f3..6576523942f2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15913,8 +15913,6 @@ with pkgs; spirv-llvm-translator = callPackage ../development/compilers/spirv-llvm-translator { }; - spirv-llvm-translator_14 = callPackage ../development/compilers/spirv-llvm-translator { llvm = llvm_14; }; - sqldeveloper = callPackage ../development/tools/database/sqldeveloper { jdk = oraclejdk; }; @@ -22035,7 +22033,7 @@ with pkgs; libGLU = mesa_glu; mesa = callPackage ../development/libraries/mesa { - llvmPackages = llvmPackages_latest; + llvmPackages = llvmPackages_15; stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv; inherit (darwin.apple_sdk_11_0.frameworks) OpenGL; inherit (darwin.apple_sdk_11_0.libs) Xplugin; From f416128e90ac75bec060e8b9435fe9c38423c036 Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 28 Jan 2023 14:26:03 +0300 Subject: [PATCH 04/14] mesa: simplify opencl patch --- pkgs/development/libraries/mesa/opencl.patch | 51 ++++---------------- 1 file changed, 10 insertions(+), 41 deletions(-) diff --git a/pkgs/development/libraries/mesa/opencl.patch b/pkgs/development/libraries/mesa/opencl.patch index 02558aaa825d..fb4da5cf7a0a 100644 --- a/pkgs/development/libraries/mesa/opencl.patch +++ b/pkgs/development/libraries/mesa/opencl.patch @@ -1,8 +1,8 @@ diff --git a/meson.build b/meson.build -index e32338b3f9a..fae804fd41e 100644 +index 172c64a7c70..05961e56926 100644 --- a/meson.build +++ b/meson.build -@@ -1894,7 +1894,7 @@ endif +@@ -1900,7 +1900,7 @@ endif dep_clang = null_dep if with_clc @@ -29,51 +29,20 @@ index 6f307018815..ab84eb1006c 100644 'platforms', type : 'array', diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build -index 7af210b5693..ff6ac8c61ca 100644 +index db3586bd7fb..4d914206d21 100644 --- a/src/gallium/targets/opencl/meson.build +++ b/src/gallium/targets/opencl/meson.build -@@ -30,6 +30,7 @@ if with_ld_version_script +@@ -39,7 +39,8 @@ if dep_llvm.version().version_compare('>=10.0.0') + polly_isl_dep = cpp.find_library('PollyISL', dirs : llvm_libdir, required : false) endif - llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir') +-dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false) +clang_libdir = get_option('clang-libdir') - opencl_libname = with_opencl_icd ? 'MesaOpenCL' : 'OpenCL' ++dep_clang = cpp.find_library('clang-cpp', dirs : clang_libdir, required : false) - polly_dep = null_dep -@@ -60,19 +61,19 @@ else - endif - if not _shared_llvm or not (dep_clang.found() and dep_clang_usable) - dep_clang = [ -- cpp.find_library('clangCodeGen', dirs : llvm_libdir), -- cpp.find_library('clangFrontendTool', dirs : llvm_libdir), -- cpp.find_library('clangFrontend', dirs : llvm_libdir), -- cpp.find_library('clangDriver', dirs : llvm_libdir), -- cpp.find_library('clangSerialization', dirs : llvm_libdir), -- cpp.find_library('clangParse', dirs : llvm_libdir), -- cpp.find_library('clangSema', dirs : llvm_libdir), -- cpp.find_library('clangAnalysis', dirs : llvm_libdir), -- cpp.find_library('clangAST', dirs : llvm_libdir), -- cpp.find_library('clangASTMatchers', dirs : llvm_libdir), -- cpp.find_library('clangEdit', dirs : llvm_libdir), -- cpp.find_library('clangLex', dirs : llvm_libdir), -- cpp.find_library('clangBasic', dirs : llvm_libdir), -+ cpp.find_library('clangCodeGen', dirs : clang_libdir), -+ cpp.find_library('clangFrontendTool', dirs : clang_libdir), -+ cpp.find_library('clangFrontend', dirs : clang_libdir), -+ cpp.find_library('clangDriver', dirs : clang_libdir), -+ cpp.find_library('clangSerialization', dirs : clang_libdir), -+ cpp.find_library('clangParse', dirs : clang_libdir), -+ cpp.find_library('clangSema', dirs : clang_libdir), -+ cpp.find_library('clangAnalysis', dirs : clang_libdir), -+ cpp.find_library('clangAST', dirs : clang_libdir), -+ cpp.find_library('clangASTMatchers', dirs : clang_libdir), -+ cpp.find_library('clangEdit', dirs : clang_libdir), -+ cpp.find_library('clangLex', dirs : clang_libdir), -+ cpp.find_library('clangBasic', dirs : clang_libdir), - polly_dep, polly_isl_dep, - ] - # check clang once more -@@ -119,7 +120,7 @@ if with_opencl_icd + # meson will return clang-cpp from system dirs if it's not found in llvm_libdir + linker_rpath_arg = '-Wl,--rpath=@0@'.format(llvm_libdir) +@@ -123,7 +124,7 @@ if with_opencl_icd configuration : _config, input : 'mesa.icd.in', output : 'mesa.icd', From 678bcd522a8efefe0ebfb69e768e15c9841f7e23 Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 28 Jan 2023 14:36:16 +0300 Subject: [PATCH 05/14] mesa: add libzstd Will be used for shader caches, should make loading them slightly faster. --- pkgs/development/libraries/mesa/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index b875f8252370..b18a380f6fad 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -23,6 +23,7 @@ , rustc , rust-bindgen , spirv-llvm-translator +, zstd }: /** Packaging design: @@ -149,6 +150,7 @@ self = stdenv.mkDerivation { libX11 libXext libxcb libXt libXfixes libxshmfence libXrandr libffi libvdpau libelf libXvMC libpthreadstubs openssl /*or another sha1 provider*/ + zstd ] ++ lib.optionals (lib.elem "wayland" eglPlatforms) [ wayland wayland-protocols ] ++ lib.optionals stdenv.isLinux [ libomxil-bellagio libva-minimal ] ++ lib.optionals stdenv.isDarwin [ libunwind ] From 5074173a5391bf67bdee59ac675eb38d4bfedeec Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 28 Jan 2023 14:38:19 +0300 Subject: [PATCH 06/14] mesa: build intel-nullhw Vulkan layer Useful for debugging --- pkgs/development/libraries/mesa/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index b18a380f6fad..1030bafdd037 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -10,7 +10,7 @@ # upstream Mesa defaults to only enabling swrast (aka lavapipe) on aarch64 for some reason, so force building the others , vulkanDrivers ? if (stdenv.isLinux && stdenv.isAarch64) then [ "swrast" "broadcom" "freedreno" "panfrost" ] else [ "auto" ] , eglPlatforms ? [ "x11" ] ++ lib.optionals stdenv.isLinux [ "wayland" ] -, vulkanLayers ? lib.optionals (!stdenv.isDarwin) [ "device-select" "overlay" ] # No Vulkan support on Darwin +, vulkanLayers ? lib.optionals (!stdenv.isDarwin) [ "device-select" "overlay" "intel-nullhw" ] # No Vulkan support on Darwin , OpenGL, Xplugin , withValgrind ? lib.meta.availableOn stdenv.hostPlatform valgrind-light && !valgrind-light.meta.broken, valgrind-light , enableGalliumNine ? stdenv.isLinux From 07e13abffc27dc99625ab16537f8dfda39272556 Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 28 Jan 2023 15:30:04 +0300 Subject: [PATCH 07/14] directx-headers: init at 1.608.2 --- .../libraries/directx-headers/default.nix | 25 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 27 insertions(+) create mode 100644 pkgs/development/libraries/directx-headers/default.nix diff --git a/pkgs/development/libraries/directx-headers/default.nix b/pkgs/development/libraries/directx-headers/default.nix new file mode 100644 index 000000000000..3ac15bb85e24 --- /dev/null +++ b/pkgs/development/libraries/directx-headers/default.nix @@ -0,0 +1,25 @@ +{ lib, stdenv, fetchFromGitHub, meson, ninja }: +stdenv.mkDerivation rec { + pname = "directx-headers"; + version = "1.608.2"; + + src = fetchFromGitHub { + owner = "microsoft"; + repo = "DirectX-Headers"; + rev = "v${version}"; + hash = "sha256-F0riTDJpydqe4yhE9GKSSvnRI0Sl3oY2sOP+H/vDHG0="; + }; + + nativeBuildInputs = [ meson ninja ]; + + # tests require WSL2 + mesonFlags = [ "-Dbuild-test=false" ]; + + meta = with lib; { + description = "Official D3D12 headers from Microsoft"; + homepage = "https://github.com/microsoft/DirectX-Headers"; + license = licenses.mit; + maintainers = with maintainers; [ k900 ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6576523942f2..f1368c98145b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24222,6 +24222,8 @@ with pkgs; diod = callPackage ../servers/diod { lua = lua5_1; }; + directx-headers = callPackage ../development/libraries/directx-headers {}; + directx-shader-compiler = callPackage ../tools/graphics/directx-shader-compiler {}; dkimproxy = callPackage ../servers/mail/dkimproxy { }; From 17af0cdc155f38bb3b14ffd5aff0169cd9a2947e Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 28 Jan 2023 16:20:49 +0300 Subject: [PATCH 08/14] mesa: enable RT on Intel hardware --- pkgs/development/libraries/mesa/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index 1030bafdd037..3f3fd66cfb2d 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -137,6 +137,9 @@ self = stdenv.mkDerivation { "-Dgbm-backends-path=${libglvnd.driverLink}/lib/gbm:${placeholder "out"}/lib/gbm" ] ++ lib.optionals stdenv.isLinux [ "-Dglvnd=true" + + # Enable RT for Intel hardware + "-Dintel-clc=enabled" ] ++ lib.optionals enableOpenCL [ "-Dgallium-opencl=icd" # Enable the gallium OpenCL frontend "-Dgallium-rusticl=true" "-Drust_std=2021" @@ -164,7 +167,7 @@ self = stdenv.mkDerivation { nativeBuildInputs = [ meson pkg-config ninja intltool bison flex file - python3Packages.python python3Packages.Mako + python3Packages.python python3Packages.Mako python3Packages.ply jdupes glslang ] ++ lib.optionals (lib.elem "wayland" eglPlatforms) [ wayland-scanner From 96978011e6b6c6364f126773c5dcfeeb0827d7af Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 28 Jan 2023 16:21:49 +0300 Subject: [PATCH 09/14] mesa: enable SPIR-V support for Clover --- pkgs/development/libraries/mesa/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index 3f3fd66cfb2d..10073cb689ac 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -141,7 +141,11 @@ self = stdenv.mkDerivation { # Enable RT for Intel hardware "-Dintel-clc=enabled" ] ++ lib.optionals enableOpenCL [ - "-Dgallium-opencl=icd" # Enable the gallium OpenCL frontend + # Clover, old OpenCL frontend + "-Dgallium-opencl=icd" + "-Dopencl-spirv=true" + + # Rusticl, new OpenCL frontend "-Dgallium-rusticl=true" "-Drust_std=2021" "-Dclang-libdir=${llvmPackages.clang-unwrapped.lib}/lib" ] ++ lib.optional enablePatentEncumberedCodecs From 677e5a1b3a1c29066dfebb604b9e8c6998e031d5 Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 28 Jan 2023 16:22:24 +0300 Subject: [PATCH 10/14] mesa: clean up, allow building with dozen --- pkgs/development/libraries/mesa/default.nix | 26 ++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index 10073cb689ac..066e0fc08475 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -19,11 +19,11 @@ , enablePatentEncumberedCodecs ? true , libclc , jdupes -, cmake , rustc , rust-bindgen , spirv-llvm-translator , zstd +, directx-headers }: /** Packaging design: @@ -57,6 +57,9 @@ let inherit (llvmPackages) llvm; }; + haveWayland = lib.elem "wayland" eglPlatforms; + haveZink = lib.elem "zink" galliumDrivers; + haveDozen = (lib.elem "d3d12" galliumDrivers) || (lib.elem "microsoft-experimental" vulkanDrivers); self = stdenv.mkDerivation { pname = "mesa"; inherit version; @@ -98,7 +101,11 @@ self = stdenv.mkDerivation { outputs = [ "out" "dev" "drivers" ] ++ lib.optional enableOSMesa "osmesa" ++ lib.optional stdenv.isLinux "driversdev" - ++ lib.optional enableOpenCL "opencl"; + ++ lib.optional enableOpenCL "opencl" + # the Dozen drivers depend on libspirv2dxil, but link it statically, and + # libspirv2dxil itself is pretty chonky, so relocate it to its own output + # in case anything wants to use it at some point + ++ lib.optional haveDozen "spirv2dxil"; # FIXME: this fixes rusticl/iris segfaulting on startup, _somehow_. # Needs more investigating. @@ -129,6 +136,7 @@ self = stdenv.mkDerivation { "-Domx-libs-path=${placeholder "drivers"}/lib/bellagio" "-Dva-libs-path=${placeholder "drivers"}/lib/dri" "-Dd3d-drivers-path=${placeholder "drivers"}/lib/d3d" + "-Dgallium-nine=${lib.boolToString enableGalliumNine}" # Direct3D in Wine "-Dosmesa=${lib.boolToString enableOSMesa}" # used by wine "-Dmicrosoft-clc=disabled" # Only relevant on Windows (OpenCL 1.2 API on top of D3D12) @@ -158,13 +166,13 @@ self = stdenv.mkDerivation { libffi libvdpau libelf libXvMC libpthreadstubs openssl /*or another sha1 provider*/ zstd - ] ++ lib.optionals (lib.elem "wayland" eglPlatforms) [ wayland wayland-protocols ] + ] ++ lib.optionals haveWayland [ wayland wayland-protocols ] ++ lib.optionals stdenv.isLinux [ libomxil-bellagio libva-minimal ] ++ lib.optionals stdenv.isDarwin [ libunwind ] ++ lib.optionals enableOpenCL [ libclc llvmPackages.clang llvmPackages.clang-unwrapped rustc rust-bindgen' spirv-llvm-translator' ] ++ lib.optional withValgrind valgrind-light - # Mesa will not build zink when gallium-drivers=auto - ++ lib.optional (lib.elem "zink" galliumDrivers) vulkan-loader; + ++ lib.optional haveZink vulkan-loader + ++ lib.optional haveDozen directx-headers; depsBuildBuild = [ pkg-config ]; @@ -173,9 +181,7 @@ self = stdenv.mkDerivation { intltool bison flex file python3Packages.python python3Packages.Mako python3Packages.ply jdupes glslang - ] ++ lib.optionals (lib.elem "wayland" eglPlatforms) [ - wayland-scanner - ]; + ] ++ lib.optional haveWayland wayland-scanner; propagatedBuildInputs = with xorg; [ libXdamage libXxf86vm @@ -232,6 +238,10 @@ self = stdenv.mkDerivation { for js in $drivers/share/vulkan/{im,ex}plicit_layer.d/*.json; do substituteInPlace "$js" --replace '"libVkLayer_' '"'"$drivers/lib/libVkLayer_" done + '' + lib.optionalString haveDozen '' + mkdir -p $spirv2dxil/{bin,lib} + mv -t $spirv2dxil/lib $out/lib/libspirv_to_dxil* + mv -t $spirv2dxil/bin $out/bin/spirv2dxil ''; postFixup = lib.optionalString stdenv.isLinux '' From e7a2c65ab54f096546c9aad6ae2e4e29e61f2885 Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 28 Jan 2023 16:22:42 +0300 Subject: [PATCH 11/14] mesa: reorganize default driver list Upstream doesn't enable lots of things we might actually want by default, so just specify everything manually. Each list is grouped into three parts: arch-independent drivers, aarch64-only drivers and x86_64 only drivers. --- pkgs/development/libraries/mesa/default.nix | 49 +++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index 066e0fc08475..75fd702badc9 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -6,9 +6,52 @@ , libelf, libvdpau , libglvnd, libunwind , vulkan-loader, glslang -, galliumDrivers ? ["auto"] -# upstream Mesa defaults to only enabling swrast (aka lavapipe) on aarch64 for some reason, so force building the others -, vulkanDrivers ? if (stdenv.isLinux && stdenv.isAarch64) then [ "swrast" "broadcom" "freedreno" "panfrost" ] else [ "auto" ] +, galliumDrivers ? + if stdenv.isLinux then + [ + "d3d12" # WSL emulated GPU (aka Dozen) + "iris" # new Intel + "kmsro" # helper driver for display-only devices + "nouveau" # Nvidia + "radeonsi" # new AMD (GCN+) + "r300" # very old AMD + "r600" # less old AMD + "swrast" # software renderer (aka LLVMPipe) + "svga" # VMWare virtualized GPU + "virgl" # QEMU virtualized GPU (aka VirGL) + "zink" # generic OpenGL over Vulkan, experimental + ] + ++ lib.optionals stdenv.isAarch64 [ + "etnaviv" # Vivante GPU designs (mostly NXP/Marvell SoCs) + "freedreno" # Qualcomm Adreno (all Qualcomm SoCs) + "lima" # ARM Mali 4xx + "panfrost" # ARM Mali Midgard and up (T/G series) + "tegra" # Nvidia Tegra SoCs + "v3d" # Broadcom VC5 (Raspberry Pi 4) + "vc4" # Broadcom VC4 (Raspberry Pi 0-3) + ] ++ lib.optionals stdenv.isx86_64 [ + "crocus" # Intel legacy, x86_64 only + ] + else [ "auto" ] +, vulkanDrivers ? + if stdenv.isLinux then + [ + "amd" # AMD (aka RADV) + "intel" # Intel (aka ANV) + "microsoft-experimental" # WSL virtualized GPU (aka DZN/Dozen) + "swrast" # software renderer (aka Lavapipe) + "virtio-experimental" # QEMU virtualized GPU (aka VirGL) + ] + ++ lib.optionals stdenv.isAarch64 [ + "broadcom" # Broadcom VC5 (Raspberry Pi 4, aka V3D) + "freedreno" # Qualcomm Adreno (all Qualcomm SoCs) + "imagination-experimental" # PowerVR Rogue (currently N/A) + "panfrost" # ARM Mali Midgard and up (T/G series) + ] + ++ lib.optionals stdenv.isx86_64 [ + "intel_hasvk" # Intel Haswell/Broadwell, experimental, x86_64 only + ] + else [ "auto" ] , eglPlatforms ? [ "x11" ] ++ lib.optionals stdenv.isLinux [ "wayland" ] , vulkanLayers ? lib.optionals (!stdenv.isDarwin) [ "device-select" "overlay" "intel-nullhw" ] # No Vulkan support on Darwin , OpenGL, Xplugin From 14e04064d36a19662c602c07db66cf87e1f5636d Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 28 Jan 2023 17:09:48 +0300 Subject: [PATCH 12/14] mesa: demote iris to x86_64 only --- pkgs/development/libraries/mesa/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index 75fd702badc9..c8968c5250f8 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -10,7 +10,6 @@ if stdenv.isLinux then [ "d3d12" # WSL emulated GPU (aka Dozen) - "iris" # new Intel "kmsro" # helper driver for display-only devices "nouveau" # Nvidia "radeonsi" # new AMD (GCN+) @@ -30,6 +29,7 @@ "v3d" # Broadcom VC5 (Raspberry Pi 4) "vc4" # Broadcom VC4 (Raspberry Pi 0-3) ] ++ lib.optionals stdenv.isx86_64 [ + "iris" # new Intel, could work on non-x86_64 with PCIe cards, but doesn't build as of 22.3.4 "crocus" # Intel legacy, x86_64 only ] else [ "auto" ] From b071fdb268fdad2ea424f5914d895f3896c20b84 Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 28 Jan 2023 17:21:16 +0300 Subject: [PATCH 13/14] mesa: also demote anv --- pkgs/development/libraries/mesa/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index c8968c5250f8..a3b48ffa745c 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -37,7 +37,6 @@ if stdenv.isLinux then [ "amd" # AMD (aka RADV) - "intel" # Intel (aka ANV) "microsoft-experimental" # WSL virtualized GPU (aka DZN/Dozen) "swrast" # software renderer (aka Lavapipe) "virtio-experimental" # QEMU virtualized GPU (aka VirGL) @@ -49,6 +48,7 @@ "panfrost" # ARM Mali Midgard and up (T/G series) ] ++ lib.optionals stdenv.isx86_64 [ + "intel" # Intel (aka ANV), could work on non-x86_64 with PCIe cards, but doesn't build as of 22.3.4 "intel_hasvk" # Intel Haswell/Broadwell, experimental, x86_64 only ] else [ "auto" ] From c304f2646c9877d99c74e7fed2591f2405c384d4 Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 28 Jan 2023 22:51:40 +0300 Subject: [PATCH 14/14] mesa: add udev dependency Enables display hotplug events for Vulkan --- pkgs/development/libraries/mesa/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index a3b48ffa745c..89526fbda7f4 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -67,6 +67,7 @@ , spirv-llvm-translator , zstd , directx-headers +, udev }: /** Packaging design: @@ -210,7 +211,7 @@ self = stdenv.mkDerivation { libpthreadstubs openssl /*or another sha1 provider*/ zstd ] ++ lib.optionals haveWayland [ wayland wayland-protocols ] - ++ lib.optionals stdenv.isLinux [ libomxil-bellagio libva-minimal ] + ++ lib.optionals stdenv.isLinux [ libomxil-bellagio libva-minimal udev ] ++ lib.optionals stdenv.isDarwin [ libunwind ] ++ lib.optionals enableOpenCL [ libclc llvmPackages.clang llvmPackages.clang-unwrapped rustc rust-bindgen' spirv-llvm-translator' ] ++ lib.optional withValgrind valgrind-light