Patch Detail
Show a patch.
GET /api/1.1/patches/11599/?format=api
{ "id": 11599, "url": "https://patchwork.libcamera.org/api/1.1/patches/11599/?format=api", "web_url": "https://patchwork.libcamera.org/patch/11599/", "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": "<20210317100211.1067585-3-naush@raspberrypi.com>", "date": "2021-03-17T10:02:06", "name": "[libcamera-devel,2/7] pipeline: ipa: raspberrypi: Open the CamHelper on ipa::init()", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "436340beaa437b15fd740937322e538962da72dc", "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/11599/mbox/", "series": [ { "id": 1799, "url": "https://patchwork.libcamera.org/api/1.1/series/1799/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1799", "date": "2021-03-17T10:02:06", "name": "Raspberry Pi: ipa::init() restructuring", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1799/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/11599/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/11599/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 C5B7BBD80C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 17 Mar 2021 10:02:21 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C4A2368D63;\n\tWed, 17 Mar 2021 11:02:20 +0100 (CET)", "from mail-ed1-x536.google.com (mail-ed1-x536.google.com\n\t[IPv6:2a00:1450:4864:20::536])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B35C16084D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Mar 2021 11:02:19 +0100 (CET)", "by mail-ed1-x536.google.com with SMTP id w18so1525227edc.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Mar 2021 03:02:19 -0700 (PDT)", "from naush-laptop.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\tp24sm12061179edt.5.2021.03.17.03.02.18\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 17 Mar 2021 03:02:18 -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=\"Mz7apkiw\"; 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=WKPDbQVEm77UntYvf9XLAzDmJH8wdZX3/OhhnGXC8so=;\n\tb=Mz7apkiw9wYt23K3kNuFupiDK58T+2K0TiO020iQXLo9nixxBqc5nB5ngsx4QEws1o\n\tURLu8iAmOZcU+wIMdNxYXXBGk6MuaXiEQ/3OaWYmXnb9mY48hQo7acuXmCv/cZcGiSeJ\n\tTZcOLn2Od8DheUd+rbqdtfwMEUsCxig83qoVzKDMvh0GnUSrYyqtTIftMuXvvv8QJIUq\n\tjvo2dZp67yn0bizbUQgHaqiE2y7c6TOdSBB7RLOOzaSDyGAxJzksUesvWUF2FTJ/kTvi\n\tRluGbA3if8qObX9ApwyJ3TiuYP9MWJrNDOFlP9hCuYFwMVKmr8qDVZYvDavEXsmV0rLk\n\tyJkw==", "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=WKPDbQVEm77UntYvf9XLAzDmJH8wdZX3/OhhnGXC8so=;\n\tb=JxTWEvulNgbDZD10JpYp7E34h3rscEcKwfCObjBaUMaU30n/1BrcMTwXFsim4g1ULa\n\t1uWHkt0oQNhNjbxH2O7K+r0n5fdswL452vP/U+V/+45XAdKK2FAyU0OQ9OEF5s4qgrwj\n\tE3wIcc5/8ODN6eRJCmooMK+n4DJAWUQaQGUorQj/pOhs4I8tjRc4S0VRjmAb5jmHrmYT\n\tFyJRnn67UzsO4UUKu5OIQUQVV4JyzNHyFsL9ZCkcv53f7R+qfdIt2q0thpHtFiMx6R3g\n\t6inoYcwKd7wAt3s3VuUgJkGyF6LIWv068snOlXMRLKtAz8L+ovaIOQepWmC07Gp8oX1t\n\tpoxQ==", "X-Gm-Message-State": "AOAM53330ZnqHGjDq2PV9fCn/xx70VM5AHHV9Z1l3Uqnr+fpmNJ2rFA0\n\t/0DhG20iSKHkj7iNVITPjCL7vuVr8kJwWw==", "X-Google-Smtp-Source": "ABdhPJzvOUXl2eceQhWTm8kdwmH075WT9v/znUJitKvM4mRv4yZTKQIX4b2k55hUb/SRFnZtcSocMw==", "X-Received": "by 2002:a05:6402:6cb:: with SMTP id\n\tn11mr41677975edy.198.1615975338727; \n\tWed, 17 Mar 2021 03:02:18 -0700 (PDT)", "From": "Naushir Patuck <naush@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 17 Mar 2021 10:02:06 +0000", "Message-Id": "<20210317100211.1067585-3-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20210317100211.1067585-1-naush@raspberrypi.com>", "References": "<20210317100211.1067585-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH 2/7] pipeline: ipa: raspberrypi: Open the\n\tCamHelper on ipa::init()", "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": "Move the opening of the CamHelper from ipa::configure() to ipa::init().\nThis allows the pipeline handler to get the sensor specific parameters\nin in pipeline_handler::match() where the ipa is initialised.\n\nHaving the sensor parameters available earlier will allow selective\nuse of the embedded data node in a future change.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n include/libcamera/ipa/raspberrypi.mojom | 7 +--\n src/ipa/raspberrypi/raspberrypi.cpp | 60 +++++++++----------\n .../pipeline/raspberrypi/raspberrypi.cpp | 36 ++++++-----\n 3 files changed, 46 insertions(+), 57 deletions(-)", "diff": "diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom\nindex eb427697d349..a713c88eee19 100644\n--- a/include/libcamera/ipa/raspberrypi.mojom\n+++ b/include/libcamera/ipa/raspberrypi.mojom\n@@ -15,10 +15,6 @@ enum BufferMask {\n /* Size of the LS grid allocation. */\n const uint32 MaxLsGridSize = 0x8000;\n \n-enum ConfigOutputParameters {\n-\tConfigSensorParams = 0x01,\n-};\n-\n struct SensorConfig {\n \tuint32 gainDelay;\n \tuint32 exposureDelay;\n@@ -41,7 +37,6 @@ struct ConfigInput {\n \n struct ConfigOutput {\n \tuint32 params;\n-\tSensorConfig sensorConfig;\n \tControlList controls;\n };\n \n@@ -51,7 +46,7 @@ struct StartControls {\n };\n \n interface IPARPiInterface {\n-\tinit(IPASettings settings) => (int32 ret);\n+\tinit(IPASettings settings) => (int32 ret, SensorConfig sensorConfig);\n \tstart(StartControls controls) => (StartControls result);\n \tstop();\n \ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 7904225a29fa..8a9eb92b39ec 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -79,7 +79,7 @@ public:\n \t\t\tmunmap(lsTable_, ipa::RPi::MaxLsGridSize);\n \t}\n \n-\tint init(const IPASettings &settings) override;\n+\tint init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConfig) override;\n \tvoid start(const ipa::RPi::StartControls &data,\n \t\t ipa::RPi::StartControls *result) override;\n \tvoid stop() override {}\n@@ -164,9 +164,35 @@ private:\n \tdouble maxFrameDuration_;\n };\n \n-int IPARPi::init(const IPASettings &settings)\n+int IPARPi::init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConfig)\n {\n \ttuningFile_ = settings.configurationFile;\n+\n+\t/*\n+\t * Load the \"helper\" for this sensor. This tells us all the device specific stuff\n+\t * that the kernel driver doesn't. We only do this the first time; we don't need\n+\t * to re-parse the metadata after a simple mode-switch for no reason.\n+\t */\n+\thelper_ = std::unique_ptr<RPiController::CamHelper>(RPiController::CamHelper::Create(settings.sensorModel));\n+\tif (!helper_) {\n+\t\tLOG(IPARPI, Error) << \"Could not create camera helper for \"\n+\t\t\t\t << settings.sensorModel;\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/*\n+\t * Pass out the sensor config to the pipeline handler in order\n+\t * to setup the staggered writer class.\n+\t */\n+\tint gainDelay, exposureDelay, vblankDelay, sensorMetadata;\n+\thelper_->GetDelays(exposureDelay, gainDelay, vblankDelay);\n+\tsensorMetadata = helper_->SensorEmbeddedDataPresent();\n+\n+\tsensorConfig->gainDelay = gainDelay;\n+\tsensorConfig->exposureDelay = exposureDelay;\n+\tsensorConfig->vblankDelay = vblankDelay;\n+\tsensorConfig->sensorMetadata = sensorMetadata;\n+\n \treturn 0;\n }\n \n@@ -319,36 +345,6 @@ int IPARPi::configure(const CameraSensorInfo &sensorInfo,\n \t/* Setup a metadata ControlList to output metadata. */\n \tlibcameraMetadata_ = ControlList(controls::controls);\n \n-\t/*\n-\t * Load the \"helper\" for this sensor. This tells us all the device specific stuff\n-\t * that the kernel driver doesn't. We only do this the first time; we don't need\n-\t * to re-parse the metadata after a simple mode-switch for no reason.\n-\t */\n-\tstd::string cameraName(sensorInfo.model);\n-\tif (!helper_) {\n-\t\thelper_ = std::unique_ptr<RPiController::CamHelper>(RPiController::CamHelper::Create(cameraName));\n-\n-\t\tif (!helper_) {\n-\t\t\tLOG(IPARPI, Error) << \"Could not create camera helper for \"\n-\t\t\t\t\t << cameraName;\n-\t\t\treturn -1;\n-\t\t}\n-\n-\t\t/*\n-\t\t * Pass out the sensor config to the pipeline handler in order\n-\t\t * to setup the staggered writer class.\n-\t\t */\n-\t\tint gainDelay, exposureDelay, vblankDelay, sensorMetadata;\n-\t\thelper_->GetDelays(exposureDelay, gainDelay, vblankDelay);\n-\t\tsensorMetadata = helper_->SensorEmbeddedDataPresent();\n-\n-\t\tresult->params |= ipa::RPi::ConfigSensorParams;\n-\t\tresult->sensorConfig.gainDelay = gainDelay;\n-\t\tresult->sensorConfig.exposureDelay = exposureDelay;\n-\t\tresult->sensorConfig.vblankDelay = vblankDelay;\n-\t\tresult->sensorConfig.sensorMetadata = sensorMetadata;\n-\t}\n-\n \t/* Re-assemble camera mode using the sensor info. */\n \tsetMode(sensorInfo);\n \ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 2c8ae31a28ad..ce1994186d66 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -146,7 +146,7 @@ public:\n \n \tvoid frameStarted(uint32_t sequence);\n \n-\tint loadIPA();\n+\tint loadIPA(ipa::RPi::SensorConfig *sensorConfig);\n \tint configureIPA(const CameraConfiguration *config);\n \n \tvoid statsMetadataComplete(uint32_t bufferId, const ControlList &controls);\n@@ -1030,11 +1030,24 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)\n \tif (data->sensor_->init())\n \t\treturn false;\n \n-\tif (data->loadIPA()) {\n+\tipa::RPi::SensorConfig sensorConfig;\n+\tif (data->loadIPA(&sensorConfig)) {\n \t\tLOG(RPI, Error) << \"Failed to load a suitable IPA library\";\n \t\treturn false;\n \t}\n \n+\t/*\n+\t * Setup our delayed control writer with the sensor default\n+\t * gain and exposure delays. Mark VBLANK for priority write.\n+\t */\n+\tstd::unordered_map<uint32_t, DelayedControls::ControlParams> params = {\n+\t\t{ V4L2_CID_ANALOGUE_GAIN, { sensorConfig.gainDelay, false } },\n+\t\t{ V4L2_CID_EXPOSURE, { sensorConfig.exposureDelay, false } },\n+\t\t{ V4L2_CID_VBLANK, { sensorConfig.vblankDelay, true } }\n+\t};\n+\tdata->delayedCtrls_ = std::make_unique<DelayedControls>(data->unicam_[Unicam::Image].dev(), params);\n+\tdata->sensorMetadata_ = sensorConfig.sensorMetadata;\n+\n \t/* Register the controls that the Raspberry Pi IPA can handle. */\n \tdata->controlInfo_ = RPi::Controls;\n \t/* Initialize the camera properties. */\n@@ -1214,7 +1227,7 @@ void RPiCameraData::frameStarted(uint32_t sequence)\n \tdelayedCtrls_->applyControls(sequence);\n }\n \n-int RPiCameraData::loadIPA()\n+int RPiCameraData::loadIPA(ipa::RPi::SensorConfig *sensorConfig)\n {\n \tipa_ = IPAManager::createIPA<ipa::RPi::IPAProxyRPi>(pipe_, 1, 1);\n \n@@ -1230,7 +1243,7 @@ int RPiCameraData::loadIPA()\n \tIPASettings settings(ipa_->configurationFile(sensor_->model() + \".json\"),\n \t\t\t sensor_->model());\n \n-\treturn ipa_->init(settings);\n+\treturn ipa_->init(settings, sensorConfig);\n }\n \n int RPiCameraData::configureIPA(const CameraConfiguration *config)\n@@ -1293,21 +1306,6 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config)\n \t\treturn -EPIPE;\n \t}\n \n-\tif (result.params & ipa::RPi::ConfigSensorParams) {\n-\t\t/*\n-\t\t * Setup our delayed control writer with the sensor default\n-\t\t * gain and exposure delays. Mark VBLANK for priority write.\n-\t\t */\n-\t\tstd::unordered_map<uint32_t, DelayedControls::ControlParams> params = {\n-\t\t\t{ V4L2_CID_ANALOGUE_GAIN, { result.sensorConfig.gainDelay, false } },\n-\t\t\t{ V4L2_CID_EXPOSURE, { result.sensorConfig.exposureDelay, false } },\n-\t\t\t{ V4L2_CID_VBLANK, { result.sensorConfig.vblankDelay, true } }\n-\t\t};\n-\n-\t\tdelayedCtrls_ = std::make_unique<DelayedControls>(unicam_[Unicam::Image].dev(), params);\n-\t\tsensorMetadata_ = result.sensorConfig.sensorMetadata;\n-\t}\n-\n \tif (!result.controls.empty()) {\n \t\tControlList &ctrls = result.controls;\n \t\tunicam_[Unicam::Image].dev()->setControls(&ctrls);\n", "prefixes": [ "libcamera-devel", "2/7" ] }