Show a patch.

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

{
    "id": 18465,
    "url": "https://patchwork.libcamera.org/api/patches/18465/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18465/",
    "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": "<20230327093439.24670-2-naush@raspberrypi.com>",
    "date": "2023-03-27T09:34:36",
    "name": "[libcamera-devel,v2,1/4] ipa: raspberrypi: Add sensor mode limits to CameraMode",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "d2c160e95db1b161828c858a748f09c904d0604c",
    "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/18465/mbox/",
    "series": [
        {
            "id": 3818,
            "url": "https://patchwork.libcamera.org/api/series/3818/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3818",
            "date": "2023-03-27T09:34:35",
            "name": "Raspberry Pi: Sensor limits",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3818/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18465/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18465/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 EC98AC326C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Mar 2023 09:34:46 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DC51E6273D;\n\tMon, 27 Mar 2023 11:34:45 +0200 (CEST)",
            "from mail-io1-xd30.google.com (mail-io1-xd30.google.com\n\t[IPv6:2607:f8b0:4864:20::d30])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 89662626DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Mar 2023 11:34:43 +0200 (CEST)",
            "by mail-io1-xd30.google.com with SMTP id e13so3630220ioc.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Mar 2023 02:34:43 -0700 (PDT)",
            "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\td12-20020a056602328c00b0075464a69c10sm7658345ioz.10.2023.03.27.02.34.41\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 27 Mar 2023 02:34:42 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1679909685;\n\tbh=O145NJ/eDREy69ovZASc8+j6VP/8f0yzLsVuI+LQYX0=;\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=mn1vPY9sVW3l8bD0BuJRF7EENjH58fjWKF3y+ZPwcMAjL1SGZPz1bKEAxQ2Nl2xCy\n\tNOlbY9Y2aTrBi0hgInDU6RGV9wYb7O7XearFfyf5zHUaZxC5IFTfqVRe/yZopOT4Ms\n\taRb/JJNkxW3gLux1oDHXBS2QXRi4pCRWnBxqvLfpRqmayYKSWOBj3VNR/1Vqe30FQ/\n\tFTD/OYyyO2RHMdSwtVmR3L1GWhJCpZbDrMF7uIcB7QBMMNRbLM1v3szocKcaHsgfVq\n\t7CubsIeS7Z5swaRUuwBan7ZMVL3ThqZTpsAKvH0vfH4vBTi97PnCKJUFfNZnvwXt+l\n\togtnFmVdnByYQ==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1679909682;\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=57Xo0a5+A05ZYv9p8DpBaQMTnNKtoIQ1uVFpyH98Sv0=;\n\tb=TdSkYR14iTLtbvRtPlf1lrBuXkzgWmLRo78+3YQBHDB0CBG3NI5tYYYSnauSK7yEPp\n\tl+VDoTbDj8l3SwhskvUe/RhDitd5iFz0ADEgJQUInxUdxlLMJnXygZdV09cUrzI3PM86\n\tIfbD1V/PCz7bYNC3MT+Hx4Fftrpa/VMt8/zgFzJQAsmCEEaxIqySWc2CINUwHnbn0P9N\n\tbBkHTRbn8/9fTiJBodrAQfa9Wg6IlaHoKx00lXEXQVa2y1f83WzouNmXG9qJVTZTvS0l\n\tzo6geBZzXpwQqG9oO3u+iwkWQ2knfJCc4/gaLhcmg+lLj8HVsUAoRasDDVDjkdL47nI+\n\tT9XA=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"TdSkYR14\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1679909682;\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=57Xo0a5+A05ZYv9p8DpBaQMTnNKtoIQ1uVFpyH98Sv0=;\n\tb=4/TqsrNVS2xpPHdb2vW7coUL7ckd0cqExHRLcVJccgeg93fvy6WN11WYI8msIZNBgT\n\t/oyiRFlYEh6GvMCxcYr/WGuRQahGoA1KSoqSUVShKCSRwQQBPwvOM/cE4mhrSC/nIJRd\n\t6dsOIpG64YlEqtdXTYdp9qI5bulB//zSklWU7C6vGnPZ4f3GOphCO0JY4zuNRxb3W4u0\n\toL+l/UsUKh36eDK/A07Sci9qC9AnRhHX2Gh7jAgZOKsY4axSzJvGzqEpLWzkIK5DIuZ0\n\tyOh8ePTyUQx6eNM9cO3kOxAMPNDF8YJwnuFYB3N8AxEyxlKY5xzsNPLcq0Oj69bnn1AQ\n\t1sSg==",
        "X-Gm-Message-State": "AAQBX9f7zuShPhBJocSTl00IMPj+jdmosP5RnRo1ldSk2mMVMDRfgDbV\n\tibE1OfxpJjk+stI5fdgit2Zn8n8XwMqjQBKWzeIBew==",
        "X-Google-Smtp-Source": "AKy350ZK8QsuRYm3dXschrbqabF5qt9Ee+lg7yc5ghLTx7mR7ZRVpN+NZ0KxoACyiCldQSL1d1xHEw==",
        "X-Received": "by 2002:a6b:da05:0:b0:759:a25a:c755 with SMTP id\n\tx5-20020a6bda05000000b00759a25ac755mr5086148iob.1.1679909682260; \n\tMon, 27 Mar 2023 02:34:42 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 27 Mar 2023 10:34:36 +0100",
        "Message-Id": "<20230327093439.24670-2-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20230327093439.24670-1-naush@raspberrypi.com>",
        "References": "<20230327093439.24670-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 1/4] ipa: raspberrypi: Add sensor mode\n\tlimits to CameraMode",
        "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 fields in the CameraMode structure to capture the mode specific\nlimits for analogue gain and shutter speed. For convenience, also add\nfields for minimum and maximum frame durations.\n\nPopulate these new fields when setting up the CameraMode structure.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/raspberrypi/controller/camera_mode.h | 10 +++++++++-\n src/ipa/raspberrypi/raspberrypi.cpp          | 16 ++++++++++++++++\n 2 files changed, 25 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/ipa/raspberrypi/controller/camera_mode.h b/src/ipa/raspberrypi/controller/camera_mode.h\nindex 94c51ddf1686..63b1177852d0 100644\n--- a/src/ipa/raspberrypi/controller/camera_mode.h\n+++ b/src/ipa/raspberrypi/controller/camera_mode.h\n@@ -36,9 +36,11 @@ struct CameraMode {\n \tdouble scaleY;\n \t/* scaling of the noise compared to the native sensor mode */\n \tdouble noiseFactor;\n-\t/* minimum and maximum line time */\n+\t/* minimum and maximum line time and frame durations */\n \tlibcamera::utils::Duration minLineLength;\n \tlibcamera::utils::Duration maxLineLength;\n+\tlibcamera::utils::Duration minFrameDuration;\n+\tlibcamera::utils::Duration maxFrameDuration;\n \t/* any camera transform *not* reflected already in the camera tuning */\n \tlibcamera::Transform transform;\n \t/* minimum and maximum frame lengths in units of lines */\n@@ -48,4 +50,10 @@ struct CameraMode {\n \tdouble sensitivity;\n \t/* pixel clock rate */\n \tuint64_t pixelRate;\n+\t/* Mode specific shutter speed limits */\n+\tlibcamera::utils::Duration minShutter;\n+\tlibcamera::utils::Duration maxShutter;\n+\t/* Mode specific analogue gain limits */\n+\tdouble minAnalogueGain;\n+\tdouble maxAnalogueGain;\n };\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 1375795568e2..3f1afb846420 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -407,11 +407,27 @@ void IPARPi::setMode(const IPACameraSensorInfo &sensorInfo)\n \tmode_.minFrameLength = sensorInfo.minFrameLength;\n \tmode_.maxFrameLength = sensorInfo.maxFrameLength;\n \n+\t/* Store these for convenience. */\n+\tmode_.minFrameDuration = mode_.minFrameLength * mode_.minLineLength;\n+\tmode_.maxFrameDuration = mode_.maxFrameLength * mode_.maxLineLength;\n+\n \t/*\n \t * Some sensors may have different sensitivities in different modes;\n \t * the CamHelper will know the correct value.\n \t */\n \tmode_.sensitivity = helper_->getModeSensitivity(mode_);\n+\n+\tconst ControlInfo &gainCtrl = sensorCtrls_.at(V4L2_CID_ANALOGUE_GAIN);\n+\tconst ControlInfo &shutterCtrl = sensorCtrls_.at(V4L2_CID_EXPOSURE);\n+\n+\tmode_.minAnalogueGain = helper_->gain(gainCtrl.min().get<int32_t>());\n+\tmode_.maxAnalogueGain = helper_->gain(gainCtrl.max().get<int32_t>());\n+\n+\t/* Shutter speed is calculated based on the limits of the frame durations. */\n+\tmode_.minShutter = helper_->exposure(shutterCtrl.min().get<int32_t>(), mode_.minLineLength);\n+\tmode_.maxShutter = Duration::max();\n+\thelper_->getBlanking(mode_.maxShutter,\n+\t\t\t     mode_.minFrameDuration, mode_.maxFrameDuration);\n }\n \n int IPARPi::configure(const IPACameraSensorInfo &sensorInfo, const IPAConfig &ipaConfig,\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "1/4"
    ]
}