Show a patch.

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

{
    "id": 18186,
    "url": "https://patchwork.libcamera.org/api/patches/18186/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18186/",
    "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": "<20230123154934.27803-13-naush@raspberrypi.com>",
    "date": "2023-01-23T15:49:32",
    "name": "[libcamera-devel,v2,12/14] ipa: raspberrypi: Add lens position to DeviceStatus",
    "commit_ref": "9b0db2aa4349817a2064e8593790ce45bedba613",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "d9cbb87983e29ce8a61d4049f5b3e0348bdb068c",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18186/mbox/",
    "series": [
        {
            "id": 3719,
            "url": "https://patchwork.libcamera.org/api/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/18186/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18186/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 CC68ABEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Jan 2023 15:50:01 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 862A96260C;\n\tMon, 23 Jan 2023 16:50:01 +0100 (CET)",
            "from mail-wm1-x329.google.com (mail-wm1-x329.google.com\n\t[IPv6:2a00:1450:4864:20::329])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BE0E8625F0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Jan 2023 16:49:55 +0100 (CET)",
            "by mail-wm1-x329.google.com with SMTP id\n\tm5-20020a05600c4f4500b003db03b2559eso8890636wmq.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Jan 2023 07:49:55 -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.54\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 23 Jan 2023 07:49:54 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1674489001;\n\tbh=9ZG7A02w3xBIZWGiPWhbv2aDDQmxJ1BjGnnw5aKsFYw=;\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=jHLtUj0TPmy6+ntcVlgQ14OeB7x9Eek1dvnsJSqEX6DpvavvO4hM238Bu2J6vzGw4\n\txGFGXFusOvrIxiwVlW8Rshfze/za3IP93N2BO022g+u51a9kSzhRjXEe5LRZymvYPm\n\tYcXIxVx5+UR5uk+zR8ycBKtzqS4u6RdLf7rRK6AcBQRLUW0VnunWFRKPef+7BBcB+c\n\tGSQ2Y+pjGPzrJEf0Xf3F4O3wHILOzqt7LTMbGS9t7nP4hs7lyxVHJDNPFnDjA89AJ9\n\t/wWN24Cxj7UA5aL2rKOi6fkUwNf3FffV3PIj8s7c9jHjLCua5qg4XkfiASuuEjktsC\n\t2HqVSDdyQDnfA==",
            "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=6oRk+CQDW/U6TdVVYX9FHJVOlZ4Hp8UtCy5Yhpw/CYE=;\n\tb=WYZoV0Te39I1NJvAST15J3w/4/9Rb8p+lNDDgDT+AfE31tn1sqNm9NGwpcnFRnNtSW\n\tLgu1ww6vZzXsNCqEyyIJYV9a5KmTVHSYAEqLVeftOwXasRGw3tDw1CcDvcBgfGhGd2bw\n\tYUyjAhnT/jxWuEhPRyE30IvibC/mFmJK1+TraiQqy2qxRC+T304HrPxbZrrxBNUMiMbU\n\tTRwAuWcozwu81vsF6jtMxsxLvXcWs+BZNc6sCZsnOY1sHwnxKZUQBNVmx0YJc8CO91En\n\tyPB662TLIyAJTTOXiyfgBJiBYSEEean1G+zzpQ8fceP5TR24TcQIZkYv3LNtcZeRdKaB\n\tvdQA=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"WYZoV0Te\"; 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=6oRk+CQDW/U6TdVVYX9FHJVOlZ4Hp8UtCy5Yhpw/CYE=;\n\tb=vNOukss93A2zsrrcsxg+9TVz1/I9nBKw7pBHIS4yS+EMcq5ljHHtUnEcANcAgAWwqO\n\tpoUM/X9O+Qy6lWslVRyrMLOlHWIt1MLX+UPPFQuVgEBajHLpC9p12wAwyWATOLWWZqCF\n\tQrN+aDqIwT1tZsO08OBEuMeLXR4gck+wRXCOh3EwFk1sLw3RM5LoM1hos22mhcpOuk17\n\tWEzCRDQA87X/JApP3IifGs+jI3ocwrOzbcJFwmSUSbqbudz4byXzHOYQVyHh7U/ReOUE\n\tpX5N9uyIwaDTQGJzkv2HHiuWkcCuASNDaNhseWQmRckt47X4ToIdLR3GodeYD3xTLtnt\n\tORNw==",
        "X-Gm-Message-State": "AFqh2kqAwawevStfn4sRRCQrrMZ/T8WFMyIDwRGW6w/2UVJQsx41T5Ox\n\tb9T9HVTjnXb7sThAyrl9UpYDmCsJKSdEOlTXUp4=",
        "X-Google-Smtp-Source": "AMrXdXtVvqAzB/pMNKuGhswXgDiVm5uoX6tAhyJHCefa/tzGiXYaqzwqMpuTF8nvOrUi4M8eFD5FVw==",
        "X-Received": "by 2002:a05:600c:35d5:b0:3db:fc4:d018 with SMTP id\n\tr21-20020a05600c35d500b003db0fc4d018mr21761591wmq.40.1674488995227; \n\tMon, 23 Jan 2023 07:49:55 -0800 (PST)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 23 Jan 2023 15:49:32 +0000",
        "Message-Id": "<20230123154934.27803-13-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 12/14] ipa: raspberrypi: Add lens\n\tposition to DeviceStatus",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Add the current frame's lens position (in dioptres) to the DeviceStatus\nstructure. This value is obtained from the AfAlgorithm::getLensPosition()\nmember function. Return this lens position back to the pipeline handler to\nstore in the metadata field of the request.\n\nAs a drive-by, fixup some inaccurate comments in the DeviceStatus structure.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Nick Hollinghurst nick.hollinghurst@raspberrypi.com\n---\n src/ipa/raspberrypi/controller/device_status.h | 4 ++--\n src/ipa/raspberrypi/raspberrypi.cpp            | 7 +++++++\n 2 files changed, 9 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/ipa/raspberrypi/controller/device_status.h b/src/ipa/raspberrypi/controller/device_status.h\nindex 4384c2149589..c45db7499f94 100644\n--- a/src/ipa/raspberrypi/controller/device_status.h\n+++ b/src/ipa/raspberrypi/controller/device_status.h\n@@ -32,9 +32,9 @@ struct DeviceStatus {\n \t/* line length for the current frame */\n \tlibcamera::utils::Duration lineLength;\n \tdouble analogueGain;\n-\t/* 1.0/distance-in-metres, or 0 if unknown */\n+\t/* 1.0/distance-in-metres */\n \tstd::optional<double> lensPosition;\n-\t/* 1/f so that brightness quadruples when this doubles, or 0 if unknown */\n+\t/* 1/f so that brightness quadruples when this doubles */\n \tstd::optional<double> aperture;\n \t/* proportional to brightness with 0 = no flash, 1 = maximum flash */\n \tstd::optional<double> flashIntensity;\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex fbace14b1afe..5f7397e2ab21 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -586,6 +586,8 @@ void IPARPi::reportMetadata(unsigned int ipaContext)\n \t\t\t\t       helper_->exposure(deviceStatus->frameLength, deviceStatus->lineLength).get<std::micro>());\n \t\tif (deviceStatus->sensorTemperature)\n \t\t\tlibcameraMetadata_.set(controls::SensorTemperature, *deviceStatus->sensorTemperature);\n+\t\tif (deviceStatus->lensPosition)\n+\t\t\tlibcameraMetadata_.set(controls::LensPosition, *deviceStatus->lensPosition);\n \t}\n \n \tAgcStatus *agcStatus = rpiMetadata.getLocked<AgcStatus>(\"agc.status\");\n@@ -1352,6 +1354,11 @@ void IPARPi::fillDeviceStatus(const ControlList &sensorControls, unsigned int ip\n \tdeviceStatus.analogueGain = helper_->gain(gainCode);\n \tdeviceStatus.frameLength = mode_.height + vblank;\n \n+\tRPiController::AfAlgorithm *af = dynamic_cast<RPiController::AfAlgorithm *>(\n+\t\t\tcontroller_.getAlgorithm(\"af\"));\n+\tif (af)\n+\t\tdeviceStatus.lensPosition = af->getLensPosition();\n+\n \tLOG(IPARPI, Debug) << \"Metadata - \" << deviceStatus;\n \n \trpiMetadata_[ipaContext].set(\"device.status\", deviceStatus);\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "12/14"
    ]
}