Patch Detail
Show a patch.
GET /api/patches/854/?format=api
{ "id": 854, "url": "https://patchwork.libcamera.org/api/patches/854/?format=api", "web_url": "https://patchwork.libcamera.org/patch/854/", "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": "<20190402162134.3894-13-jacopo@jmondi.org>", "date": "2019-04-02T16:21:34", "name": "[libcamera-devel,v6,12/12] libcamera: ipu3: Enable ImgU media links", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "5b4cd4f9be03f598a1a256e0bc9a17679b431ea2", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/854/mbox/", "series": [ { "id": 229, "url": "https://patchwork.libcamera.org/api/series/229/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=229", "date": "2019-04-02T16:21:22", "name": "libcamera: ipu3: Add ImgU support", "version": 6, "mbox": "https://patchwork.libcamera.org/series/229/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/854/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/854/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[217.70.183.200])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9789C611A7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 2 Apr 2019 18:21:04 +0200 (CEST)", "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay7-d.mail.gandi.net (Postfix) with ESMTPSA id C8E9320006;\n\tTue, 2 Apr 2019 16:21:03 +0000 (UTC)" ], "X-Originating-IP": "2.224.242.101", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 2 Apr 2019 18:21:34 +0200", "Message-Id": "<20190402162134.3894-13-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190402162134.3894-1-jacopo@jmondi.org>", "References": "<20190402162134.3894-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v6 12/12] libcamera: ipu3: Enable ImgU\n\tmedia 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, 02 Apr 2019 16:21:04 -0000" }, "content": "As the lengthy comment reports, link enable/disable is not trivial, as\nlinks in one ImgU instance interfere with capture operations in the\nother one. As it is not yet clear if this behaviour is intended, as of\nnow reset the media graph during pipeline's match() and enable the\nrequired links at streamConfiguration time.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 102 +++++++++++++++++++++++++++\n 1 file changed, 102 insertions(+)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 838215de1603..691f815caa95 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -89,6 +89,11 @@ public:\n \tint start();\n \tint stop();\n \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 name_;\n \tMediaDevice *media_;\n@@ -277,6 +282,14 @@ int PipelineHandlerIPU3::configureStreams(Camera *camera,\n \t\treturn -EINVAL;\n \t}\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 stream size to the CIO2 unit and get back the\n \t * adjusted format to be propagated to the ImgU output devices.\n@@ -487,6 +500,30 @@ bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator)\n \t\treturn false;\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 and then trying to capture from the other\n+\t * one right after, without disabling media links in the media graph\n+\t * first.\n+\t *\n+\t * The tricky part here is where to disable links on the ImgU instance\n+\t * which is currently 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 at the least in configureStreams,\n+\t * before configuring formats, the only place where to disable links\n+\t * would be 'stop()', but the Camera class state machine allows\n+\t * start()<->stop() sequences without any streamConfiguration() in\n+\t * between.\n+\t *\n+\t * As of now, disable all links in the media graph at 'match()' time,\n+\t * to allow testing different cameras in different test applications\n+\t * runs. A test application that would use two distinct cameras without\n+\t * going through a library teardown->match() sequence would fail\n+\t * at the moment.\n+\t */\n \tif (imguMediaDev_->disableLinks())\n \t\tgoto error;\n \n@@ -898,6 +935,71 @@ int ImgUDevice::stop()\n \treturn ret;\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 = media_->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 viewfinderName = name_ + \" viewfinder\";\n+\tstd::string outputName = name_ + \" output\";\n+\tstd::string statName = name_ + \" 3a stat\";\n+\tstd::string inputName = name_ + \" input\";\n+\tint ret;\n+\n+\t/* \\todo Establish rules to handle media devices open/close. */\n+\tret = media_->open();\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tret = linkSetup(inputName, 0, name_, PAD_INPUT, enable);\n+\tif (ret)\n+\t\tgoto done;\n+\n+\tret = linkSetup(name_, PAD_OUTPUT, outputName, 0, enable);\n+\tif (ret)\n+\t\tgoto done;\n+\n+\tret = linkSetup(name_, PAD_VF, viewfinderName, 0, enable);\n+\tif (ret)\n+\t\tgoto done;\n+\n+\tret = linkSetup(name_, PAD_STAT, statName, 0, enable);\n+\n+done:\n+\tmedia_->close();\n+\n+\treturn ret;\n+}\n+\n /*------------------------------------------------------------------------------\n * CIO2 Device\n */\n", "prefixes": [ "libcamera-devel", "v6", "12/12" ] }