Files
nixos-configs/hosts/pinwheel/modules/webcam/default.nix
T
Alexander Heldt 36292c4f14 pinwheel: Fix webcam frame drops and raise resolution to 1080p
With the default 6 icamerasrc buffers the camera HAL ran out of pending
requests and dropped every fourth sensor frame, capping output at ~22.5 fps.
Using 10 buffers keeps the request queue fed and restores 30 fps.
2026-10-22 19:37:42 +02:00

52 lines
1.6 KiB
Nix

{ config, lib, ... }:
{
nixpkgs.overlays = [
(final: prev: {
ipu6epmtl-camera-hal = prev.ipu6epmtl-camera-hal.overrideAttrs (old: {
postPatch = (old.postPatch or "") + ''
substituteInPlace src/v4l2/MediaControl.cpp \
--replace-fail 'static const string ivscName = "Intel IVSC CSI";' \
'static const string ivscName = "Intel CVS";'
'';
});
gst_all_1 = prev.gst_all_1 // {
icamerasrc-ipu6epmtl =
(prev.gst_all_1.icamerasrc-ipu6epmtl.override {
ipu6-camera-hal = final.ipu6epmtl-camera-hal;
}).overrideAttrs
(old: {
version = "20250923_ov02e";
src = final.fetchFromGitHub {
owner = "intel";
repo = "icamerasrc";
tag = "20250923_ov02e";
hash = "sha256-mKRK0Z3dnyvzvoL6BotpVFRtkb53GQw9wUOrHIUoEsA=";
};
});
};
})
];
hardware.ipu6 = {
enable = true;
platform = "ipu6epmtl";
};
services.v4l2-relayd.instances.ipu6.input = {
pipeline = lib.mkForce "icamerasrc buffer-count=10";
width = 1920;
height = 1080;
};
systemd.services.v4l2-relayd-ipu6 = {
preStart = lib.mkOverride 40 ''
mkdir -p "$(dirname "$V4L2_DEVICE_FILE")"
${config.boot.kernelPackages.v4l2loopback.bin}/bin/v4l2loopback-ctl \
add --name "Intel MIPI Camera" --exclusive-caps=1 --buffers 8 \
${toString config.hardware.ipu6.videoDeviceNumber} || [ $? -eq 17 ]
echo /dev/video${toString config.hardware.ipu6.videoDeviceNumber} > "$V4L2_DEVICE_FILE"
'';
};
}