From f53387e15a15891957971706df1d70321533a79b Mon Sep 17 00:00:00 2001 From: Matej Cotman Date: Tue, 8 Oct 2024 13:04:07 +0300 Subject: [PATCH] ipu6: update packages This updates the ipu6 driver and firmware to a more recent version, which seems to at least work in Chrom{e,ium}. ipu6-drivers now relies on the in-kernel ipu6 kernel driver, so we update our logic and metadata for it. --- nixos/modules/hardware/video/webcam/ipu6.nix | 6 ++--- .../gstreamer/icamerasrc/default.nix | 11 +++++--- .../libraries/ipu6-camera-hal/default.nix | 26 ++++++++++++++----- .../firmware/ipu6-camera-bins/default.nix | 15 ++++++----- .../linux/firmware/ivsc-firmware/default.nix | 6 ++--- .../linux/ipu6-drivers/default.nix | 14 +++++----- .../os-specific/linux/ivsc-driver/default.nix | 6 ++--- pkgs/top-level/linux-kernels.nix | 5 +--- 8 files changed, 52 insertions(+), 37 deletions(-) diff --git a/nixos/modules/hardware/video/webcam/ipu6.nix b/nixos/modules/hardware/video/webcam/ipu6.nix index ae54e24ee2da..803902530dd9 100644 --- a/nixos/modules/hardware/video/webcam/ipu6.nix +++ b/nixos/modules/hardware/video/webcam/ipu6.nix @@ -26,9 +26,9 @@ in config = mkIf cfg.enable { - # Module is upstream as of 6.10 - boot.extraModulePackages = with config.boot.kernelPackages; - optional (kernelOlder "6.10") ipu6-drivers; + # Module is upstream as of 6.10, + # but still needs various out-of-tree i2c and the `intel-ipu6-psys` kernel driver + boot.extraModulePackages = with config.boot.kernelPackages; [ ipu6-drivers ]; hardware.firmware = with pkgs; [ ipu6-camera-bins diff --git a/pkgs/development/libraries/gstreamer/icamerasrc/default.nix b/pkgs/development/libraries/gstreamer/icamerasrc/default.nix index 68485f7e7454..4bbb20c6e41a 100644 --- a/pkgs/development/libraries/gstreamer/icamerasrc/default.nix +++ b/pkgs/development/libraries/gstreamer/icamerasrc/default.nix @@ -6,17 +6,18 @@ , gst_all_1 , ipu6-camera-hal , libdrm +, libva }: -stdenv.mkDerivation { +stdenv.mkDerivation rec { pname = "icamerasrc-${ipu6-camera-hal.ipuVersion}"; - version = "unstable-2023-10-23"; + version = "unstable-2024-09-29"; src = fetchFromGitHub { owner = "intel"; repo = "icamerasrc"; - rev = "528a6f177732def4d5ebc17927220d8823bc8fdc"; - hash = "sha256-Ezcm5OpF/NKvJf5sFeJyvNc2Uq0166GukC9MuNUV2Fs="; + rev = "refs/tags/20240926_1446"; + hash = "sha256-BpIZxkPmSVKqPntwBJjGmCaMSYFCEZHJa4soaMAJRWE="; }; nativeBuildInputs = [ @@ -34,8 +35,10 @@ stdenv.mkDerivation { buildInputs = [ gst_all_1.gstreamer gst_all_1.gst-plugins-base + gst_all_1.gst-plugins-bad ipu6-camera-hal libdrm + libva ]; NIX_CFLAGS_COMPILE = [ diff --git a/pkgs/development/libraries/ipu6-camera-hal/default.nix b/pkgs/development/libraries/ipu6-camera-hal/default.nix index 9c6cc585f9b3..0bbed96ca3af 100644 --- a/pkgs/development/libraries/ipu6-camera-hal/default.nix +++ b/pkgs/development/libraries/ipu6-camera-hal/default.nix @@ -11,6 +11,7 @@ , ipu6-camera-bins , libtool , gst_all_1 +, libdrm # Pick one of # - ipu6 (Tiger Lake) @@ -27,13 +28,13 @@ let in stdenv.mkDerivation { pname = "${ipuVersion}-camera-hal"; - version = "unstable-2023-09-25"; + version = "unstable-2024-09-29"; src = fetchFromGitHub { owner = "intel"; repo = "ipu6-camera-hal"; - rev = "9fa05a90886d399ad3dda4c2ddc990642b3d20c9"; - hash = "sha256-yS1D7o6dsQ4FQkjfwcisOxcP7Majb+4uQ/iW5anMb5c="; + rev = "f98f72b156563fe8373e4f8d017a9f609676bb33"; + hash = "sha256-zVcgKW7/GHYd1oMvsaI77cPyj3G68dL+OXBJDz5+Td4="; }; nativeBuildInputs = [ @@ -41,12 +42,16 @@ stdenv.mkDerivation { pkg-config ]; - PKG_CONFIG_PATH = "${lib.makeLibraryPath [ ipu6-camera-bins ]}/${ipuTarget}/pkgconfig"; cmakeFlags = [ "-DIPU_VER=${ipuVersion}" + "-DTARGET_SUFFIX=-${ipuVersion}" # missing libiacss "-DUSE_PG_LITE_PIPE=ON" + "-DCMAKE_BUILD_TYPE=Release" + "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}" + "-DCMAKE_INSTALL_SUB_PATH=${ipuTarget}" + "-DCMAKE_INSTALL_LIBDIR=lib" ]; NIX_CFLAGS_COMPILE = [ @@ -61,21 +66,28 @@ stdenv.mkDerivation { libtool gst_all_1.gstreamer gst_all_1.gst-plugins-base + libdrm ]; postPatch = '' substituteInPlace src/platformdata/PlatformData.h \ - --replace '/usr/share/' "${placeholder "out"}/share/" + --replace '/usr/share/' "${placeholder "out"}/share/" \ + --replace '#define CAMERA_DEFAULT_CFG_PATH "/etc/camera/"' '#define CAMERA_DEFAULT_CFG_PATH "${placeholder "out"}/etc/camera/"' + ''; + + postInstall = '' + mkdir -p $out/include/${ipuTarget}/ + cp -r $src/include $out/include/${ipuTarget}/libcamhal ''; postFixup = '' for lib in $out/lib/*.so; do - patchelf --add-rpath "${lib.makeLibraryPath [ ipu6-camera-bins ]}/${ipuTarget}" $lib + patchelf --add-rpath "${ipu6-camera-bins}/lib" $lib done ''; passthru = { - inherit ipuVersion; + inherit ipuVersion ipuTarget; }; meta = with lib; { diff --git a/pkgs/os-specific/linux/firmware/ipu6-camera-bins/default.nix b/pkgs/os-specific/linux/firmware/ipu6-camera-bins/default.nix index 4c3bede4fba2..873e0c971d67 100644 --- a/pkgs/os-specific/linux/firmware/ipu6-camera-bins/default.nix +++ b/pkgs/os-specific/linux/firmware/ipu6-camera-bins/default.nix @@ -6,15 +6,15 @@ , zlib }: -stdenv.mkDerivation (finalAttrs: { +stdenv.mkDerivation (finalAttrs: rec { pname = "ipu6-camera-bins"; - version = "unstable-2023-10-26"; + version = "unstable-2024-09-27"; src = fetchFromGitHub { - owner = "intel"; repo = "ipu6-camera-bins"; - rev = "af5ba0cb4a763569ac7514635013e9d870040bcf"; - hash = "sha256-y0pT5M7AKACbquQWLZPYpTPXRC5hipLNL61nhs+cst4="; + owner = "intel"; + rev = "98ca6f2a54d20f171628055938619972514f7a07"; + hash = "sha256-DAjAzHMqX41mrfQVpDUJLw4Zjb9pz6Uy3TJjTGIkd6o="; }; nativeBuildInputs = [ @@ -33,13 +33,14 @@ stdenv.mkDerivation (finalAttrs: { include \ $out/ - install -m 0644 -D LICENSE $out/share/doc/LICENSE + # There is no LICENSE file in the src + # install -m 0644 -D LICENSE $out/share/doc/LICENSE runHook postInstall ''; postFixup = '' - for pcfile in $out/lib/*/pkgconfig/*.pc; do + for pcfile in $out/lib/pkgconfig/*.pc; do substituteInPlace $pcfile \ --replace 'prefix=/usr' "prefix=$out" done diff --git a/pkgs/os-specific/linux/firmware/ivsc-firmware/default.nix b/pkgs/os-specific/linux/firmware/ivsc-firmware/default.nix index 9674cea2226f..931c85470821 100644 --- a/pkgs/os-specific/linux/firmware/ivsc-firmware/default.nix +++ b/pkgs/os-specific/linux/firmware/ivsc-firmware/default.nix @@ -5,13 +5,13 @@ stdenv.mkDerivation { pname = "ivsc-firmware"; - version = "unstable-2023-08-11"; + version = "unstable-2024-06-14"; src = fetchFromGitHub { owner = "intel"; repo = "ivsc-firmware"; - rev = "10c214fea5560060d387fbd2fb8a1af329cb6232"; - hash = "sha256-kEoA0yeGXuuB+jlMIhNm+SBljH+Ru7zt3PzGb+EPBPw="; + rev = "74a01d1208a352ed85d76f959c68200af4ead918"; + hash = "sha256-kHYfeftMtoOsOtVN6+XoDMDHP7uTEztbvjQLpCnKCh0="; }; dontBuild = true; diff --git a/pkgs/os-specific/linux/ipu6-drivers/default.nix b/pkgs/os-specific/linux/ipu6-drivers/default.nix index 304f27dfb43c..d6aafa53a52f 100644 --- a/pkgs/os-specific/linux/ipu6-drivers/default.nix +++ b/pkgs/os-specific/linux/ipu6-drivers/default.nix @@ -5,17 +5,19 @@ , kernel }: -stdenv.mkDerivation { +stdenv.mkDerivation rec { pname = "ipu6-drivers"; - version = "unstable-2023-11-24"; + version = "unstable-2024-10-10"; src = fetchFromGitHub { owner = "intel"; repo = "ipu6-drivers"; - rev = "07f0612eabfdc31df36f5e316a9eae115807804f"; - hash = "sha256-8JRZG6IKJT0qtoqJHm8641kSQMLc4Z+DRzK6FpL9Euk="; + rev = "118952d49ec598f56add50d93fa7bc3ac4a05643"; + hash = "sha256-xdMwINoKrdRHCPMpdZQn86ATi1dAXncMU39LLXS16mc="; }; + patches = [ "${src}/patches/0001-v6.10-IPU6-headers-used-by-PSYS.patch" ]; + postPatch = '' cp --no-preserve=mode --recursive --verbose \ ${ivsc-driver.src}/backport-include \ @@ -47,7 +49,7 @@ stdenv.mkDerivation { license = lib.licenses.gpl2Only; maintainers = [ ]; platforms = [ "x86_64-linux" ]; - # requires 6.1.7 https://github.com/intel/ipu6-drivers/pull/84 - broken = kernel.kernelOlder "6.1.7"; + # requires 6.10 + broken = kernel.kernelOlder "6.10"; }; } diff --git a/pkgs/os-specific/linux/ivsc-driver/default.nix b/pkgs/os-specific/linux/ivsc-driver/default.nix index 74ad354a984f..d9fa513ede87 100644 --- a/pkgs/os-specific/linux/ivsc-driver/default.nix +++ b/pkgs/os-specific/linux/ivsc-driver/default.nix @@ -6,13 +6,13 @@ stdenv.mkDerivation { pname = "ivsc-driver"; - version = "unstable-2023-11-09"; + version = "unstable-2024-09-18"; src = fetchFromGitHub { owner = "intel"; repo = "ivsc-driver"; - rev = "73a044d9633212fac54ea96cdd882ff5ab40573e"; - hash = "sha256-vE5pOtVqjiWovlUMSEoBKTk/qvs8K8T5oY2r7njh0wQ="; + rev = "10f440febe87419d5c82d8fe48580319ea135b54"; + hash = "sha256-jc+8geVquRtaZeIOtadCjY9F162Rb05ptE7dk8kuof0="; }; nativeBuildInputs = kernel.moduleBuildDependencies; diff --git a/pkgs/top-level/linux-kernels.nix b/pkgs/top-level/linux-kernels.nix index 4255d0c036e8..b1e4cbd2d53f 100644 --- a/pkgs/top-level/linux-kernels.nix +++ b/pkgs/top-level/linux-kernels.nix @@ -367,10 +367,7 @@ in { intel-speed-select = if lib.versionAtLeast kernel.version "5.3" then callPackage ../os-specific/linux/intel-speed-select { } else null; - ipu6-drivers = - if kernelOlder "6.10" - then callPackage ../os-specific/linux/ipu6-drivers {} - else null; + ipu6-drivers = callPackage ../os-specific/linux/ipu6-drivers {}; ivsc-driver = callPackage ../os-specific/linux/ivsc-driver {};