From patchwork Sun Nov 15 21:16:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 10423 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 4A459BE082 for ; Sun, 15 Nov 2020 21:16:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A8E3463286; Sun, 15 Nov 2020 22:16:16 +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="kwtsS+H0"; 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 A121A6300C for ; Sun, 15 Nov 2020 22:16:15 +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 23A29AF7 for ; Sun, 15 Nov 2020 22:16:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1605474975; bh=oea5jpt1W8uq3rI/vy6Xs8aGrJiwYkTMF6IePYHjEKA=; h=From:To:Subject:Date:From; b=kwtsS+H0Q+ed4UTMgu9MxwwIw7hSaAnXQ5M0v84/CtMAmZ2lPmDPYRnKpQ1hcfUzv FRTyWIkCUGG5CkSETCWkSlcB/O8ioURDINzSMolrCHSoFCgsbfqWKfGzvb9LEekG73 JgJZq6Ycp8/EsiWkI+OCk0AMwmgEl6b0mZSwLBVg= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sun, 15 Nov 2020 23:16:07 +0200 Message-Id: <20201115211607.2625-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: pipeline: simple: Reset format on capture side of converter 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 configuring the converter, the format is first set on the output side based on the format of the camera pipeline output, and then the format is set on the capture side to match the desired stream configuration. The format parameter passed to V4L2VideoDevice::setFormat() uses the same variable for both calls, which has the unwanted side effect of carrying plane configuration from the output side to the capture side of the converter. In particular, the stride or plane size requested on the capture side can become unnecessarily large when converting to a format with a lower number of bits per pixel (for instance converting YUYV to NV12). Fix this by resetting the format variable before using it to configure the capture side. Signed-off-by: Laurent Pinchart Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/simple/converter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp index 57538ab08fcd..67e6e864aa0a 100644 --- a/src/libcamera/pipeline/simple/converter.cpp +++ b/src/libcamera/pipeline/simple/converter.cpp @@ -164,6 +164,7 @@ int SimpleConverter::configure(PixelFormat inputFormat, const Size &inputSize, /* Set the pixel format and size on the output. */ videoFormat = m2m_->capture()->toV4L2PixelFormat(cfg->pixelFormat); + format = {}; format.fourcc = videoFormat; format.size = cfg->size;