{"id":11556,"url":"https://patchwork.libcamera.org/api/1.1/patches/11556/?format=json","web_url":"https://patchwork.libcamera.org/patch/11556/","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":"<20210312054727.852622-6-kieran.bingham@ideasonboard.com>","date":"2021-03-12T05:47:24","name":"[libcamera-devel,v2,5/8] libcamera: v4l2_videodevice: Prevent queueing buffers without a cache","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"ea9e39e88278d6280598a542e4555a4e685cbc52","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":{"id":11,"url":"https://patchwork.libcamera.org/api/1.1/users/11/?format=json","username":"kbingham","first_name":"Kieran","last_name":"Bingham","email":"kieran.bingham@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/11556/mbox/","series":[{"id":1785,"url":"https://patchwork.libcamera.org/api/1.1/series/1785/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1785","date":"2021-03-12T05:47:19","name":"IPU3 Stability","version":2,"mbox":"https://patchwork.libcamera.org/series/1785/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11556/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11556/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 4072EBD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 12 Mar 2021 05:47:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E2DF9605B2;\n\tFri, 12 Mar 2021 06:47:37 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3E29968C70\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 12 Mar 2021 06:47:33 +0100 (CET)","from localhost.localdomain\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D73BCA27;\n\tFri, 12 Mar 2021 06:47:32 +0100 (CET)"],"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=\"NsrIm3ZV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1615528053;\n\tbh=+Nkpy6OrrmrW1e/H1IXCtKLtFskncsRslC13N7+Bok4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=NsrIm3ZVkJFLuD2o5/sNdUOoOAbgqczqoWsLsSBNZSz1e2YgWmT8Nzu0SikhDe/n+\n\tOc5o1FPscriCOrbs8FhTlEqgiH8xVVUlX7kAKAFFk4DVa7WA7e9lUkZOv0SYCzYezu\n\t2XxkluFhMX8x6KV04aYdE3t74KJQGsHswmJt64CA=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Fri, 12 Mar 2021 05:47:24 +0000","Message-Id":"<20210312054727.852622-6-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20210312054727.852622-1-kieran.bingham@ideasonboard.com>","References":"<20210312054727.852622-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 5/8] libcamera: v4l2_videodevice:\n\tPrevent queueing buffers without a cache","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":"The v4l2 buffer cache allows us to map incoming buffers to an instance\nof the V4L2 Buffer required to actually queue.\n\nIf the cache_ is not available, then the buffers required to allow\nqueuing to a device have been released, and this indicates an issue at\nthe pipeline handler.\n\nThis could be a common mistake, as it could happen if a pipeline handler\nalways requeues buffers to the device after they complete, without\nchecking if they are cancelled.\n\nThat can then lead to trying to queue a buffer to a device which no\nlonger expects buffers, so add a loud message to indicate what has\nhappened but return an error without fatally crashing.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/v4l2_videodevice.cpp | 10 ++++++++++\n 1 file changed, 10 insertions(+)","diff":"diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex cb52d4cea3f6..12c09dc7578d 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -1391,6 +1391,16 @@ int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer)\n \tstruct v4l2_buffer buf = {};\n \tint ret;\n \n+\t/*\n+\t * Pipeline handlers should not requeue buffers after releasing the\n+\t * buffers on the device. Any occurence of this error should be fixed\n+\t * in the pipeline handler directly.\n+\t */\n+\tif (!cache_) {\n+\t\tLOG(V4L2, Fatal) << \"No BufferCache available to queue.\";\n+\t\treturn -ENOENT;\n+\t}\n+\n \tret = cache_->get(*buffer);\n \tif (ret < 0)\n \t\treturn ret;\n","prefixes":["libcamera-devel","v2","5/8"]}