Patch Detail
Show a patch.
GET /api/1.1/patches/12556/?format=api
{ "id": 12556, "url": "https://patchwork.libcamera.org/api/1.1/patches/12556/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12556/", "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": "<20210610183732.174697-3-nfraprado@collabora.com>", "date": "2021-06-10T18:37:29", "name": "[libcamera-devel,v7,2/5] lc-compliance: Make SimpleCapture::stop() idempotent", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "414f04ec37c0392ac7496c417867ce570ed30432", "submitter": { "id": 84, "url": "https://patchwork.libcamera.org/api/1.1/people/84/?format=api", "name": "Nícolas F. R. A. Prado", "email": "nfraprado@collabora.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/12556/mbox/", "series": [ { "id": 2119, "url": "https://patchwork.libcamera.org/api/1.1/series/2119/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2119", "date": "2021-06-10T18:37:27", "name": "lc-compliance: Refactor using Googletest", "version": 7, "mbox": "https://patchwork.libcamera.org/series/2119/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12556/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12556/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 EDA96C320B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 10 Jun 2021 18:38:35 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BBC236029C;\n\tThu, 10 Jun 2021 20:38:35 +0200 (CEST)", "from bhuna.collabora.co.uk (bhuna.collabora.co.uk\n\t[IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 11D0F6029B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Jun 2021 20:38:34 +0200 (CEST)", "from localhost.localdomain (unknown\n\t[IPv6:2804:14c:1a9:2978:fdf4:5e57:8aee:5d72])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits))\n\t(No client certificate requested) (Authenticated sender: nfraprado)\n\tby bhuna.collabora.co.uk (Postfix) with ESMTPSA id 4CB731F441F3;\n\tThu, 10 Jun 2021 19:38:31 +0100 (BST)" ], "From": "=?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= <nfraprado@collabora.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 10 Jun 2021 15:37:29 -0300", "Message-Id": "<20210610183732.174697-3-nfraprado@collabora.com>", "X-Mailer": "git-send-email 2.32.0", "In-Reply-To": "<20210610183732.174697-1-nfraprado@collabora.com>", "References": "<20210610183732.174697-1-nfraprado@collabora.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v7 2/5] lc-compliance: Make\n\tSimpleCapture::stop() idempotent", "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>", "Cc": "kernel@collabora.com, =?utf-8?q?Andr=C3=A9_Almeida?=\n\t<andrealmeid@collabora.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Make SimpleCapture::stop() be able to be called multiple times and at\nany point so that it can be called from the destructor and an assert\nfailure can return immediately.\n\nSigned-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\nChanges in v7:\n- Thanks to Jacopo:\n - Moved the check for buffers allocated to the beginning of\n SimpleCapture::stop()\n\nNo changes in v6\n\nNo changes in v5\n\nNo changes in v4\n\nNo changes in v3\n\nChanges in v2:\n- Suggested by Laurent:\n - Fixed code style\n\n src/lc-compliance/simple_capture.cpp | 30 ++++++++++------------------\n 1 file changed, 10 insertions(+), 20 deletions(-)", "diff": "diff --git a/src/lc-compliance/simple_capture.cpp b/src/lc-compliance/simple_capture.cpp\nindex 64e862a08e3a..bfc91b26444e 100644\n--- a/src/lc-compliance/simple_capture.cpp\n+++ b/src/lc-compliance/simple_capture.cpp\n@@ -17,6 +17,7 @@ SimpleCapture::SimpleCapture(std::shared_ptr<Camera> camera)\n \n SimpleCapture::~SimpleCapture()\n {\n+\tstop();\n }\n \n Results::Result SimpleCapture::configure(StreamRole role)\n@@ -55,12 +56,14 @@ Results::Result SimpleCapture::start()\n \n void SimpleCapture::stop()\n {\n-\tStream *stream = config_->at(0).stream();\n+\tif (!config_ || !allocator_->allocated())\n+\t\treturn;\n \n \tcamera_->stop();\n \n \tcamera_->requestCompleted.disconnect(this, &SimpleCapture::requestComplete);\n \n+\tStream *stream = config_->at(0).stream();\n \tallocator_->free(stream);\n }\n \n@@ -84,7 +87,6 @@ Results::Result SimpleCaptureBalanced::capture(unsigned int numRequests)\n \tif (buffers.size() > numRequests) {\n \t\t/* Cache buffers.size() before we destroy it in stop() */\n \t\tint buffers_size = buffers.size();\n-\t\tstop();\n \n \t\treturn { Results::Skip, \"Camera needs \" + std::to_string(buffers_size)\n \t\t\t+ \" requests, can't test only \" + std::to_string(numRequests) };\n@@ -98,20 +100,14 @@ Results::Result SimpleCaptureBalanced::capture(unsigned int numRequests)\n \tstd::vector<std::unique_ptr<libcamera::Request>> requests;\n \tfor (const std::unique_ptr<FrameBuffer> &buffer : buffers) {\n \t\tstd::unique_ptr<Request> request = camera_->createRequest();\n-\t\tif (!request) {\n-\t\t\tstop();\n+\t\tif (!request)\n \t\t\treturn { Results::Fail, \"Can't create request\" };\n-\t\t}\n \n-\t\tif (request->addBuffer(stream, buffer.get())) {\n-\t\t\tstop();\n+\t\tif (request->addBuffer(stream, buffer.get()))\n \t\t\treturn { Results::Fail, \"Can't set buffer for request\" };\n-\t\t}\n \n-\t\tif (queueRequest(request.get()) < 0) {\n-\t\t\tstop();\n+\t\tif (queueRequest(request.get()) < 0)\n \t\t\treturn { Results::Fail, \"Failed to queue request\" };\n-\t\t}\n \n \t\trequests.push_back(std::move(request));\n \t}\n@@ -175,20 +171,14 @@ Results::Result SimpleCaptureUnbalanced::capture(unsigned int numRequests)\n \tstd::vector<std::unique_ptr<libcamera::Request>> requests;\n \tfor (const std::unique_ptr<FrameBuffer> &buffer : buffers) {\n \t\tstd::unique_ptr<Request> request = camera_->createRequest();\n-\t\tif (!request) {\n-\t\t\tstop();\n+\t\tif (!request)\n \t\t\treturn { Results::Fail, \"Can't create request\" };\n-\t\t}\n \n-\t\tif (request->addBuffer(stream, buffer.get())) {\n-\t\t\tstop();\n+\t\tif (request->addBuffer(stream, buffer.get()))\n \t\t\treturn { Results::Fail, \"Can't set buffer for request\" };\n-\t\t}\n \n-\t\tif (camera_->queueRequest(request.get()) < 0) {\n-\t\t\tstop();\n+\t\tif (camera_->queueRequest(request.get()) < 0)\n \t\t\treturn { Results::Fail, \"Failed to queue request\" };\n-\t\t}\n \n \t\trequests.push_back(std::move(request));\n \t}\n", "prefixes": [ "libcamera-devel", "v7", "2/5" ] }