Show a patch.

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

{
    "id": 12907,
    "url": "https://patchwork.libcamera.org/api/patches/12907/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12907/",
    "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": "<20210712100209.447893-7-naush@raspberrypi.com>",
    "date": "2021-07-12T10:02:07",
    "name": "[libcamera-devel,v7,6/8] pipeline: raspberrypi: Use priority write for vblank when writing sensor ctrls",
    "commit_ref": "9c0f6a22a2411fe5f21a1d8ac8783d1b6a13500f",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "488b9e90b9336904aae4702be02949746bc7ad81",
    "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/12907/mbox/",
    "series": [
        {
            "id": 2227,
            "url": "https://patchwork.libcamera.org/api/series/2227/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2227",
            "date": "2021-07-12T10:02:01",
            "name": "ipa: raspberrypi: Allow long exposure modes for imx477.",
            "version": 7,
            "mbox": "https://patchwork.libcamera.org/series/2227/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12907/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12907/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 8710BC3228\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 Jul 2021 10:02:23 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 10BAA68541;\n\tMon, 12 Jul 2021 12:02:23 +0200 (CEST)",
            "from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com\n\t[IPv6:2a00:1450:4864:20::32e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BF2A268513\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Jul 2021 12:02:20 +0200 (CEST)",
            "by mail-wm1-x32e.google.com with SMTP id\n\tg8-20020a1c9d080000b02901f13dd1672aso9486432wme.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Jul 2021 03:02:20 -0700 (PDT)",
            "from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:3395:5e50:10bb:f8fd])\n\tby smtp.gmail.com with ESMTPSA id\n\tb16sm14249941wrs.51.2021.07.12.03.02.19\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 12 Jul 2021 03:02:19 -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=\"VGEbvU7E\"; 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=9yRgYhw3UKh19+/uNBMvathD7mePEk0qnePq4Nd1t/0=;\n\tb=VGEbvU7E5boc9nZ/cLbhVItqXts35gUcPxHpnWGbOSuLMjStnynl51TFuzbtzjeMDm\n\t7DZ/bvMpL6d0i3Fw7L4pBwa2b1kQwzpKJrgb1OIbex+e1P+7T3IszPy2KFlkRyk1arrr\n\tQe2lHM/9TGZ7TfNbNeBC272yFf00hGBPl4o6jBFxSZ62TX8mWL/E1v6umnU/ldIa//Js\n\t2u2Nn+orSG3ts83WhP/Lqv1c4hVjaJIvHKx9d9J3pXo3u+1qsKHGxNkJ+rLhQWYpCElR\n\taiHwEXP3gXUGSQcp6lNaZhAKbSvndr01H8JnpfqN3EKNKIJg+RTFrFxHVT3apdUJwdOm\n\thJXw==",
        "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=9yRgYhw3UKh19+/uNBMvathD7mePEk0qnePq4Nd1t/0=;\n\tb=RShdYGZsGRIg99eh8U2/eObvHI69rV+rVk4S9QoCteWswnQGxXDnUzsXFVVTeTO9Fp\n\tOzYLaVpuZfd+fm+814mGnbunNwr2WovJfHcFC45Z3o0OF33/hj+XEk+2zTneWgb7ZizB\n\tOBZe4xX2HnCjZ8vPleM+kUZ/EAPR60dfqL00r6+v97B0AkgGrl7nUBuqePZTRnBNs1PS\n\tNwLktKhaggrOiVEkW94bfe91mH/1t0Eeul9LVJS4e60nAsOLL0YUME/R7E1Qe6Yu5X6C\n\tQ0Cr13UkWcfP7PyAhPds33dfYvFynHVI3gN9bLS45AqNZ7Mbx67V/2lMN/q0aWlHwqp1\n\tsgsw==",
        "X-Gm-Message-State": "AOAM530ZDkgwAS1ogDLLnEwXH9j5cRTfHMiSCWjd+3CZgcE/BqcLXCRZ\n\tZKsRsjLi9WkGq/BXooV3ZjhLvlPHoD+gZQ==",
        "X-Google-Smtp-Source": "ABdhPJwUXfOdEIXNuOQFrlK2b+wEoajCXCBWmTqnYA+8J0yg4qMSiEQZTgVW8k9cI2/vnuRe60RNMw==",
        "X-Received": "by 2002:a7b:c92b:: with SMTP id\n\th11mr11130194wml.182.1626084140109; \n\tMon, 12 Jul 2021 03:02:20 -0700 (PDT)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 12 Jul 2021 11:02:07 +0100",
        "Message-Id": "<20210712100209.447893-7-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210712100209.447893-1-naush@raspberrypi.com>",
        "References": "<20210712100209.447893-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v7 6/8] pipeline: raspberrypi: Use\n\tpriority write for vblank when writing sensor ctrls",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "When directly writing controls to the sensor device, ensure that VBLANK is\nwritten ahead of and before the EXPOSURE control. This is the same priority\nwrite mechanism used in DelayedControls.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 43 ++++++++++++++-----\n 1 file changed, 32 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 082eb1ee1c23..c09352809c01 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -154,6 +154,7 @@ public:\n \tvoid embeddedComplete(uint32_t bufferId);\n \tvoid setIspControls(const ControlList &controls);\n \tvoid setDelayedControls(const ControlList &controls);\n+\tvoid setSensorControls(ControlList &controls);\n \n \t/* bufferComplete signal handlers. */\n \tvoid unicamBufferDequeue(FrameBuffer *buffer);\n@@ -828,7 +829,7 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)\n \n \t/* Apply any gain/exposure settings that the IPA may have passed back. */\n \tif (!startConfig.controls.empty())\n-\t\tdata->unicam_[Unicam::Image].dev()->setControls(&startConfig.controls);\n+\t\tdata->setSensorControls(startConfig.controls);\n \n \t/* Configure the number of dropped frames required on startup. */\n \tdata->dropFrameCount_ = startConfig.dropFrameCount;\n@@ -1075,7 +1076,7 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)\n \t\tControlList ctrls(dev->controls());\n \t\tctrls.set(V4L2_CID_HFLIP, 0);\n \t\tctrls.set(V4L2_CID_VFLIP, 0);\n-\t\tdev->setControls(&ctrls);\n+\t\tdata->setSensorControls(ctrls);\n \t}\n \n \t/* Look for a valid Bayer format. */\n@@ -1294,22 +1295,20 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config)\n \t\treturn -EPIPE;\n \t}\n \n-\tif (!controls.empty())\n-\t\tunicam_[Unicam::Image].dev()->setControls(&controls);\n-\n \t/*\n \t * Configure the H/V flip controls based on the combination of\n \t * the sensor and user transform.\n \t */\n \tif (supportsFlips_) {\n-\t\tControlList ctrls(unicam_[Unicam::Image].dev()->controls());\n-\t\tctrls.set(V4L2_CID_HFLIP,\n-\t\t\t  static_cast<int32_t>(!!(rpiConfig->combinedTransform_ & Transform::HFlip)));\n-\t\tctrls.set(V4L2_CID_VFLIP,\n-\t\t\t  static_cast<int32_t>(!!(rpiConfig->combinedTransform_ & Transform::VFlip)));\n-\t\tunicam_[Unicam::Image].dev()->setControls(&ctrls);\n+\t\tcontrols.set(V4L2_CID_HFLIP,\n+\t\t\t     static_cast<int32_t>(!!(rpiConfig->combinedTransform_ & Transform::HFlip)));\n+\t\tcontrols.set(V4L2_CID_VFLIP,\n+\t\t\t     static_cast<int32_t>(!!(rpiConfig->combinedTransform_ & Transform::VFlip)));\n \t}\n \n+\tif (!controls.empty())\n+\t\tsetSensorControls(controls);\n+\n \treturn 0;\n }\n \n@@ -1379,6 +1378,28 @@ void RPiCameraData::setDelayedControls(const ControlList &controls)\n \thandleState();\n }\n \n+void RPiCameraData::setSensorControls(ControlList &controls)\n+{\n+\t/*\n+\t * We need to ensure that if both VBLANK and EXPOSURE are present, the\n+\t * former must be written ahead of, and separately from EXPOSURE to avoid\n+\t * V4L2 rejecting the latter. This is identical to what DelayedControls\n+\t * does with the priority write flag.\n+\t *\n+\t * As a consequence of the below logic, VBLANK gets set twice, and we\n+\t * rely on the v4l2 framework to not pass the second control set to the\n+\t * driver as the actual control value has not changed.\n+\t */\n+\tif (controls.contains(V4L2_CID_EXPOSURE) && controls.contains(V4L2_CID_VBLANK)) {\n+\t\tControlList vblank_ctrl;\n+\n+\t\tvblank_ctrl.set(V4L2_CID_VBLANK, controls.get(V4L2_CID_VBLANK));\n+\t\tunicam_[Unicam::Image].dev()->setControls(&vblank_ctrl);\n+\t}\n+\n+\tunicam_[Unicam::Image].dev()->setControls(&controls);\n+}\n+\n void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)\n {\n \tRPi::Stream *stream = nullptr;\n",
    "prefixes": [
        "libcamera-devel",
        "v7",
        "6/8"
    ]
}