Show a patch.

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

{
    "id": 11797,
    "url": "https://patchwork.libcamera.org/api/patches/11797/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/11797/",
    "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": "<20210330165743.4924-2-david.plowman@raspberrypi.com>",
    "date": "2021-03-30T16:57:43",
    "name": "[libcamera-devel,1/1] libcamera: camera_sensor: Fix frame lengths calculated by sensorInfo()",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "6cf46535f869587e8b4f30c3b738759c94a7b75d",
    "submitter": {
        "id": 42,
        "url": "https://patchwork.libcamera.org/api/people/42/?format=api",
        "name": "David Plowman",
        "email": "david.plowman@raspberrypi.com"
    },
    "delegate": {
        "id": 14,
        "url": "https://patchwork.libcamera.org/api/users/14/?format=api",
        "username": "pinchartl",
        "first_name": "Laurent",
        "last_name": "Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/11797/mbox/",
    "series": [
        {
            "id": 1873,
            "url": "https://patchwork.libcamera.org/api/series/1873/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1873",
            "date": "2021-03-30T16:57:42",
            "name": "Fix CameraSensor::sensorInfo by updating VBLANK ControlInfo",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1873/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/11797/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/11797/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 DB159C0DA3\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Mar 2021 16:57:53 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9E81668786;\n\tTue, 30 Mar 2021 18:57:53 +0200 (CEST)",
            "from mail-wm1-x336.google.com (mail-wm1-x336.google.com\n\t[IPv6:2a00:1450:4864:20::336])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 89576602DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Mar 2021 18:57:50 +0200 (CEST)",
            "by mail-wm1-x336.google.com with SMTP id\n\tw203-20020a1c49d40000b029010c706d0642so1332053wma.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Mar 2021 09:57:50 -0700 (PDT)",
            "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\ts13sm3695448wrv.80.2021.03.30.09.57.48\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 30 Mar 2021 09:57:49 -0700 (PDT)"
        ],
        "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=\"KqrRJhXI\"; 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=QHDoLoAUL/R93Owuukrgf+27dpMKbdjQ6Sz/zQdv/9c=;\n\tb=KqrRJhXIVEN4EiZXKz5aMaMwCfTKW31n1PhNJxkcOEyEBMetfGsrzECTyOOA36GUhy\n\tWrl1TumhN4Vu5QTd1AiIbWGf4DLsDnXjTrk9YlB1hrgY6GTU6mNDonaIu4AJe2RVp3Bv\n\tdpEP32yYrAcqKkh7X4SfDFpsuRvlvdcSsPuxhKC8C5Nv8DkQB7clf2QVk47/DZ67Qx8u\n\tiOcd3zV9u208PDSI6EUBT4SlVpQxq6VE0NWYwR+DJoTJ0CIxPKUV9h81Y/s20zzaqvOj\n\t7bjYwiSRtmv4BpY7mtASaLDmiSwNmR/CjFwcQ8gQdSbDUyilqlQ8wWw4aVRugfYWLTUJ\n\tE/LQ==",
        "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=QHDoLoAUL/R93Owuukrgf+27dpMKbdjQ6Sz/zQdv/9c=;\n\tb=o0LWnI6XPcf+io0xIXuZtG8H08dkgrp2BbNoa85r9AMS1dRr3oXTYm5gHLqsvVA+I4\n\tycIhsZ0q3cytApjeaRD8YMRUo1t6IQQ8NmKSnBjTRt5PPXZTEPunSOq57VTzjZVBqqur\n\tSOlU1Ikm36XlS5hxXF5YhmgY49V6Q4BbYT6O3+tgWf6SfOLis+7RsRaxHLQJPOndgBXD\n\tGvIJ7UsWqmyTwWxFjIR4fuL22UpMrr6AOEFQfwsay+OyyvLhjFzj1uGjk+giGQuyfvRk\n\tfKvrVEqtgG7yBOfUxTJrRFllMF2mVC3AdVNxyxW86ss9B8GXYMdLiFDo39RsqGrxYP5F\n\ts2jQ==",
        "X-Gm-Message-State": "AOAM531UR8Yo4sBCHlCs0W4gmOBsEbxSkdtbjOyCC8WMXQOmGKix5Qfo\n\tFLCSLW7fBd8tM3RDdt2NRrs4i4ona1B5Ew==",
        "X-Google-Smtp-Source": "ABdhPJzxTwtArI1HrN9MgPnoZHwP19VwgL7LdmvU2G7USBzDnHuYhS+7CLRYQHYZARWr8mavxC9gBQ==",
        "X-Received": "by 2002:a7b:c396:: with SMTP id s22mr4961505wmj.38.1617123470091;\n\tTue, 30 Mar 2021 09:57:50 -0700 (PDT)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 30 Mar 2021 17:57:43 +0100",
        "Message-Id": "<20210330165743.4924-2-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20210330165743.4924-1-david.plowman@raspberrypi.com>",
        "References": "<20210330165743.4924-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 1/1] libcamera: camera_sensor: Fix frame\n\tlengths calculated by sensorInfo()",
        "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": "The minimum and maximum vblanking can change when a new format is\napplied to the sensor subdevice, so be sure to retrieve up-to-date\nvalues.\n\nThe V4L2Device acquires the new refreshControls() method to perform\nthis function. Note that not all pipeline handlers invoke the\nsubdevice's setFormat method directly, so the new method must be made\npublicly available.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/internal/v4l2_device.h |  2 ++\n src/libcamera/camera_sensor.cpp          |  7 +++++++\n src/libcamera/v4l2_device.cpp            | 26 ++++++++++++++++++++++++\n 3 files changed, 35 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h\nindex d006bf68..6efcb0db 100644\n--- a/include/libcamera/internal/v4l2_device.h\n+++ b/include/libcamera/internal/v4l2_device.h\n@@ -41,6 +41,8 @@ public:\n \tint setFrameStartEnabled(bool enable);\n \tSignal<uint32_t> frameStart;\n \n+\tvoid refreshControls();\n+\n protected:\n \tV4L2Device(const std::string &deviceNode);\n \t~V4L2Device();\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex f7ed91d9..9f99ce3e 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -796,6 +796,13 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const\n \tinfo->bitsPerPixel = format.bitsPerPixel();\n \tinfo->outputSize = format.size;\n \n+\t/*\n+\t * Some controls, specifically the vblanking, may have different min\n+\t * or max values if the sensor format has been changed since it was\n+\t * opened, so be sure to update them first.\n+\t */\n+\tsubdev_->refreshControls();\n+\n \t/*\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,\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex decd19ef..6d396f89 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -514,6 +514,32 @@ void V4L2Device::listControls()\n \tcontrols_ = std::move(ctrls);\n }\n \n+/*\n+ * \\brief Update the control information that was previously stored by\n+ * listControls(). Some parts of this information, such as min and max\n+ * values of some controls, are liable to change when a new format is set.\n+ */\n+void V4L2Device::refreshControls()\n+{\n+\tfor (auto &controlId : controlIds_) {\n+\t\tunsigned int id = controlId->id();\n+\n+\t\tstruct v4l2_query_ext_ctrl ctrl = {};\n+\t\tctrl.id = id;\n+\n+\t\tif (ioctl(VIDIOC_QUERY_EXT_CTRL, &ctrl)) {\n+\t\t\tLOG(V4L2, Debug)\n+\t\t\t\t<< \"Could not refresh control \"\n+\t\t\t\t<< utils::hex(ctrl.id);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\t/* Assume these are present - listControls() made them. */\n+\t\tcontrolInfo_[id] = ctrl;\n+\t\tcontrols_.at(controlId.get()) = V4L2ControlInfo(ctrl);\n+\t}\n+}\n+\n /*\n  * \\brief Update the value of the first \\a count V4L2 controls in \\a ctrls using\n  * values in \\a v4l2Ctrls\n",
    "prefixes": [
        "libcamera-devel",
        "1/1"
    ]
}