From patchwork Tue Jul 16 07:27:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 1713 Return-Path: Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4341160C23 for ; Tue, 16 Jul 2019 09:26:34 +0200 (CEST) X-Originating-IP: 104.132.146.101 Received: from uno.localdomain (unknown [104.132.146.101]) (Authenticated sender: jacopo@jmondi.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id B68681C000C; Tue, 16 Jul 2019 07:26:32 +0000 (UTC) From: Jacopo Mondi 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 Subject: [libcamera-devel] [PATCH v2 2/2] libcamera: ipu3: Do not re-queue cancelled buffers X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jul 2019 07:26:34 -0000 When a video device is stopped all the buffers there queued are released and their state is set to BufferCancelled. Currently, on buffer completion, cancelled buffers are blindly re-queued to the ImgU input or CIO2 output devices, preventing them to be re-started succesfully in future capture sessions. Fix that by inspecting the buffers status and skip re-queueing if they're reported as cancelled. For the ImgU output buffer this is not required, as cancelled request should be reported to applications in order to report them failure of the capture operations. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/ipu3/ipu3.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.21.0 diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index bae3072b177f..c27fe75577f5 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -927,6 +927,10 @@ int PipelineHandlerIPU3::registerCameras() */ void IPU3CameraData::imguInputBufferReady(Buffer *buffer) { + /* \todo Handle buffer failures when state is set to BufferError. */ + if (buffer->status() == Buffer::BufferCancelled) + return; + cio2_.output_->queueBuffer(buffer); } @@ -957,6 +961,10 @@ void IPU3CameraData::imguOutputBufferReady(Buffer *buffer) */ void IPU3CameraData::cio2BufferReady(Buffer *buffer) { + /* \todo Handle buffer failures when state is set to BufferError. */ + if (buffer->status() == Buffer::BufferCancelled) + return; + imgu_->input_->queueBuffer(buffer); }