From patchwork Wed Mar 24 20:06:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 11701 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 12426C32E5 for ; Wed, 24 Mar 2021 20:06:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 37B8C68D61; Wed, 24 Mar 2021 21:06:31 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="YPKIcPCQ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7E24A602E3 for ; Wed, 24 Mar 2021 21:06:29 +0100 (CET) Received: from localhost.localdomain (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D7C96580; Wed, 24 Mar 2021 21:06:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1616616389; bh=lzSrkrUc0l8+nLWqJltYdrKwb9Zn5Q5Z7gP+1f2VyaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YPKIcPCQNyjqEhIHB8jNNYtruQU+wnGnlC/S9nh9nqs2p6S/4mfZ3pOuHJCLGsDZA KbvwFirUuSi6CU+W7KzIzgDkXbnOOcwn/XIqsSbBhxXZsTHNiDxHst8XKaqCfIM0BD JwnZyrZWKtTdZQmPZQmTmOBO0Sn3ewKMsDtMPIlU= From: Kieran Bingham To: libcamera devel Date: Wed, 24 Mar 2021 20:06:24 +0000 Message-Id: <20210324200624.1347604-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3.1] libcamera: pipeline: ipu3: Cancel unused buffers X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" When the CIO2 returns a cancelled buffer, we will not queue buffers to the IMGU. These buffers should be explicitly marked as cancelled to ensure the application knows there is no valid metadata or frame data provided in the buffer. Provide a cancel() method on the FrameBuffer to allow explicitly cancelling a buffer. Signed-off-by: Kieran Bingham --- include/libcamera/buffer.h | 1 + src/libcamera/pipeline/ipu3/ipu3.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h index 302fe3d3e86b..6557fb1e59b5 100644 --- a/include/libcamera/buffer.h +++ b/include/libcamera/buffer.h @@ -49,6 +49,7 @@ public: Request *request() const { return request_; } void setRequest(Request *request) { request_ = request; } const FrameMetadata &metadata() const { return metadata_; } + void cancel() { metadata_.status = FrameMetadata::FrameCancelled; } unsigned int cookie() const { return cookie_; } void setCookie(unsigned int cookie) { cookie_ = cookie; } diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index fc40dcb381ea..44bd5a9d042b 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1256,8 +1256,11 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer) /* If the buffer is cancelled force a complete of the whole request. */ if (buffer->metadata().status == FrameMetadata::FrameCancelled) { - for (auto it : request->buffers()) - pipe_->completeBuffer(request, it.second); + for (auto it : request->buffers()) { + FrameBuffer *b = it.second; + b->cancel(); + pipe_->completeBuffer(request, b); + } frameInfos_.remove(info); pipe_->completeRequest(request);