Patch Detail
Show a patch.
GET /api/patches/24695/?format=api
{ "id": 24695, "url": "https://patchwork.libcamera.org/api/patches/24695/?format=api", "web_url": "https://patchwork.libcamera.org/patch/24695/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20251017-exposure-limits-v1-2-6288cd86e719@ideasonboard.com>", "date": "2025-10-17T09:00:06", "name": "[2/3] libcamera: rkisp1: Update camera::controls() on limit changes", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "2b39cc614fb6516d4fe804c33257595d39905d82", "submitter": { "id": 143, "url": "https://patchwork.libcamera.org/api/people/143/?format=api", "name": "Jacopo Mondi", "email": "jacopo.mondi@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/24695/mbox/", "series": [ { "id": 5508, "url": "https://patchwork.libcamera.org/api/series/5508/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5508", "date": "2025-10-17T09:00:04", "name": "rkisp1: Update exposure limits on vblank change", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5508/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/24695/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/24695/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 18A45C32CE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 17 Oct 2025 09:00:22 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B1202606A4;\n\tFri, 17 Oct 2025 11:00:18 +0200 (CEST)", "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 3E0D1606A3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Oct 2025 11:00:16 +0200 (CEST)", "from [192.168.1.182] (93-46-82-201.ip106.fastwebnet.it\n\t[93.46.82.201])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C59041E2F;\n\tFri, 17 Oct 2025 10:58:35 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"PFzaoL3/\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1760691515;\n\tbh=EJcNXPRfts0MnODBTGcYhq7MQ3EqFRL97hh4t6jRWnM=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=PFzaoL3/zi0p2bxAkohLny68KdstOr5PWYbrJiC1oBAUZcGjj5zYHDFhJ4igDN8hC\n\t85RmwbQ9rlUQc04baNxuowzPlt3582TakoNNcpaPTQqzyEqjQmbCbnmvyr5btm/7TZ\n\t/pBOUM3tQevzCt9O+bE5HVauhk/PuFXS/HLi6Ifw=", "From": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "Date": "Fri, 17 Oct 2025 11:00:06 +0200", "Subject": "[PATCH 2/3] libcamera: rkisp1: Update camera::controls() on limit\n\tchanges", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20251017-exposure-limits-v1-2-6288cd86e719@ideasonboard.com>", "References": "<20251017-exposure-limits-v1-0-6288cd86e719@ideasonboard.com>", "In-Reply-To": "<20251017-exposure-limits-v1-0-6288cd86e719@ideasonboard.com>", "To": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>,\n\tlibcamera-devel@lists.libcamera.org", "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "X-Mailer": "b4 0.14.2", "X-Developer-Signature": "v=1; a=openpgp-sha256; l=6379;\n\ti=jacopo.mondi@ideasonboard.com; h=from:subject:message-id;\n\tbh=EJcNXPRfts0MnODBTGcYhq7MQ3EqFRL97hh4t6jRWnM=;\n\tb=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBo8gWfgDagLSWyzlIHi517Pg/KU/PtkrmBsS3CN\n\ti5qqDwVaCqJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaPIFnwAKCRByNAaPFqFW\n\tPOHBD/9W5DRzUnEt6lR4BNjCUgXKIfgmT9yvt6nfsl6tzUlBIofk2ERChqGayQdIPV4eEGl7BNj\n\tPdxKOxjro8LB5D4VEpWA8ret4j1nuk4mgsc7o/4awHsikkG3f8YYxcE9+0nbBEhHvBLF2rk/ZAk\n\tRGdQ3fQxUphesTC9aI279wqO95jjzcAft5W+r3yZ5VcfdI0ObsaqoI2+Tc5U+rUcsYGeQqYJsZQ\n\tf5MTvWlhfniwvSJE3tRPX+TIPOWbvsNDLDHPcNyruehbTY0Kzdmo34cLO1Ots/T4nP9BFwWr+E2\n\tFCBm+cLKfqZJ9BnweeidSDNrsrZVZeQ1infDAEtn/9PBe1d9RSKgVnfiq0CwhNSB//Xt00xbPfP\n\t4SJ1YthLcn/R5e9WejMeel8qPpfNItl9Wt6G9zqoE/hUg9lB8rANX8pgwcmU04f+KL6vvD/QQED\n\tG9Hjbv0IoFU1qwneJCDQdfiY8Gib4VjXPr47ReIojjnkyeB5meqOXZJK8KDjGcEG1DpJRpANrIr\n\thLJnGD9bJYv/P3HRge7IY58lUnPQ8E00lT9a59iw6g/MldDsucSfDQ0Ixt6jix0cga1aTAc9yCN\n\txcI2gvH9f5uuv3jztG3iNqDpopIev2t7Npaxzvxtwht9gbGyNV/4SQDwmQhCbftTpNmF6mVuhCr\n\tqCYEAlOmKSyvRCQ==", "X-Developer-Key": "i=jacopo.mondi@ideasonboard.com; a=openpgp;\n\tfpr=72392EDC88144A65C701EA9BA5826A2587AD026B", "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": "The limits (min and max values) for the Camera controls are\nregistered at Camera configuration time and never updated.\nSome controls, like FrameDurationLimits have a direct impact on\nthe limits of other controls, such as the ExposureTime and as they\ncan be configured by the application, this has to be taken into account.\n\nCurrently, when a user changes the frame duration, the limits for\nboth the ExposureTime and FrameDurationControls are not updated.\n\nThe timing at which the controls limits should be updated is also\ncritical: the new control values take effect once the Request they\nbelong to is completed.\n\nTo support this operation model introduce a new IPA function\n'updateControlsLimits()' which the pipeline handler calls before\ncompleting a Request.\n\nStore the exposure time limits in the FrameContext (frame\nduration limits were already there) and update the Camera::controls()\ncontrol info map with the limits as computed for the Request that has\njust completed.\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n include/libcamera/ipa/rkisp1.mojom | 2 ++\n src/ipa/rkisp1/algorithms/agc.cpp | 3 +++\n src/ipa/rkisp1/ipa_context.h | 3 +++\n src/ipa/rkisp1/rkisp1.cpp | 26 ++++++++++++++++++++++++++\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 3 +++\n 5 files changed, 37 insertions(+)", "diff": "diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom\nindex 068e898848c4943282b4a6a05362a99016560afd..8d9446f5cbe9851886832f5cf7fd41d1a6d23a11 100644\n--- a/include/libcamera/ipa/rkisp1.mojom\n+++ b/include/libcamera/ipa/rkisp1.mojom\n@@ -27,6 +27,8 @@ interface IPARkISP1Interface {\n \t\t map<uint32, libcamera.IPAStream> streamConfig)\n \t\t=> (int32 ret, libcamera.ControlInfoMap ipaControls);\n \n+\tupdateControlsLimits(uint32 frame) => (int32 ret, libcamera.ControlInfoMap ipaControls);\n+\n \tmapBuffers(array<libcamera.IPABuffer> buffers);\n \tunmapBuffers(array<uint32> ids);\n \ndiff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\nindex f5a3c917cb6909f6ef918e5ee8e46cf97ba55010..0fd7541c9f1ab9b4cbae1f8fa60c39b032c3bcd1 100644\n--- a/src/ipa/rkisp1/algorithms/agc.cpp\n+++ b/src/ipa/rkisp1/algorithms/agc.cpp\n@@ -585,6 +585,8 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \t\t\t\t* frameContext.agc.exposure;\n \t\tmaxExposureTime = minExposureTime;\n \t}\n+\tframeContext.agc.minExposureTime = minExposureTime;\n+\tframeContext.agc.maxExposureTime = maxExposureTime;\n \n \tif (frameContext.agc.autoGainEnabled) {\n \t\tminAnalogueGain = context.configuration.sensor.minAnalogueGain;\n@@ -606,6 +608,7 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \t * applied to the sensor when the statistics were collected.\n \t */\n \tutils::Duration exposureTime = lineDuration * frameContext.sensor.exposure;\n+\tframeContext.agc.exposureTime = exposureTime;\n \tdouble analogueGain = frameContext.sensor.gain;\n \tutils::Duration effectiveExposureValue = exposureTime * analogueGain;\n \ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex af66a749052bc82bbbe7fbb0c4626f2422700926..54ff5c114f5c6cdfaf515475a3892f76e2e022d6 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -143,6 +143,9 @@ struct IPAActiveState {\n \n struct IPAFrameContext : public FrameContext {\n \tstruct {\n+\t\tutils::Duration minExposureTime;\n+\t\tutils::Duration maxExposureTime;\n+\t\tutils::Duration exposureTime;\n \t\tuint32_t exposure;\n \t\tdouble gain;\n \t\tdouble exposureValue;\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 54bd1434e0f4e34834beb1f9e9c39b77590f8b34..ad5c24a7159a8634aae883915b54ae0f4456692b 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -62,6 +62,8 @@ public:\n \tint configure(const IPAConfigInfo &ipaConfig,\n \t\t const std::map<uint32_t, IPAStream> &streamConfig,\n \t\t ControlInfoMap *ipaControls) override;\n+\tint updateControlsLimits(const uint32_t frame,\n+\t\t\t\t ControlInfoMap *ipaControls) override;\n \tvoid mapBuffers(const std::vector<IPABuffer> &buffers) override;\n \tvoid unmapBuffers(const std::vector<unsigned int> &ids) override;\n \n@@ -294,6 +296,30 @@ int IPARkISP1::configure(const IPAConfigInfo &ipaConfig,\n \treturn 0;\n }\n \n+int IPARkISP1::updateControlsLimits(const uint32_t frame, ControlInfoMap *ipaControls)\n+{\n+\tIPAFrameContext &frameContext = context_.frameContexts.get(frame);\n+\n+\t/*\n+\t * Update the exposure time and frame duration limits with the\n+\t * settings computed by the AGC for the frame at hand.\n+\t */\n+\tassert(ipaControls->find(&controls::ExposureTime) != ipaControls->end());\n+\tassert(ipaControls->find(&controls::FrameDurationLimits) != ipaControls->end());\n+\n+\tControlValue eMin(static_cast<int32_t>(frameContext.agc.minExposureTime.get<std::micro>()));\n+\tControlValue eMax(static_cast<int32_t>(frameContext.agc.maxExposureTime.get<std::micro>()));\n+\tControlValue eDef(static_cast<int32_t>(frameContext.agc.exposureTime.get<std::micro>()));\n+\tipaControls->at(controls::ExposureTime.id()) = ControlInfo(eMin, eMax, eDef);\n+\n+\tControlValue fMin(static_cast<int32_t>(frameContext.agc.minFrameDuration.get<std::micro>()));\n+\tControlValue fMax(static_cast<int32_t>(frameContext.agc.maxFrameDuration.get<std::micro>()));\n+\tControlValue fDef(static_cast<int32_t>(frameContext.agc.frameDuration.get<std::micro>()));\n+\tipaControls->at(controls::FrameDurationLimits.id()) = ControlInfo(fMin, fMax, fDef);\n+\n+\treturn 0;\n+}\n+\n void IPARkISP1::mapBuffers(const std::vector<IPABuffer> &buffers)\n {\n \tfor (const IPABuffer &buffer : buffers) {\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex ecd13831539fdf5cb79da2ea4b33a353514328ae..ad1ff7a8be8d6e3268e21ec92ae4e07500b38c66 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -1494,6 +1494,9 @@ void PipelineHandlerRkISP1::tryCompleteRequest(RkISP1FrameInfo *info)\n \tif (!isRaw_ && !info->paramDequeued)\n \t\treturn;\n \n+\t/* Update controls before completing the request */\n+\tdata->ipa_->updateControlsLimits(info->frame, &data->controlInfo_);\n+\n \tdata->frameInfo_.destroy(info->frame);\n \n \tcompleteRequest(request);\n", "prefixes": [ "2/3" ] }