wip: crocus/rusticl/elk/hasvk local changes before h264 cherry-pick

This commit is contained in:
elwrcl committed 2026-07-21 14:26:36 +03:00
1 parent 60a99fd3d3
commit 7e82b85d19
35 files changed
+1177 -191

No files matched your search

+192 -50
View File
@@ -1,58 +1,200 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
description = "intel-hard-graphics / clvk development";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs =
{ self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
# HD 4000 (Gen7) PCI ID: 8086:0166
pciId = "8086:0166";
defaultClvkBuildDir = "/home/elars/ProjectsHDD/Drivers/clvk/build";
commonBuildInputs = with pkgs; [
llvmPackages_21.clang-unwrapped
llvmPackages_21.llvm.dev
llvmPackages_21.libclang
llvmPackages_21.bintools
python3Packages.packaging
python3Packages.pyyaml
python3Packages.mako
python3
cargo
meson
ninja
pkg-config
spirv-llvm-translator
spirv-tools
rust-bindgen
rustc
vkmark
vulkan-headers
vulkan-loader
vulkan-tools
shaderc
libpciaccess
opencl-headers
libclc
bison
flex
libdrm
libelf
expat
zlib
zstd
libx11
ocl-icd
libxcb
cmake
libxext
libxfixes
libxrandr
libxshmfence
wayland
wayland-protocols
wayland-scanner
xorgproto
xorg.libXxf86vm
xorg.xcbutilkeysyms
(python3.withPackages (
ps: with ps; [
pyopencl
opencv4
numpy
]
))
clinfo
strace
clpeak
pocl
gdb
];
commonShellVars = ''
export LIBRARY_PATH=${pkgs.llvmPackages_21.clang-unwrapped.lib}/lib:$LIBRARY_PATH
export LIBCLANG_PATH=${pkgs.llvmPackages_21.libclang.lib}/lib
export BINDGEN_EXTRA_CLANG_ARGS="-I${pkgs.llvmPackages_21.clang-unwrapped}/lib/clang/21/include"
export C_INCLUDE_PATH=${pkgs.opencl-headers}/include:$C_INCLUDE_PATH
export LIBRARY_PATH=${pkgs.ocl-icd}/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH="${pkgs.vulkan-loader}/lib:$LD_LIBRARY_PATH"
'';
# 32-bit (i686) build için: L4D2 gibi 32-bit oyunlarla test amaçlı.
# clvk/rusticl/OpenCL burada yok — sadece hasvk (vulkan_hasvk) + crocus
# için gereken Vulkan/GL/WSI kütüphaneleri, i686 varyantlarıyla.
pkgs32 = pkgs.pkgsi686Linux;
i686BuildInputs = with pkgs32; [
libdrm
libelf
libpciaccess
expat
zlib
zstd
libx11
libxcb
libxext
libxfixes
libxrandr
libxshmfence
wayland
wayland-protocols
xorgproto
xorg.libXxf86vm
xorg.xcbutilkeysyms
vulkan-headers
vulkan-loader
llvmPackages_21.llvm.dev
llvmPackages_21.clang-unwrapped
llvmPackages_21.libclang
spirv-llvm-translator
spirv-tools
libclc
# crocus + hasvk (with_driver_using_cl) libclc'ye hard-dependency,
# rusticl/opencl kapalı olsa bile gerekiyor
];
# Build araçları (meson/ninja/python/bison/flex/pkg-config vs.) i686'da
# da bulunur ama host mimarisinde çalıştırılmaları yeterli; yine de
# pkgsi686Linux'tan almak pkg-config'in .pc arama yollarını tutarlı
# tutar. cmake/rust burada gerekmiyor (clvk 32-bit hedefi değil).
i686NativeBuildInputs = with pkgs32; [
meson
ninja
pkg-config
python3
python3Packages.packaging
python3Packages.pyyaml
python3Packages.mako
bison
flex
wayland-scanner
];
in
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
llvmPkgs = pkgs.llvmPackages_19;
in
{
devShells.default = pkgs.mkShell {
name = "mesa-crocus-opencl";
packages = with pkgs; [
# build tools
meson
ninja
pkg-config
cmake
python3
python3Packages.packaging
# LLVM stack
llvmPkgs.llvm.dev
llvmPkgs.clang
llvmPkgs.libclc
# Rust
rust-bindgen
rustc
cargo
# Mesa deps
libdrm
expat
zlib
zstd
glslang
libffi
elfutils
];
devShells.${system} = {
# nix develop = intel-hard-graphics shell
default = pkgs.mkShell {
buildInputs = commonBuildInputs;
shellHook = ''
export PKG_CONFIG_PATH=${pkgs.llvmPackages_19.libclc}/share/pkgconfig:$PKG_CONFIG_PATH
${commonShellVars}
export LD_LIBRARY_PATH=$PWD/build/src/gallium/targets/rusticl:$LD_LIBRARY_PATH
export RUSTICL_ENABLE=crocus
mkdir -p $PWD/.icd-vendors
ln -sf $PWD/build/src/gallium/targets/rusticl/rusticl.icd $PWD/.icd-vendors/rusticl.icd
ln -sf ${pkgs.pocl}/etc/OpenCL/vendors/pocl.icd $PWD/.icd-vendors/pocl.icd
export OCL_ICD_VENDORS=$PWD/.icd-vendors
echo "=== intel-hard-graphics ==="
echo "OCL_ICD_VENDORS=$OCL_ICD_VENDORS"
echo "RUSTICL_ENABLE=$RUSTICL_ENABLE"
echo ""
'';
};
}
);
# nix develop .#clvk = clvk shell
clvk = pkgs.mkShell {
buildInputs = commonBuildInputs;
shellHook = ''
${commonShellVars}
CLVK_BUILD_DIR="''${CLVK_BUILD_DIR:-${defaultClvkBuildDir}}"
if [ ! -d "$CLVK_BUILD_DIR" ]; then
echo "UYARI: clvk build dizini bulunamadi: $CLVK_BUILD_DIR"
echo "CLVK_BUILD_DIR ortam degiskeniyle dogru yolu ver, ornek:"
echo " CLVK_BUILD_DIR=/gercek/yol nix develop .#clvk"
else
export LD_LIBRARY_PATH="$CLVK_BUILD_DIR:$LD_LIBRARY_PATH"
fi
export MESA_VK_DEVICE_SELECT="${pciId}"
echo "=== clvk ==="
echo "CLVK_BUILD_DIR=$CLVK_BUILD_DIR"
echo "MESA_VK_DEVICE_SELECT=$MESA_VK_DEVICE_SELECT"
echo ""
'';
};
# nix develop .#i686 = 32-bit hasvk/crocus build shell (L4D2 testi için)
i686 = pkgs32.mkShell {
buildInputs = i686BuildInputs;
nativeBuildInputs = i686NativeBuildInputs;
shellHook = ''
export MESA_VK_DEVICE_SELECT="${pciId}"
echo "=== intel-hard-graphics (i686 / 32-bit) ==="
echo "CC=$CC"
echo "meson setup build32 --buildtype=debugoptimized \\"
echo " -Dgallium-drivers=crocus -Dvulkan-drivers=intel_hasvk \\"
echo " -Dplatforms=x11 -Degl=disabled -Dglx=disabled -Dgbm=disabled \\"
echo " -Dopengl=false -Dgles1=disabled -Dgles2=disabled \\"
echo " -Dgallium-rusticl=false -Dmicrosoft-clc=disabled -Dllvm=enabled"
echo ""
'';
};
};
};
}