Show a patch.

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

{
    "id": 14554,
    "url": "https://patchwork.libcamera.org/api/patches/14554/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14554/",
    "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": "<20211111104958.312070-3-hanlinchen@chromium.org>",
    "date": "2021-11-11T10:49:58",
    "name": "[libcamera-devel,v3,3/3] ipu3: ipa: Allow IPA to apply controls to the lens device",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "fb055c9d59dbf706fffe2510cafc0bd536b5a5ae",
    "submitter": {
        "id": 98,
        "url": "https://patchwork.libcamera.org/api/people/98/?format=api",
        "name": "Hanlin Chen",
        "email": "hanlinchen@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/14554/mbox/",
    "series": [
        {
            "id": 2712,
            "url": "https://patchwork.libcamera.org/api/series/2712/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2712",
            "date": "2021-11-11T10:49:56",
            "name": "[libcamera-devel,v3,1/3] ipa: ipu3: Extend ipu3 ipa interface for lens controls",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/2712/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14554/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14554/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 77ACBBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 11 Nov 2021 10:50:09 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 33EDC6036C;\n\tThu, 11 Nov 2021 11:50:09 +0100 (CET)",
            "from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com\n\t[IPv6:2607:f8b0:4864:20::1032])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C726660345\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 11 Nov 2021 11:50:07 +0100 (CET)",
            "by mail-pj1-x1032.google.com with SMTP id\n\tgf14-20020a17090ac7ce00b001a7a2a0b5c3so4107438pjb.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 11 Nov 2021 02:50:07 -0800 (PST)",
            "from localhost ([2401:fa00:1:10:3925:da9c:3049:be7a])\n\tby smtp.gmail.com with UTF8SMTPSA id\n\tt11sm2001373pgi.73.2021.11.11.02.50.05\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tThu, 11 Nov 2021 02:50:05 -0800 (PST)"
        ],
        "Authentication-Results": "lancelot.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=\"ZlXvJa+T\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=AFX2LYvfAacH1KE9QZfq436ZV6sRvZfc/kkUBq/UUPI=;\n\tb=ZlXvJa+TuZqEBZaNp7T8AINtTy2drqYPiUO3GxnazSvPCdzESOnwuJVuFeNIR+xr3G\n\tcFPhUMxSDEr42TSyDJ4XKtAdRVksYvRLaoQx6qhYOAS/b95YbulksXW0tiBDbNCigQ17\n\t2AWzq6bs58Ev1IkkGFw8gmA1FCLT4e8kR+4Ow=",
        "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=AFX2LYvfAacH1KE9QZfq436ZV6sRvZfc/kkUBq/UUPI=;\n\tb=Cp1oMirgtrxMANKyaxwPNSSsgXnGWUFFa7Z8yyvRTxETx9tgRkt2qy3WUYs6z1Wfzx\n\ttDrGtKTn5yyR5PJYdMykCkF2oi39FKNLpcFioAI+FBsp4V5zX6znqHVTvzGTrwCm8IfN\n\tiuAXV9Izee6D97qnIkpStzpZ3N4Feh2vAIT0zHArDpiRlLgqZ2uGidjP6z4tOaNXPVcg\n\txzXgLJz+YfauILEh5oN3m709sBlnZYi47t6sCnlYvmdegoRYrtFdiScROKsU4hHtx+gd\n\tW8YBKn/X4pGSoFsePQgwWVnIXC3JCLqMj+KcXhC5qnFUJH4BUkq1usgohZCwEfQqUiVV\n\twDJA==",
        "X-Gm-Message-State": "AOAM533NEunC3JUVK8L+i0ArumcrcOqosmm+//oi+89nvhIjYtmLlJ5g\n\ti+Y+R8GRhZte+ZqYLqjv+VWViCBNCFXTww==",
        "X-Google-Smtp-Source": "ABdhPJxYgb7WXUwq6Imb8Pu4BkqYn8fOIX7g9lcPzJlK9zqXL87Lmb7c7tZbDTSWjBRG+aqJWTEIcg==",
        "X-Received": "by 2002:a17:90a:9294:: with SMTP id\n\tn20mr7049936pjo.69.1636627806210; \n\tThu, 11 Nov 2021 02:50:06 -0800 (PST)",
        "From": "Han-Lin Chen <hanlinchen@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 11 Nov 2021 18:49:58 +0800",
        "Message-Id": "<20211111104958.312070-3-hanlinchen@chromium.org>",
        "X-Mailer": "git-send-email 2.34.0.rc1.387.gb447b232ab-goog",
        "In-Reply-To": "<20211111104958.312070-1-hanlinchen@chromium.org>",
        "References": "<20211111104958.312070-1-hanlinchen@chromium.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 3/3] 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>"
    },
    "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..233553c2 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 97003681..88775f67 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@@ -1255,8 +1256,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",
        "v3",
        "3/3"
    ]
}