Patch Detail
Show a patch.
GET /api/1.1/patches/10561/?format=api
{ "id": 10561, "url": "https://patchwork.libcamera.org/api/1.1/patches/10561/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10561/", "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": "<20201204153121.66136-4-naush@raspberrypi.com>", "date": "2020-12-04T15:31:21", "name": "[libcamera-devel,v3,3/3] pipeline: ipa: raspberrypi: Pass controls to IPA on start", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "844ddb98f9f73bd53e73aeb0384dccef0e04ed30", "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/10561/mbox/", "series": [ { "id": 1505, "url": "https://patchwork.libcamera.org/api/1.1/series/1505/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1505", "date": "2020-12-04T15:31:18", "name": "Pass controls on camera:start()", "version": 3, "mbox": "https://patchwork.libcamera.org/series/1505/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10561/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10561/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 A1362BE177\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 4 Dec 2020 15:31:30 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1BD3E635F8;\n\tFri, 4 Dec 2020 16:31:30 +0100 (CET)", "from mail-wm1-x335.google.com (mail-wm1-x335.google.com\n\t[IPv6:2a00:1450:4864:20::335])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 948BC635D6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 4 Dec 2020 16:31:28 +0100 (CET)", "by mail-wm1-x335.google.com with SMTP id g185so7404293wmf.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 04 Dec 2020 07:31:28 -0800 (PST)", "from naushir-VirtualBox.pitowers.org\n\t([2a00:1098:3142:14:a00:27ff:fe4d:f6a2])\n\tby smtp.gmail.com with ESMTPSA id\n\tx66sm3465426wmg.26.2020.12.04.07.31.27\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 04 Dec 2020 07:31:27 -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=\"cw2hQg02\"; 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=0PV2Y5oXqUFKFkSmsjE6h2mwWzE30CUw3vNPsXz+F/M=;\n\tb=cw2hQg025wombO8odwyKU7iDFApHYVLjhosBLHNH9kUfqzDFtUetlxq41L1PxjhGnx\n\ttLwoxLKjiHHifIWb0cLbeB3zbVi5DUa/Ad++bflZ43hw4EsjtYFMJAYNfoPLvx4cnRA6\n\tL1rtobsztDQLC7EeWO/YRb0UvJpJmE9Ossbf3lfEhanvAKfoBkQDtq8mWXYGEjoJsgF+\n\tFQ0p9/r5foNaW/ug/a14kOB558l34klpkEGvnqil3YaNTE1YzAjjNoqcBUoiqtsTf3EC\n\tWb8OPyRoKqDrjrlTSaN2MTm2+QJEISk30GQ1sjiqmylFnhGadXvh5s3TMo/zRyNeYWXM\n\tzotQ==", "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=0PV2Y5oXqUFKFkSmsjE6h2mwWzE30CUw3vNPsXz+F/M=;\n\tb=KTgc+yEK9Ok5ngLw5LmVBDx1BPKJVujgblQjFLA+8MUd9GWmcoSATAuNhv+3f76esU\n\tyAUdkPHylpWBI6tMfNoIbNqiOUHqwuIYQAlTowgtn21xtsy9MaJkg3Gce/7HVR7lnTi2\n\tfPAy7yqAWbO/liK+M1up91qe6OFjNMY6phLrV/9aluuvH4fOxVA/c06J7+E5PH2BVTO1\n\tLDIE3b8lACZ/7ADjJLpBdS9H9aRFejkKxA4w95Rdr2NKUADNZUvbo6gycBGx3QVUMGqD\n\toAir3OFTtLm8XoKofjdw46wZuP/kld8mwgGP8i8N7Y5bduNUgp+IPelcBFVNOIAtYaw6\n\tWSAw==", "X-Gm-Message-State": "AOAM530N7Um/tJW5wj6hStBcdOUjZ6xMQvpbZ/iT3sMy+OPluGw+ubUK\n\tUf2uD6RmEHpztP3wCmGflVvvEWoI3kmhvA==", "X-Google-Smtp-Source": "ABdhPJx9YLoE0u8f2RA1uZAZrKzTxdQt6qAkfXsiEOUImXZpB+oM3+V5g9tzBdn8qo19cu2XOsZIQQ==", "X-Received": "by 2002:a1c:5f83:: with SMTP id\n\tt125mr4944212wmb.82.1607095887960; \n\tFri, 04 Dec 2020 07:31:27 -0800 (PST)", "From": "Naushir Patuck <naush@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 4 Dec 2020 15:31:21 +0000", "Message-Id": "<20201204153121.66136-4-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20201204153121.66136-1-naush@raspberrypi.com>", "References": "<20201204153121.66136-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v3 3/3] pipeline: ipa: raspberrypi: Pass\n\tcontrols to IPA on start", "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": "Forward any controls passed into the pipeline handler to the IPA.\nThe IPA then sets up the Raspberry Pi controller with these settings\nappropriately, and passes back any V4L2 sensor controls that need\nto be applied.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nTested-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/ipa/raspberrypi.h | 1 +\n src/ipa/raspberrypi/raspberrypi.cpp | 54 ++++++++++++-------\n .../pipeline/raspberrypi/raspberrypi.cpp | 13 ++++-\n 3 files changed, 47 insertions(+), 21 deletions(-)", "diff": "diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h\nindex 2b55dbfc..c91a14bd 100644\n--- a/include/libcamera/ipa/raspberrypi.h\n+++ b/include/libcamera/ipa/raspberrypi.h\n@@ -21,6 +21,7 @@ enum ConfigParameters {\n \tIPA_CONFIG_STAGGERED_WRITE = (1 << 1),\n \tIPA_CONFIG_SENSOR = (1 << 2),\n \tIPA_CONFIG_DROP_FRAMES = (1 << 3),\n+\tIPA_CONFIG_STARTUP = (1 << 4)\n };\n \n enum Operations {\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex b8c0f955..ff95580e 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -78,8 +78,7 @@ public:\n \t}\n \n \tint init(const IPASettings &settings) override;\n-\tint start([[maybe_unused]] const IPAOperationData &data,\n-\t\t [[maybe_unused]] IPAOperationData *result) override { return 0; }\n+\tint start(const IPAOperationData &data, IPAOperationData *result) override;\n \tvoid stop() override {}\n \n \tvoid configure(const CameraSensorInfo &sensorInfo,\n@@ -154,6 +153,36 @@ int IPARPi::init(const IPASettings &settings)\n \treturn 0;\n }\n \n+int IPARPi::start(const IPAOperationData &data, IPAOperationData *result)\n+{\n+\tRPiController::Metadata metadata;\n+\n+\tASSERT(result);\n+\tresult->operation = 0;\n+\tif (data.operation & RPi::IPA_CONFIG_STARTUP) {\n+\t\t/* We have been given some controls to action before start. */\n+\t\tqueueRequest(data.controls[0]);\n+\t}\n+\n+\tcontroller_.SwitchMode(mode_, &metadata);\n+\n+\t/* SwitchMode may supply updated exposure/gain values to use. */\n+\tAgcStatus agcStatus;\n+\tagcStatus.shutter_time = 0.0;\n+\tagcStatus.analogue_gain = 0.0;\n+\n+\t/* SwitchMode may supply updated exposure/gain values to use. */\n+\tmetadata.Get(\"agc.status\", agcStatus);\n+\tif (agcStatus.shutter_time != 0.0 && agcStatus.analogue_gain != 0.0) {\n+\t\tControlList ctrls(unicamCtrls_);\n+\t\tapplyAGC(&agcStatus, ctrls);\n+\t\tresult->controls.emplace_back(ctrls);\n+\t\tresult->operation |= RPi::IPA_CONFIG_SENSOR;\n+\t}\n+\n+\treturn 0;\n+}\n+\n void IPARPi::setMode(const CameraSensorInfo &sensorInfo)\n {\n \tmode_.bitdepth = sensorInfo.bitsPerPixel;\n@@ -229,7 +258,6 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,\n \t\tresult->data.push_back(gainDelay);\n \t\tresult->data.push_back(exposureDelay);\n \t\tresult->data.push_back(sensorMetadata);\n-\n \t\tresult->operation |= RPi::IPA_CONFIG_STAGGERED_WRITE;\n \t}\n \n@@ -285,11 +313,6 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,\n \tresult->data.push_back(dropFrame);\n \tresult->operation |= RPi::IPA_CONFIG_DROP_FRAMES;\n \n-\t/* These zero values mean not program anything (unless overwritten). */\n-\tstruct AgcStatus agcStatus;\n-\tagcStatus.shutter_time = 0.0;\n-\tagcStatus.analogue_gain = 0.0;\n-\n \tif (!controllerInit_) {\n \t\t/* Load the tuning file for this sensor. */\n \t\tcontroller_.Read(tuningFile_.c_str());\n@@ -297,20 +320,13 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,\n \t\tcontrollerInit_ = true;\n \n \t\t/* Supply initial values for gain and exposure. */\n+\t\tControlList ctrls(unicamCtrls_);\n+\t\tAgcStatus agcStatus;\n \t\tagcStatus.shutter_time = DefaultExposureTime;\n \t\tagcStatus.analogue_gain = DefaultAnalogueGain;\n-\t}\n-\n-\tRPiController::Metadata metadata;\n-\tcontroller_.SwitchMode(mode_, &metadata);\n-\n-\t/* SwitchMode may supply updated exposure/gain values to use. */\n-\tmetadata.Get(\"agc.status\", agcStatus);\n-\tif (agcStatus.shutter_time != 0.0 && agcStatus.analogue_gain != 0.0) {\n-\t\tControlList ctrls(unicamCtrls_);\n \t\tapplyAGC(&agcStatus, ctrls);\n-\t\tresult->controls.push_back(ctrls);\n \n+\t\tresult->controls.emplace_back(ctrls);\n \t\tresult->operation |= RPi::IPA_CONFIG_SENSOR;\n \t}\n \n@@ -824,7 +840,7 @@ void IPARPi::processStats(unsigned int bufferId)\n \n \t\tIPAOperationData op;\n \t\top.operation = RPi::IPA_ACTION_V4L2_SET_STAGGERED;\n-\t\top.controls.push_back(ctrls);\n+\t\top.controls.emplace_back(ctrls);\n \t\tqueueFrameAction.emit(0, op);\n \t}\n }\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex bafd0b2d..bc7c56f8 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -753,8 +753,10 @@ int PipelineHandlerRPi::start(Camera *camera, [[maybe_unused]] ControlList *cont\n \n \t/* Start the IPA. */\n \tIPAOperationData ipaData = {}, result = {};\n-\tif (controls)\n+\tif (controls) {\n+\t\tipaData.operation = RPi::IPA_CONFIG_STARTUP;\n \t\tipaData.controls.emplace_back(*controls);\n+\t}\n \tret = data->ipa_->start(ipaData, &result);\n \tif (ret) {\n \t\tLOG(RPI, Error)\n@@ -763,6 +765,14 @@ int PipelineHandlerRPi::start(Camera *camera, [[maybe_unused]] ControlList *cont\n \t\treturn ret;\n \t}\n \n+\t/* Apply any gain/exposure settings that the IPA may have passed back. */\n+\tASSERT(data->staggeredCtrl_);\n+\tif (result.operation & RPi::IPA_CONFIG_SENSOR) {\n+\t\tconst ControlList &ctrls = result.controls[0];\n+\t\tif (!data->staggeredCtrl_.set(ctrls))\n+\t\t\tLOG(RPI, Error) << \"V4L2 staggered set failed\";\n+\t}\n+\n \t/*\n \t * IPA configure may have changed the sensor flips - hence the bayer\n \t * order. Get the sensor format and set the ISP input now.\n@@ -783,7 +793,6 @@ int PipelineHandlerRPi::start(Camera *camera, [[maybe_unused]] ControlList *cont\n \t * starting. First check that the staggered ctrl has been initialised\n \t * by configure().\n \t */\n-\tASSERT(data->staggeredCtrl_);\n \tdata->staggeredCtrl_.reset();\n \tdata->staggeredCtrl_.write();\n \tdata->expectedSequence_ = 0;\n", "prefixes": [ "libcamera-devel", "v3", "3/3" ] }