Show a patch.

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

{
    "id": 18179,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/18179/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18179/",
    "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": "<20230123154934.27803-5-naush@raspberrypi.com>",
    "date": "2023-01-23T15:49:24",
    "name": "[libcamera-devel,v2,04/14] pipeline: ipa: raspberrypi: Validate lens controls",
    "commit_ref": "b9923747ad28bea8b9466c7205a0db4d56545716",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "311557bd10b10ce7b62eadc4e5c8d3435f5d2d01",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18179/mbox/",
    "series": [
        {
            "id": 3719,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3719/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3719",
            "date": "2023-01-23T15:49:20",
            "name": "Raspberry Pi: Camera Module 3 support",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3719/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18179/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18179/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 51AE3C3240\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Jan 2023 15:49:55 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 15FB9625F8;\n\tMon, 23 Jan 2023 16:49:54 +0100 (CET)",
            "from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com\n\t[IPv6:2a00:1450:4864:20::32c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8BA07625DF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Jan 2023 16:49:50 +0100 (CET)",
            "by mail-wm1-x32c.google.com with SMTP id\n\tfl11-20020a05600c0b8b00b003daf72fc844so10952956wmb.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Jan 2023 07:49:50 -0800 (PST)",
            "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tn16-20020a05600c181000b003d1de805de5sm10339689wmp.16.2023.01.23.07.49.49\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 23 Jan 2023 07:49:49 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1674488994;\n\tbh=8oh+xFylsUCpNA5AeRcTyGVjoYq0AXKXMU73wp4krkY=;\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=MkbHM/5HkHy5cYMX4C0RYT4TGNHYTJ3DwnAX9jICV1XbCgp3sbONSl41h2HDWnT4g\n\tn9QlOyVrkJy3Q7KC4lqePrAoYyFvixil8XMlB8AzQqulCss3pg22r/IoRHx7VQRTWY\n\tA5s3HDOZ0sky3vMU1V6jf+pO8xnJ5pL5m865+gfjSeKKoGjP2z+CnHzA/iSrPoU4Th\n\tiBFptiasuAHx64MWD+nAZ65nDjhgORY8B+oXMcJgEheP5Nhh/k1GzIDM1Kc7jUFopf\n\tikJsL0CS6wZ3y/DffUmxTu3bWQ7HPrwSjCES9dDqUodh3XTdHX8MI0n3c2SeYbUVjQ\n\tjBvOQSzK2Mw2A==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\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=FhJw6of4WXMHBF4q06UQklcI9vOo0hl5yvU9EvL/D4E=;\n\tb=ZQDhtdIc866vEkbwkwlNzpOjhaKN7X29NrOraWgOTk8rZzyKGRRmkBERC2/+3ay1u8\n\tNmryBB//kP+EWmybbEmUzSvNNzk7BCzjXwZfuRkOqs4s2wtlF5/oXHxywLHdM3oYISEp\n\tth9nahvIiYCN1ooNz0CtEah/sz0wiDGB4jEu+LfPIB36J/yOryH8kiE0R8aHGTBQjKyA\n\tlGr0JKYCPx8YM6xRbUvFnMjKP/bYNKy+MNajdyHS242mHCVyI36B7kmftzbYfvtyezvn\n\tAY/NW9XWOYy0Jn0Z8uqhfbD41J/tZsMcxq8b5wH3XmtmmW/tMp4WQZbKV48eMuYETDSP\n\tTxrg=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"ZQDhtdIc\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\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=FhJw6of4WXMHBF4q06UQklcI9vOo0hl5yvU9EvL/D4E=;\n\tb=Lesuy3+Vr0F+S6wMM8sXKZvj9zGMchHZrswu6WA61NRE4uI6vjyANZgN6m7FxLgl1b\n\tOTKqAr4yzZALA8UgwOeVWoOz2Rdga0UJdy4kgU/vkB44Ef6Q4c145CjuCl5o3YXfvapb\n\trz8ursWDyl94uGz7KO8F0OS6/FdePglMw+vGBKAxsAvPeMv1fYLBa7AP3zErU6qbAJmP\n\tYtdib8gWeFKJAW+Ijg/fvnkr4rWQouZCGWLliHq1RYYlnstPq/LQZe5ruJ07zI+47M8G\n\tI/Gqmi+PQqd9fmfeqkm1MtJPuK8sMHBEpBSEiUnB7IIBMHxEw42gI+PBorhHKtvJgFF9\n\tC87A==",
        "X-Gm-Message-State": "AFqh2kra0uAXj1PYGjhtKJoVzjhwJhPeB42tFEQoR8PKkBdDqOryYOst\n\tTPXIgnGRu+cu8pPvii2WL4CnKpV7HqFIszG4OG0=",
        "X-Google-Smtp-Source": "AMrXdXu5kgBaXm7+Uf7Kbk23I/OVchsYhhs6mdPZEAzE+CA55XbvJiYys9tveUDDF1fA8y3SgLfSHQ==",
        "X-Received": "by 2002:a05:600c:3d19:b0:3db:1810:8c9e with SMTP id\n\tbh25-20020a05600c3d1900b003db18108c9emr20089281wmb.38.1674488989962; \n\tMon, 23 Jan 2023 07:49:49 -0800 (PST)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 23 Jan 2023 15:49:24 +0000",
        "Message-Id": "<20230123154934.27803-5-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20230123154934.27803-1-naush@raspberrypi.com>",
        "References": "<20230123154934.27803-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 04/14] pipeline: ipa: raspberrypi:\n\tValidate lens controls",
        "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": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Naushir Patuck <naush@raspberrypi.com>",
        "Cc": "Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Pass the available lens controls to the IPA through the configure() function.\nValidate that the V4L2_CID_FOCUS_ABSOLUTE does exist. If it doesn't, log a\nwarning message, and do not advertise focus related controls from the IPA.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/ipa/raspberrypi.mojom       |  1 +\n src/ipa/raspberrypi/raspberrypi.cpp           | 21 +++++++++++++++++++\n .../pipeline/raspberrypi/raspberrypi.cpp      |  3 +++\n 3 files changed, 25 insertions(+)",
    "diff": "diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom\nindex 2a4821fbc0ef..bfacd1275bfb 100644\n--- a/include/libcamera/ipa/raspberrypi.mojom\n+++ b/include/libcamera/ipa/raspberrypi.mojom\n@@ -38,6 +38,7 @@ struct IPAConfig {\n \tlibcamera.SharedFD lsTableHandle;\n \tlibcamera.ControlInfoMap sensorControls;\n \tlibcamera.ControlInfoMap ispControls;\n+\tlibcamera.ControlInfoMap lensControls;\n };\n \n struct IPAConfigResult {\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex aa18ed750370..bbf3c7dc4a69 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -131,6 +131,7 @@ private:\n \tvoid setMode(const IPACameraSensorInfo &sensorInfo);\n \tbool validateSensorControls();\n \tbool validateIspControls();\n+\tbool validateLensControls();\n \tvoid queueRequest(const ControlList &controls);\n \tvoid returnEmbeddedBuffer(unsigned int bufferId);\n \tvoid prepareISP(const ISPConfig &data);\n@@ -155,6 +156,7 @@ private:\n \n \tControlInfoMap sensorCtrls_;\n \tControlInfoMap ispCtrls_;\n+\tControlInfoMap lensCtrls_;\n \tbool lensPresent_;\n \tControlList libcameraMetadata_;\n \n@@ -394,6 +396,15 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo, const IPAConfig &ip\n \t\treturn -1;\n \t}\n \n+\tif (lensPresent_) {\n+\t\tlensCtrls_ = ipaConfig.lensControls;\n+\t\tif (!validateLensControls()) {\n+\t\t\tLOG(IPARPI, Warning) << \"Lens validation failed, \"\n+\t\t\t\t\t     << \"no lens control will be available.\";\n+\t\t\tlensPresent_ = false;\n+\t\t}\n+\t}\n+\n \tmaxSensorGainCode_ = sensorCtrls_.at(V4L2_CID_ANALOGUE_GAIN).max().get<int32_t>();\n \n \t/* Setup a metadata ControlList to output metadata. */\n@@ -648,6 +659,16 @@ bool IPARPi::validateIspControls()\n \treturn true;\n }\n \n+bool IPARPi::validateLensControls()\n+{\n+\tif (lensCtrls_.find(V4L2_CID_FOCUS_ABSOLUTE) == lensCtrls_.end()) {\n+\t\tLOG(IPARPI, Error) << \"Unable to find Lens control V4L2_CID_FOCUS_ABSOLUTE\";\n+\t\treturn false;\n+\t}\n+\n+\treturn true;\n+}\n+\n /*\n  * Converting between enums (used in the libcamera API) and the names that\n  * we use to identify different modes. Unfortunately, the conversion tables\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 9dd36cbaea78..b0f4930c6f1b 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1615,8 +1615,11 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::IPA\n \tstd::map<unsigned int, ControlInfoMap> entityControls;\n \tipa::RPi::IPAConfig ipaConfig;\n \n+\t/* \\todo Move passing of ispControls and lensControls to ipa::init() */\n \tipaConfig.sensorControls = sensor_->controls();\n \tipaConfig.ispControls = isp_[Isp::Input].dev()->controls();\n+\tif (sensor_->focusLens())\n+\t\tipaConfig.lensControls = sensor_->focusLens()->controls();\n \n \t/* Always send the user transform to the IPA. */\n \tipaConfig.transform = static_cast<unsigned int>(config->transform);\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "04/14"
    ]
}