Patch Detail
Show a patch.
GET /api/1.1/patches/2368/?format=api
{ "id": 2368, "url": "https://patchwork.libcamera.org/api/1.1/patches/2368/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2368/", "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": "<20191126233620.1695316-21-niklas.soderlund@ragnatech.se>", "date": "2019-11-26T23:36:10", "name": "[libcamera-devel,20/30] libcamera: stream: Add prototypes for new interface", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "40cadbd1fea3680e475cc59db2d0e68028477460", "submitter": { "id": 5, "url": "https://patchwork.libcamera.org/api/1.1/people/5/?format=api", "name": "Niklas Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/2368/mbox/", "series": [ { "id": 579, "url": "https://patchwork.libcamera.org/api/1.1/series/579/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=579", "date": "2019-11-26T23:35:50", "name": "libcamera: Rework buffer API", "version": 1, "mbox": "https://patchwork.libcamera.org/series/579/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2368/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2368/checks/", "tags": {}, "headers": { "Return-Path": "<niklas.soderlund@ragnatech.se>", "Received": [ "from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net\n\t[195.74.38.229])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3A10F61CC9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Nov 2019 00:39:40 +0100 (CET)", "from bismarck.berto.se (p54ac5865.dip0.t-ipconnect.de\n\t[84.172.88.101]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA\n\tid 02b0592e-10a6-11ea-a0b9-005056917f90;\n\tWed, 27 Nov 2019 00:39:38 +0100 (CET)" ], "X-Halon-ID": "02b0592e-10a6-11ea-a0b9-005056917f90", "Authorized-sender": "niklas@soderlund.pp.se", "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 27 Nov 2019 00:36:10 +0100", "Message-Id": "<20191126233620.1695316-21-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.24.0", "In-Reply-To": "<20191126233620.1695316-1-niklas.soderlund@ragnatech.se>", "References": "<20191126233620.1695316-1-niklas.soderlund@ragnatech.se>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 20/30] libcamera: stream: Add prototypes\n\tfor new interface", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "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, 26 Nov 2019 23:39:40 -0000" }, "content": "The buffer allocation rework will remove most of the methods in the\nStream class. This change adds the prototypes for the FrameBuffer\ninterface with stub default implementations.\n\nOnce the new buffer allocation work is completed the prototypes added in\nthis change will be turned into pure virtual functions preventing\nthe base Stream class from being instantiated.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n include/libcamera/stream.h | 11 ++++++++\n src/libcamera/stream.cpp | 55 ++++++++++++++++++++++++++++++++++++++\n 2 files changed, 66 insertions(+)", "diff": "diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\nindex a404eccf34d9c93b..395148e45d342d92 100644\n--- a/include/libcamera/stream.h\n+++ b/include/libcamera/stream.h\n@@ -7,6 +7,7 @@\n #ifndef __LIBCAMERA_STREAM_H__\n #define __LIBCAMERA_STREAM_H__\n \n+#include <errno.h>\n #include <map>\n #include <memory>\n #include <string>\n@@ -74,6 +75,7 @@ class Stream\n {\n public:\n \tStream();\n+\tvirtual ~Stream(){};\n \n \tstd::unique_ptr<Buffer> createBuffer(unsigned int index);\n \tstd::unique_ptr<Buffer> createBuffer(const std::array<int, 3> &fds);\n@@ -86,6 +88,15 @@ public:\n protected:\n \tfriend class Camera;\n \n+\tvirtual int allocateBuffers(const StreamConfiguration &config,\n+\t\t\t\t std::vector<FrameBuffer *> *buffers)\n+\t{\n+\t\treturn -EINVAL;\n+\t}\n+\tvirtual void releaseBuffers() { return; }\n+\tvirtual int start() { return -EINVAL; }\n+\tvirtual void stop() { return; }\n+\n \tint mapBuffer(const Buffer *buffer);\n \tvoid unmapBuffer(const Buffer *buffer);\n \ndiff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\nindex e70a1e307ecaa5ba..ba3f571b08cb0c41 100644\n--- a/src/libcamera/stream.cpp\n+++ b/src/libcamera/stream.cpp\n@@ -520,6 +520,61 @@ std::unique_ptr<Buffer> Stream::createBuffer(const std::array<int, 3> &fds)\n * \\return The memory type used by the stream\n */\n \n+/**\n+ * \\fn Stream::allocateBuffers()\n+ * \\brief Allocate buffers from the stream\n+ * \\param[in] config A configuration describing the buffer(s) to be allocated\n+ * \\param[out] buffers Array of buffers successfully allocated\n+ *\n+ * Allocate buffers matching exactly what is described in \\a config and return\n+ * then in \\a buffers. If buffers matching \\a config can't be allocated an error\n+ * shall be returned and no buffers returned in \\a buffers.\n+ *\n+ * This is a helper which may be used by libcamera helper classes to allocate\n+ * buffers from the stream itself. The allocated buffers may then be treated\n+ * in the same way as if they where externally allocated.\n+ *\n+ * The only intended caller is buffer allocator helpers and the function must\n+ * be implemeted by all subclasses of Stream.\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n+\n+/**\n+ * \\fn Stream::releaseBuffers()\n+ * \\brief Relase buffers allocated from the stram\n+ *\n+ * This is a helper which release buffers allocated using allocateBuffers(). The\n+ * only intended caller is buffer allocator helpers.\n+ *\n+ * The only intended caller is buffer allocator helpers and the function must\n+ * be implemeted by all subclasses of Stream.\n+ */\n+\n+/**\n+ * \\fn Stream::start()\n+ * \\brief Prepare a stream for capture\n+ *\n+ * The subclss shall prepare the stream for capture and if needed allocate\n+ * resources to allow for that. No buffers may be allocated from the stream\n+ * using allocateBuffers() after a stream have been started.\n+ *\n+ * The only intended caller is the camera base class and the function must be\n+ * implemeted by all subclasses of Stream.\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n+\n+/**\n+ * \\fn Stream::stop()\n+ * \\brief Stop a stream after capture\n+ *\n+ * The subclass shall free all resources allocated in start().\n+ *\n+ * The only intended caller is the camera base class and the function must be\n+ * implemeted by all subclasses of Stream.\n+ */\n+\n /**\n * \\brief Map a Buffer to a buffer memory index\n * \\param[in] buffer The buffer to map to a buffer memory index\n", "prefixes": [ "libcamera-devel", "20/30" ] }