From 00475b637b3a908ad4fdf83dad09327b66b1d2ca Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Fri, 2 Oct 2026 09:45:20 +0200 Subject: [PATCH] pinwheel: Give the webcam `v4l2loopback` device more buffers --- hosts/pinwheel/modules/webcam/default.nix | 37 +++++++++++++++-------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/hosts/pinwheel/modules/webcam/default.nix b/hosts/pinwheel/modules/webcam/default.nix index 5a658b5..95df1e3 100644 --- a/hosts/pinwheel/modules/webcam/default.nix +++ b/hosts/pinwheel/modules/webcam/default.nix @@ -1,4 +1,4 @@ -{ ... }: +{ config, lib, ... }: { nixpkgs.overlays = [ (final: prev: { @@ -11,18 +11,19 @@ }); 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="; - }; - }); + 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="; + }; + }); }; }) ]; @@ -31,4 +32,14 @@ enable = true; platform = "ipu6epmtl"; }; + + 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" + ''; + }; }