Show a patch.

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

{
    "id": 18452,
    "url": "https://patchwork.libcamera.org/api/patches/18452/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18452/",
    "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": "<20230324142908.64224-10-dse@thaumatec.com>",
    "date": "2023-03-24T14:29:07",
    "name": "[libcamera-devel,v5,09/10] rkisp1: Control camera lens position from IPA",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "e8157a8e9457a0e799fab6fb96842e506663d349",
    "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/18452/mbox/",
    "series": [
        {
            "id": 3813,
            "url": "https://patchwork.libcamera.org/api/series/3813/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3813",
            "date": "2023-03-24T14:28:58",
            "name": "ipa: rkisp1: Add autofocus algorithm",
            "version": 5,
            "mbox": "https://patchwork.libcamera.org/series/3813/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18452/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18452/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 06385C32A0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 24 Mar 2023 14:29:38 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9563162750;\n\tFri, 24 Mar 2023 15:29:38 +0100 (CET)",
            "from mail-lj1-x231.google.com (mail-lj1-x231.google.com\n\t[IPv6:2a00:1450:4864:20::231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A41F36270E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Mar 2023 15:29:29 +0100 (CET)",
            "by mail-lj1-x231.google.com with SMTP id q14so1895965ljm.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Mar 2023 07:29:29 -0700 (PDT)",
            "from localhost.localdomain ([91.90.166.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tj21-20020a2e8515000000b002a10b2ea089sm981714lji.16.2023.03.24.07.29.28\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 24 Mar 2023 07:29:28 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1679668178;\n\tbh=ep3Vg6jIAMY8T9rW1GuAOePig6yWoEtEUB3rcWDKES0=;\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=BQw+gCbwBzRFc8JU3nkHhe2jTyZR5BtzJhaUBSGAxIq/gx/GcsSzCNYZybqs9YRJM\n\t3mRKZpxmROT3hltOPkfubmWL2DIsOtNQMCxVIE1g7m0zqHLIlsP/500eUhoBenkvLX\n\tqB69XipdsvKNkhPdJdIzls5Cvp82cP9SSBibfZRIuMenx7bZiX4s/nNL12aGAED0Fo\n\tHkgKiMRU2dGLiqjTzIr9kO2i3DlJ78BRvr0VCESZYVkvRYjmS+Fm5LkFo/SX7bkQzf\n\tVS9yV19TgBv3sEKwwEDrcgPZRVotelEQtNwifLBRWQ9fwDGOUYdnuNQC58VAorMhlN\n\tFANOPeA1WQ+/Q==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=thaumatec-com.20210112.gappssmtp.com; s=20210112; t=1679668169;\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=pCKH6OcTTdDeYB8O+3cUHp8U7UiJ/Ef5VKZA4e1pH+Y=;\n\tb=tj91w3S6LTlldMfy41yvl7qEFVmSvmqNu9s4gkheCqVQ8aZRGTDlKfkZd3NOtUQiqZ\n\tNRHz+T7Vqp5jjakAaeXnGclHMxjBMT5+An5hGo+wMm4wiiYsfDIR16WJprA00PM+gus7\n\tl+dMbj5W9ODUDa4J4q3lJB0bgocuiplEir8xGDbBpEljVvoHxyTRCKnXZtaTs0Wxn10i\n\tBzwe+nSmxOF+HuwxGTWBQfJMpY4GVG+2CMTSyLSB+exYgPouc+8h8gOIVjY3a1KJvmKS\n\tWiidWRQcxCK0e6eNjdCVb18CoRByJxzEcvXcJwWAT5kQcLrPYP3p0tm+9HJ308N0AMlX\n\trdYg=="
        ],
        "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=\"tj91w3S6\"; \n\tdkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1679668169;\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=pCKH6OcTTdDeYB8O+3cUHp8U7UiJ/Ef5VKZA4e1pH+Y=;\n\tb=0yDd3vLs5KF8+80ODEIRviKyZ2/Y9KnMbET0KTxyryptOlF1joU9pKbKJmLhCWg4sM\n\txvN4MnQeT57JOT2bvsVAswjF+hidHz0Bb43XUOJcuWx4XfyQ+VrOiZo8QImERJDrP+ii\n\t+0SZbrDBEKqxpPKGsnhdvF3qHZltHArfXuMtKSakKw5qdj7OPKciNwNP1mqy9NJcIbzI\n\t/EsplLdIIDOj6fc4eqXtVVoK/YTyBWbu5uVGCKpAAImD4uAatzYvJtVIihwxIXXoReOm\n\ttYn21P1oJ8zmWsa///M3GncaXY2vMNpZ/WkYvHUr1Z7krXjEP2xilbDHACxVnVLo8kuI\n\thnHg==",
        "X-Gm-Message-State": "AAQBX9ekaq+opjPeCaSf+UH0A4Vx3RRpZDGeN16bcjlM6B9cw4TIgV7N\n\txMVEJkib8qEyZ5FzCNSpyvBRR1VzOjz1Ry3xtOs=",
        "X-Google-Smtp-Source": "AKy350blIjx8nlvcw1L4pw2tawbyH0/N45S+taDTjhb98KTrFzxmnzFTL3Nn1iHqq/2QOiSoupZ0hw==",
        "X-Received": "by 2002:a2e:9402:0:b0:29a:6325:6412 with SMTP id\n\ti2-20020a2e9402000000b0029a63256412mr886962ljh.47.1679668168940; \n\tFri, 24 Mar 2023 07:29:28 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 24 Mar 2023 15:29:07 +0100",
        "Message-Id": "<20230324142908.64224-10-dse@thaumatec.com>",
        "X-Mailer": "git-send-email 2.39.2",
        "In-Reply-To": "<20230324142908.64224-1-dse@thaumatec.com>",
        "References": "<20230324142908.64224-1-dse@thaumatec.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v5 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 | 13 +++++++++++++\n 3 files changed, 22 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..b6eef541 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,8 @@ int RkISP1CameraData::loadIPA(unsigned int hwRevision)\n \t\treturn -ENOENT;\n \n \tipa_->setSensorControls.connect(this, &RkISP1CameraData::setSensorControls);\n+\tif (sensor_->focusLens())\n+\t\tipa_->setLensControls.connect(this, &RkISP1CameraData::setLensControls);\n \tipa_->paramsBufferReady.connect(this, &RkISP1CameraData::paramFilled);\n \tipa_->metadataReady.connect(this, &RkISP1CameraData::metadataReady);\n \n@@ -403,6 +406,16 @@ 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+\n+\tfor (auto const &[id, value] : lensControls) {\n+\t\tif (id == V4L2_CID_FOCUS_ABSOLUTE)\n+\t\t\tfocusLens->setFocusPosition(value.get<int32_t>());\n+\t}\n+}\n+\n void RkISP1CameraData::metadataReady(unsigned int frame, const ControlList &metadata)\n {\n \tRkISP1FrameInfo *info = frameInfo_.find(frame);\n",
    "prefixes": [
        "libcamera-devel",
        "v5",
        "09/10"
    ]
}