Patch Detail
Show a patch.
GET /api/1.1/patches/9197/?format=api
{ "id": 9197, "url": "https://patchwork.libcamera.org/api/1.1/patches/9197/?format=api", "web_url": "https://patchwork.libcamera.org/patch/9197/", "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": "<20200804214711.177645-5-kieran.bingham@ideasonboard.com>", "date": "2020-08-04T21:47:02", "name": "[libcamera-devel,v3,04/13] test: mapped-buffers: Provide MappedBuffer test", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "14269774264faaf32cac1cb17763448ffb6c32f6", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/9197/mbox/", "series": [ { "id": 1191, "url": "https://patchwork.libcamera.org/api/1.1/series/1191/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1191", "date": "2020-08-04T21:46:58", "name": "android: JPEG support", "version": 3, "mbox": "https://patchwork.libcamera.org/series/1191/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/9197/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/9197/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 5131EBD87A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 4 Aug 2020 21:47:21 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EEC406059B;\n\tTue, 4 Aug 2020 23:47:20 +0200 (CEST)", "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 CC3BC60555\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 4 Aug 2020 23:47:17 +0200 (CEST)", "from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net\n\t[86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 58A31A66;\n\tTue, 4 Aug 2020 23:47:17 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"SHbusFKn\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1596577637;\n\tbh=8X9yghRwQQ+CEuljUFWC6/ib0WPrO/zRGEc2udASvCs=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=SHbusFKnHTSKyxoe5SJ93rK/0o7gg2ZtsOMc55bgV4EjxpLqnC1rM1CMukxfOk8xa\n\tCLXSJ3rn5BWDe+UHteu3iHSNyCckQkbmw3LN1Y6rWBE0U39auTkl0qlY1M7AhhkYd1\n\tnLf/Stujc8PisoSJteCZd3pUr52ngF1T87oRlcVk=", "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "To": "libcamera devel <libcamera-devel@lists.libcamera.org>", "Date": "Tue, 4 Aug 2020 22:47:02 +0100", "Message-Id": "<20200804214711.177645-5-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20200804214711.177645-1-kieran.bingham@ideasonboard.com>", "References": "<20200804214711.177645-1-kieran.bingham@ideasonboard.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v3 04/13] test: mapped-buffers: Provide\n\tMappedBuffer test", "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>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Provide initial testing framework for the MappedBuffer component.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n test/mapped-buffers.cpp | 113 ++++++++++++++++++++++++++++++++++++++++\n test/meson.build | 1 +\n 2 files changed, 114 insertions(+)\n create mode 100644 test/mapped-buffers.cpp", "diff": "diff --git a/test/mapped-buffers.cpp b/test/mapped-buffers.cpp\nnew file mode 100644\nindex 000000000000..4c0557070ca3\n--- /dev/null\n+++ b/test/mapped-buffers.cpp\n@@ -0,0 +1,113 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2020, Google Inc.\n+ *\n+ * libcamera internal MappedBuffer tests\n+ */\n+\n+#include <iostream>\n+\n+#include \"camera_test.h\"\n+#include \"test.h\"\n+\n+#include \"libcamera/internal/buffer.h\"\n+\n+using namespace std;\n+\n+namespace {\n+\n+class MappedBuffers : public CameraTest, public Test\n+{\n+public:\n+\tMappedBuffers()\n+\t\t: CameraTest(\"VIMC Sensor B\")\n+\t{\n+\t}\n+\n+protected:\n+\tint init() override\n+\t{\n+\t\tif (status_ != TestPass)\n+\t\t\treturn status_;\n+\n+\t\tconfig_ = camera_->generateConfiguration({ StreamRole::VideoRecording });\n+\t\tif (!config_ || config_->size() != 1) {\n+\t\t\tcout << \"Failed to generate default configuration\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tallocator_ = new FrameBufferAllocator(camera_);\n+\n+\t\tStreamConfiguration &cfg = config_->at(0);\n+\n+\t\tif (camera_->acquire()) {\n+\t\t\tcout << \"Failed to acquire the camera\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (camera_->configure(config_.get())) {\n+\t\t\tcout << \"Failed to set default configuration\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tstream_ = cfg.stream();\n+\n+\t\tint ret = allocator_->allocate(stream_);\n+\t\tif (ret < 0)\n+\t\t\treturn TestFail;\n+\n+\t\treturn TestPass;\n+\t}\n+\n+\tvoid cleanup() override\n+\t{\n+\t\tdelete allocator_;\n+\t}\n+\n+\tint run() override\n+\t{\n+\t\tconst std::unique_ptr<FrameBuffer> &buffer = allocator_->buffers(stream_).front();\n+\t\tstd::vector<MappedBuffer> maps;\n+\n+\t\tMappedFrameBuffer map(buffer.get(), PROT_READ);\n+\t\tif (!map.isValid()) {\n+\t\t\tcout << \"Failed to successfully map buffer\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Make sure we can move it. */\n+\t\tmaps.emplace_back(std::move(map));\n+\n+\t\t/* But copying is prevented, it would cause double-unmap. */\n+\t\t// MappedFrameBuffer map_copy = map;\n+\n+\t\t/* Local map should be invalid (after move). */\n+\t\tif (map.isValid()) {\n+\t\t\tcout << \"Post-move map should not be valid\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Test for multiple successful maps on the same buffer. */\n+\t\tMappedFrameBuffer write_map(buffer.get(), PROT_WRITE);\n+\t\tif (!write_map.isValid()) {\n+\t\t\tcout << \"Failed to map write buffer\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tMappedFrameBuffer rw_map(buffer.get(), PROT_READ | PROT_WRITE);\n+\t\tif (!rw_map.isValid()) {\n+\t\t\tcout << \"Failed to map RW buffer\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\treturn TestPass;\n+\t}\n+\n+\tstd::unique_ptr<CameraConfiguration> config_;\n+\tFrameBufferAllocator *allocator_;\n+\tStream *stream_;\n+};\n+\n+} /* namespace */\n+\n+TEST_REGISTER(MappedBuffers);\ndiff --git a/test/meson.build b/test/meson.build\nindex 775187159dec..376ee6cee175 100644\n--- a/test/meson.build\n+++ b/test/meson.build\n@@ -31,6 +31,7 @@ internal_tests = [\n ['file', 'file.cpp'],\n ['file-descriptor', 'file-descriptor.cpp'],\n ['hotplug-cameras', 'hotplug-cameras.cpp'],\n+ ['mapped-buffers', 'mapped-buffers.cpp'],\n ['message', 'message.cpp'],\n ['object', 'object.cpp'],\n ['object-delete', 'object-delete.cpp'],\n", "prefixes": [ "libcamera-devel", "v3", "04/13" ] }