From patchwork Fri Sep 24 10:06:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dorota Czaplejewicz X-Patchwork-Id: 12514925 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MIME_HEADER_CTYPE_ONLY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FEE5C4332F for ; Fri, 24 Sep 2021 10:07:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7B45B61164 for ; Fri, 24 Sep 2021 10:07:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245423AbhIXKIn (ORCPT ); Fri, 24 Sep 2021 06:08:43 -0400 Received: from comms.puri.sm ([159.203.221.185]:34686 "EHLO comms.puri.sm" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245565AbhIXKIm (ORCPT ); Fri, 24 Sep 2021 06:08:42 -0400 Received: from localhost (localhost [127.0.0.1]) by comms.puri.sm (Postfix) with ESMTP id A7B1DDF4E2; Fri, 24 Sep 2021 03:06:38 -0700 (PDT) Received: from comms.puri.sm ([127.0.0.1]) by localhost (comms.puri.sm [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id K32DZ-SiYatL; Fri, 24 Sep 2021 03:06:38 -0700 (PDT) Date: Fri, 24 Sep 2021 12:06:31 +0200 From: Dorota Czaplejewicz To: Steve Longerbeam , Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: kernel@puri.sm, phone-devel@vger.kernel.org Subject: [PATCH] media: imx: Fix rounding Message-ID: <20210924120631.7060da0f.dorota.czaplejewicz@puri.sm> Organization: Purism Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Change rounding to the minimal burst size from 2^n to n. This fixes images with sizes that are a multiple of 8 pixels. See section 13.7.6.13 CSI Image Parameter Register of the i.MX 8M Quad Applications Processors Reference Manual. Fixes: 451a7b7815d0b ("media: imx: lift CSI and PRP ENC/VF width alignment restriction") Signed-off-by: Dorota Czaplejewicz --- Hi, I tested this patch on the Librem 5 with the main camera. --Dorota drivers/staging/media/imx/imx-media-utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c index 5128915a5d6f..a2d8fab32a39 100644 --- a/drivers/staging/media/imx/imx-media-utils.c +++ b/drivers/staging/media/imx/imx-media-utils.c @@ -545,13 +545,13 @@ int imx_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix, } /* Round up width for minimum burst size */ - width = round_up(mbus->width, 8); + width = round_up(mbus->width, 3); /* Round up stride for IDMAC line start address alignment */ if (cc->planar) - stride = round_up(width, 16); + stride = round_up(width, 4); else - stride = round_up((width * cc->bpp) >> 3, 8); + stride = round_up((width * cc->bpp) >> 3, 3); pix->width = width; pix->height = mbus->height;