Patch Detail
Show a patch.
GET /api/patches/12083/?format=api
{ "id": 12083, "url": "https://patchwork.libcamera.org/api/patches/12083/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12083/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20210422210609.425987-2-nfraprado@collabora.com>", "date": "2021-04-22T21:06:08", "name": "[libcamera-devel,RFC,1/2] lc-compliance: Make SimpleCapture::stop() idempotent", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "ff90ac1297af7490b73f4175854e0142b8d2ebd6", "submitter": { "id": 84, "url": "https://patchwork.libcamera.org/api/people/84/?format=api", "name": "Nícolas F. R. A. Prado", "email": "nfraprado@collabora.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/12083/mbox/", "series": [ { "id": 1965, "url": "https://patchwork.libcamera.org/api/series/1965/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1965", "date": "2021-04-22T21:06:07", "name": "lc-compliance: Refactor using Googletest", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1965/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12083/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12083/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 EBA98BDB1A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 Apr 2021 21:06:53 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B8E2D68861;\n\tThu, 22 Apr 2021 23:06:53 +0200 (CEST)", "from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C28C260516\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 Apr 2021 23:06:51 +0200 (CEST)", "from [127.0.0.1] (localhost [127.0.0.1])\n\t(Authenticated sender: nfraprado) with ESMTPSA id E45B41F43755" ], "From": "=?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= <nfraprado@collabora.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 22 Apr 2021 18:06:08 -0300", "Message-Id": "<20210422210609.425987-2-nfraprado@collabora.com>", "X-Mailer": "git-send-email 2.31.1", "In-Reply-To": "<20210422210609.425987-1-nfraprado@collabora.com>", "References": "<20210422210609.425987-1-nfraprado@collabora.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [RFC PATCH 1/2] 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>", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "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 immeadiately.\n\nSigned-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>\n---\n src/lc-compliance/simple_capture.cpp | 12 +++++-------\n 1 file changed, 5 insertions(+), 7 deletions(-)", "diff": "diff --git a/src/lc-compliance/simple_capture.cpp b/src/lc-compliance/simple_capture.cpp\nindex 811a62200096..e6715ac07f12 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@@ -52,12 +53,16 @@ Results::Result SimpleCapture::start()\n \n void SimpleCapture::stop()\n {\n+\tif (!config_)\n+\t\treturn;\n \tStream *stream = config_->at(0).stream();\n \n \tcamera_->stop();\n \n \tcamera_->requestCompleted.disconnect(this, &SimpleCapture::requestComplete);\n \n+\tif (!allocator_->allocated())\n+\t\treturn;\n \tallocator_->free(stream);\n }\n \n@@ -81,7 +86,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@@ -96,17 +100,14 @@ Results::Result SimpleCaptureBalanced::capture(unsigned int numRequests)\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\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\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\t\treturn { Results::Fail, \"Failed to queue request\" };\n \t\t}\n \n@@ -173,17 +174,14 @@ Results::Result SimpleCaptureUnbalanced::capture(unsigned int numRequests)\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\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\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\t\treturn { Results::Fail, \"Failed to queue request\" };\n \t\t}\n \n", "prefixes": [ "libcamera-devel", "RFC", "1/2" ] }