Show a patch.

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

{
    "id": 14503,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/14503/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14503/",
    "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": "<20211028100319.1097720-4-hanlinchen@chromium.org>",
    "date": "2021-10-28T10:03:19",
    "name": "[libcamera-devel,4/4] ipu3: ipa: Allow IPA to apply controls to the lens device",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "777492b12701b10364d4d60a25233bdcc324509e",
    "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/14503/mbox/",
    "series": [
        {
            "id": 2672,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2672/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2672",
            "date": "2021-10-28T10:03:16",
            "name": "[libcamera-devel,1/4] ipa: ipu3: Extend ipu3 ipa interface for sensor and lens controls",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2672/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14503/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14503/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 B424EBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  9 Nov 2021 19:29:41 +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 B8211FD1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  9 Nov 2021 20:29:40 +0100 (CET)",
            "from perceval.ideasonboard.com\n\tby perceval.ideasonboard.com with LMTP id yFXLNHV1emFzBgAA4E0KoQ\n\t(envelope-from <libcamera-devel-bounces@lists.libcamera.org>)\n\tfor <kbingham@ideasonboard.com>; Thu, 28 Oct 2021 12:03:33 +0200",
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\tby perceval.ideasonboard.com (Postfix) with ESMTPS\n\tid C2992513;\tThu, 28 Oct 2021 12:03:33 +0200 (CEST)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 58ABE60103;\n\tThu, 28 Oct 2021 12:03:33 +0200 (CEST)",
            "from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com\n\t[IPv6:2607:f8b0:4864:20::52f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6082F600B6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Oct 2021 12:03:30 +0200 (CEST)",
            "by mail-pg1-x52f.google.com with SMTP id r28so5964027pga.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Oct 2021 03:03:30 -0700 (PDT)",
            "from localhost ([2401:fa00:1:10:1bc:52e7:6df5:c7cf])\n\tby smtp.gmail.com with UTF8SMTPSA id\n\tf4sm2241488pgn.93.2021.10.28.03.03.27\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tThu, 28 Oct 2021 03:03:28 -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=\"Zl7+Gub+\"; 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=\"Zl7+Gub+\";\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=v3TIv1B+NBMqukcEHLimuJfzih/lGpnEG+7CxByQeSE=;\n\tb=Zl7+Gub+W7rkKOp5L8m8GafmFpZUp2/Zjv8gSuVs3ZTW+chV1uuI74y+3ukO/QXCj0\n\t+n05ir1eb4zojujB8S7YpSJqsbXTWt6oJlErieFRx3YdIY284eOE1tG8FqyC4CTMR2Em\n\t3c64Smi6oipZr2gbpROwbFly1Vh/QtboBM/Nk=",
        "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=v3TIv1B+NBMqukcEHLimuJfzih/lGpnEG+7CxByQeSE=;\n\tb=GhmdiX4MuFn6zhb3ovfTm9osLb4Chl0LtSuJNL2DxFLeuKVYRn1kaZtLDgyVCY8EMB\n\tSBikDRKvy7tqEyuqoa1uUpdQDUUE4GxNRZCQEgxGIzF0YKFfwozpxIDNSe1OdvNUqmmN\n\tFrgKJylG5kUDnAIuSLJ4gn4VkVGQuAYuWtGuwPRnE/4xG1q8ONQgcQVpsMmtexKwjKkj\n\t2XU+0tRBH1XnsUgYw3qzKGNlsqen/HxHOABcx8Fsob6gG3yifwcHcT6oNURvOgL6ZkUA\n\tQzjypci9SBDieRo04l1Jr7ww3U0YnAaVsEyfZg4hCXiGMFmGirQ0Y/NCRICITWbXSmM4\n\tLkFw==",
        "X-Gm-Message-State": "AOAM5338YSrTQllk/HzsINrlNbVXVLJXv+V7PSWs3biQ40oGd3F9Cx1u\n\tXygSim6YKIq7NDsBfZj7b1tzoE7668RyD4nb",
        "X-Google-Smtp-Source": "=?utf-8?q?ABdhPJwLEFuGH4Yz6STOAS5u+Prpk5ko5q0XTjW7w?=\n\t=?utf-8?q?QdjDe+gIRhJbVphF2tj5zwFn1vtOBExR3OvuQ=3D=3D?=",
        "X-Received": "by 2002:a63:a80c:: with SMTP id\n\to12mr2447140pgf.422.1635415408736; \n\tThu, 28 Oct 2021 03:03:28 -0700 (PDT)",
        "From": "Han-Lin Chen <hanlinchen@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 28 Oct 2021 18:03:19 +0800",
        "Message-Id": "<20211028100319.1097720-4-hanlinchen@chromium.org>",
        "X-Mailer": "git-send-email 2.33.1.1089.g2158813163f-goog",
        "In-Reply-To": "<20211028100319.1097720-1-hanlinchen@chromium.org>",
        "References": "<20211028100319.1097720-1-hanlinchen@chromium.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 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>",
        "Cc": "Han-Lin Chen <hanlinchen@chromium.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>",
        "X-TUID": "09URPkhGSLE3",
        "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.com>\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..36e93fb0 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 = const_cast<ControlList&>(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",
        "4/4"
    ]
}