Patch Detail
Show a patch.
GET /api/1.1/patches/660/?format=api
{ "id": 660, "url": "https://patchwork.libcamera.org/api/1.1/patches/660/?format=api", "web_url": "https://patchwork.libcamera.org/patch/660/", "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": "<20190228162913.6508-8-laurent.pinchart@ideasonboard.com>", "date": "2019-02-28T16:29:10", "name": "[libcamera-devel,07/10] libcamera: buffer: Add buffer completion status", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "f6c7791a7536780bb2a4e6ef799737505f40bf6a", "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/660/mbox/", "series": [ { "id": 196, "url": "https://patchwork.libcamera.org/api/1.1/series/196/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=196", "date": "2019-02-28T16:29:03", "name": "Rework request completion handling", "version": 1, "mbox": "https://patchwork.libcamera.org/series/196/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/660/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/660/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 767B9610B7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Feb 2019 17:29:27 +0100 (CET)", "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0E11549\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Feb 2019 17:29:26 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1551371367;\n\tbh=OiouI0WIP4KokHgWBXtzSeN3x/+3HQnLsvei202zKR4=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=OOKIgQCeIGbXDeK9BuuL+WtAbQlITzslL0YQa1juoUAn4MvXVadYUpKN4IO7OyYuM\n\tEAie4tSdcvu4d4yYX5tIppEwoA3UsNzLMUz9ErsxRFYIlEwHo+cyFBUXNzFfqSsoai\n\tXVdDWHxjV7xLSAzB7sCfhGriB0GJEGpyqymrniMI=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 28 Feb 2019 18:29:10 +0200", "Message-Id": "<20190228162913.6508-8-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.19.2", "In-Reply-To": "<20190228162913.6508-1-laurent.pinchart@ideasonboard.com>", "References": "<20190228162913.6508-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 07/10] libcamera: buffer: Add buffer\n\tcompletion status", "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, 28 Feb 2019 16:29:27 -0000" }, "content": "Add a new field to the Buffer class to report its completion status,\nwith a new cancel() method to mark the buffer as cancelled.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/buffer.h | 10 ++++++++++\n src/libcamera/buffer.cpp | 35 +++++++++++++++++++++++++++++++++++\n src/libcamera/v4l2_device.cpp | 2 ++\n 3 files changed, 47 insertions(+)", "diff": "diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h\nindex dc9aaad12a81..f740ade9bb4f 100644\n--- a/include/libcamera/buffer.h\n+++ b/include/libcamera/buffer.h\n@@ -40,12 +40,19 @@ private:\n class Buffer final\n {\n public:\n+\tenum Status {\n+\t\tBufferSuccess,\n+\t\tBufferError,\n+\t\tBufferCancelled,\n+\t};\n+\n \tBuffer();\n \n \tunsigned int index() const { return index_; }\n \tunsigned int bytesused() const { return bytesused_; }\n \tuint64_t timestamp() const { return timestamp_; }\n \tunsigned int sequence() const { return sequence_; }\n+\tStatus status() const { return status_; }\n \tstd::vector<Plane> &planes() { return planes_; }\n \n \tSignal<Buffer *> completed;\n@@ -54,10 +61,13 @@ private:\n \tfriend class BufferPool;\n \tfriend class V4L2Device;\n \n+\tvoid cancel();\n+\n \tunsigned int index_;\n \tunsigned int bytesused_;\n \tuint64_t timestamp_;\n \tunsigned int sequence_;\n+\tStatus status_;\n \n \tstd::vector<Plane> planes_;\n };\ndiff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp\nindex 80dd9c854a4b..524eb47d4364 100644\n--- a/src/libcamera/buffer.cpp\n+++ b/src/libcamera/buffer.cpp\n@@ -181,6 +181,20 @@ void *Plane::mem()\n * objects if the image format is multi-planar.\n */\n \n+/**\n+ * \\enum Buffer::Status\n+ * Buffer completion status\n+ * \\var Buffer::BufferSuccess\n+ * The buffer has completed with success and contains valid data. All its other\n+ * metadata (such as bytesused(), timestamp() or sequence() number) are valid.\n+ * \\var Buffer::BufferError\n+ * The buffer has completed with an error and doesn't contain valid data. Its\n+ * other metadata are valid.\n+ * \\var Buffer::BufferCancelled\n+ * The buffer has been cancelled due to capture stop. Its other metadata are\n+ * invalid and shall not be used.\n+ */\n+\n Buffer::Buffer()\n \t: index_(-1)\n {\n@@ -229,6 +243,27 @@ Buffer::Buffer()\n * \\return Sequence number of the buffer\n */\n \n+/**\n+ * \\fn Buffer::status()\n+ * \\brief Retrieve the buffer status\n+ *\n+ * The buffer status reports whether the buffer has completed successfully\n+ * (BufferSuccess) or if an error occurred (BufferError).\n+ *\n+ * \\return The buffer status\n+ */\n+\n+/**\n+ * \\brief Mark a buffer as cancel by setting its status to BufferCancelled\n+ */\n+void Buffer::cancel()\n+{\n+\tbytesused_ = 0;\n+\ttimestamp_ = 0;\n+\tsequence_ = 0;\n+\tstatus_ = BufferCancelled;\n+}\n+\n /**\n * \\class BufferPool\n * \\brief A pool of buffers\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 31200a6e7d6f..054499e4b888 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -793,6 +793,8 @@ Buffer *V4L2Device::dequeueBuffer()\n \tbuffer->timestamp_ = buf.timestamp.tv_sec * 1000000000ULL\n \t\t\t + buf.timestamp.tv_usec * 1000ULL;\n \tbuffer->sequence_ = buf.sequence;\n+\tbuffer->status_ = buf.flags & V4L2_BUF_FLAG_ERROR\n+\t\t\t? Buffer::BufferError : Buffer::BufferSuccess;\n \n \treturn buffer;\n }\n", "prefixes": [ "libcamera-devel", "07/10" ] }