Show a patch.

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

{
    "id": 849,
    "url": "https://patchwork.libcamera.org/api/patches/849/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/849/",
    "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-8-jacopo@jmondi.org>",
    "date": "2019-04-02T16:21:29",
    "name": "[libcamera-devel,v6,07/12] libcamera: ipu3: Implement camera start/stop",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "a2d7f6edc8c85a503a3e63200ccbe54124595d44",
    "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/849/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/849/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/849/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 E4CC3610BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Apr 2019 18:20:59 +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 1D76B20006;\n\tTue,  2 Apr 2019 16:20:58 +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:29 +0200",
        "Message-Id": "<20190402162134.3894-8-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 07/12] libcamera: ipu3: Implement\n\tcamera start/stop",
        "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:00 -0000"
    },
    "content": "Start and stop video devices in the pipeline.\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 | 103 +++++++++++++++++++++++++--\n 1 file changed, 96 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 7eac36f0c561..7061f36b4495 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -86,6 +86,9 @@ public:\n \tint exportBuffers(ImgUOutput *output, BufferPool *pool);\n \tvoid freeBuffers();\n \n+\tint start();\n+\tint stop();\n+\n \tunsigned int index_;\n \tstd::string name_;\n \tMediaDevice *media_;\n@@ -125,6 +128,9 @@ public:\n \tBufferPool *exportBuffers();\n \tvoid freeBuffers();\n \n+\tint start();\n+\tint stop();\n+\n \tV4L2Device *output_;\n \tV4L2Subdevice *csi2_;\n \tV4L2Subdevice *sensor_;\n@@ -349,25 +355,42 @@ int PipelineHandlerIPU3::freeBuffers(Camera *camera, Stream *stream)\n int PipelineHandlerIPU3::start(Camera *camera)\n {\n \tIPU3CameraData *data = cameraData(camera);\n-\tV4L2Device *cio2 = data->cio2_.output_;\n+\tCIO2Device *cio2 = &data->cio2_;\n+\tImgUDevice *imgu = data->imgu_;\n \tint ret;\n \n-\tret = cio2->streamOn();\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+\t */\n+\tret = cio2->start();\n+\tif (ret)\n+\t\tgoto error;\n+\n+\tret = imgu->start();\n \tif (ret) {\n-\t\tLOG(IPU3, Info) << \"Failed to start camera \" << camera->name();\n-\t\treturn ret;\n+\t\timgu->stop();\n+\t\tcio2->stop();\n+\t\tgoto error;\n \t}\n \n \treturn 0;\n+\n+error:\n+\tLOG(IPU3, Error) << \"Failed to start camera \" << camera->name();\n+\treturn ret;\n }\n \n void PipelineHandlerIPU3::stop(Camera *camera)\n {\n \tIPU3CameraData *data = cameraData(camera);\n-\tV4L2Device *cio2 = data->cio2_.output_;\n+\tint ret;\n \n-\tif (cio2->streamOff())\n-\t\tLOG(IPU3, Info) << \"Failed to stop camera \" << camera->name();\n+\tret = data->cio2_.stop();\n+\tret |= data->imgu_->stop();\n+\tif (ret)\n+\t\tLOG(IPU3, Warning) << \"Failed to stop camera \"\n+\t\t\t\t   << camera->name();\n \n \tPipelineHandler::stop(camera);\n }\n@@ -778,6 +801,50 @@ void ImgUDevice::freeBuffers()\n \t\tLOG(IPU3, Error) << \"Failed to release ImgU input buffers\";\n }\n \n+int ImgUDevice::start()\n+{\n+\tint ret;\n+\n+\t/* Start the ImgU video devices. */\n+\tret = output_.dev->streamOn();\n+\tif (ret) {\n+\t\tLOG(IPU3, Error) << \"Failed to start ImgU output\";\n+\t\treturn ret;\n+\t}\n+\n+\tret = viewfinder_.dev->streamOn();\n+\tif (ret) {\n+\t\tLOG(IPU3, Error) << \"Failed to start ImgU viewfinder\";\n+\t\treturn ret;\n+\t}\n+\n+\tret = stat_.dev->streamOn();\n+\tif (ret) {\n+\t\tLOG(IPU3, Error) << \"Failed to start ImgU stat\";\n+\t\treturn ret;\n+\t}\n+\n+\tret = input_->streamOn();\n+\tif (ret) {\n+\t\tLOG(IPU3, Error) << \"Failed to start ImgU input\";\n+\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int ImgUDevice::stop()\n+{\n+\tint ret;\n+\n+\tret = output_.dev->streamOff();\n+\tret |= viewfinder_.dev->streamOff();\n+\tret |= stat_.dev->streamOff();\n+\tret |= input_->streamOff();\n+\n+\treturn ret;\n+}\n+\n /*------------------------------------------------------------------------------\n  * CIO2 Device\n  */\n@@ -971,6 +1038,28 @@ void CIO2Device::freeBuffers()\n \t\tLOG(IPU3, Error) << \"Failed to release CIO2 buffers\";\n }\n \n+int CIO2Device::start()\n+{\n+\tint ret;\n+\n+\tfor (Buffer &buffer : pool_.buffers()) {\n+\t\tret = output_->queueBuffer(&buffer);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n+\tret = output_->streamOn();\n+\tif (ret)\n+\t\treturn ret;\n+\n+\treturn 0;\n+}\n+\n+int CIO2Device::stop()\n+{\n+\treturn output_->streamOff();\n+}\n+\n REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3);\n \n } /* namespace libcamera */\n",
    "prefixes": [
        "libcamera-devel",
        "v6",
        "07/12"
    ]
}