Patch Detail
Show a patch.
GET /api/1.1/patches/18141/?format=api
{ "id": 18141, "url": "https://patchwork.libcamera.org/api/1.1/patches/18141/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18141/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20230119084112.20564-3-dse@thaumatec.com>", "date": "2023-01-19T08:41:06", "name": "[libcamera-devel,v3,2/8] rkisp1: Control camera lens position from IPA", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "82bafab915c6ba7cea7986a72a5123bc9b7f7db6", "submitter": { "id": 126, "url": "https://patchwork.libcamera.org/api/1.1/people/126/?format=api", "name": "Daniel Semkowicz", "email": "dse@thaumatec.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18141/mbox/", "series": [ { "id": 3714, "url": "https://patchwork.libcamera.org/api/1.1/series/3714/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3714", "date": "2023-01-19T08:41:04", "name": "ipa: rkisp1: Add autofocus algorithm", "version": 3, "mbox": "https://patchwork.libcamera.org/series/3714/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18141/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18141/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 DB73FC3294\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 19 Jan 2023 08:42:10 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 70C01625EB;\n\tThu, 19 Jan 2023 09:42:10 +0100 (CET)", "from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com\n\t[IPv6:2a00:1450:4864:20::32e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2542361EFC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Jan 2023 09:42:09 +0100 (CET)", "by mail-wm1-x32e.google.com with SMTP id\n\tf12-20020a7bc8cc000000b003daf6b2f9b9so3027904wml.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Jan 2023 00:42:09 -0800 (PST)", "from localhost.localdomain (ip092042140082.rev.nessus.at.\n\t[92.42.140.82]) by smtp.gmail.com with ESMTPSA id\n\tj10-20020a05600c074a00b003db0ee277b2sm3935754wmn.5.2023.01.19.00.42.07\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 19 Jan 2023 00:42:08 -0800 (PST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1674117730;\n\tbh=MHzwZkPrjFZzqFqY+IIHDDrrED15mLTFTjZlBdvTItc=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=OXOIgBoQBvFZPJG4aBNla6KfgIEDwB6+5RWoYE2Uc8QthAbzpDD8zttLuOY/Qvqra\n\tgNWAeoLPUg0XRlzqvP2KdT9hlTYWg3fUIsLI+n2/IfxVBE0b0GGPwQdCm0c7k/kQwT\n\tbzymZgyrarUBf8k3Y8znk33vFP5tYsA+RqWrKDmD7t5tsYBUglIyvA9zRhpTjJH0Om\n\tIcrr4+1ZxLTQJq97Dz4O8avFVt5tG+SIJbqEMjKpbFMDfbKa5wi93/7p17tIQp1Mi9\n\t874KQ2BWYGg4Aa8QFgzSjKbG5clXKspVWxMLVNt8n5VWUDaz5JIA3EcKXLOUV1OYmM\n\tuIQJMoE1DZO4Q==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=thaumatec-com.20210112.gappssmtp.com; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=ruQTIYdis1jrfTOZQl3cOInBkB3eyVJBswJS5xkktXk=;\n\tb=QEx+T+Bs5xexf697oj9h1b/guMUTM7yYtVbvizOmlJYhN5rgO79oZNq+gJnZdscC0/\n\t+HYgc3xMj1ZzTkH//qPfQqWuOxqURYx3SZC1/u++GmW7KW/I5teFgbYMtwM2WMzN6GE7\n\twahxihZCZAqWCLbWWS8axDR0P32c3fC03F3gPARMs2Rb4IiC/9B5PFvYZhUGCxVaNACL\n\tU/MBcWHUbXN5q8CyvDqVGdw5TxoTGZcSQJeN3PN/zqbSInlB8RnBpY9H82zV/Ja66vTC\n\tv7V62Q7Hc1R/O8+EIVenisIvRL2lOfPPxNtDbDufGcLCcKMfB9ri4NaEKFmfFHmrQ1nN\n\t8dEw==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=thaumatec-com.20210112.gappssmtp.com\n\theader.i=@thaumatec-com.20210112.gappssmtp.com header.b=\"QEx+T+Bs\"; \n\tdkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=ruQTIYdis1jrfTOZQl3cOInBkB3eyVJBswJS5xkktXk=;\n\tb=Z5+X1Zvh5Nwjdhfk08VzE0a33dBs7KUXtkAjnwZ7AI/4DEg7kGEMLLNRTgkETb+g6f\n\tj0ZJiknMXnjw1pZCwB04pKtM0p6Rr1hYh/g0ZvAY7Oy0v34MLVNR5LzeXNyoncmum7cD\n\t/NdebZxZH7mf8QMaR9O5qOdntHHCEW/WASiI6SMqqN1wYC4d+y8KjUChJA4wl46Tl6su\n\tng6O1YkfMq7XQhsfZcMGLdHutnmcvH0+mh3I+03eG8766U1iPlecAx/UAhD20bwYmoIM\n\t3686kNWxVhEjs6YQ6YYkyFwLLXqgCVyOj/2FMwWjasHLtIFZaCtVsnkqgxle+oRmxM7K\n\tuAKg==", "X-Gm-Message-State": "AFqh2kooLG4uC5BY2igvDK+VfQHR+iYBr+X6ZsNX0E3u6XUCsnKQ87wu\n\tMz2mLlbec71913IwJEdqPVBFPbUn01+N1R3efxg=", "X-Google-Smtp-Source": "AMrXdXu/6QSSIZbHtHdJqZ6kP/Ig7yA2INmPsp/rbahcU7780NiXuxXCZpjE7VY6qgWBU0aayn0fuA==", "X-Received": "by 2002:a05:600c:13c8:b0:3db:3e8:feca with SMTP id\n\te8-20020a05600c13c800b003db03e8fecamr9923463wmg.15.1674117728880; \n\tThu, 19 Jan 2023 00:42:08 -0800 (PST)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 19 Jan 2023 09:41:06 +0100", "Message-Id": "<20230119084112.20564-3-dse@thaumatec.com>", "X-Mailer": "git-send-email 2.39.0", "In-Reply-To": "<20230119084112.20564-1-dse@thaumatec.com>", "References": "<20230119084112.20564-1-dse@thaumatec.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 2/8] rkisp1: Control camera lens\n\tposition from IPA", "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>", "From": "Daniel Semkowicz via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Daniel Semkowicz <dse@thaumatec.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Allow control of lens position from the IPA, by setting corresponding\naf fields in the IPAFrameContext structure. Controls are then passed to\nthe pipeline handler, which sets the lens position in CameraLens.\n\nSigned-off-by: Daniel Semkowicz <dse@thaumatec.com>\n---\n include/libcamera/ipa/rkisp1.mojom | 1 +\n src/ipa/rkisp1/ipa_context.h | 5 +++++\n src/ipa/rkisp1/rkisp1.cpp | 12 ++++++++++++\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 16 ++++++++++++++++\n 4 files changed, 34 insertions(+)", "diff": "diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom\nindex bf6e9141..c3ed87aa 100644\n--- a/include/libcamera/ipa/rkisp1.mojom\n+++ b/include/libcamera/ipa/rkisp1.mojom\n@@ -39,5 +39,6 @@ interface IPARkISP1Interface {\n interface IPARkISP1EventInterface {\n \tparamsBufferReady(uint32 frame);\n \tsetSensorControls(uint32 frame, libcamera.ControlList sensorControls);\n+\tsetLensControls(libcamera.ControlList lensControls);\n \tmetadataReady(uint32 frame, libcamera.ControlList metadata);\n };\ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex b9b20653..1fac6af9 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -53,6 +53,11 @@ struct IPASessionConfiguration {\n };\n \n struct IPAActiveState {\n+\tstruct {\n+\t\tuint32_t lensPosition;\n+\t\tbool applyLensCtrls;\n+\t} af;\n+\n \tstruct {\n \t\tstruct {\n \t\t\tuint32_t exposure;\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 9e861fc0..297161b2 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -270,6 +270,10 @@ int IPARkISP1::configure(const IPAConfigInfo &ipaConfig,\n \t\t\treturn format.colourEncoding == PixelFormatInfo::ColourEncodingRAW;\n \t\t});\n \n+\t/* Lens position is unknown at the startup, so initilize the variable\n+\t * that holds the current position to something out of the range. */\n+\tcontext_.activeState.af.lensPosition = std::numeric_limits<int32_t>::max();\n+\n \tfor (auto const &a : algorithms()) {\n \t\tAlgorithm *algo = static_cast<Algorithm *>(a.get());\n \n@@ -452,6 +456,14 @@ void IPARkISP1::setControls(unsigned int frame)\n \tctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast<int32_t>(gain));\n \n \tsetSensorControls.emit(frame, ctrls);\n+\n+\tif (lensControls_ && context_.activeState.af.applyLensCtrls) {\n+\t\tcontext_.activeState.af.applyLensCtrls = false;\n+\t\tControlList lensCtrls(*lensControls_);\n+\t\tlensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE,\n+\t\t\t static_cast<int32_t>(context_.activeState.af.lensPosition));\n+\t\tsetLensControls.emit(lensCtrls);\n+\t}\n }\n \n } /* namespace ipa::rkisp1 */\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 0559d261..b2fedc5f 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -113,6 +113,7 @@ private:\n \tvoid paramFilled(unsigned int frame);\n \tvoid setSensorControls(unsigned int frame,\n \t\t\t const ControlList &sensorControls);\n+\tvoid setLensControls(const ControlList &lensControls);\n \n \tvoid metadataReady(unsigned int frame, const ControlList &metadata);\n };\n@@ -337,6 +338,7 @@ int RkISP1CameraData::loadIPA(unsigned int hwRevision)\n \t\treturn -ENOENT;\n \n \tipa_->setSensorControls.connect(this, &RkISP1CameraData::setSensorControls);\n+\tipa_->setLensControls.connect(this, &RkISP1CameraData::setLensControls);\n \tipa_->paramsBufferReady.connect(this, &RkISP1CameraData::paramFilled);\n \tipa_->metadataReady.connect(this, &RkISP1CameraData::metadataReady);\n \n@@ -400,6 +402,20 @@ void RkISP1CameraData::setSensorControls([[maybe_unused]] unsigned int frame,\n \tdelayedCtrls_->push(sensorControls);\n }\n \n+void RkISP1CameraData::setLensControls(const ControlList &lensControls)\n+{\n+\tCameraLens *focusLens = sensor_->focusLens();\n+\tif (!focusLens)\n+\t\treturn;\n+\n+\tif (!lensControls.contains(V4L2_CID_FOCUS_ABSOLUTE))\n+\t\treturn;\n+\n+\tconst ControlValue &focusValue = lensControls.get(V4L2_CID_FOCUS_ABSOLUTE);\n+\n+\tfocusLens->setFocusPosition(focusValue.get<int32_t>());\n+}\n+\n void RkISP1CameraData::metadataReady(unsigned int frame, const ControlList &metadata)\n {\n \tRkISP1FrameInfo *info = frameInfo_.find(frame);\n", "prefixes": [ "libcamera-devel", "v3", "2/8" ] }