{"id":19696,"url":"https://patchwork.libcamera.org/api/patches/19696/?format=json","web_url":"https://patchwork.libcamera.org/patch/19696/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20240313105645.120317-9-stefan.klug@ideasonboard.com>","date":"2024-03-13T10:56:40","name":"[08/12] libcamera: delayed_controls: Add ctrls list parameter to reset() function","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"c592a7eb40d1161a2c380dcd93954f688bcee1c8","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19696/mbox/","series":[{"id":4219,"url":"https://patchwork.libcamera.org/api/series/4219/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4219","date":"2024-03-13T10:56:32","name":"Preparation for per-frame-controls and initial tests","version":1,"mbox":"https://patchwork.libcamera.org/series/4219/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19696/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19696/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id F2101BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Mar 2024 10:57:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9DE0962C9A;\n\tWed, 13 Mar 2024 11:57:05 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5E2D262C8F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Mar 2024 11:56:54 +0100 (CET)","from jasper.fritz.box (unknown\n\t[IPv6:2a00:6020:448c:6c00:9b07:31b5:38e1:e957])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E8CA0A8F;\n\tWed, 13 Mar 2024 11:56:31 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"pJUn/1/x\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1710327392;\n\tbh=sO0A/gemJARVBZjvuPwdylUf4HYJ/EZt5BDp1fF+NCs=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=pJUn/1/xqvb6YsdxGXCkkt211+QHSU7lH/Zl6/a41JNa+CwZxkjUrw23RySvwoO8y\n\tnH0Lwxszim00JKR02RFjjyyhucHkgCkVsxWUsIXaLF8+wVel0t9gZ6pOEudXUiP/na\n\tz4rL8RWyu/C7wUhX9O0PLRmeJjO9ojPJXZ5sGYh0=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH 08/12] libcamera: delayed_controls: Add ctrls list parameter\n\tto reset() function","Date":"Wed, 13 Mar 2024 11:56:40 +0100","Message-Id":"<20240313105645.120317-9-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.40.1","In-Reply-To":"<20240313105645.120317-1-stefan.klug@ideasonboard.com>","References":"<20240313105645.120317-1-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"This makes it easier for the caller. There is often this pattern\n\n  sensor_->setControls(controls);\n  delayedControls_->reset();\n\nwhich can then be reduced to\n\n  delayedControls_->reset(controls);\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n include/libcamera/internal/delayed_controls.h |  2 +-\n src/libcamera/delayed_controls.cpp            | 14 +++++++++++++-\n 2 files changed, 14 insertions(+), 2 deletions(-)","diff":"diff --git a/include/libcamera/internal/delayed_controls.h b/include/libcamera/internal/delayed_controls.h\nindex 2738e8bf..a3063400 100644\n--- a/include/libcamera/internal/delayed_controls.h\n+++ b/include/libcamera/internal/delayed_controls.h\n@@ -27,7 +27,7 @@ public:\n \tDelayedControls(V4L2Device *device,\n \t\t\tconst std::unordered_map<uint32_t, ControlParams> &controlParams);\n \n-\tvoid reset();\n+\tvoid reset(ControlList *controls = nullptr);\n \n \tbool push(const ControlList &controls);\n \tbool pushForFrame(uint32_t sequence, const ControlList &controls);\ndiff --git a/src/libcamera/delayed_controls.cpp b/src/libcamera/delayed_controls.cpp\nindex c46e54d1..ac38eb64 100644\n--- a/src/libcamera/delayed_controls.cpp\n+++ b/src/libcamera/delayed_controls.cpp\n@@ -115,7 +115,7 @@ DelayedControls::DelayedControls(V4L2Device *device,\n  * Resets the state machine to a starting position based on control values\n  * retrieved from the device.\n  */\n-void DelayedControls::reset()\n+void DelayedControls::reset(ControlList *ctrls)\n {\n \tqueueIndex_ = 0;\n \t/* Frames up to maxDelay_ will be based on sensor init values. */\n@@ -126,6 +126,18 @@ void DelayedControls::reset()\n \tfor (auto const &param : controlParams_)\n \t\tids.push_back(param.first->id());\n \n+\tif (ctrls) {\n+\t\tdevice_->setControls(ctrls);\n+\n+\t\tLOG(DelayedControls, Debug) << \"reset:\";\n+\t\tauto idMap = ctrls->idMap();\n+\t\tif (idMap) {\n+\t\t\tfor (const auto &[id, value] : *ctrls) {\n+\t\t\t\tLOG(DelayedControls, Debug) << \"  \" << idMap->at(id)->name() << \" : \" << value.toString();\n+\t\t\t}\n+\t\t}\n+\t}\n+\n \tControlList controls = device_->getControls(ids);\n \n \t/* Seed the control queue with the controls reported by the device. */\n","prefixes":["08/12"]}