From patchwork Wed Feb 21 17:40:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 19527 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 DF3B8C3263 for ; Wed, 21 Feb 2024 17:40:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B4F4A6281F; Wed, 21 Feb 2024 18:40:34 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="G5DzlPop"; 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 0F2CC62805 for ; Wed, 21 Feb 2024 18:40:29 +0100 (CET) Received: from localhost.localdomain (unknown [IPv6:2001:b07:5d2e:52c9:cc1e:e404:491f:e6ea]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 03F119EC; Wed, 21 Feb 2024 18:40:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1708537221; bh=+XaQ5Ov4BVfEVahJ7Eafb+W0a15MLRT1NfZGI7e/+UU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G5DzlPopJGktXOMY0iAVbyEtOaU/qfPNX3gem/TSIw4OHVziWwPDVGdezrrJwzmVw 59V6VdpeHpgRETcaj6Bw8SyCMMwfts8UjXL/qvpQ4Up9eelW6HeOLVZbxFv4G1TyOe v+7relkLsn/xAgUPNa2WKE7hSUAeyHxorQCkoMVQ= From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Subject: [PATCH 5/5] libcamera: ipu3: Return Raw buffers on error Date: Wed, 21 Feb 2024 18:40:13 +0100 Message-ID: <20240221174015.52958-6-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240221174015.52958-1-jacopo.mondi@ideasonboard.com> References: <20240221174015.52958-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 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: , Cc: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" When a Request is cancelled, all its application-provided buffers are completed and the paramters and stats buffer are made available again to the pipeline handler. If the RAW buffer doesn't come from the application (no RAW stream requested) it comes from the CIO2Device internal pool. Return it to the CIO2 pool in case of error. Signed-off-by: Jacopo Mondi Reviewed-by: Daniel Scally --- src/libcamera/pipeline/ipu3/ipu3.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index f61e4a10892e..bcbcfd3dc290 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1393,6 +1393,9 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer) availableParamBuffers_.push(request->paramBuffer); availableStatBuffers_.push(request->statBuffer); + /* Return RAW buffer to the CIO2. */ + cio2_.tryReturnBuffer(buffer); + pipe()->completeRequest(request->_o()); return; }