Patch Detail
Show a patch.
GET /api/patches/961/?format=api
{ "id": 961, "url": "https://patchwork.libcamera.org/api/patches/961/?format=api", "web_url": "https://patchwork.libcamera.org/patch/961/", "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-7-jacopo@jmondi.org>", "date": "2019-04-09T19:25:42", "name": "[libcamera-devel,v4,06/12] libcamera: ipu3: Queue requests for multiple streams", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "3f9c626c6d50cfd165008608924be5c62a2a0826", "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/961/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/961/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/961/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 26DD260DB7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 9 Apr 2019 21:25:09 +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 B43A6200008;\n\tTue, 9 Apr 2019 19:25:08 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 9 Apr 2019 21:25:42 +0200", "Message-Id": "<20190409192548.20325-7-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 06/12] libcamera: ipu3: Queue requests\n\tfor multiple streams", "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:09 -0000" }, "content": "Add support for queueing requests for multiple streams in the IPU3\npipeline handler class. The output video node should be queued with\nbuffers even if not part of the requested streams.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 46 +++++++++++++++++++++-------\n 1 file changed, 35 insertions(+), 11 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex f5d768f9f87f..bb8d4ce644ca 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -146,6 +146,7 @@ public:\n \tstd::string name_;\n \tImgUDevice::ImgUOutput *device_;\n \tconst StreamConfiguration *cfg_;\n+\tunsigned int bufferCount;\n };\n \n class PipelineHandlerIPU3 : public PipelineHandler\n@@ -473,6 +474,9 @@ int PipelineHandlerIPU3::start(Camera *camera)\n \tImgUDevice *imgu = data->imgu_;\n \tint ret;\n \n+\tif (!data->outStream_.active_)\n+\t\tdata->outStream_.bufferCount = 0;\n+\n \t/*\n \t * Start the ImgU video devices, buffers will be queued to the\n \t * ImgU output and viewfinder when requests will be queued.\n@@ -513,20 +517,40 @@ void PipelineHandlerIPU3::stop(Camera *camera)\n int PipelineHandlerIPU3::queueRequest(Camera *camera, Request *request)\n {\n \tIPU3CameraData *data = cameraData(camera);\n-\tV4L2Device *output = data->imgu_->output_.dev;\n-\tIPU3Stream *stream = &data->outStream_;\n+\tIPU3Stream *output = &data->outStream_;\n+\tbool outputRequested = false;\n \n-\t/* Queue a buffer to the ImgU output for capture. */\n-\tBuffer *buffer = request->findBuffer(stream);\n-\tif (!buffer) {\n-\t\tLOG(IPU3, Error)\n-\t\t\t<< \"Attempt to queue request with invalid stream\";\n-\t\treturn -ENOENT;\n+\tfor (auto const &bufferMap : request->bufferMap()) {\n+\t\tIPU3Stream *stream = static_cast<IPU3Stream *>(bufferMap.first);\n+\t\tBuffer *buffer = bufferMap.second;\n+\n+\t\tint ret = stream->device_->dev->queueBuffer(buffer);\n+\t\tif (ret)\n+\t\t\tcontinue;\n+\n+\t\tif (stream == output)\n+\t\t\toutputRequested = true;\n \t}\n \n-\tint ret = output->queueBuffer(buffer);\n-\tif (ret < 0)\n-\t\treturn ret;\n+\t/*\n+\t * The output node should be queued with buffers even if not part\n+\t * of the request, otherwise the ImgU stalls.\n+\t *\n+\t * Use buffers from the stream's pool or the internal pool depending\n+\t * if the output stream has been configured or not.\n+\t */\n+\tif (!outputRequested) {\n+\t\tBufferPool *pool = output->active_ ? &output->bufferPool()\n+\t\t\t\t\t\t : output->device_->pool;\n+\t\tBuffer *buffer = &pool->buffers()[output->bufferCount];\n+\t\tunsigned int numBuffers = pool->count();\n+\n+\t\tint ret = output->device_->dev->queueBuffer(buffer);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\n+\t\toutput->bufferCount = (output->bufferCount + 1) % numBuffers;\n+\t}\n \n \tPipelineHandler::queueRequest(camera, request);\n \n", "prefixes": [ "libcamera-devel", "v4", "06/12" ] }