From patchwork Sun Jan 31 22:46:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 11084 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 0F381BD808 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 B09E268401; Sun, 31 Jan 2021 23:47:36 +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="i2MHfw5g"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 950DB683D9 for ; Sun, 31 Jan 2021 23:47:29 +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 1D7D88F1; 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=H1qIVCyOhiIrEzzsoNBN34FbiBDaspLhH6VLpFXQn9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i2MHfw5gUx9ax9q/Lf1eJrZq4Wlhr7zuid4kg2R9Ovj03oINy5Q1zEXOamYMJ3d32 ElIdly5Ss3WKGA7e8mdWCWDfOasAvHEq2fDTSblcuf11n6AZw1enUTORTstxhiTvwm tydHXeiqIzLxLYDnG76lzzN0rMv1183VXx0i6ZhI= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 1 Feb 2021 00:46:47 +0200 Message-Id: <20210131224702.8838-6-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 05/20] libcamera: pipeline: simple: converter: Configure input stride 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" Use the stride of the video capture device to configure the converter input. This ensures that no stride mismatch occurs inadvertently along the pipeline. Signed-off-by: Laurent Pinchart Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/simple/converter.cpp | 5 ++++- src/libcamera/pipeline/simple/simple.cpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp index 6f4e41db2e00..550b2bcfb001 100644 --- a/src/libcamera/pipeline/simple/converter.cpp +++ b/src/libcamera/pipeline/simple/converter.cpp @@ -159,6 +159,8 @@ int SimpleConverter::configure(const StreamConfiguration &inputCfg, V4L2DeviceFormat format; format.fourcc = videoFormat; format.size = inputCfg.size; + format.planesCount = 1; + format.planes[0].bpl = inputCfg.stride; ret = m2m_->output()->setFormat(&format); if (ret < 0) { @@ -167,7 +169,8 @@ int SimpleConverter::configure(const StreamConfiguration &inputCfg, return ret; } - if (format.fourcc != videoFormat || format.size != inputCfg.size) { + if (format.fourcc != videoFormat || format.size != inputCfg.size || + format.planes[0].bpl != inputCfg.stride) { LOG(SimplePipeline, Error) << "Input format not supported"; return -EINVAL; diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 0a53fa934261..1ed67bcec490 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -606,6 +606,7 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) StreamConfiguration inputCfg; inputCfg.pixelFormat = pipeConfig.pixelFormat; inputCfg.size = pipeConfig.captureSize; + inputCfg.stride = captureFormat.planes[0].bpl; ret = converter_->configure(inputCfg, cfg); if (ret < 0) {