{"id":1713,"url":"https://patchwork.libcamera.org/api/patches/1713/?format=json","web_url":"https://patchwork.libcamera.org/patch/1713/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20190716072739.2071-3-jacopo@jmondi.org>","date":"2019-07-16T07:27:39","name":"[libcamera-devel,v2,2/2] libcamera: ipu3: Do not re-queue cancelled buffers","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"e0c409faf542ca494fa2d6ecdd6e703e460a3b59","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1713/mbox/","series":[{"id":436,"url":"https://patchwork.libcamera.org/api/series/436/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=436","date":"2019-07-16T07:27:37","name":"libcamera: ipu3: fixes","version":2,"mbox":"https://patchwork.libcamera.org/series/436/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1713/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1713/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4341160C23\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Jul 2019 09:26:34 +0200 (CEST)","from uno.localdomain (unknown [104.132.146.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay5-d.mail.gandi.net (Postfix) with ESMTPSA id B68681C000C;\n\tTue, 16 Jul 2019 07:26:32 +0000 (UTC)"],"X-Originating-IP":"104.132.146.101","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 16 Jul 2019 09:27:39 +0200","Message-Id":"<20190716072739.2071-3-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190716072739.2071-1-jacopo@jmondi.org>","References":"<20190716072739.2071-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 2/2] libcamera: ipu3: Do not re-queue\n\tcancelled buffers","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Tue, 16 Jul 2019 07:26:34 -0000"},"content":"When a video device is stopped all the buffers there queued are released\nand their state is set to BufferCancelled.\n\nCurrently, on buffer completion, cancelled buffers are blindly re-queued\nto the ImgU input or CIO2 output devices, preventing them to be\nre-started succesfully in future capture sessions.\n\nFix that by inspecting the buffers status and skip re-queueing if\nthey're reported as cancelled. For the ImgU output buffer this is not\nrequired, as cancelled request should be reported to applications in\norder to report them failure of the capture operations.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\n--\n2.21.0","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex bae3072b177f..c27fe75577f5 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -927,6 +927,10 @@ int PipelineHandlerIPU3::registerCameras()\n  */\n void IPU3CameraData::imguInputBufferReady(Buffer *buffer)\n {\n+\t/* \\todo Handle buffer failures when state is set to BufferError. */\n+\tif (buffer->status() == Buffer::BufferCancelled)\n+\t\treturn;\n+\n \tcio2_.output_->queueBuffer(buffer);\n }\n\n@@ -957,6 +961,10 @@ void IPU3CameraData::imguOutputBufferReady(Buffer *buffer)\n  */\n void IPU3CameraData::cio2BufferReady(Buffer *buffer)\n {\n+\t/* \\todo Handle buffer failures when state is set to BufferError. */\n+\tif (buffer->status() == Buffer::BufferCancelled)\n+\t\treturn;\n+\n \timgu_->input_->queueBuffer(buffer);\n }\n\n","prefixes":["libcamera-devel","v2","2/2"]}