From patchwork Fri Sep 15 13:06:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 19024 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 821E1BD160 for ; Fri, 15 Sep 2023 13:07:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 874046292A; Fri, 15 Sep 2023 15:07:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1694783235; bh=RZhYEj/pzFsYZ1EdPil8Y7m2aIi45fZLApt+gcqLs9I=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=e5y5WoNcf+ZD1PqG3zRnIiGeEwisE3QqJDbxGvra9l4KV9XQLNChB95n+gIfx8DU4 5P66tC/+BKtvhVHVXXZ7lG7MVPaQsYw0Jhj1GHvznFxbPmxd+fcgI2lAdCu6SgIm07 8dTg4pNtLTaNFOvimJv5KYHMykO//JsRGiBrMMJSZLPJykAdUElAZe4fjhL/TxZti6 hW7XKGhsr5BrPKAuLe8+dOUhw66Gx4s6h5oywDQanxcE6bDIYTtdvcmqw/cCH12rOs PNk3BKu7YBZlRh5bk4ADq7XsvVZ9kJRTBSyAtBIXPwar+8einU7yYpZ+/9EvC6tUG+ g0LVpXm3cVXvw== 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 360B062918 for ; Fri, 15 Sep 2023 15:07:10 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="KciLzndu"; dkim-atps=neutral Received: from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BCD3C9A8; Fri, 15 Sep 2023 15:05:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1694783137; bh=RZhYEj/pzFsYZ1EdPil8Y7m2aIi45fZLApt+gcqLs9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KciLzndu+TN4h/c2nUjv5JfkXjqM2HQ0XN+1FKmpuU907T6E9VoHLunG30EU/0pC2 nm4qTFnLw0D6nRNl9ms2m+mIrixKntmPim50bqZlRyGp88f1UMyG6k5LnL0oubzwnl 5l7XRXVhcDqMP5FJEWslJppX1DlP1wTvj9yIsn60= To: libcamera-devel@lists.libcamera.org Date: Fri, 15 Sep 2023 15:06:43 +0200 Message-ID: <20230915130650.35691-6-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230915130650.35691-1-jacopo.mondi@ideasonboard.com> References: <20230915130650.35691-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 05/12] libcamera: rpi: Allow platformValidate() to adjust format strides 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: , X-Patchwork-Original-From: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Cc: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Naushir Patuck Propagate any changes to the format stride done by platformValidate(). The stride value may be adjusted for performace reasons. Signed-off-by: Naushir Patuck Reviewed-by: Jacopo Mondi Signed-off-by: Jacopo Mondi --- src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp index dff4164a5f02..2d787f4b99ed 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp @@ -305,6 +305,17 @@ CameraConfiguration::Status RPiCameraConfiguration::validate() V4L2DeviceFormat format; format.fourcc = out.dev->toV4L2PixelFormat(cfg.pixelFormat); format.size = cfg.size; + + /* + * platformValidate may have worked out the correct stride so we + * must pass it in. This also needs the planesCount to be set + * correctly or the stride will be ignored. + */ + const PixelFormat &pixFormat = format.fourcc.toPixelFormat(); + const PixelFormatInfo &info = PixelFormatInfo::info(pixFormat); + format.planesCount = info.numPlanes(); + format.planes[0].bpl = cfg.stride; + /* We want to send the associated YCbCr info through to the driver. */ format.colorSpace = yuvColorSpace_;