From patchwork Wed Sep 24 12:47:05 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: 24446 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 507C1BDB1C for ; Wed, 24 Sep 2025 12:47:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4C9B66B5F8; Wed, 24 Sep 2025 14:47:21 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="FsBgHmfT"; 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 802B769367 for ; Wed, 24 Sep 2025 14:47:16 +0200 (CEST) Received: from pb-laptop.local (185.221.140.70.nat.pool.zt.hu [185.221.140.70]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 67F8CAD0; Wed, 24 Sep 2025 14:45:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1758717952; bh=Ld1/w6ot7hwv/3EkFFHHw0X9yxcIk8dFexT+4J0GOs4=; h=From:To:Subject:Date:From; b=FsBgHmfT4jZiYXd2uCr++54LPC2HZBOIHUTAbcfCwYy/uV9fJpBcOOdLT3+3P8JRM Pcn9IF96fZyptwoU+9vaY7bjHHykekOSxLnz5INMqROphIkdh+HxxU0VWuIPLmfVzY oUa2Fws3XJNCkV8yo2CG/9wsQH94GzW21JUD+WaE= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org, Kieran Bingham Subject: [RFC PATCH v1 0/7] libcamera: camera: Add `applyControls()` Date: Wed, 24 Sep 2025 14:47:05 +0200 Message-ID: <20250924124713.3361707-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.51.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 is a proof-of-concept implementation of the `Camera::applyControls()` mechanism for fast(er) control application. At the moment controls can be set at two specific points: * when the camera is started, * for a given request. However, sometimes it is desirable to apply controls "as fast as possible" regardless of how many requests are queued. This could be implemented by making available the minimum number of requests that need to be queued at any given time, and letting the application implement its own queue. Such a queue, however, is essentially already implemented in libcamera: `Camera::Private::waitingRequests_`, so this patch set makes use of that. The implementation is in the second to last patch. It adds a new virtual function for pipeline handlers to implement, this function should apply the given controls "immediately". If that is not implemented, then a fallback mechanism is used, which merges the control list into the control list of the request that is submitted to the pipeline handler next. There are a number of questions regarding the exact implementation, marked as TODO items in the code, please check those as well. In addition, there is also the question of (async) success/failure reporting. The last change implements it for the UVC pipeline handler. Barnabás Pőcze (7): libcamera: base: bound_method: Strip qualifiers in argument pack libcamera: base: bound_method: Forward when invoking libcamera: controls: Add rvalue `ControlList::merge()` libcamera: controls: ControlList: Add `erase()` libcamera: camera: Make `waitingRequests_` an `std::deque` libcamera: camera: Add `applyControls()` libcamera: pipeline: uvcvideo: Implement `applyControlsDevice()` include/libcamera/base/bound_method.h | 8 +- include/libcamera/camera.h | 1 + include/libcamera/controls.h | 4 + include/libcamera/internal/camera.h | 3 +- include/libcamera/internal/pipeline_handler.h | 7 ++ src/libcamera/camera.cpp | 53 ++++++++ src/libcamera/controls.cpp | 59 ++++++++- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 5 + src/libcamera/pipeline_handler.cpp | 118 +++++++++++++++++- 9 files changed, 245 insertions(+), 13 deletions(-) --- 2.51.0