From patchwork Wed Apr 19 07:07:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 13216455 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82309C6FD18 for ; Wed, 19 Apr 2023 07:08:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RU/WhVKgpPPEQxr+2n7voDuPVg/Y05LWMscx3fc3aPA=; b=QPOKb2tMtK5gI0 kuN8uLt2IHf1/lgrKjzhh0MXxN798nGYvvkoxeZP2DUpQYyGrZ3ggQpu4dOazMGjEalMLE21yzCNJ AF0K73thFvlReSct8g9YDLYyxRS5SJ9WVdBjfY2g2UcUONqNcUT8N+bEFRP3w2pzW9Gt/DNu30Zlr KiLgMTYBkDiQg9DnJx5TNxp/xmcc/CYZ0nvats5CiyEnY8RQzkfYRymbR8G3MV1QJUWpQJbQGng7w OpZP0sHPKZ12HZ8wszrtiJW1+z2J/zMhuN1oh6qerX+Sl1ErggfZaDiDfO8eQ2ftbyV4cy4gc9AGi NYcWX3w6ZmzeXolzUlKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pp1ua-004MEr-2w; Wed, 19 Apr 2023 07:07:28 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pp1uT-004MA3-30 for linux-arm-kernel@lists.infradead.org; Wed, 19 Apr 2023 07:07:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1681888041; x=1713424041; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fL8PZNABlAgAhG80OdCGVSVIWgAQMIfpGqcXZCETe8g=; b=CCicoqP2nBb+MRgWljqggFd3CAtzkoPX4Nvk3FxKNjqjCAvYBt/TjGuO n0XwGsDcCZhCX+/3URUVWXmS+eZ/R2buMy/ZbvKYdTz3ZYxHBABItMYrQ i0J2gaAoWmk1Sq0/FyQMD8D8M1RHUW6YMLXgY1n34KdoZpGkCsFGXEPBs Odc4vNQiVfioCZBZaoltTSlFi9VVKAJw6cM04iV+gb9fy4d6qFsSIVlT1 6JuwF/YLo88G+pVXd7WtF097YpIFSCbVJT+Yy+T4rekWQDTTry+jGOnqu otTbH5eblUKB6Rraq/TZBWjXlTlhtOPcHHyCp4Izj5j7wbK1fRasPi1Cm A==; X-IronPort-AV: E=Sophos;i="5.99,208,1677538800"; d="scan'208";a="30415571" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 19 Apr 2023 09:07:16 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 19 Apr 2023 09:07:16 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 19 Apr 2023 09:07:16 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1681888036; x=1713424036; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fL8PZNABlAgAhG80OdCGVSVIWgAQMIfpGqcXZCETe8g=; b=RjVFZatqBRUG2zsfv+3bxBYq9etL3WfdqccFc+yovnuKT1kAwvZ6BX0G 8sPirsiY7WhR2hfeCYdAjpjzsMiQSwkptNhtVech8FdkoHejKuUBQej83 n5ZE9Qn+S3TX2qdbEMp9LcFCrcIduPr1w+usx40ljua6UwufwS8cLDnVw 4FuJGGbh+i4MqhqILKCKS6ZjZCGRnW8p+QNPmcqdOYNLgenlbtNYvrTrZ rF/DtPamfEPwKDSkuD69REOvCr8jbJMXs6+fwOBTLy+JffQcLAN+6YIax D9gknra4qr0Wdk0ONYJ0hz+ww2cygivXc7SgVasQQIG/lxKS7BC0mEwh5 Q==; X-IronPort-AV: E=Sophos;i="5.99,208,1677538800"; d="scan'208";a="30415570" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 19 Apr 2023 09:07:16 +0200 Received: from steina-w.tq-net.de (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 6183E280072; Wed, 19 Apr 2023 09:07:16 +0200 (CEST) From: Alexander Stein To: Rui Miguel Silva , Laurent Pinchart , Mauro Carvalho Chehab , Shawn Guo , Sascha Hauer , Fabio Estevam Cc: Alexander Stein , Pengutronix Kernel Team , NXP Linux Team , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 3/4] media: imx: imx7-media-csi: Relax width constraints for non-8bpp formats Date: Wed, 19 Apr 2023 09:07:11 +0200 Message-Id: <20230419070712.1422335-4-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230419070712.1422335-1-alexander.stein@ew.tq-group.com> References: <20230419070712.1422335-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230419_000722_268924_706D3E42 X-CRM114-Status: GOOD ( 14.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The driver unconditionally aligns the image width to multiples of 8 pixels. The real alignment constraint is 8 bytes, as indicated by the CSI_IMAG_PARA.IMAGE_WIDTH documentation that calls for 8 pixel alignment for 8bpp formats and 4 pixel alignment for other formats. Signed-off-by: Alexander Stein Reviewed-by: Laurent Pinchart --- Changes in v4: * Improve commit message * Simplify walign calculation * Remove comment on hardware alignment constraints drivers/media/platform/nxp/imx7-media-csi.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c index 1315f5743b76f..e6abbfbc5c129 100644 --- a/drivers/media/platform/nxp/imx7-media-csi.c +++ b/drivers/media/platform/nxp/imx7-media-csi.c @@ -1146,6 +1146,7 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt, struct v4l2_rect *compose) { const struct imx7_csi_pixfmt *cc; + u32 walign; if (compose) { compose->width = pixfmt->width; @@ -1163,12 +1164,13 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt, } /* - * Round up width for minimum burst size. + * The width alignment is 8 bytes as indicated by the + * CSI_IMAG_PARA.IMAGE_WIDTH documentation. Convert it to pixels. * - * TODO: Implement configurable stride support, and check what the real - * hardware alignment constraint on the width is. + * TODO: Implement configurable stride support. */ - v4l_bound_align_image(&pixfmt->width, 1, 0xffff, 8, + walign = 8 * 8 / cc->bpp; + v4l_bound_align_image(&pixfmt->width, 1, 0xffff, walign, &pixfmt->height, 1, 0xffff, 1, 0); pixfmt->bytesperline = pixfmt->width * cc->bpp / 8;