Show a patch.

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

{
    "id": 14518,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/14518/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14518/",
    "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": "<20211029115917.2467936-4-hanlinchen@chromium.org>",
    "date": "2021-10-29T11:59:17",
    "name": "[libcamera-devel,v2,4/4] ipu3: ipa: Allow IPA to apply controls to the lens device",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d413f5840fa5869c41bd7c386199ee22e93e38a4",
    "submitter": {
        "id": 98,
        "url": "https://patchwork.libcamera.org/api/1.1/people/98/?format=api",
        "name": "Hanlin Chen",
        "email": "hanlinchen@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/14518/mbox/",
    "series": [
        {
            "id": 2680,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2680/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2680",
            "date": "2021-10-29T11:59:14",
            "name": "[libcamera-devel,v2,1/4] ipa: ipu3: Extend ipu3 ipa interface for sensor and lens controls",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2680/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14518/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14518/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<kieran.bingham@ideasonboard.com>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": [
            "parsemail@patchwork.libcamera.org",
            "kbingham@ideasonboard.com"
        ],
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 74A65BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 10 Nov 2021 13:56:32 +0000 (UTC)",
            "from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net\n\t[86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 756B0501\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 10 Nov 2021 14:56:31 +0100 (CET)",
            "from perceval.ideasonboard.com\n\tby perceval.ideasonboard.com with LMTP id gOo7Ii3ie2EWOQAA4E0KoQ\n\t(envelope-from <libcamera-devel-bounces@lists.libcamera.org>)\n\tfor <kbingham@ideasonboard.com>; Fri, 29 Oct 2021 13:59:41 +0200",
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\tby perceval.ideasonboard.com (Postfix) with ESMTPS\n\tid 7710A881;\tFri, 29 Oct 2021 13:59:41 +0200 (CEST)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 144EF600C2;\n\tFri, 29 Oct 2021 13:59:41 +0200 (CEST)",
            "from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com\n\t[IPv6:2607:f8b0:4864:20::62d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EB0FB600B8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 29 Oct 2021 13:59:38 +0200 (CEST)",
            "by mail-pl1-x62d.google.com with SMTP id t11so6649490plq.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 29 Oct 2021 04:59:38 -0700 (PDT)",
            "from localhost ([2401:fa00:1:10:35fe:d53b:684:b538])\n\tby smtp.gmail.com with UTF8SMTPSA id\n\tn29sm2224842pfv.29.2021.10.29.04.59.33\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tFri, 29 Oct 2021 04:59:34 -0700 (PDT)"
        ],
        "Authentication-Results": [
            "perceval.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"VMpLmWUU\"; dkim-atps=neutral",
            "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature\n\tverification failed\" (1024-bit key; unprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"VMpLmWUU\";\tdkim-atps=neutral"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; h=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=WEuD6Qo9dGtBh7JN3uPzd0sh7jtrp0zRRNTgSKY7mVM=;\n\tb=VMpLmWUUkUfrUYK32D/fTkkNR4CFbpbfbCU5JUrn+UM9yfFAzdF9g3jDgKdiEPryh+\n\t9qIhULx0eyOeLDHeLkzgL5ZCAZlQ0gzsD86QaHpapFxjcOcuHwrppOtx2AbB+pdldSC3\n\tlrpCfiku2HjBqO2u5B0aX+TvdMeC5KT8smzfM=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=WEuD6Qo9dGtBh7JN3uPzd0sh7jtrp0zRRNTgSKY7mVM=;\n\tb=nNKAiO3gPZdeUjPgrZulkx5rmakA/qC0el8/IpP7BSiAuAnq+tAB2KNxkUtuzOU2HA\n\tjbrmdmc1fU1rCFN5oZmIV4P67sNH2vL7ImjI57jfML+q7/Vdc5PPMVi7k35UAYjAAFDc\n\tTCUVWe7FBfxDQg88u48m9o1rctkfYbmlGAKMcuHg/4xezzobQ63V0rydRPIt7PsDRff3\n\tUWLjzP0e2EXqUjsZ/J37n+Imus5Y5rZD+Z9VZgjuGs6pNA95tuc70sOhWimHedIJYNFa\n\t8FE9wQbT5WvuMT5LuKVZRsUSH6jxd6c42Oydh8Z84pPwO9bh2hqy3wdf0CjCK6YxvOdK\n\ty3rA==",
        "X-Gm-Message-State": "AOAM531yrOKF21XYxCeZSIXQhKRGXB+1i78pv39dRcQ11s4wYxIJl371\n\tCNGdQ5f89wipHGFvS1ig0UDQIiriem7CfTna",
        "X-Google-Smtp-Source": "=?utf-8?q?ABdhPJzBhYNo9UUV+bIjavZ36C/3XyFbbAvri9D6t?=\n\t=?utf-8?q?Tv+pGApSXoMUbUUFN/JUMzcWN8i2VVJ91KfAg=3D=3D?=",
        "X-Received": "by 2002:a17:90a:d582:: with SMTP id\n\tv2mr11077660pju.46.1635508774666; \n\tFri, 29 Oct 2021 04:59:34 -0700 (PDT)",
        "From": "Han-Lin Chen <hanlinchen@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 29 Oct 2021 19:59:17 +0800",
        "Message-Id": "<20211029115917.2467936-4-hanlinchen@chromium.org>",
        "X-Mailer": "git-send-email 2.33.1.1089.g2158813163f-goog",
        "In-Reply-To": "<20211029115917.2467936-1-hanlinchen@chromium.org>",
        "References": "<20211029115917.2467936-1-hanlinchen@chromium.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 4/4] ipu3: ipa: Allow IPA to apply\n\tcontrols to the lens device",
        "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>",
        "X-TUID": "qXTHFnL+LICb",
        "Resent-From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "Resent-To": "parsemail@patchwork.libcamera.org"
    },
    "content": "Allow IPA to apply controls to the lens device.\n\nSigned-off-by: Han-Lin Chen <hanlinchen@chromium.org>\n---\n meson.build                          |  6 ++++++\n src/libcamera/pipeline/ipu3/cio2.cpp | 30 ++++++++++++++++++++++++++++\n src/libcamera/pipeline/ipu3/cio2.h   |  3 +++\n src/libcamera/pipeline/ipu3/ipu3.cpp |  9 +++++++--\n 4 files changed, 46 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/meson.build b/meson.build\nindex 7892a9e3..2a4b68a2 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -108,6 +108,12 @@ if cc.has_argument('-Wno-c99-designator')\n     ]\n endif\n \n+if get_option('android_platform') == 'cros'\n+    common_arguments += [\n+        '-DOS_CHROMEOS',\n+    ]\n+endif\n+\n c_arguments += common_arguments\n cpp_arguments += common_arguments\n \ndiff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\nindex 59dda56b..143e2a95 100644\n--- a/src/libcamera/pipeline/ipu3/cio2.cpp\n+++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n@@ -16,6 +16,7 @@\n #include <libcamera/geometry.h>\n #include <libcamera/stream.h>\n \n+#include \"libcamera/internal/camera_lens.h\"\n #include \"libcamera/internal/camera_sensor.h\"\n #include \"libcamera/internal/framebuffer.h\"\n #include \"libcamera/internal/media_device.h\"\n@@ -159,6 +160,35 @@ int CIO2Device::init(const MediaDevice *media, unsigned int index)\n \t\treturn -EINVAL;\n \t}\n \n+#if defined(OS_CHROMEOS)\n+\t/*\n+\t * \\todo Read the lens model from the sensor itself or from a device database.\n+\t * For now use default values taken from ChromeOS.\n+\t */\n+\tstatic std::unordered_map<std::string, std::string> sensorLens = {\n+\t\t{ \"ov13858\", \"dw9714\" },\n+\t\t{ \"imx258\", \"dw9807\" },\n+\t\t{ \"imx355\", \"ak7375\" }\n+\t};\n+\n+\tauto it = sensorLens.find(sensor_->model());\n+\tif (it != sensorLens.end()) {\n+\t\tconst std::vector<MediaEntity *> &entities = media->entities();\n+\t\tfor (auto ent: entities) {\n+\t\t\tif (ent->function() == MEDIA_ENT_F_LENS) {\n+\t\t\t\tlens_ = std::make_unique<CameraLens>(ent);\n+\t\t\t\tret = lens_->init();\n+\t\t\t\tif (!ret && lens_->model() == it->second) {\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\t\tlens_.reset();\n+\t\t\t}\n+\t\t\tif (!lens_)\n+\t\t\t\tLOG(IPU3, Warning) << \"Lens device \" << it->second << \" not found\";\n+\t\t}\n+\t}\n+#endif\n+\n \t/*\n \t * \\todo Define when to open and close video device nodes, as they\n \t * might impact on power consumption.\ndiff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h\nindex ba8f0052..635566c8 100644\n--- a/src/libcamera/pipeline/ipu3/cio2.h\n+++ b/src/libcamera/pipeline/ipu3/cio2.h\n@@ -18,6 +18,7 @@\n \n namespace libcamera {\n \n+class CameraLens;\n class CameraSensor;\n class FrameBuffer;\n class MediaDevice;\n@@ -52,6 +53,7 @@ public:\n \tint stop();\n \n \tCameraSensor *sensor() { return sensor_.get(); }\n+\tCameraLens *lens() { return lens_.get(); }\n \tconst CameraSensor *sensor() const { return sensor_.get(); }\n \n \tFrameBuffer *queueBuffer(Request *request, FrameBuffer *rawBuffer);\n@@ -67,6 +69,7 @@ private:\n \tvoid cio2BufferReady(FrameBuffer *buffer);\n \n \tstd::unique_ptr<CameraSensor> sensor_;\n+\tstd::unique_ptr<CameraLens> lens_;\n \tstd::unique_ptr<V4L2Subdevice> csi2_;\n \tstd::unique_ptr<V4L2VideoDevice> output_;\n \ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 6a7f5b9a..6c44957f 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -24,6 +24,7 @@\n #include <libcamera/stream.h>\n \n #include \"libcamera/internal/camera.h\"\n+#include \"libcamera/internal/camera_lens.h\"\n #include \"libcamera/internal/camera_sensor.h\"\n #include \"libcamera/internal/delayed_controls.h\"\n #include \"libcamera/internal/device_enumerator.h\"\n@@ -1250,8 +1251,12 @@ void IPU3CameraData::queueFrameAction(unsigned int id,\n {\n \tswitch (action.op) {\n \tcase ipa::ipu3::ActionSetSensorControls: {\n-\t\tconst ControlList &controls = action.sensorControls;\n-\t\tdelayedCtrls_->push(controls);\n+\t\tconst ControlList &sensorControls = action.sensorControls;\n+\t\tdelayedCtrls_->push(sensorControls);\n+\t\tif (cio2_.lens()) {\n+\t\t\tControlList lensControls = action.lensControls;\n+\t\t\tcio2_.lens()->setControls(&lensControls);\n+\t\t}\n \t\tbreak;\n \t}\n \tcase ipa::ipu3::ActionParamFilled: {\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "4/4"
    ]
}