{"id":11185,"url":"https://patchwork.libcamera.org/api/1.1/patches/11185/?format=json","web_url":"https://patchwork.libcamera.org/patch/11185/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210208094416.2124569-1-niklas.soderlund@ragnatech.se>","date":"2021-02-08T09:44:16","name":"[libcamera-devel] cam: Fail capture if to few Requests asked for","commit_ref":null,"pull_url":null,"state":"rejected","archived":false,"hash":"d0ff67b90a9e5b0b610b97946879af791a401bf6","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/1.1/people/5/?format=json","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"delegate":{"id":16,"url":"https://patchwork.libcamera.org/api/1.1/users/16/?format=json","username":"neg","first_name":"Niklas","last_name":"Söderlund","email":"niklas.soderlund@ragnatech.se"},"mbox":"https://patchwork.libcamera.org/patch/11185/mbox/","series":[{"id":1664,"url":"https://patchwork.libcamera.org/api/1.1/series/1664/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1664","date":"2021-02-08T09:44:16","name":"[libcamera-devel] cam: Fail capture if to few Requests asked for","version":1,"mbox":"https://patchwork.libcamera.org/series/1664/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11185/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11185/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 8A8D5BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  8 Feb 2021 09:44:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 015AE60D14;\n\tMon,  8 Feb 2021 10:44:27 +0100 (CET)","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 5465360D10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Feb 2021 10:44:25 +0100 (CET)","from bismarck.berto.se (p4fca2458.dip0.t-ipconnect.de\n\t[79.202.36.88])\n\tby bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid 36ddc28c-69f2-11eb-a542-005056917a89;\n\tMon, 08 Feb 2021 10:44:23 +0100 (CET)"],"X-Halon-ID":"36ddc28c-69f2-11eb-a542-005056917a89","Authorized-sender":"niklas.soderlund@fsdn.se","From":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon,  8 Feb 2021 10:44:16 +0100","Message-Id":"<20210208094416.2124569-1-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.30.0","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH] cam: Fail capture if to few Requests\n\tasked for","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=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Running cam with the --capture=N option only queues N Requests to the\ncamera. If N is less then the number of requests needed by the camera to\noperate cam may deadlock waiting for the camera to complete requests\nwhile the camera waits for the application to give it more buffers.\n\nFix this by adding a check in cam to no attempt a capture session if to\nfew requests are requested.\n\nReported-by: Sebastian Fricke <sebastian.fricke@posteo.net>\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/cam/capture.cpp | 7 +++++++\n 1 file changed, 7 insertions(+)","diff":"diff --git a/src/cam/capture.cpp b/src/cam/capture.cpp\nindex 7b55fc6770225e2a..18aa97c7cdb55dcc 100644\n--- a/src/cam/capture.cpp\n+++ b/src/cam/capture.cpp\n@@ -90,6 +90,13 @@ int Capture::capture(FrameBufferAllocator *allocator)\n \t\tnbuffers = std::min(nbuffers, allocated);\n \t}\n \n+\tif (captureLimit_ && captureLimit_ < nbuffers) {\n+\t\tstd::cerr << \"Camera requiers at least \" << nbuffers\n+\t\t\t  << \" reqests to function, \" << captureLimit_\n+\t\t\t  << \" requested\" << std::endl;\n+\t\treturn -EINVAL;\n+\t}\n+\n \t/*\n \t * TODO: make cam tool smarter to support still capture by for\n \t * example pushing a button. For now run all streams all the time.\n","prefixes":["libcamera-devel"]}