Patch Detail
Show a patch.
GET /api/1.1/patches/729/?format=api
{ "id": 729, "url": "https://patchwork.libcamera.org/api/1.1/patches/729/?format=api", "web_url": "https://patchwork.libcamera.org/patch/729/", "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": "<20190312121242.2253-15-jacopo@jmondi.org>", "date": "2019-03-12T12:12:42", "name": "[libcamera-devel,v2,14/14] RFC: libcamera: ipu3: Enable ImgU media links", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "f880a7059522cd8c1f41d621452bc25083bd2bf5", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/729/mbox/", "series": [ { "id": 205, "url": "https://patchwork.libcamera.org/api/1.1/series/205/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=205", "date": "2019-03-12T12:12:28", "name": "libcamera: ipu3: ImgU support", "version": 2, "mbox": "https://patchwork.libcamera.org/series/205/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/729/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/729/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 01CC7611A8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 Mar 2019 13:12:28 +0100 (CET)", "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 88C291C0002;\n\tTue, 12 Mar 2019 12:12:27 +0000 (UTC)" ], "X-Originating-IP": "2.224.242.101", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 12 Mar 2019 13:12:42 +0100", "Message-Id": "<20190312121242.2253-15-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20190312121242.2253-1-jacopo@jmondi.org>", "References": "<20190312121242.2253-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 14/14] RFC: libcamera: ipu3: Enable\n\tImgU media links", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.23", "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>", "X-List-Received-Date": "Tue, 12 Mar 2019 12:12:28 -0000" }, "content": "As the lenghty comment reports, link enable/disable is not trivial, as\nlinks in one ImgU instance interfere with capture operations in the\nother one. As I struggle to find where to disable links selectively,\nas of now reset the media graph and only enable the required links at\nstreamConfiguration time.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 107 +++++++++++++++++++++++++++\n 1 file changed, 107 insertions(+)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex a113fd6ee74b..1c0d63f912d5 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -51,6 +51,10 @@ public:\n \t}\n \n \tvoid init(MediaDevice *media, unsigned int index);\n+\tint linkSetup(const std::string &source, unsigned int sourcePad,\n+\t\t const std::string &sink, unsigned int sinkPad,\n+\t\t bool enable);\n+\tint enableLinks(bool enable);\n \n \tunsigned int index_;\n \tstd::string imguName_;\n@@ -270,6 +274,35 @@ int PipelineHandlerIPU3::configureStreams(Camera *camera,\n \t\treturn -EINVAL;\n \t}\n \n+\t/*\n+\t * FIXME: enabled links in one ImgU instance interfere with capture\n+\t * operations on the other one. This can be easily triggered by\n+\t * capturing from one camera, then trying to capture from the other\n+\t * one right after without disabling media links in the media graph.\n+\t *\n+\t * The tricky part here is where to disable links on the ImgU instance\n+\t * which is not in use:\n+\t * 1) Link enable/disable cannot be done at start/stop time as video\n+\t * devices needs to be linked first before format can be configured on\n+\t * them.\n+\t * 2) As link enable has to be done here, before configuring formats,\n+\t * the only place where to disable links would be 'stop()', but the\n+\t * camera state machine allows start()<->stop() sequences without any\n+\t * streamConfiguration() in between.\n+\t *\n+\t * As of now, disable all links in the media graph before enabling\n+\t * the requested ones only.\n+\t */\n+\tdata->imgu->mediaDevice_->disableLinks();\n+\n+\t/*\n+\t * \\todo: Enable links selectively based on the requested streams.\n+\t * As of now, enable all links unconditionally.\n+\t */\n+\tret = data->imgu->enableLinks(true);\n+\tif (ret)\n+\t\treturn ret;\n+\n \t/*\n \t * Pass the requested output image size to the sensor and get back the\n \t * adjusted one to be propagated to the CIO2 device and to the ImgU\n@@ -631,6 +664,80 @@ void ImgUDevice::init(MediaDevice *mediaDevice, unsigned int index)\n \tmediaDevice_ = mediaDevice;\n }\n \n+/**\n+ * \\brief Enable or disable a single link on the ImgU instance\n+ *\n+ * This method assumes the media device associated with the ImgU instance\n+ * is open.\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n+int ImgUDevice::linkSetup(const std::string &source, unsigned int sourcePad,\n+\t\t\t const std::string &sink, unsigned int sinkPad,\n+\t\t\t bool enable)\n+{\n+\tMediaLink *link = mediaDevice_->link(source, sourcePad, sink, sinkPad);\n+\tif (!link) {\n+\t\tLOG(IPU3, Error)\n+\t\t\t<< \"Failed to get link: '\" << source << \"':\"\n+\t\t\t<< sourcePad << \" -> '\" << sink << \"':\" << sinkPad;\n+\t\treturn -ENODEV;\n+\t}\n+\n+\treturn link->setEnabled(enable);\n+}\n+\n+/**\n+ * \\brief Enable or disable all media links in the ImgU instance to prepare\n+ * for capture operations\n+ *\n+ * \\todo This method will probably be removed or changed once links will be\n+ * enabled or disabled selectively.\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n+int ImgUDevice::enableLinks(bool enable)\n+{\n+\tstd::string inputName = imguName_ + \" input\";\n+\tstd::string outputName = imguName_ + \" output\";\n+\tstd::string viewfinderName = imguName_ + \" viewfinder\";\n+\tstd::string statName = imguName_ + \" 3a stat\";\n+\tint ret;\n+\n+\t/* \\todo Establish rules to handle media devices open/close. */\n+\tret = mediaDevice_->open();\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tret = linkSetup(inputName, 0, imguName_, PAD_INPUT, enable);\n+\tif (ret) {\n+\t\tmediaDevice_->close();\n+\t\treturn ret;\n+\t}\n+\n+\tret = linkSetup(imguName_, PAD_OUTPUT, outputName, 0, enable);\n+\tif (ret) {\n+\t\tmediaDevice_->close();\n+\t\treturn ret;\n+\t}\n+\n+\tret = linkSetup(imguName_, PAD_VF, viewfinderName, 0, enable);\n+\tif (ret) {\n+\t\tmediaDevice_->close();\n+\t\treturn ret;\n+\t}\n+\n+\tret = linkSetup(imguName_, PAD_STAT, statName, 0, enable);\n+\tif (ret) {\n+\t\tmediaDevice_->close();\n+\t\treturn ret;\n+\t}\n+\n+\tmediaDevice_->close();\n+\n+\treturn 0;\n+}\n+\n int PipelineHandlerIPU3::mediaBusToCIO2Format(unsigned int code)\n {\n \tswitch(code) {\n", "prefixes": [ "libcamera-devel", "v2", "14/14" ] }