{"id":26356,"url":"https://patchwork.libcamera.org/api/patches/26356/?format=json","web_url":"https://patchwork.libcamera.org/patch/26356/","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":"<20260325151416.2114564-15-stefan.klug@ideasonboard.com>","date":"2026-03-25T15:13:46","name":"[v2,14/32] pipeline: rkisp1: Apply initial controls","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"8d05ed5ab6c74c2ade5de553e7b75d92ce1d3858","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/26356/mbox/","series":[{"id":5849,"url":"https://patchwork.libcamera.org/api/series/5849/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5849","date":"2026-03-25T15:13:32","name":"rkisp1: pipeline rework for PFC","version":2,"mbox":"https://patchwork.libcamera.org/series/5849/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/26356/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/26356/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 B8BBFC3300\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 25 Mar 2026 15:15:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 221DB62BDE;\n\tWed, 25 Mar 2026 16:15:21 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E859E62857\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 25 Mar 2026 16:15:19 +0100 (CET)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:b16a:5ed9:4ada:a95a])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 021D81862; \n\tWed, 25 Mar 2026 16:14:01 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"dMPTN9jd\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1774451642;\n\tbh=UvrXME2nZvlUfV9R4/FUoLETP9kb1SrndT7JYlzUCws=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=dMPTN9jdFaLsJLhBhG+9Kg2Zz+GkSvV/63MUSPjCOE4nltgBKQR79Pys7JXsx2uaT\n\twQvYm3+rn9UTHBWbW++0Z2zKekgsC8EC+l33TdiRTFDF3oXnbLcEFDMLNkWqEvKiBv\n\t0641lbIRz+aV6ALrNqCVymqud5Dc60HUGv9Itbwo=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH v2 14/32] pipeline: rkisp1: Apply initial controls","Date":"Wed, 25 Mar 2026 16:13:46 +0100","Message-ID":"<20260325151416.2114564-15-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.51.0","In-Reply-To":"<20260325151416.2114564-1-stefan.klug@ideasonboard.com>","References":"<20260325151416.2114564-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":"Controls passed to Camera::start() are not handled at the moment.\nImplement that by initializing a separate frame\ncontext and then returning the controls synchronously to the caller. In\nthe pipeline the controls get passed to the sensor before the call to\nstreamOn() to ensure the controls are applied right away. Passing the\ncontrols to the pipeline using the setSensorControls signal is not\nappropriate because it is asynchronous and would reach the sensor too\nlate (initial controls need to be applied before the sensor starts and\nbefore delayed controls initializes it's start condition.)\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n include/libcamera/ipa/rkisp1.mojom       |  7 ++++++-\n src/ipa/rkisp1/rkisp1.cpp                | 10 ++++++----\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 11 +++++++++--\n 3 files changed, 21 insertions(+), 7 deletions(-)","diff":"diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom\nindex 068e898848c4..4c29b53cd7f9 100644\n--- a/include/libcamera/ipa/rkisp1.mojom\n+++ b/include/libcamera/ipa/rkisp1.mojom\n@@ -14,13 +14,18 @@ struct IPAConfigInfo {\n \tuint32 paramFormat;\n };\n \n+struct StartResult {\n+\tlibcamera.ControlList controls;\n+\tint32 code;\n+};\n+\n interface IPARkISP1Interface {\n \tinit(libcamera.IPASettings settings,\n \t     uint32 hwRevision, uint32 supportedBlocks,\n \t     libcamera.IPACameraSensorInfo sensorInfo,\n \t     libcamera.ControlInfoMap sensorControls)\n \t\t=> (int32 ret, libcamera.ControlInfoMap ipaControls);\n-\tstart() => (int32 ret);\n+\tstart(libcamera.ControlList controls) => (StartResult result);\n \tstop();\n \n \tconfigure(IPAConfigInfo configInfo,\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 98ed4a8ff16d..3f943a08d011 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -56,7 +56,7 @@ public:\n \t\t const IPACameraSensorInfo &sensorInfo,\n \t\t const ControlInfoMap &sensorControls,\n \t\t ControlInfoMap *ipaControls) override;\n-\tint start() override;\n+\tvoid start(const ControlList &controls, StartResult *result) override;\n \tvoid stop() override;\n \n \tint configure(const IPAConfigInfo &ipaConfig,\n@@ -215,10 +215,12 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision,\n \treturn 0;\n }\n \n-int IPARkISP1::start()\n+void IPARkISP1::start(const ControlList &controls, StartResult *result)\n {\n-\t/* \\todo Properly handle startup controls. */\n-\treturn 0;\n+\tIPAFrameContext frameContext = {};\n+\tinitializeFrameContext(0, frameContext, controls);\n+\tresult->controls = getSensorControls(frameContext);\n+\tresult->code = 0;\n }\n \n void IPARkISP1::stop()\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 7352237dbb86..89e8ab0999f4 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -1238,13 +1238,20 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlL\n \t\treturn ret;\n \tactions += [&]() { freeBuffers(camera); };\n \n-\tret = data->ipa_->start();\n-\tif (ret) {\n+\tControlList ctrls;\n+\tif (!!controls)\n+\t\tctrls = *controls;\n+\n+\tipa::rkisp1::StartResult res;\n+\tdata->ipa_->start(ctrls, &res);\n+\tif (res.code) {\n \t\tLOG(RkISP1, Error)\n \t\t\t<< \"Failed to start IPA \" << camera->id();\n \t\treturn ret;\n \t}\n \tactions += [&]() { data->ipa_->stop(); };\n+\tdata->sensor_->setControls(&res.controls);\n+\tdata->delayedCtrls_->reset();\n \n \tdata->frame_ = 0;\n \n","prefixes":["v2","14/32"]}