Show a patch.

GET /api/patches/1068/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1068,
    "url": "https://patchwork.libcamera.org/api/patches/1068/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1068/",
    "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": "<20190418164638.400-4-jacopo@jmondi.org>",
    "date": "2019-04-18T16:46:35",
    "name": "[libcamera-devel,v6,3/6] libcamera: ipu3: Add multiple stream memory management",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "27c1ebbd74c0fe26038f0c3970e9fb58d1c3d365",
    "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/1068/mbox/",
    "series": [
        {
            "id": 259,
            "url": "https://patchwork.libcamera.org/api/series/259/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=259",
            "date": "2019-04-18T16:46:32",
            "name": "libcamera: ipu3: Multiple streams support",
            "version": 6,
            "mbox": "https://patchwork.libcamera.org/series/259/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1068/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1068/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 587D060DC9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Apr 2019 18:45:54 +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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id B2E601C000B;\n\tThu, 18 Apr 2019 16:45:53 +0000 (UTC)"
        ],
        "X-Originating-IP": "2.224.242.101",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 18 Apr 2019 18:46:35 +0200",
        "Message-Id": "<20190418164638.400-4-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190418164638.400-1-jacopo@jmondi.org>",
        "References": "<20190418164638.400-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v6 3/6] 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": "Thu, 18 Apr 2019 16:45:55 -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 8c2504499f33..d14ba47e1c2c 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -92,6 +92,7 @@ public:\n \n \tBufferPool vfPool_;\n \tBufferPool statPool_;\n+\tBufferPool outPool_;\n };\n \n class CIO2Device\n@@ -408,11 +409,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@@ -427,28 +437,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->cfg_) {\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->cfg_) {\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@@ -813,6 +844,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",
        "v6",
        "3/6"
    ]
}