Patch Detail
Show a patch.
GET /api/patches/1091/?format=api
{ "id": 1091, "url": "https://patchwork.libcamera.org/api/patches/1091/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1091/", "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": "<20190419132531.17856-6-jacopo@jmondi.org>", "date": "2019-04-19T13:25:28", "name": "[libcamera-devel,v8,5/8] libcamera: ipu3: Add multiple stream memory management", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "606fc46419c85450827ea38c5332a1a7ad89e6ad", "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/1091/mbox/", "series": [ { "id": 263, "url": "https://patchwork.libcamera.org/api/series/263/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=263", "date": "2019-04-19T13:25:23", "name": "libcamera: ipu3: Multiple streams support", "version": 8, "mbox": "https://patchwork.libcamera.org/series/263/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1091/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1091/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 802B460B2E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 19 Apr 2019 15:24:47 +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 C5A0C20003;\n\tFri, 19 Apr 2019 13:24:46 +0000 (UTC)" ], "X-Originating-IP": "2.224.242.101", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 19 Apr 2019 15:25:28 +0200", "Message-Id": "<20190419132531.17856-6-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190419132531.17856-1-jacopo@jmondi.org>", "References": "<20190419132531.17856-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v8 5/8] 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": "Fri, 19 Apr 2019 13:24:47 -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\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 64 +++++++++++++++++++++-------\n 1 file changed, 48 insertions(+), 16 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 0130a83973ca..3f1f1bc8644f 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -93,6 +93,7 @@ public:\n \n \tBufferPool vfPool_;\n \tBufferPool statPool_;\n+\tBufferPool outPool_;\n };\n \n class CIO2Device\n@@ -439,11 +440,20 @@ 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 \tunsigned int bufferCount;\n@@ -458,28 +468,49 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera,\n \tif (ret)\n \t\tgoto error;\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\tgoto error;\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 pool 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-\tbufferCount = stream->bufferPool().count();\n-\n-\timgu->viewfinder_.pool->createBuffers(bufferCount);\n-\tret = imgu->exportBuffers(&imgu->viewfinder_, imgu->viewfinder_.pool);\n-\tif (ret)\n-\t\tgoto error;\n-\n+\tbufferCount = pool->count();\n \timgu->stat_.pool->createBuffers(bufferCount);\n \tret = imgu->exportBuffers(&imgu->stat_, imgu->stat_.pool);\n \tif (ret)\n \t\tgoto error;\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\tgoto error;\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\tgoto error;\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\tgoto error;\n+\t}\n+\n \treturn 0;\n \n error:\n@@ -844,6 +875,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", "v8", "5/8" ] }