Patch Detail
Show a patch.
GET /api/patches/16308/?format=api
{ "id": 16308, "url": "https://patchwork.libcamera.org/api/patches/16308/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16308/", "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": "<20220622102047.22492-3-naush@raspberrypi.com>", "date": "2022-06-22T10:20:46", "name": "[libcamera-devel,v3,2/3] pipeline: ipa: raspberrypi: Correctly report available control limits", "commit_ref": "ac955c425d15570694d668a546c2d8fa1cebcdef", "pull_url": null, "state": "accepted", "archived": false, "hash": "e726ea775e4bbec2991ebd2f657dc2680754f069", "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/16308/mbox/", "series": [ { "id": 3202, "url": "https://patchwork.libcamera.org/api/series/3202/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3202", "date": "2022-06-22T10:20:44", "name": "Correct ControlInfoMap from the IPA", "version": 3, "mbox": "https://patchwork.libcamera.org/series/3202/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16308/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16308/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 85050BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 Jun 2022 10:21:04 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5185B65640;\n\tWed, 22 Jun 2022 12:21:04 +0200 (CEST)", "from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com\n\t[IPv6:2a00:1450:4864:20::42f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9E97B65638\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jun 2022 12:20:59 +0200 (CEST)", "by mail-wr1-x42f.google.com with SMTP id i10so18944992wrc.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jun 2022 03:20:59 -0700 (PDT)", "from naush-laptop.localdomain ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\th204-20020a1c21d5000000b0039c693a54ecsm26849423wmh.23.2022.06.22.03.20.57\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 22 Jun 2022 03:20:58 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655893264;\n\tbh=2tme2r25E6v8Hd+ZFkt14xUEx8o8WHikpVKgnqRQj7c=;\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=ga0Y1Yp5loKlACzqILVjGM7MQSj4kbB1WotjIf5JXU/w8HSF2NdBm1Boz1luF5UIl\n\tqg5/ygVFhGVfEJ5plu1q+6tI2Vh2Al3kPzn+1rHTYh8xSWpzNutKfvGOAro6UNXDIv\n\tbcHKJFr6D7Eu4NHkDVMxDY3GVfuCMY2MCu5/HzNtKRQUEPdzAIxA1UsFnw5vjMNbQf\n\tAvhD2JZCFNNh3+HWH4ZedBBasIR5Uvz3Zu7zA0LDAAB9bqCu/oEwPIZBCIW1SFVaSV\n\twvk5zWJjMG/OxI2/gv6MgaYrdquP2t7VUIul1j+r9tA/BKWbhVLrWapRNuxKqeub2h\n\tG4nL/aTQRW6fA==", "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=hEvVAIMRDdzIdQ1Up9tQJGX/dynhotDpdpBJ2vFJbEs=;\n\tb=aMlY+3Aed3/2vFAjbVhtfpj9gUD2OD3bXTXc99zuAs4VVQg2dFk4WOox4zs5124XZ9\n\tFTUNH1tkQ4rcBwEpEtCSj+I0Iv77QMagUwgAi9PZu0opdhDNShWE3riGScgZRAsAd4jI\n\tDt3TzxIiJ0AoLiQN7xeHQXyr3/ocJ9hZIqmqnjwkxcT1tLrN6+p/JL/4Uxevd5kWRf4c\n\t5VRHI3ZXERGNVjEwHttjLESPYVFLfd7n7c8Ve56PFNXLOLt11nph2z7pKDrZUiYqJ7Xp\n\tlrVBCyKOAuclkxYWY0fRMxzXEImQIBt5zZYtCrjxyEyhnPiWQvjxn/oc848XvWeKVj9m\n\tyzgQ==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"aMlY+3Ae\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\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=hEvVAIMRDdzIdQ1Up9tQJGX/dynhotDpdpBJ2vFJbEs=;\n\tb=AoZQRLt0Da0Fl1ljeincaQQfuMlwsOHemfD6X8A3FzcSGccXCKJBih8Eufno0Kl0e3\n\tQljf44sA3sSMeqFqD9hvFLb2KweVBhXpaQPYxVBLPK8oe43kNzjfdtY5rQsD2BO7bOk3\n\t26HrzRFEgvMeREGSjKTh9eG58hMIsqApaB9ge7dF3UqZzSqDj5STbfxLa2LqqdLjIGWt\n\tSybY/umtueJqx6e8faNS798wrAeN5P5bJbEfp+khIawzFLw2K/Om1+E1oizBwr9eT/Ks\n\tV8pNGv5BqByklagz61mDTgEsRJ7MPUYDIkFWa7E+TbWsTlvzNZF3Y1KjauBRLkT9iJAl\n\ts5Qg==", "X-Gm-Message-State": "AJIora+JbPHygHJMJ2RqC2HFRgrMUxgqYP+0uxudKQD9ICRc3fr6Ne3v\n\t/6VaS8H0yszFp7B7odztQLBnL2Jvdticoof7", "X-Google-Smtp-Source": "AGRyM1sK6kD1Gkhy3ezL5g8h7MHj5r+9uXOP5VUfU7zfc8XMDKGDv7n4q/hn8dccsjgtStae0Q+rag==", "X-Received": "by 2002:a5d:6d8f:0:b0:219:b5cd:6516 with SMTP id\n\tl15-20020a5d6d8f000000b00219b5cd6516mr2583514wrs.246.1655893258704; \n\tWed, 22 Jun 2022 03:20:58 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 22 Jun 2022 11:20:46 +0100", "Message-Id": "<20220622102047.22492-3-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20220622102047.22492-1-naush@raspberrypi.com>", "References": "<20220622102047.22492-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 2/3] pipeline: ipa: raspberrypi:\n\tCorrectly report available control limits", "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": "The ipa currently advertises a static ControlInfoMap to specify the available\ncontrols and their limits. Fix this limitation by having the IPA populate a new\nControlInfoMap with updated limits for ExposureTime, AnalogueGain, and\nFrameDurationLimits controls based on the current sensor mode. This new\nControlInfoMap is then returned back to the pipeline handler and available to\nthe application after a successful Camera::configure() call.\n\nBefore the first call to Camera::configure(), this ControlInfoMap provides some\nreasonable default limits for ExposureTime, AnalogueGain, and\nFrameDurationLimits. However, applications must not rely on these values, but\nobtain the correct limits after the call to Camera::configure().\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n include/libcamera/ipa/raspberrypi.mojom | 1 +\n src/ipa/raspberrypi/raspberrypi.cpp | 33 +++++++++++++++++--\n .../pipeline/raspberrypi/raspberrypi.cpp | 3 ++\n 3 files changed, 34 insertions(+), 3 deletions(-)", "diff": "diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom\nindex 77f52c282b0f..c0de435b7b33 100644\n--- a/include/libcamera/ipa/raspberrypi.mojom\n+++ b/include/libcamera/ipa/raspberrypi.mojom\n@@ -45,6 +45,7 @@ struct IPAConfig {\n \n struct IPAConfigResult {\n float modeSensitivity;\n+ libcamera.ControlInfoMap controlInfo;\n };\n \n struct StartConfig {\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 089528f5e126..8f57350878cf 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -74,8 +74,8 @@ constexpr Duration controllerMinFrameDuration = 1.0s / 30.0;\n /* List of controls handled by the Raspberry Pi IPA */\n static const ControlInfoMap::Map ipaControls{\n \t{ &controls::AeEnable, ControlInfo(false, true) },\n-\t{ &controls::ExposureTime, ControlInfo(0, 999999) },\n-\t{ &controls::AnalogueGain, ControlInfo(1.0f, 32.0f) },\n+\t{ &controls::ExposureTime, ControlInfo(0, 66666) },\n+\t{ &controls::AnalogueGain, ControlInfo(1.0f, 16.0f) },\n \t{ &controls::AeMeteringMode, ControlInfo(controls::AeMeteringModeValues) },\n \t{ &controls::AeConstraintMode, ControlInfo(controls::AeConstraintModeValues) },\n \t{ &controls::AeExposureMode, ControlInfo(controls::AeExposureModeValues) },\n@@ -89,7 +89,7 @@ static const ControlInfoMap::Map ipaControls{\n \t{ &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },\n \t{ &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) },\n \t{ &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },\n-\t{ &controls::FrameDurationLimits, ControlInfo(INT64_C(1000), INT64_C(1000000000)) },\n+\t{ &controls::FrameDurationLimits, ControlInfo(INT64_C(33333), INT64_C(120000)) },\n \t{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }\n };\n \n@@ -446,6 +446,33 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo,\n \tASSERT(controls);\n \t*controls = std::move(ctrls);\n \n+\t/*\n+\t * Apply the correct limits to the exposure, gain and frame duration controls\n+\t * based on the current sensor mode.\n+\t */\n+\tControlInfoMap::Map ctrlMap = ipaControls;\n+\tconst Duration minSensorFrameDuration = mode_.min_frame_length * mode_.line_length;\n+\tconst Duration maxSensorFrameDuration = mode_.max_frame_length * mode_.line_length;\n+\tctrlMap[&controls::FrameDurationLimits] =\n+\t\tControlInfo(static_cast<int64_t>(minSensorFrameDuration.get<std::micro>()),\n+\t\t\t static_cast<int64_t>(maxSensorFrameDuration.get<std::micro>()));\n+\n+\tctrlMap[&controls::AnalogueGain] =\n+\t\tControlInfo(1.0f, static_cast<float>(helper_->Gain(maxSensorGainCode_)));\n+\n+\t/*\n+\t * Calculate the max exposure limit from the frame duration limit as V4L2\n+\t * will limit the maximum control value based on the current VBLANK value.\n+\t */\n+\tDuration maxShutter = Duration::max();\n+\thelper_->GetVBlanking(maxShutter, minSensorFrameDuration, maxSensorFrameDuration);\n+\tconst uint32_t exposureMin = sensorCtrls_.at(V4L2_CID_EXPOSURE).min().get<int32_t>();\n+\n+\tctrlMap[&controls::ExposureTime] =\n+\t\tControlInfo(static_cast<int32_t>(helper_->Exposure(exposureMin).get<std::micro>()),\n+\t\t\t static_cast<int32_t>(maxShutter.get<std::micro>()));\n+\n+\tresult->controlInfo = ControlInfoMap(std::move(ctrlMap), controls::controls);\n \treturn 0;\n }\n \ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex d980c1a71dd8..4596f2babcea 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -940,6 +940,9 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \t/* Store the mode sensitivity for the application. */\n \tdata->properties_.set(properties::SensorSensitivity, result.modeSensitivity);\n \n+\t/* Update the controls that the Raspberry Pi IPA can handle. */\n+\tdata->controlInfo_ = result.controlInfo;\n+\n \t/* Setup the Video Mux/Bridge entities. */\n \tfor (auto &[device, link] : data->bridgeDevices_) {\n \t\t/*\n", "prefixes": [ "libcamera-devel", "v3", "2/3" ] }