Merge pull request #212799 from mweinelt/ipu6

ipu6  webcam support
This commit is contained in:
Martin Weinelt 2023-03-12 15:57:47 +00:00 committed by GitHub
commit 237e2f744b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 352 additions and 0 deletions

View File

@ -25,5 +25,7 @@
gst-vaapi = callPackage ./vaapi { };
icamerasrc = callPackage ./icamerasrc { };
# note: gst-python is in ./python/default.nix - called under pythonPackages
}

View File

@ -0,0 +1,55 @@
{ lib
, stdenv
, fetchFromGitHub
, autoreconfHook
, pkg-config
, gst_all_1
, ipu6-camera-hal
, libdrm
}:
stdenv.mkDerivation rec {
pname = "icamerasrc";
version = "20221209";
src = fetchFromGitHub {
owner = "intel";
repo = "icamerasrc";
rev = "refs/tags/rpl_plat_${version}_pv";
hash = "sha256-qlV363l4tUjUAa1LiZQq55byKpz1tLESKAXEmgiYHVo=";
};
nativeBuildInputs = [
autoreconfHook
pkg-config
];
preConfigure = ''
# https://github.com/intel/ipu6-camera-hal/issues/1
export CHROME_SLIM_CAMHAL=ON
# https://github.com/intel/icamerasrc/issues/22
export STRIP_VIRTUAL_CHANNEL_CAMHAL=ON
'';
buildInputs = [
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
ipu6-camera-hal
libdrm
];
NIX_CFLAGS_COMPILE = [
# gstcameradeinterlace.cpp:55:10: fatal error: gst/video/video.h: No such file or directory
"-I${gst_all_1.gst-plugins-base.dev}/include/gstreamer-1.0"
];
enableParallelBuilding = true;
meta = with lib; {
description = "GStreamer Plugin for MIPI camera support through the IPU6/IPU6EP/IPU6SE on Intel Tigerlake/Alderlake/Jasperlake platforms";
homepage = "https://github.com/intel/icamerasrc/tree/icamerasrc_slim_api";
license = licenses.lgpl21Plus;
maintainers = with maintainers; [ hexa ];
platforms = [ "x86_64-linux" ];
};
}

View File

@ -0,0 +1,72 @@
{ lib
, stdenv
, fetchFromGitHub
# build
, cmake
, pkg-config
# runtime
, expat
, ipu6-camera-bin
, libtool
, gst_all_1
}:
stdenv.mkDerivation {
pname = "ipu6-camera-hal";
version = "unstable-2023-01-09";
src = fetchFromGitHub {
owner = "intel";
repo = "ipu6-camera-hal";
rev = "37292891c73367d22ba1fc96ea9b6e4546903037";
hash = "sha256-dJvTZt85rt5/v2JXOsfbSY933qffyXW74L0nWdIlqug=";
};
nativeBuildInputs = [
cmake
pkg-config
];
cmakeFlags = [
"-DIPU_VER=${ipu6-camera-bin.ipuVersion}"
# missing libiacss
"-DUSE_PG_LITE_PIPE=ON"
# missing libipu4
"-DENABLE_VIRTUAL_IPU_PIPE=OFF"
];
NIX_CFLAGS_COMPILE = [
"-I${lib.getDev ipu6-camera-bin}/include/ia_imaging"
"-I${lib.getDev ipu6-camera-bin}/include/ia_camera"
];
enableParallelBuilding = true;
buildInputs = [
expat
ipu6-camera-bin
libtool
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
];
preFixup = ''
ls -lah $out/lib/pkgconfig/
sed -Ei \
-e "s,^prefix=.*,prefix=$out," \
-e "s,^exec_prefix=.*,exec_prefix=''${prefix}," \
-e "s,^libdir=.*,libdir=''${prefix}/lib," \
-e "s,^includedir=.*,includedir=''${prefix}/include/libcamhal," \
$out/lib/pkgconfig/libcamhal.pc
'';
meta = with lib; {
description = "HAL for processing of images in userspace";
homepage = "https://github.com/intel/ipu6-camera-hal";
license = licenses.asl20;
maintainers = with maintainers; [ hexa ];
platforms = [ "x86_64-linux" ];
};
}

View File

@ -0,0 +1,69 @@
{ lib
, stdenv
, fetchFromGitHub
# Pick one of
# - ipu6 (Tiger Lake)
# - ipu6ep (Alder Lake)
, ipuVersion ? "ipu6"
}:
stdenv.mkDerivation {
pname = "${ipuVersion}-camera-bin";
version = "unstable-2022-11-12";
src = fetchFromGitHub {
owner = "intel";
repo = "ipu6-camera-bins";
rev = "4694ba7ee51652d29ef41e7fde846b83a2a1c53b";
hash = "sha256-XPT3dbV6Kl1/TEeiQESF4Q4s95hjtiv4VLlqlahQXqE=";
};
sourceRoot = "source/${ipuVersion}";
installPhase = ''
runHook preInstall
mkdir -p $out
cp --no-preserve=mode --recursive \
lib \
include \
$out/
install -D ../LICENSE $out/share/doc
runHook postInstall
'';
postFixup = ''
for pcfile in $out/lib/pkgconfig/*.pc; do
substituteInPlace $pcfile \
--replace 'exec_prefix=/usr' 'exec_prefix=''${prefix}' \
--replace 'prefix=/usr' "prefix=$out" \
--replace 'libdir=/usr/lib' 'libdir=''${prefix}/lib' \
--replace 'includedir=/usr/include' 'includedir=''${prefix}/include'
done
'';
passthru = {
inherit ipuVersion;
};
meta = let
generation = {
ipu6 = "Tiger Lake";
ipu6ep = "Alder Lake";
}.${ipuVersion};
in with lib; {
description = "${generation} IPU firmware and proprietary image processing libraries";
homepage = "https://github.com/intel/ipu6-camera-bins";
license = licenses.issl;
sourceProvenance = with sourceTypes; [
binaryFirmware
];
maintainers = with maintainers; [
hexa
];
platforms = [ "x86_64-linux" ];
};
}

View File

@ -0,0 +1,41 @@
{ lib
, stdenv
, fetchFromGitHub
}:
stdenv.mkDerivation {
pname = "ivsc-firmware";
version = "unstable-2022-11-02";
src = fetchFromGitHub {
owner = "intel";
repo = "ivsc-firmware";
rev = "29c5eff4cdaf83e90ef2dcd2035a9cdff6343430";
hash = "sha256-GuD1oTnDEs0HslJjXx26DkVQIe0eS+js4UoaTDa77ME=";
};
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out/lib/firmware/vsc
cp --no-preserve=mode --recursive ./firmware/* $out/lib/firmware/vsc/
install -D ./LICENSE $out/share/doc
runHook postInstall
'';
meta = with lib; {
description = "Firmware binaries for the Intel Vision Sensing Controller";
homepage = "https://github.com/intel/ivsc-firmware";
license = licenses.issl;
sourceProvenance = with sourceTypes; [
binaryFirmware
];
maintainers = with maintainers; [
hexa
];
platforms = [ "x86_64-linux" ];
};
}

View File

@ -0,0 +1,52 @@
{ lib
, stdenv
, fetchFromGitHub
, ivsc-driver
, kernel
}:
stdenv.mkDerivation rec {
pname = "ipu6-drivers";
version = "unstable-2023-01-17";
src = fetchFromGitHub {
owner = "intel";
repo = pname;
rev = "f83b0747b297cc42325668aaf69471d89253b88e";
hash = "sha256-yl2ZtJUTh1/qmTA8USd+FBCUAY5qNdh4bSvFRPImQNI=";
};
postPatch = ''
cp --no-preserve=mode --recursive --verbose \
${ivsc-driver.src}/backport-include \
${ivsc-driver.src}/drivers \
${ivsc-driver.src}/include \
.
'';
nativeBuildInputs = kernel.moduleBuildDependencies;
makeFlags = kernel.makeFlags ++ [
"KERNELRELEASE=${kernel.modDirVersion}"
"KERNEL_SRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
];
enableParallelBuilding = true;
preInstall = ''
sed -i -e "s,INSTALL_MOD_DIR=,INSTALL_MOD_PATH=$out INSTALL_MOD_DIR=," Makefile
'';
installTargets = [
"modules_install"
];
meta = {
homepage = "https://github.com/intel/ipu6-drivers";
description = "IPU6 kernel driver";
license = lib.licenses.gpl2;
maintainers = with lib.maintainers; [ hexa ];
platforms = [ "x86_64-linux" ];
broken = kernel.kernelOlder "5.15";
};
}

View File

@ -0,0 +1,43 @@
{ lib
, stdenv
, fetchFromGitHub
, kernel
}:
stdenv.mkDerivation rec {
pname = "ivsc-drivers";
version = "unstable-2023-01-06";
src = fetchFromGitHub {
owner = "intel";
repo = "ivsc-driver";
rev = "94ecb88b3ac238d9145ac16230d6e0779bb4fd32";
hash = "sha256-Q7iyKw4WFSX42E4AtoW/zYRKpknWZSU66V5VPAx6AjA=";
};
nativeBuildInputs = kernel.moduleBuildDependencies;
makeFlags = kernel.makeFlags ++ [
"KERNELRELEASE=${kernel.modDirVersion}"
"KERNEL_SRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
];
enableParallelBuilding = true;
preInstall = ''
sed -i -e "s,INSTALL_MOD_DIR=,INSTALL_MOD_PATH=$out INSTALL_MOD_DIR=," Makefile
'';
installTargets = [
"modules_install"
];
meta = {
homepage = "https://github.com/intel/ivsc-drivers";
description = "Intel Vision Sensing Controller kernel driver";
license = lib.licenses.gpl2;
maintainers = with lib.maintainers; [ hexa ];
platforms = [ "x86_64-linux" ];
broken = kernel.kernelOlder "5.15";
};
}

View File

@ -26170,6 +26170,20 @@ with pkgs;
iproute2 = callPackage ../os-specific/linux/iproute { };
ipu6-camera-bin = callPackage ../os-specific/linux/firmware/ipu6-camera-bins {};
ipu6-camera-hal = callPackage ../development/libraries/ipu6-camera-hal {};
ipu6ep-camera-bin = callPackage ../os-specific/linux/firmware/ipu6-camera-bins {
ipuVersion = "ipu6ep";
};
ipu6ep-camera-hal = callPackage ../development/libraries/ipu6-camera-hal {
ipu6-camera-bin = ipu6ep-camera-bin;
};
ivsc-firmware = callPackage ../os-specific/linux/firmware/ivsc-firmware { };
iputils = hiPrio (callPackage ../os-specific/linux/iputils { });
# hiPrio for collisions with inetutils (ping)

View File

@ -351,6 +351,10 @@ in {
intel-speed-select = if lib.versionAtLeast kernel.version "5.3" then callPackage ../os-specific/linux/intel-speed-select { } else null;
ipu6-drivers = callPackage ../os-specific/linux/ipu6-drivers {};
ivsc-driver = callPackage ../os-specific/linux/ivsc-driver {};
ixgbevf = callPackage ../os-specific/linux/ixgbevf {};
it87 = callPackage ../os-specific/linux/it87 {};