From patchwork Thu Sep 21 16:55:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 19069 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 83AA4BE080 for ; Thu, 21 Sep 2023 16:56:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A3BD26294B; Thu, 21 Sep 2023 18:56:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1695315368; bh=okpaM9IVcdE0ATLSllywNITjoe6yEZ6SVs+WCpQmepE=; 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=JqlOPQJvIeVNHc42iP62eIi5Dq3u1HwrzgcJQB8ZZPl2HUWh1/PBzBqQta33hhZZu MiqAQcbAL0QoZePERR1i/nDvHk8psI+nrBl6sBO4qmfQNo5zfn9npV6XNuKLJ4vPye uLCY6AqRbwchSXDdja53VJeQwVVfJfFAUfk3bJHCFwGapYsxbxJmt2erIqzhHi7TFX qN3H9HabkliwRXfsdCk1i1KwgoQo8zSWjyS3avpvi5HUpQGFDEuu7sMO6+AGEDeo9w pPQkMygSrytY/4nQ9sdM7mXq9mBBbGtyniUzcy/ajmJ1/x4P/kxEJMtaNDjqqp/wuy Y9k0s/lLD+axw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C27FC62949 for ; Thu, 21 Sep 2023 18:56:03 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="uhBzdXUI"; dkim-atps=neutral Received: from uno.lan (93-46-82-201.ip106.fastwebnet.it [93.46.82.201]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 384FB1102; Thu, 21 Sep 2023 18:54:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1695315266; bh=okpaM9IVcdE0ATLSllywNITjoe6yEZ6SVs+WCpQmepE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uhBzdXUIEi0N7f3QWFfIHqy1AnRE0bolP3fv4f+vG5cCgplq0gyG5EQmYsplv0n6v uOcur21SXd1dQvOcA02NaIA0+KvKjsKs21LfH93O8Vq4oju0uz6yG3r6FgCge4TR9C IZwyvk4KlHdtqWLUrc8fM59rWyixpBntTI4Gx9k4= To: libcamera-devel@lists.libcamera.org Date: Thu, 21 Sep 2023 18:55:42 +0200 Message-ID: <20230921165550.50956-6-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230921165550.50956-1-jacopo.mondi@ideasonboard.com> References: <20230921165550.50956-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 05/13] 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 c02ceb65cae8..502cdff0051b 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp @@ -309,6 +309,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_;