Patch Detail
Show a patch.
GET /api/patches/12889/?format=api
{ "id": 12889, "url": "https://patchwork.libcamera.org/api/patches/12889/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12889/", "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": "<20210709145825.2943443-7-naush@raspberrypi.com>", "date": "2021-07-09T14:58:23", "name": "[libcamera-devel,v6,6/8] pipeline: raspberrypi: Use priority write for vblank when writing sensor ctrls", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "3e44d378cd7b5b45e6706db300c90eb39cd83a19", "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/12889/mbox/", "series": [ { "id": 2223, "url": "https://patchwork.libcamera.org/api/series/2223/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2223", "date": "2021-07-09T14:58:17", "name": "ipa: raspberrypi: Allow long exposure modes for imx477.", "version": 6, "mbox": "https://patchwork.libcamera.org/series/2223/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12889/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12889/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 D72F5C3225\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 9 Jul 2021 14:58:37 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8919A68526;\n\tFri, 9 Jul 2021 16:58:37 +0200 (CEST)", "from mail-wm1-x331.google.com (mail-wm1-x331.google.com\n\t[IPv6:2a00:1450:4864:20::331])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E010F68535\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 9 Jul 2021 16:58:34 +0200 (CEST)", "by mail-wm1-x331.google.com with SMTP id j34so6494361wms.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 09 Jul 2021 07:58:34 -0700 (PDT)", "from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:35c2:26d3:e217:4410])\n\tby smtp.gmail.com with ESMTPSA id\n\tc2sm1480995wrn.28.2021.07.09.07.58.33\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 09 Jul 2021 07:58:33 -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=\"XYQdrjXj\"; 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=9Qm+sWatsYcAykyKyO/dDov0LMdnllNiYyhQV+ZFn1Y=;\n\tb=XYQdrjXjjn3mPM9gRuElruCgIgrqsGQ5cA4rab1CneXJgIey3sheJ5imy4jaJgDttR\n\tIm6GlufnmaA4cI+1+QjNtimoIZTgu5nYU3GqHfvUSDjWaUqkHtW8z5JhLCOqZrOiEp0O\n\tEaANmzxAzVa83RIYPnq8CEJ2XTZ1k+tTqn3aZKtF7Dl7mxBmb/5Rxb+FaXlL6Te7J0gO\n\trU4eQqYsCdtOPvWqpvWH65Vt1WE0kKEBI143br2fhM2g4HywAe2nBHTSD4ZBUQF+Zavj\n\td4NzEKDAor3AetQAAJpNlt4OvMczVwrf+YrIUkFbPPiAVLa1eS2VRTzGajTKiXxyVvvj\n\tfPKQ==", "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=9Qm+sWatsYcAykyKyO/dDov0LMdnllNiYyhQV+ZFn1Y=;\n\tb=dZapRvSNizHP1vmMOVd1+dh/4tyPKNpPtLhD8ubayTK2gCrgjZzXFulGwBRtwVjBeR\n\tZaZyRQk5YTG1imCVO/wwhEcBLYOeqrzIewUgbF3ltwI4ZwLJjDhrJdEr0NcPseJFuZet\n\tIwoHvohkMeu/M8k8j68tphUmZmyUi4VKZhJwDcy4mvhnWudPNHW0jJq8yCLgkcBy6sNJ\n\tq/cKMWqj8v16ZfX4/aH+tmWynM8ltdg9VZEMA5nCkggKq92EYc96MpSat7yFixnWd+YF\n\tL1t64xZwWJ6w7hFPsdBOpD9KRbJa2NngEy5cC8y8FrI45mk4X1Y2h+rPWdPqzmJC6DuU\n\tcs3Q==", "X-Gm-Message-State": "AOAM533RTOEk3L11ypWGeWp92RXI0nQ+BqqEO5/pGmIdd0ActAtSQOQj\n\tY0ug4AnUKT8PHkuGhOausSEVxRxL4VbaKA==", "X-Google-Smtp-Source": "ABdhPJwFZA37iad30KWK6c5GGIGaX941dZQso5vdiJC220HfgK+5zRZgCytNpNPpX22WaWzx9cskag==", "X-Received": "by 2002:a05:600c:a04:: with SMTP id\n\tz4mr39782773wmp.103.1625842714366; \n\tFri, 09 Jul 2021 07:58:34 -0700 (PDT)", "From": "Naushir Patuck <naush@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 9 Jul 2021 15:58:23 +0100", "Message-Id": "<20210709145825.2943443-7-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20210709145825.2943443-1-naush@raspberrypi.com>", "References": "<20210709145825.2943443-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v6 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>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp | 41 ++++++++++++++-----\n 1 file changed, 31 insertions(+), 10 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 082eb1ee1c23..e09328ffa0bc 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@@ -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", "v6", "6/8" ] }