From patchwork Wed Dec 10 13:37:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 25454 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id CD778C3257 for ; Wed, 10 Dec 2025 13:37:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F2BBF61475; Wed, 10 Dec 2025 14:37:10 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="mQBCUMAJ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A8E08613CB for ; Wed, 10 Dec 2025 14:37:09 +0100 (CET) Received: from pb-laptop.local (185.221.143.114.nat.pool.zt.hu [185.221.143.114]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 021D66DC for ; Wed, 10 Dec 2025 14:37:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1765373827; bh=PaHng9z1B9Te7XfEl6Nk0sA+FRDToKieTnpdYZGMxUw=; h=From:To:Subject:Date:From; b=mQBCUMAJBx2IOOA3Ezs5HB8+hvdHwB+XrnfPczBJg3rz/FyhPyIwm6oifR6JzlNOh RVTIIIhoOeIr997GlQOlOmzqXeBd1RYKVgtVfnz2aZsKIWqKA0RPmizYjE1GgPgQdR ltumQiyh8dUhFbVPcqt97eisydUmlq6x1F7htfyc= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [RFC PATCH v1 0/2] libcamera: pipeline: uvcvideo: FrameDurationLimits Date: Wed, 10 Dec 2025 14:37:02 +0100 Message-ID: <20251210133704.2711629-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This patch set tries to add at least some kind of support for setting a frame duration on uvc camera to address https://gitlab.freedesktop.org/camera/libcamera/-/issues/296 The mismatches in the kernel and libcamera interfaces are elaborated in the last patch. A couple points remain: (a) Since the frame interval cannot be set during streaming, could this indicate that a "startup control" concept would be useful in libcamera, where cameras could mark certain controls in their `ControlInfoMap` to indicate that they can only be set when passed to `Camera::start()`? (B) I originally intended to advertise all available discrete options in the `ControlInfo`. For example: $ v4l2-ctl --list-formats-ext ioctl: VIDIOC_ENUM_FMT Type: Video Capture [0]: 'YUYV' (YUYV 4:2:2) Size: Discrete 640x480 Interval: Discrete 0.033s (30.000 fps) Interval: Discrete 0.040s (25.000 fps) Interval: Discrete 0.050s (20.000 fps) Interval: Discrete 0.067s (15.000 fps) Interval: Discrete 0.100s (10.000 fps) Interval: Discrete 0.200s (5.000 fps) would produce: ControlInfo { .min = { 0.033s }, .max = { 0.200s }, .values = { { 0.033s, 0.033s }, { 0.040s, 0.040s }, { 0.050s, 0.050s }, { 0.067s, 0.067s }, { 0.100s, 0.100s }, { 0.200s, 0.200s }, }, } This would be done in order to satisfy two requirements: * every item in `ControlInfo::values()` should be of the proper shape and type to be directly applicable as the value of the control; * the min/max for array like controls (except strings) should denote the min/max for any single element in the array. Unfortunately, there is no constructor of `ControlInfo` that achieves this. Would it be useful to add one? Barnabás Pőcze (2): libcamera: pipeline: uvcvideo: Report `FrameDuration` libcamera: pipeline: uvcvideo: Handle `FrameDurationLimits` include/libcamera/internal/v4l2_videodevice.h | 5 + src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 72 ++++++++ src/libcamera/v4l2_videodevice.cpp | 171 ++++++++++++++++++ 3 files changed, 248 insertions(+) --- 2.52.0