Patch Detail
Show a patch.
GET /api/1.1/patches/9902/?format=api
{ "id": 9902, "url": "https://patchwork.libcamera.org/api/1.1/patches/9902/?format=api", "web_url": "https://patchwork.libcamera.org/patch/9902/", "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": "<20201002093309.109180-5-naush@raspberrypi.com>", "date": "2020-10-02T09:33:08", "name": "[libcamera-devel,4/5] pipeline: ipa: raspberrypi: Pass controls to IPA on start", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "cffbdaabe834c923d6fa89fd9f689dbac72fd259", "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/9902/mbox/", "series": [ { "id": 1345, "url": "https://patchwork.libcamera.org/api/1.1/series/1345/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1345", "date": "2020-10-02T09:33:04", "name": "RFQ: Pass controls on camera:start()", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1345/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/9902/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/9902/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 1D8B6C3B5E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 2 Oct 2020 09:33:19 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C996263B2A;\n\tFri, 2 Oct 2020 11:33:18 +0200 (CEST)", "from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com\n\t[IPv6:2a00:1450:4864:20::32c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 52FD0623B6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 2 Oct 2020 11:33:17 +0200 (CEST)", "by mail-wm1-x32c.google.com with SMTP id t17so995321wmi.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 02 Oct 2020 02:33:17 -0700 (PDT)", "from naushir-VirtualBox.pitowers.org\n\t([2a00:1098:3142:14:a00:27ff:fe4d:f6a2])\n\tby smtp.gmail.com with ESMTPSA id\n\tt203sm1101145wmg.43.2020.10.02.02.33.15\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 02 Oct 2020 02:33:15 -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=\"Lx7hH0Jn\"; 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=FRLR4Qe7S0mbYWoA4CPpaFxkRcM5eogrblUzHby1gCU=;\n\tb=Lx7hH0JniXwpY7vZpH8WO9loAs1loTRHIjXybA6Rvror5z0niZbsx/CTwdeeRc7+Mu\n\tWuGk3XSexP1dVrg8fyXlOAQ2Zg/3qkkzqInUyOzFGgD/sTdUHOS+je+G4OAfpwH0Py2d\n\ttZgKwaPVnOq+YiuaOy4sSrKpss/xJiR++roCrOtoJqHBoVqpio0fEwbgIagKeDfUQ2zK\n\tuPEE7en4Z89xVvYQD9gVIlLK6lRe6AMNDS0I7Hk9G1oQLub9EAcl8O5Hc22uYj96KBTi\n\twmn4oVYPuybnP7wEFDrd9lQO828OC9hIDASXGfg6JUhCU7h1F1lAgLfAho9fcMkEgBYI\n\tM1pQ==", "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=FRLR4Qe7S0mbYWoA4CPpaFxkRcM5eogrblUzHby1gCU=;\n\tb=HQ2O8b8e+rzi0sUs1DS8qqNZKJp/Qa8cS7CPLzlyPtHkJLkS57SIB/FoY5UiRdnPzu\n\tvx1pRx8GPAXCn0NZ/O1USrHllF01FXYo+7+KgLfOkWMdptkz6XQU9wMPcbOEyyGVPxyB\n\tucxhMl1G7b2iE56RrpjiRvAz2tnj7MsKTMiO6QWFhcemrD2fb+/rsomyCZpeBVmQM5h1\n\tTR0H9a1Rkllve+UpHKPUF3foPuanY5Z9ptEp49XVX20hx98LqvuMK+Ahdnm2KwWCczcB\n\tmwAtt7haKkcLgWnjVR54+bGqgQnel59b+HubmtQ2GxZzmXf8rDwqFZo2V2dwcMBs1gCr\n\tD1pQ==", "X-Gm-Message-State": "AOAM533T2ADpTQneX7TNme1bHoJyh0y7SPrD+r1nGwZXtcvWHx1dbY5L\n\thk3Q7vW3sLUSU3d/axWlLE086VxOXDuruQ==", "X-Google-Smtp-Source": "ABdhPJw2beWz19qiJnRa1xSLXSP3Ry+YKY77UQcHKKQ6dJPuN8l07hYoD0T7vTmHpmQ36GHvS7xgNA==", "X-Received": "by 2002:a1c:4601:: with SMTP id t1mr1913910wma.5.1601631196529; \n\tFri, 02 Oct 2020 02:33:16 -0700 (PDT)", "From": "Naushir Patuck <naush@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 2 Oct 2020 10:33:08 +0100", "Message-Id": "<20201002093309.109180-5-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20201002093309.109180-1-naush@raspberrypi.com>", "References": "<20201002093309.109180-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH 4/5] 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>\n---\n include/libcamera/ipa/raspberrypi.h | 1 +\n src/ipa/raspberrypi/raspberrypi.cpp | 51 ++++++++++++-------\n .../pipeline/raspberrypi/raspberrypi.cpp | 14 ++++-\n 3 files changed, 46 insertions(+), 20 deletions(-)", "diff": "diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h\nindex b3041591..8954aa66 100644\n--- a/include/libcamera/ipa/raspberrypi.h\n+++ b/include/libcamera/ipa/raspberrypi.h\n@@ -19,6 +19,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 9610229a..86b16089 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -77,8 +77,7 @@ public:\n \t}\n \n \tint init(const IPASettings &settings) override;\n-\tint start([[maybe_unused]] const IPAOperationData &ipaConfig,\n-\t\t [[maybe_unused]] IPAOperationData *result) override { return 0; }\n+\tint start(const IPAOperationData &ipaConfig, IPAOperationData *result) override;\n \tvoid stop() override {}\n \n \tvoid configure(const CameraSensorInfo &sensorInfo,\n@@ -154,6 +153,35 @@ int IPARPi::init(const IPASettings &settings)\n \treturn 0;\n }\n \n+int IPARPi::start(const IPAOperationData &ipaConfig, IPAOperationData *result)\n+{\n+\tRPiController::Metadata metadata;\n+\n+\tresult->operation = 0;\n+\tif (ipaConfig.operation & RPi::IPA_CONFIG_STARTUP) {\n+\t\t/* We have been given some controls to action before start. */\n+\t\tqueueRequest(ipaConfig.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.push_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 +257,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 +312,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 +319,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.push_back(ctrls);\n \t\tresult->operation |= RPi::IPA_CONFIG_SENSOR;\n \t}\n \ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 2e0b0dcf..81e23ed2 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -734,7 +734,10 @@ int PipelineHandlerRPi::start(Camera *camera, [[maybe_unused]] ControlList *cont\n \n \t/* Start the IPA. */\n \tIPAOperationData ipaConfig, result;\n-\tipaConfig.controls.emplace_back(*controls);\n+\tif (controls) {\n+\t\tipaConfig.operation = RPi::IPA_CONFIG_STARTUP;\n+\t\tipaConfig.controls.emplace_back(*controls);\n+\t}\n \tret = data->ipa_->start(ipaConfig, &result);\n \tif (ret) {\n \t\tLOG(RPI, Error)\n@@ -743,6 +746,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@@ -763,7 +774,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", "4/5" ] }