Show a patch.

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

{
    "id": 18515,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/18515/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18515/",
    "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": "<20230331081930.19289-10-dse@thaumatec.com>",
    "date": "2023-03-31T08:19:29",
    "name": "[libcamera-devel,v6,09/10] rkisp1: Control camera lens position from IPA",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "e8157a8e9457a0e799fab6fb96842e506663d349",
    "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/18515/mbox/",
    "series": [
        {
            "id": 3831,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3831/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3831",
            "date": "2023-03-31T08:19:21",
            "name": "ipa: rkisp1: Add autofocus algorithm",
            "version": 6,
            "mbox": "https://patchwork.libcamera.org/series/3831/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18515/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18515/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 7E925C32A1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 31 Mar 2023 08:20:00 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 205FC627AF;\n\tFri, 31 Mar 2023 10:20:00 +0200 (CEST)",
            "from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com\n\t[IPv6:2a00:1450:4864:20::12f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DECD662768\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 31 Mar 2023 10:19:51 +0200 (CEST)",
            "by mail-lf1-x12f.google.com with SMTP id g19so14771264lfr.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 31 Mar 2023 01:19:51 -0700 (PDT)",
            "from localhost.localdomain ([91.90.166.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tt1-20020ac24c01000000b004e84a8c3d86sm281459lfq.42.2023.03.31.01.19.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 31 Mar 2023 01:19:51 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1680250800;\n\tbh=bLqSmcHJss4tPX5K00bkSod/puYdxUrHTNdIMYC+T4g=;\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=sXhfkpM497wNlQGQbZY4bxxdTaVPfBA4Ox7wwTi6jMsJ7Dv1U8Mgk7yPQzxsooz73\n\twWQW+XBAM72DUNChEccaRiVDf8H++ljW8p2xOM8BnSWR9S8co7yTIzA/7Y4obo0YVJ\n\tLMpLMIWwJfVznW2Asmu6pWOZWd25RTI0VmQlK76SEneebK8Sq8BYJ6hFs2ALahAj6Z\n\tmODIbcbwRWAKpSua9y8jo+c30R+1s5K+IamKA+ITbBrQo8NbeyaUg6fUvIAnGvbuO9\n\t8kt0rzwDLdJAJDJ1g4+HYbhPLpAS9gA29NiuERj4Fmu0YCL28JGK2DoYaarNare3i0\n\tzdQmO9PJ+eAMA==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=thaumatec-com.20210112.gappssmtp.com; s=20210112; t=1680250791;\n\tx=1682842791; \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=bF+pQHcoCZEIwhlblfRqtcMkef8BVDr4E6eAf4PH+RY=;\n\tb=znrHpllc/gKHFg1K8WJR7uyIq4CeBOOdmjIpwWkQ/XVYF8FyhwuClI/KjMXOmUZMQF\n\t2tBv6QeCRKo0xexKroLjxj5lbL5kb09deqFIBGRoNdevQD8egrCiUikeW8CyWZi1p4iW\n\t+hJD4qz2vB9URkr3qnlJePS9nYQuQb/RRnUsIIGf+H4yzu/vsE5ZM3188gO4fAB7N1dO\n\tOrGCrgF/sgSGQ5hNnRDV1oTbvuzdCZQ1Ew16yZ67kxznRfBG2V7O78GA39taV3gGp+TG\n\tRfwtDya2G3YVscWz/0fMdAGLeqERiwy32yvkxJHOtC4ZALFI7M1NOCft08kADB8pIWzF\n\t2xIQ=="
        ],
        "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=\"znrHpllc\"; \n\tdkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1680250791; x=1682842791;\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=bF+pQHcoCZEIwhlblfRqtcMkef8BVDr4E6eAf4PH+RY=;\n\tb=KIrcJ1s9hBLTgPA1mV105PM7Ps/9V9fexhad6rX9tGusaS+kZeUX9IAd1zw1CEPytp\n\tYbp/sXFNciSMZwzBjx1c1kiGTDPMI1GhIgn3s6T9c+n/N69uBchgFWH22xLWayYkd8HQ\n\tenObf0Bhwa/teo7ZNPIm9pBpzxvhlimHreTHqV6UsRD5l13kWs3u+1FVwRuGFDYphjH+\n\tISjZ/hV1m3mG6bxxU4IOYnmX+mZQoaxVKyqDflKc4Z1cz8iDFcBkkv5h+n2ay28pZAV/\n\tYfweg1nmrEs0bEnQddB4CA2seXABcF11i+mrM4N5+sHyh2N4FE38xgYfuEuQ2H8cOEgO\n\tce7A==",
        "X-Gm-Message-State": "AAQBX9ebMmbFvIX46jkYym1t4pgjHs4OcZEwcRSxp9zx8/UqM+giF+M2\n\tpZzWyotoOfUBCBekx/9IE2uQAEx0f29UOA8v5XwQfw==",
        "X-Google-Smtp-Source": "AKy350Y+tZRguc0e8D/rHEZCEx/JwaHZshapC/da2YrZ7emqoyDIAmS+v9QF0H5KIvPzaXVUFyOF6A==",
        "X-Received": "by 2002:a19:f519:0:b0:4eb:304f:66f3 with SMTP id\n\tj25-20020a19f519000000b004eb304f66f3mr232857lfb.22.1680250791671; \n\tFri, 31 Mar 2023 01:19:51 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 31 Mar 2023 10:19:29 +0200",
        "Message-Id": "<20230331081930.19289-10-dse@thaumatec.com>",
        "X-Mailer": "git-send-email 2.39.2",
        "In-Reply-To": "<20230331081930.19289-1-dse@thaumatec.com>",
        "References": "<20230331081930.19289-1-dse@thaumatec.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v6 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>",
        "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 d4ff1230..dc6a8ffc 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 9c8b4a82..37b1e0a8 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -497,6 +497,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 f966254a..f42a8368 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@@ -409,6 +412,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",
        "v6",
        "09/10"
    ]
}