Show a patch.

GET /api/patches/18401/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 18401,
    "url": "https://patchwork.libcamera.org/api/patches/18401/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18401/",
    "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": "<20230314144834.85193-10-dse@thaumatec.com>",
    "date": "2023-03-14T14:48:33",
    "name": "[libcamera-devel,v4,09/10] rkisp1: Control camera lens position from IPA",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d8e3f21d7d956ce293abd176328a5fe472db39b5",
    "submitter": {
        "id": 126,
        "url": "https://patchwork.libcamera.org/api/people/126/?format=api",
        "name": "Daniel Semkowicz",
        "email": "dse@thaumatec.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18401/mbox/",
    "series": [
        {
            "id": 3805,
            "url": "https://patchwork.libcamera.org/api/series/3805/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3805",
            "date": "2023-03-14T14:48:24",
            "name": "ipa: rkisp1: Add autofocus algorithm",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/3805/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18401/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18401/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 B3F69C32A0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Mar 2023 14:50:09 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 301A16274E;\n\tTue, 14 Mar 2023 15:50:09 +0100 (CET)",
            "from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com\n\t[IPv6:2a00:1450:4864:20::22b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 10D016270D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Mar 2023 15:49:57 +0100 (CET)",
            "by mail-lj1-x22b.google.com with SMTP id t14so16295683ljd.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Mar 2023 07:49:57 -0700 (PDT)",
            "from localhost.localdomain ([91.90.166.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tq25-20020a2eb4b9000000b00295a35f30e1sm470961ljm.115.2023.03.14.07.49.55\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 14 Mar 2023 07:49:55 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1678805409;\n\tbh=J62OTx3oB/aLsxLwgoirbptPdUBJpLLnjDolM8ZEjBI=;\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:Cc:\n\tFrom;\n\tb=W0cok8L5BSbYxQkJ7P/pCA8kg+Zu0AVwzO9uRLBXj64bvxTxzYAX0eWzzVCKoZpJz\n\tTYS3vpwnfy7QlhPbkJT0C4xfBZhdj2q7JNSb5FCN0YPywN30Tfqq4O+2e47Grdkm9P\n\twbPakH+J8l2eo59DOzuTfTUAzJD5rZ+eeMEhDjCdn9cS0f9y3v2EQb53p5K/rnW0tz\n\tdPqznwTijNmKhQcg5D66K8bHIAxI/VgOwq051qw4OFx4l/vDIciD+eePkimJ/3AJVa\n\tXHo44WCbnJdDidxZK/1Ivg2VhOs++4FXSBGZD9x9hzlLXmnXGBuKgxS2er4qdOBjZa\n\tu7dXLJykRFxgg==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=thaumatec-com.20210112.gappssmtp.com; s=20210112; t=1678805395;\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=/VDexCp2IVtvlqpNyv5xS3Sww9RNPylcLJ5hCb13SxA=;\n\tb=M5O2tbBfgDYlkmIEuX9bvyKrkqp3jK00z1xG5d1qSJ/0d4K3abwSaCZYDagyjMQc8Q\n\t+wEqKcuRpWNyHCJPOVz5c+9KHEQw9j+PUpwdrVQupt/Z9ixBE8Lidqv1a7EnneMpkIVo\n\tYfra1KTnG3cEPgGUOD5sgluaHw5Yep+kZhHA5wuPDPPmlDkpIyGl2LwTDxQ3p8wNsAEq\n\tWJPPZw9xoxJAFJltnKBaurm+jwqp3KNGVELS6lq3Eb14AUfcLvOdTMMAJu/xiOhVAv7z\n\tJK1Djw9YeskN+kNz77l3AMFrqDoOGRrAKGJOTbf0sgU7VJuZVYhSADYq7YZVh8HqHq80\n\tlJYg=="
        ],
        "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=\"M5O2tbBf\"; \n\tdkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1678805395;\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=/VDexCp2IVtvlqpNyv5xS3Sww9RNPylcLJ5hCb13SxA=;\n\tb=LOMWklzw20rrjOzKPa6r+HzRlaMopm/oPSsv7eZW2OtN23OMnwOvOQo2OYC3dFpi61\n\tbDeFffSBjAX728q/oAFuib0jDcyYtwom9zPbrQxvvR/IWZbeK7tb4EwxOt4Q/gocxkOw\n\tYrN+f631SGdvkWMF/hhizoRRt3GaA+SJkldQnVkhHduRvvxgeP8t6kVayQh+N0AzhEZp\n\tJ8D4o9SVahAUH8jEpsb2cJwOb/ljU/swu3KQS8WmeeV901aSjLIXdVvENGOMBCroBEfk\n\tb3+mxlCtS5aOklf4DW5bHyuH4poiLBZ0ULSrE8nUOB8yyxlNrtpZAKpSRlUCy2UvMCpL\n\t+W3w==",
        "X-Gm-Message-State": "AO0yUKU0rxE0yJShXRFSk+L1ACAmFF68FtSKDEbe4tlAzatQfQnLZK4p\n\t5JjOWU19tI08K7P+RujxYpM2ILSLs314tVPzXEs=",
        "X-Google-Smtp-Source": "AK7set+/tsJqdz9jguoTotjh6vFFa7kVhK4eT8niQSnYG31yKuO1Qlgp0g/X4ReqrjVdGSdSCRs25Q==",
        "X-Received": "by 2002:a2e:83d6:0:b0:293:2ca4:bbcb with SMTP id\n\ts22-20020a2e83d6000000b002932ca4bbcbmr10945456ljh.50.1678805395821; \n\tTue, 14 Mar 2023 07:49:55 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 14 Mar 2023 15:48:33 +0100",
        "Message-Id": "<20230314144834.85193-10-dse@thaumatec.com>",
        "X-Mailer": "git-send-email 2.39.2",
        "In-Reply-To": "<20230314144834.85193-1-dse@thaumatec.com>",
        "References": "<20230314144834.85193-1-dse@thaumatec.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 09/10] 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>",
        "Cc": "jacopo.mondi@ideasonboard.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/rkisp1.cpp                |  8 ++++++++\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 17 +++++++++++++++++\n 3 files changed, 26 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/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 4b30844f..4aef2e30 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -469,6 +469,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      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 83fb6287..1dc3f957 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -114,6 +114,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@@ -340,6 +341,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@@ -403,6 +405,21 @@ 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 =\n+\t\tlensControls.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",
        "v4",
        "09/10"
    ]
}