Show a patch.

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

{
    "id": 11052,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/11052/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/11052/",
    "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": "<20210129111616.1047483-3-naush@raspberrypi.com>",
    "date": "2021-01-29T11:16:13",
    "name": "[libcamera-devel,v4,2/5] libcamera: camera_sensor: Add frame length limits to CameraSensorInfo",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "d9a8657e6b4d600f3ab2c6ee5ae55e0221ee7683",
    "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/11052/mbox/",
    "series": [
        {
            "id": 1625,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1625/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1625",
            "date": "2021-01-29T11:16:11",
            "name": "Raspberry Pi: FrameDurations control refinements",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/1625/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/11052/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/11052/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 CEE39BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 29 Jan 2021 11:16:29 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9AD31683AD;\n\tFri, 29 Jan 2021 12:16:29 +0100 (CET)",
            "from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com\n\t[IPv6:2a00:1450:4864:20::42d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C28FA683A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 29 Jan 2021 12:16:27 +0100 (CET)",
            "by mail-wr1-x42d.google.com with SMTP id s7so5447320wru.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 29 Jan 2021 03:16:27 -0800 (PST)",
            "from naushir-VirtualBox.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\tf14sm11324007wre.69.2021.01.29.03.16.25\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 29 Jan 2021 03:16:26 -0800 (PST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"t4xD5WZw\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=lB1gEBJZ04IbOiJJDY++VCv0eADH9q7VDwMF3UMW9ZE=;\n\tb=t4xD5WZwzNgzr08U7mXeyzSFdEtEu0JWdOMyWkEH4cfCushPHvdnFBp8yUD+IgjQgD\n\tXt6YNHjljrkQ09LUV6WAOkdGn5Dt4d1NqP3XgFZvItSWi4yFPAePW76K+CXE5qlJ3am2\n\tWmePCBVrjjLsZn0Nj4ec06ng1rLcQGkuSjMmToMfeL21loOdnEHOPts0O0n5QWmmxXpg\n\tGkiypFM+DVtzEP6SCBE7MrfJT9yRyyL+EgaYdipnnG6MLBzf+2vDupwXwhRAtMd8z9lm\n\t/SPqwma5xLbzfhV/UpyLdYY1eHVgJlH/mbvs2sk/3wUzuUNW44/Z4xjs5mx7ezhvgK7N\n\tNRMw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\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=lB1gEBJZ04IbOiJJDY++VCv0eADH9q7VDwMF3UMW9ZE=;\n\tb=RTYPGZsHXPHto/dNnUOGhN/RDTjEh3BCb5FEVeTQKKVa2OWV54vci3dsuS6iGRo9A5\n\t2e+vG9phTP7sM0Sb1fiFd2dYnL1DGaiqYEkxD4gXq5/6Smnh0+mZbKSNdQI4hHimG7VW\n\tf6CirUKUKPmsTmyxT3DKBIgVW6zAkB79/S1pza6nVCgZ7poJvJwBI3vi1KuUXwOXt4Rs\n\t87iDGEDzXvTQepfg+DMhJKQPNlfITd7TA8U3Ws7PEPhHph9SDsmH4eYhpbTFwsLzqZSf\n\tZZDp3jHRZsZtmxW6onQR+BgN+xc7rwDSQU4IQbk2N485vYROMJ0L+HxyLZ21I3jYxmCn\n\tEy3Q==",
        "X-Gm-Message-State": "AOAM530IwMlJalkiDeXZpmP40cf2tHjAfRUY8qNuEe+dBqqoy2cqi9ta\n\tzVlKHyP7ojxfUeVoyuF0sKwR9uFI0max3SX6",
        "X-Google-Smtp-Source": "ABdhPJw1O1IrHI7ijkdUgWmbG6b8b+0a8G/SaMfEVAzZSNEULQz+KKBFz49AhqiASlkxCixfsLqEVA==",
        "X-Received": "by 2002:adf:ee43:: with SMTP id w3mr4201606wro.200.1611918987251;\n\tFri, 29 Jan 2021 03:16:27 -0800 (PST)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 29 Jan 2021 11:16:13 +0000",
        "Message-Id": "<20210129111616.1047483-3-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210129111616.1047483-1-naush@raspberrypi.com>",
        "References": "<20210129111616.1047483-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v4 2/5] libcamera: camera_sensor: Add\n\tframe length limits to CameraSensorInfo",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Sensor frame length is made up of active and inactive (blanking) lines.\nThe minimum and maximum frame length values may be used by pipeline\nhandlers to limit frame durations based on the sensor mode capabilities.\n\nStore the minimum and maximum allowable frame length values (in lines)\nin the CameraSensorInfo structure. These values are computed in\nCameraSensor::sensorInfo() by querying the sensor subdevice\nV4L2_CID_VBLANK control limits. This in turn means that V4L2_CID_VBLANK\nis now a mandatory subdevice control.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/internal/camera_sensor.h |  3 ++\n src/libcamera/camera_sensor.cpp            | 43 ++++++++++++++++++++--\n test/ipa/ipa_wrappers_test.cpp             |  2 +\n 3 files changed, 44 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex fed36bf26e47..5d8c9b1a3121 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -33,6 +33,9 @@ struct CameraSensorInfo {\n \n \tuint64_t pixelRate;\n \tuint32_t lineLength;\n+\n+\tuint32_t minFrameLength;\n+\tuint32_t maxFrameLength;\n };\n \n class CameraSensor : protected Loggable\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex ab315bdc468c..f60d0cc9c6fa 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -113,6 +113,36 @@ LOG_DEFINE_CATEGORY(CameraSensor)\n  * The total line length in pixel clock periods, including blanking.\n  */\n \n+/**\n+ * \\var CameraSensorInfo::minFrameLength\n+ * \\brief The minimum allowable frame length in units of lines\n+ *\n+ * The sensor frame length comprises of active output lines and blanking lines\n+ * in a frame. The minimum frame length value dictates the minimum allowable\n+ * frame duration of the sensor mode.\n+ *\n+ * To obtain the minimum frame duration:\n+ *\n+ * \\verbatim\n+\tframeDuration(s) = minFrameLength(lines) * lineLength(pixels) / pixelRate(pixels per second)\n+   \\endverbatim\n+ */\n+\n+/**\n+ * \\var CameraSensorInfo::maxFrameLength\n+ * \\brief The maximum allowable frame length in units of lines\n+ *\n+ * The sensor frame length comprises of active output lines and blanking lines\n+ * in a frame. The maximum frame length value dictates the maximum allowable\n+ * frame duration of the sensor mode.\n+ *\n+ * To obtain the maximum frame duration:\n+ *\n+ * \\verbatim\n+\tframeDuration(s) = maxFrameLength(lines) * lineLength(pixels) / pixelRate(pixels per second)\n+   \\endverbatim\n+ */\n+\n /**\n  * \\class CameraSensor\n  * \\brief A camera sensor based on V4L2 subdevices\n@@ -699,12 +729,13 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const\n \tinfo->outputSize = format.size;\n \n \t/*\n-\t * Retrieve the pixel rate and the line length through V4L2 controls.\n-\t * Support for the V4L2_CID_PIXEL_RATE and V4L2_CID_HBLANK controls is\n-\t * mandatory.\n+\t * Retrieve the pixel rate, line length and minimum/maximum frame\n+\t * duration through V4L2 controls. Support for the V4L2_CID_PIXEL_RATE,\n+\t * V4L2_CID_HBLANK and V4L2_CID_VBLANK controls is mandatory.\n \t */\n \tControlList ctrls = subdev_->getControls({ V4L2_CID_PIXEL_RATE,\n-\t\t\t\t\t\t   V4L2_CID_HBLANK });\n+\t\t\t\t\t\t   V4L2_CID_HBLANK,\n+\t\t\t\t\t\t   V4L2_CID_VBLANK });\n \tif (ctrls.empty()) {\n \t\tLOG(CameraSensor, Error)\n \t\t\t<< \"Failed to retrieve camera info controls\";\n@@ -715,6 +746,10 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const\n \tinfo->lineLength = info->outputSize.width + hblank;\n \tinfo->pixelRate = ctrls.get(V4L2_CID_PIXEL_RATE).get<int64_t>();\n \n+\tconst ControlInfo vblank = ctrls.infoMap()->at(V4L2_CID_VBLANK);\n+\tinfo->minFrameLength = info->outputSize.height + vblank.min().get<int32_t>();\n+\tinfo->maxFrameLength = info->outputSize.height + vblank.max().get<int32_t>();\n+\n \treturn 0;\n }\n \ndiff --git a/test/ipa/ipa_wrappers_test.cpp b/test/ipa/ipa_wrappers_test.cpp\nindex 47533d105d03..eb6d783e8489 100644\n--- a/test/ipa/ipa_wrappers_test.cpp\n+++ b/test/ipa/ipa_wrappers_test.cpp\n@@ -313,6 +313,8 @@ protected:\n \t\t\t.outputSize = { 2560, 1940 },\n \t\t\t.pixelRate = 96000000,\n \t\t\t.lineLength = 2918,\n+\t\t\t.minFrameLength = 1940,\n+\t\t\t.maxFrameLength = 2880\n \t\t};\n \t\tstd::map<unsigned int, IPAStream> config{\n \t\t\t{ 1, { V4L2_PIX_FMT_YUYV, { 1024, 768 } } },\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "2/5"
    ]
}