From patchwork Thu Feb 4 16:29:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 11154 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 D4D33BD162 for ; Thu, 4 Feb 2021 16:30:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B5D6161442; Thu, 4 Feb 2021 17:30:08 +0100 (CET) Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 838C361437 for ; Thu, 4 Feb 2021 17:30:07 +0100 (CET) X-Halon-ID: 3d660bfa-6706-11eb-b73f-0050569116f7 Authorized-sender: niklas.soderlund@fsdn.se Received: from bismarck.berto.se (p4fca2458.dip0.t-ipconnect.de [79.202.36.88]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id 3d660bfa-6706-11eb-b73f-0050569116f7; Thu, 04 Feb 2021 17:30:06 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Thu, 4 Feb 2021 17:29:36 +0100 Message-Id: <20210204162943.268517-5-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210204162943.268517-1-niklas.soderlund@ragnatech.se> References: <20210204162943.268517-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 04/11] libcamera: ipu3: cio2: Return the FrameBuffer pointer used 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 adding IPA plumbing to the IPU3 pipeline handler it will be needed to track which raw buffer was queued to the CIO2 for a specific request. Currently if using an internally allocated raw buffer the FrameBuffer is not exposed outside the CIO2Device as it was not needed. Prepare for the IPA by exposing which internal raw buffer is picked for each request, later changes will associate this with a Request. Signed-off-by: Niklas Söderlund Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- * Changes since v1 - Update commit message. --- src/libcamera/pipeline/ipu3/cio2.cpp | 10 +++++++--- src/libcamera/pipeline/ipu3/cio2.h | 2 +- src/libcamera/pipeline/ipu3/ipu3.cpp | 8 ++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp index 72e88067f55f29c6..c7fabb98cd6b3438 100644 --- a/src/libcamera/pipeline/ipu3/cio2.cpp +++ b/src/libcamera/pipeline/ipu3/cio2.cpp @@ -253,7 +253,7 @@ int CIO2Device::stop() return ret; } -int CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer) +FrameBuffer *CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer) { FrameBuffer *buffer = rawBuffer; @@ -261,7 +261,7 @@ int CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer) if (!buffer) { if (availableBuffers_.empty()) { LOG(IPU3, Error) << "CIO2 buffer underrun"; - return -EINVAL; + return nullptr; } buffer = availableBuffers_.front(); @@ -270,7 +270,11 @@ int CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer) buffer->setRequest(request); - return output_->queueBuffer(buffer); + int ret = output_->queueBuffer(buffer); + if (ret) + return nullptr; + + return buffer; } void CIO2Device::tryReturnBuffer(FrameBuffer *buffer) diff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h index 236ad287354a0bf6..dca4d40e4c32e8b2 100644 --- a/src/libcamera/pipeline/ipu3/cio2.h +++ b/src/libcamera/pipeline/ipu3/cio2.h @@ -51,7 +51,7 @@ public: CameraSensor *sensor() { return sensor_.get(); } const CameraSensor *sensor() const { return sensor_.get(); } - int queueBuffer(Request *request, FrameBuffer *rawBuffer); + FrameBuffer *queueBuffer(Request *request, FrameBuffer *rawBuffer); void tryReturnBuffer(FrameBuffer *buffer); Signal &bufferReady() { return output_->bufferReady; } diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 23845ff3dee5f8b0..184986fc648b541a 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -646,10 +646,10 @@ int PipelineHandlerIPU3::queueRequestDevice(Camera *camera, Request *request) * Queue a buffer on the CIO2, using the raw stream buffer provided in * the request, if any, or a CIO2 internal buffer otherwise. */ - FrameBuffer *rawBuffer = request->findBuffer(&data->rawStream_); - error = data->cio2_.queueBuffer(request, rawBuffer); - if (error) - return error; + FrameBuffer *reqRawBuffer = request->findBuffer(&data->rawStream_); + FrameBuffer *rawBuffer = data->cio2_.queueBuffer(request, reqRawBuffer); + if (!rawBuffer) + return -ENOMEM; /* Queue all buffers from the request aimed for the ImgU. */ for (auto it : request->buffers()) {