Patch Detail
Show a patch.
GET /api/patches/959/?format=api
{ "id": 959, "url": "https://patchwork.libcamera.org/api/patches/959/?format=api", "web_url": "https://patchwork.libcamera.org/patch/959/", "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": "<20190409192548.20325-5-jacopo@jmondi.org>", "date": "2019-04-09T19:25:40", "name": "[libcamera-devel,v4,04/12] libcamera: ipu3: Add multiple stream memory management", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "fcbb6fc6841e7f0fb87057476797dca10c197627", "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/959/mbox/", "series": [ { "id": 247, "url": "https://patchwork.libcamera.org/api/series/247/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=247", "date": "2019-04-09T19:25:36", "name": "libcamera: ipu3: Multiple streams support", "version": 4, "mbox": "https://patchwork.libcamera.org/series/247/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/959/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/959/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 07F6960DB7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 9 Apr 2019 21:25:08 +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 relay12.mail.gandi.net (Postfix) with ESMTPSA id 80F9920000B;\n\tTue, 9 Apr 2019 19:25:07 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 9 Apr 2019 21:25:40 +0200", "Message-Id": "<20190409192548.20325-5-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190409192548.20325-1-jacopo@jmondi.org>", "References": "<20190409192548.20325-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 04/12] libcamera: ipu3: Add multiple\n\tstream memory management", "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, 09 Apr 2019 19:25:08 -0000" }, "content": "Perform allocation and setup of memory sharing between the CIO2 output\nand the ImgU input and allocate memory for each active stream.\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 65 +++++++++++++++++++++-------\n 1 file changed, 49 insertions(+), 16 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 527213a8970a..f5d768f9f87f 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -91,6 +91,7 @@ public:\n \n \tBufferPool vfPool_;\n \tBufferPool statPool_;\n+\tBufferPool outPool_;\n };\n \n class CIO2Device\n@@ -380,13 +381,23 @@ int PipelineHandlerIPU3::configureStreams(Camera *camera,\n \treturn 0;\n }\n \n+/**\n+ * \\todo Clarify if 'viewfinder' and 'stat' nodes have to be set up and\n+ * started even if not in use. As of now, if not properly configured and\n+ * enabled, the ImgU processing pipeline stalls.\n+ *\n+ * In order to be able to start the 'viewfinder' and 'stat' nodes, we need\n+ * memory to be reserved.\n+ */\n int PipelineHandlerIPU3::allocateBuffers(Camera *camera,\n \t\t\t\t\t const std::set<Stream *> &streams)\n {\n \tIPU3CameraData *data = cameraData(camera);\n-\tStream *stream = *streams.begin();\n+\tIPU3Stream *outStream = &data->outStream_;\n+\tIPU3Stream *vfStream = &data->vfStream_;\n \tCIO2Device *cio2 = &data->cio2_;\n \tImgUDevice *imgu = data->imgu_;\n+\n \tint ret;\n \n \t/* Share buffers between CIO2 output and ImgU input. */\n@@ -398,28 +409,49 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera,\n \tif (ret)\n \t\treturn ret;\n \n-\t/* Export ImgU output buffers to the stream's pool. */\n-\tret = imgu->exportBuffers(&imgu->output_, &stream->bufferPool());\n-\tif (ret)\n-\t\treturn ret;\n-\n \t/*\n-\t * Reserve memory in viewfinder and stat output devices. Use the\n-\t * same number of buffers as the ones requested for the output\n-\t * stream.\n+\t * Use for the stat's internal pools the same number of buffer as\n+\t * for the input pool.\n+\t * \\todo To be revised when we'll actually use the stat node.\n \t */\n-\tunsigned int bufferCount = stream->bufferPool().count();\n-\n-\timgu->viewfinder_.pool->createBuffers(bufferCount);\n-\tret = imgu->exportBuffers(&imgu->viewfinder_, imgu->viewfinder_.pool);\n-\tif (ret)\n-\t\treturn ret;\n-\n+\tunsigned int bufferCount = pool->count();\n \timgu->stat_.pool->createBuffers(bufferCount);\n \tret = imgu->exportBuffers(&imgu->stat_, imgu->stat_.pool);\n \tif (ret)\n \t\treturn ret;\n \n+\t/* Allocate buffers for each active stream. */\n+\tfor (Stream *s : streams) {\n+\t\tIPU3Stream *stream = static_cast<IPU3Stream *>(s);\n+\t\tImgUDevice::ImgUOutput *dev = stream->device_;\n+\n+\t\tret = imgu->exportBuffers(dev, &stream->bufferPool());\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n+\t/*\n+\t * Allocate buffers also on non-active outputs; use the same number\n+\t * of buffers as the active ones.\n+\t */\n+\tif (!outStream->active_) {\n+\t\tbufferCount = vfStream->bufferPool().count();\n+\t\toutStream->device_->pool->createBuffers(bufferCount);\n+\t\tret = imgu->exportBuffers(outStream->device_,\n+\t\t\t\t\t outStream->device_->pool);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n+\tif (!vfStream->active_) {\n+\t\tbufferCount = outStream->bufferPool().count();\n+\t\tvfStream->device_->pool->createBuffers(bufferCount);\n+\t\tret = imgu->exportBuffers(vfStream->device_,\n+\t\t\t\t\t vfStream->device_->pool);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n \treturn 0;\n }\n \n@@ -780,6 +812,7 @@ int ImgUDevice::init(MediaDevice *media, unsigned int index)\n \n \toutput_.pad = PAD_OUTPUT;\n \toutput_.name = \"output\";\n+\toutput_.pool = &outPool_;\n \n \tviewfinder_.dev = V4L2Device::fromEntityName(media,\n \t\t\t\t\t\t name_ + \" viewfinder\");\n", "prefixes": [ "libcamera-devel", "v4", "04/12" ] }