From patchwork Sun Jan 31 22:46:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 11085 X-Patchwork-Delegate: laurent.pinchart@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 C8D63BD808 for ; Sun, 31 Jan 2021 22:47:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 89D80683F0; Sun, 31 Jan 2021 23:47:37 +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="rKsc6uU4"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 08890683E3 for ; Sun, 31 Jan 2021 23:47:30 +0100 (CET) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 87D53144C; Sun, 31 Jan 2021 23:47:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1612133249; bh=DzYvlXA+EbM9lCOtKu+NO+jfA8Dcz6NpNaNgMQh4Nlo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rKsc6uU4hwWRefUMHVG6cSl90EOhN1ehut/lo0Yh5c8ui8Bzy0Iy2qmFPlEJuFnVf q7VTegezOuCzmwh6qTHb3r8pD+BEqiwcV730SopDslmWwGuLFKdAgdasknVJkCa3wM 9/xIvo+QvG3KEie/xf9LOxt7Qm5Hv5h1sDUVk/BU= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 1 Feb 2021 00:46:48 +0200 Message-Id: <20210131224702.8838-7-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210131224702.8838-1-laurent.pinchart@ideasonboard.com> References: <20210131224702.8838-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 06/20] libcamera: pipeline: simple: converter: Differentiate input and output buffers count 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: Phi-Bang Nguyen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The number of buffers on the input and output of the converter don't necessarily need to match. Use the buffer count from the input and output configuration respectively. This removes the need to pass the buffer count to the start() function, which brings it closer to the pipeline handler API. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Paul Elder --- src/libcamera/pipeline/simple/converter.cpp | 9 ++++++--- src/libcamera/pipeline/simple/converter.h | 5 ++++- src/libcamera/pipeline/simple/simple.cpp | 3 ++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp index 550b2bcfb001..6b3249ea92b0 100644 --- a/src/libcamera/pipeline/simple/converter.cpp +++ b/src/libcamera/pipeline/simple/converter.cpp @@ -195,6 +195,9 @@ int SimpleConverter::configure(const StreamConfiguration &inputCfg, return -EINVAL; } + inputBufferCount_ = inputCfg.bufferCount; + outputBufferCount_ = outputCfg.bufferCount; + return 0; } @@ -204,13 +207,13 @@ int SimpleConverter::exportBuffers(unsigned int count, return m2m_->capture()->exportBuffers(count, buffers); } -int SimpleConverter::start(unsigned int count) +int SimpleConverter::start() { - int ret = m2m_->output()->importBuffers(count); + int ret = m2m_->output()->importBuffers(inputBufferCount_); if (ret < 0) return ret; - ret = m2m_->capture()->importBuffers(count); + ret = m2m_->capture()->importBuffers(outputBufferCount_); if (ret < 0) { stop(); return ret; diff --git a/src/libcamera/pipeline/simple/converter.h b/src/libcamera/pipeline/simple/converter.h index 47a056e582d6..a1503a6099ff 100644 --- a/src/libcamera/pipeline/simple/converter.h +++ b/src/libcamera/pipeline/simple/converter.h @@ -43,7 +43,7 @@ public: int exportBuffers(unsigned int count, std::vector> *buffers); - int start(unsigned int count); + int start(); void stop(); int queueBuffers(FrameBuffer *input, FrameBuffer *output); @@ -58,6 +58,9 @@ private: std::queue captureDoneQueue_; std::queue outputDoneQueue_; + + unsigned int inputBufferCount_; + unsigned int outputBufferCount_; }; } /* namespace libcamera */ diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 1ed67bcec490..8c0bca36bbfb 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -607,6 +607,7 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) inputCfg.pixelFormat = pipeConfig.pixelFormat; inputCfg.size = pipeConfig.captureSize; inputCfg.stride = captureFormat.planes[0].bpl; + inputCfg.bufferCount = cfg.bufferCount; ret = converter_->configure(inputCfg, cfg); if (ret < 0) { @@ -660,7 +661,7 @@ int SimplePipelineHandler::start(Camera *camera, [[maybe_unused]] ControlList *c } if (useConverter_) { - ret = converter_->start(count); + ret = converter_->start(); if (ret < 0) { stop(camera); return ret;