Show a patch.

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

{
    "id": 532,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/532/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/532/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20190206060818.13907-17-laurent.pinchart@ideasonboard.com>",
    "date": "2019-02-06T06:08:07",
    "name": "[libcamera-devel,16/27] libcamera: pipeline_handler: Extend the interface to support capture",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "afd95276a5562b7831516bb10aae24946c0169cd",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/532/mbox/",
    "series": [
        {
            "id": 170,
            "url": "https://patchwork.libcamera.org/api/1.1/series/170/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=170",
            "date": "2019-02-06T06:07:51",
            "name": "Capture frames throught requests",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/170/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/532/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/532/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 774FA61040\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Feb 2019 07:08:27 +0100 (CET)",
            "from pendragon.ideasonboard.com (d51A4137F.access.telenet.be\n\t[81.164.19.127])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1322A2D8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Feb 2019 07:08:27 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1549433307;\n\tbh=kMAlJ1ARRsRLF0eLMB/RxFJ+jXDX7LjR6/9xqfScPWY=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=ZSpBEbXBCbqPBgJMyE1XKugtS+9+85hUoVor8Os/EtUFCpQHkdhFeZ6+sCZ36Yvip\n\tu62A85qusGg2NyaQmiHYe2lwizqubW06DRlWJp1WYNxXX+Fv8NznLmVoCxHWS5dIum\n\tT4SQuRDl342Lvhepd4hoOk9IvjadVHl4hKD4+Y0s=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed,  6 Feb 2019 08:08:07 +0200",
        "Message-Id": "<20190206060818.13907-17-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.19.2",
        "In-Reply-To": "<20190206060818.13907-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20190206060818.13907-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 16/27] libcamera: pipeline_handler: Extend\n\tthe interface to support capture",
        "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": "Wed, 06 Feb 2019 06:08:29 -0000"
    },
    "content": "From: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\nIn order to support capture, the pipeline handler needs methods to\nallocate and free buffers, to start and stop the capture and to queue\nrequests. Define those interfaces in the PipelineHandler class and\nimplement them as stubs in the existing pipeline handlers.\n\nThis initial implementation only considers the allocation of new\nbuffers. Future work would need to expand this to also cover importing\nbuffers from an external source.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/include/pipeline_handler.h | 10 ++++\n src/libcamera/pipeline/ipu3/ipu3.cpp     | 34 ++++++++++++\n src/libcamera/pipeline/uvcvideo.cpp      | 34 ++++++++++++\n src/libcamera/pipeline/vimc.cpp          | 34 ++++++++++++\n src/libcamera/pipeline_handler.cpp       | 67 ++++++++++++++++++++++++\n 5 files changed, 179 insertions(+)",
    "diff": "diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h\nindex b4321f0fa0f7..7f2ec2975db0 100644\n--- a/src/libcamera/include/pipeline_handler.h\n+++ b/src/libcamera/include/pipeline_handler.h\n@@ -14,10 +14,12 @@\n \n namespace libcamera {\n \n+class BufferPool;\n class Camera;\n class CameraManager;\n class DeviceEnumerator;\n class MediaDevice;\n+class Request;\n class Stream;\n class StreamConfiguration;\n \n@@ -45,6 +47,14 @@ public:\n \tvirtual int configureStreams(Camera *camera,\n \t\t\t\t     std::map<Stream *, StreamConfiguration> &config) = 0;\n \n+\tvirtual int allocateBuffers(Camera *camera, Stream *stream) = 0;\n+\tvirtual int freeBuffers(Camera *camera, Stream *stream) = 0;\n+\n+\tvirtual int start(const Camera *camera) = 0;\n+\tvirtual void stop(const Camera *camera) = 0;\n+\n+\tvirtual int queueRequest(const Camera *camera, Request *request) = 0;\n+\n \tvirtual bool match(DeviceEnumerator *enumerator) = 0;\n \n protected:\ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex fa3c5224f6d5..3f096bf1251b 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -34,6 +34,14 @@ public:\n \tint configureStreams(Camera *camera,\n \t\t\t     std::map<Stream *, StreamConfiguration> &config) override;\n \n+\tint allocateBuffers(Camera *camera, Stream *stream) override;\n+\tint freeBuffers(Camera *camera, Stream *stream) override;\n+\n+\tint start(const Camera *camera) override;\n+\tvoid stop(const Camera *camera) override;\n+\n+\tint queueRequest(const Camera *camera, Request *request) override;\n+\n \tbool match(DeviceEnumerator *enumerator);\n \n private:\n@@ -104,6 +112,32 @@ int PipelineHandlerIPU3::configureStreams(Camera *camera,\n \treturn 0;\n }\n \n+int PipelineHandlerIPU3::allocateBuffers(Camera *camera, Stream *stream)\n+{\n+\treturn -ENOTRECOVERABLE;\n+}\n+\n+int PipelineHandlerIPU3::freeBuffers(Camera *camera, Stream *stream)\n+{\n+\treturn 0;\n+}\n+\n+int PipelineHandlerIPU3::start(const Camera *camera)\n+{\n+\tLOG(IPU3, Error) << \"TODO: start camera\";\n+\treturn 0;\n+}\n+\n+void PipelineHandlerIPU3::stop(const Camera *camera)\n+{\n+\tLOG(IPU3, Error) << \"TODO: stop camera\";\n+}\n+\n+int PipelineHandlerIPU3::queueRequest(const Camera *camera, Request *request)\n+{\n+\treturn 0;\n+}\n+\n bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator)\n {\n \tDeviceMatch cio2_dm(\"ipu3-cio2\");\ndiff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\nindex ecec4e659ac8..74bdf5c5aea5 100644\n--- a/src/libcamera/pipeline/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo.cpp\n@@ -30,6 +30,14 @@ public:\n \tint configureStreams(Camera *camera,\n \t\t\t     std::map<Stream *, StreamConfiguration> &config) override;\n \n+\tint allocateBuffers(Camera *camera, Stream *stream) override;\n+\tint freeBuffers(Camera *camera, Stream *stream) override;\n+\n+\tint start(const Camera *camera) override;\n+\tvoid stop(const Camera *camera) override;\n+\n+\tint queueRequest(const Camera *camera, Request *request) override;\n+\n \tbool match(DeviceEnumerator *enumerator);\n \n private:\n@@ -82,6 +90,32 @@ int PipelineHandlerUVC::configureStreams(Camera *camera,\n \treturn 0;\n }\n \n+int PipelineHandlerUVC::allocateBuffers(Camera *camera, Stream *stream)\n+{\n+\treturn -ENOTRECOVERABLE;\n+}\n+\n+int PipelineHandlerUVC::freeBuffers(Camera *camera, Stream *stream)\n+{\n+\treturn 0;\n+}\n+\n+int PipelineHandlerUVC::start(const Camera *camera)\n+{\n+\tLOG(UVC, Error) << \"TODO: start camera\";\n+\treturn 0;\n+}\n+\n+void PipelineHandlerUVC::stop(const Camera *camera)\n+{\n+\tLOG(UVC, Error) << \"TODO: stop camera\";\n+}\n+\n+int PipelineHandlerUVC::queueRequest(const Camera *camera, Request *request)\n+{\n+\treturn 0;\n+}\n+\n bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator)\n {\n \tDeviceMatch dm(\"uvcvideo\");\ndiff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\nindex 86a89c63fab1..ea6f28c64cc0 100644\n--- a/src/libcamera/pipeline/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc.cpp\n@@ -30,6 +30,14 @@ public:\n \tint configureStreams(Camera *camera,\n \t\t\t     std::map<Stream *, StreamConfiguration> &config) override;\n \n+\tint allocateBuffers(Camera *camera, Stream *stream) override;\n+\tint freeBuffers(Camera *camera, Stream *stream) override;\n+\n+\tint start(const Camera *camera) override;\n+\tvoid stop(const Camera *camera) override;\n+\n+\tint queueRequest(const Camera *camera, Request *request) override;\n+\n \tbool match(DeviceEnumerator *enumerator);\n \n private:\n@@ -77,6 +85,32 @@ int PipeHandlerVimc::configureStreams(Camera *camera,\n \treturn 0;\n }\n \n+int PipeHandlerVimc::allocateBuffers(Camera *camera, Stream *stream)\n+{\n+\treturn -ENOTRECOVERABLE;\n+}\n+\n+int PipeHandlerVimc::freeBuffers(Camera *camera, Stream *stream)\n+{\n+\treturn 0;\n+}\n+\n+int PipeHandlerVimc::start(const Camera *camera)\n+{\n+\tLOG(VIMC, Error) << \"TODO: start camera\";\n+\treturn 0;\n+}\n+\n+void PipeHandlerVimc::stop(const Camera *camera)\n+{\n+\tLOG(VIMC, Error) << \"TODO: stop camera\";\n+}\n+\n+int PipeHandlerVimc::queueRequest(const Camera *camera, Request *request)\n+{\n+\treturn 0;\n+}\n+\n bool PipeHandlerVimc::match(DeviceEnumerator *enumerator)\n {\n \tDeviceMatch dm(\"vimc\");\ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex 3a560e10c442..cc2d4643ec2f 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -109,6 +109,73 @@ PipelineHandler::~PipelineHandler()\n  * \\return 0 on success or a negative error code on error.\n  */\n \n+/**\n+ * \\fn PipelineHandler::allocateBuffers()\n+ * \\brief Allocate buffers for a stream\n+ * \\param[in] camera The camera the \\a stream belongs to\n+ * \\param[in] stream The stream to allocate buffers for\n+ *\n+ * This method allocates buffers internally in the pipeline handler and\n+ * associates them with the stream's buffer pool.\n+ *\n+ * The intended caller of this method is the Camera class.\n+ *\n+ * \\return 0 on success or a negative error code on error\n+ */\n+\n+/**\n+ * \\fn PipelineHandler::freeBuffers()\n+ * \\brief Free all buffers associated with a stream\n+ * \\param[in] camera The camera the \\a stream belongs to\n+ * \\param[in] stream The stream to free buffers from\n+ *\n+ * After a capture session has been stopped all buffers associated with the\n+ * stream shall be freed.\n+ *\n+ * The intended caller of this method is the Camera class.\n+ *\n+ * \\return 0 on success or a negative error code on error\n+ */\n+\n+/**\n+ * \\fn PipelineHandler::start()\n+ * \\brief Start capturing from a group of streams\n+ * \\param[in] camera The camera to start\n+ *\n+ * Start the group of streams that have been configured for capture by\n+ * \\a configureStreams(). The intended caller of this method is the Camera\n+ * class which will in turn be called from the application to indicate that it\n+ * has configured the streams and is ready to capture.\n+ *\n+ * \\return 0 on success or a negative error code on error\n+ */\n+\n+/**\n+ * \\fn PipelineHandler::stop()\n+ * \\brief Stop capturing from all running streams\n+ * \\param[in] camera The camera to stop\n+ *\n+ * This method stops capturing and processing requests immediately. All pending\n+ * requests are cancelled and complete immediately in an error state.\n+ *\n+ * \\todo Complete the pending requests immediately\n+ */\n+\n+/**\n+ * \\fn PipelineHandler::queueRequest()\n+ * \\brief Queue a request to the camera\n+ * \\param[in] camera The camera to queue the request to\n+ * \\param[in] request The request to queue\n+ *\n+ * This method queues a capture request to the pipeline handler for processing.\n+ * The request contains a set of buffers associated with streams and a set of\n+ * parameters. The pipeline handler shall program the device to ensure that the\n+ * parameters will be applied to the frames captured in the buffers provided in\n+ * the request.\n+ *\n+ * \\return 0 on success or a negative error code on error\n+ */\n+\n /**\n  * \\fn PipelineHandler::match(DeviceEnumerator *enumerator)\n  * \\brief Match media devices and create camera instances\n",
    "prefixes": [
        "libcamera-devel",
        "16/27"
    ]
}