Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6382292pxb; Tue, 15 Feb 2022 00:55:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUJ7xRZvz3o/djZX/0uhjaVtHgSObPg2u4ciG2QhqYYC4J7Dqb/OouPcP/mVkuoL8iUMRa X-Received: by 2002:a17:902:a9c2:: with SMTP id b2mr3001656plr.168.1644915317421; Tue, 15 Feb 2022 00:55:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644915317; cv=none; d=google.com; s=arc-20160816; b=Pd2jCKtvSFcoRAMehuLHa8a0sJu/k0+GllmOUUbeN6H0Izkh1jdsqpA94f2fnpYpFX 3cZuK2/fDyK1CgrWb8u9EfF8aCq5CAlHkRPxbh1ksnkL8XFHlzKXgTmn0gPp1SAfXTU8 dOK6Rgm+EprHOOCZ1Vy+0MA07u7ni8LmFjmFN/UoZyzDmYunx3mPTsD9pnQ6iGXvC52C 5O1cNu+hV9yYkiYK6zDphDpZ99ix3Xitel6Mhsvx8Gra4HVDY7pKxv2sOzl418l7laqG 8pwgws2n8avD3B3oRDms/2D8RgUA1Bw7w0OfNPb87tA0q3IsPUypF/IjiCFUaphwImcm ggrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature:dkim-signature; bh=CuEMJmA9h+m8AulyGOrOUYh21nJq6vCzLpq25JW9MGY=; b=CrUDR3KZ8sI0k1bQL37nrtTTfS7pwUtmSg70jV5S+aExHv2zDNKNHriZhnCJl5TkOW XfSSTmHGkH2HFSOZjNdZMLsXjbJkL13GRIfSh4i4SvaHZP3z+0TD4NNkNnNFsW/smg6J UlIgWDhOwgWMmyOVhJd8Yv3/9BLrNDbDwTfqwdyi3lbGbAu+mI4zJflWPN0OqJ8X2Typ VJZTVm8c00fnILwioVtqvqw/LNtT3Pzq6+/uxRkWMJwlONhhdj/66n6fQ7nbtsiR7EB3 b9Xn7rb3jmuBeuhEtpG3STCspUKIM8uGWqdP6BS7bJrthPY3Z3icnzdOb7unlufYlArw 5LmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=PggtTNd3; dkim=pass header.i=@tq-group.com header.s=key1 header.b=NnEhC4bC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s21si2001049pgs.540.2022.02.15.00.55.02; Tue, 15 Feb 2022 00:55:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=PggtTNd3; dkim=pass header.i=@tq-group.com header.s=key1 header.b=NnEhC4bC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234797AbiBOH3u (ORCPT + 99 others); Tue, 15 Feb 2022 02:29:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:36148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231206AbiBOH3t (ORCPT ); Tue, 15 Feb 2022 02:29:49 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0967106119; Mon, 14 Feb 2022 23:29:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1644910179; x=1676446179; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CuEMJmA9h+m8AulyGOrOUYh21nJq6vCzLpq25JW9MGY=; b=PggtTNd3ECDDLPLteUPIP21inIQjSUQqwxu1O9BVPX+ZBzfX1vkfiU90 91yf9rePwHw7WN5L6MeseB5HGMErDJmweBzKVZeBWJh5CSTzU4omuCDej vPhN63rrDS80fH9tbviJm3fsLGls3ze7No58HBYdy8fTQNHK2s0nED+Zr JZLgnTP5IJQZojRSNis6NOMoEg7c4c9s6POuCHxumrSHv8MTX0c5EFDeB /3nIjoeIvcEbkYCT82TWF0llevGQ+fH/YnXs23VE1jXwTA06JheEPpCgV UYjzTBbNg8ONTIwnbRHPgFXCKMrMrQLnOnL7A1reWbB80lSuoIoKHA2ZJ A==; X-IronPort-AV: E=Sophos;i="5.88,370,1635199200"; d="scan'208";a="22084228" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 15 Feb 2022 08:29:36 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Tue, 15 Feb 2022 08:29:37 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Tue, 15 Feb 2022 08:29:37 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1644910177; x=1676446177; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CuEMJmA9h+m8AulyGOrOUYh21nJq6vCzLpq25JW9MGY=; b=NnEhC4bCVVDumb+pGTmdZRYWByzP/B27Mu1AMUUYsTc/5crugdps+lPy 4050OLmwNyYApFAJE4+QBybBwy4kamAUAs0om8v2DOKbY9Ru5c0QN34Tq ej2laN9Dm6Eaf5vhvQMQPFFpcHnQ/7l6G/Ye5eznu899Sqi8MTgX3CEnp 4dJn8uMCZol6DA6VE+2qZHlyTw0Xegt2UUJHNEXpxY+lVXRDuK6VWq/gr bd3Gwef0iRmPBxO30AUwzr4//i1E4qB9SpBEBjuIg5bN838cdne5KCYvS GbK7p2c3Us2ADo+ynXsp7kQKEMQGy0yrUgWqG8chZe9+fv+ZnExrIxQkP A==; X-IronPort-AV: E=Sophos;i="5.88,370,1635199200"; d="scan'208";a="22084227" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 15 Feb 2022 08:29:36 +0100 Received: from steina-w.localnet (unknown [10.123.49.12]) (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 97C3B280065; Tue, 15 Feb 2022 08:29:36 +0100 (CET) From: Alexander Stein To: Jacopo Mondi Cc: Steve Longerbeam , Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rui Miguel Silva , Laurent Pinchart , Dorota Czaplejewicz , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: (EXT) Re: [PATCH v2 3/9] media: imx: Use dedicated format handler for i.MX7/8 Date: Tue, 15 Feb 2022 08:29:34 +0100 Message-ID: <2319937.ElGaqSPkdT@steina-w> Organization: TQ-Systems GmbH In-Reply-To: <20220214185115.y3rdxyvi7dmupeye@uno.localdomain> References: <20220211142752.779952-1-alexander.stein@ew.tq-group.com> <20220211142752.779952-4-alexander.stein@ew.tq-group.com> <20220214185115.y3rdxyvi7dmupeye@uno.localdomain> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jacopo, Am Montag, 14. Februar 2022, 19:51:15 CET schrieb Jacopo Mondi: > Hello > > On Fri, Feb 11, 2022 at 03:27:46PM +0100, Alexander Stein wrote: > > From: Dorota Czaplejewicz > > > > This splits out a format handler which takes into account > > the capabilities of the i.MX7/8 video device, > > as opposed to the default handler compatible with both i.MX5/6 and > > i.MX7/8. > > > > Signed-off-by: Dorota Czaplejewicz > > Signed-off-by: Alexander Stein > > --- > > Changes in v2: > > * Switch back to using enum > > * Get rid of an additional call to v4l2_fill_pixfmt() > > > > drivers/staging/media/imx/imx-media-utils.c | 60 +++++++++++++++++++-- > > 1 file changed, 56 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/staging/media/imx/imx-media-utils.c > > b/drivers/staging/media/imx/imx-media-utils.c index > > c42f3da8e3a8..02a4cb124d37 100644 > > --- a/drivers/staging/media/imx/imx-media-utils.c > > +++ b/drivers/staging/media/imx/imx-media-utils.c > > @@ -516,10 +516,9 @@ void imx_media_try_colorimetry(struct > > v4l2_mbus_framefmt *tryfmt,> > > } > > EXPORT_SYMBOL_GPL(imx_media_try_colorimetry); > > > > -int imx_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix, > > - const struct v4l2_mbus_framefmt *mbus, > > - const struct imx_media_pixfmt *cc, > > - enum imx_media_device_type type) > > +static int imx56_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix, > > + const struct v4l2_mbus_framefmt *mbus, > > + const struct imx_media_pixfmt *cc) > > > > { > > > > u32 width; > > u32 stride; > > > > @@ -568,6 +567,59 @@ int imx_media_mbus_fmt_to_pix_fmt(struct > > v4l2_pix_format *pix,> > > return 0; > > > > } > > > > + > > +static int imx78_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix, > > + const struct v4l2_mbus_framefmt *mbus, > > + const struct imx_media_pixfmt *cc) > > +{ > > + u32 aligned_width; > > + int ret; > > + > > + if (!cc) > > + cc = imx_media_find_mbus_format(mbus->code, PIXFMT_SEL_ANY); > > + > > + if (!cc) > > + return -EINVAL; > > + /* > > + * The hardware can handle line lengths divisible by 4 pixels > > + * as long as the whole buffer size ends up divisible by 8 bytes. > > + * If not, use the value of 8 pixels recommended in the datasheet. > > + * Only 8bits-per-pixel formats may need to get aligned to 8 pixels, > > + * because both 10-bit and 16-bit pixels occupy 2 bytes. > > + * In those, 4-pixel aligmnent is equal to 8-byte alignment. > > + */ > > + if (cc->bpp == 1) > > Am I mistaken or in the format enumeration bpp is expressed in bits > and not bytes ? No, you are completely right. Thanks for find noticing that. Regards, Alexander > > + aligned_width = round_up(mbus->width, 8); > > + else > > + aligned_width = round_up(mbus->width, 4); > > + > > + ret = v4l2_fill_pixfmt(pix, cc->fourcc, > > + aligned_width, mbus->height); > > + if (ret) > > + return ret; > > + > > + pix->colorspace = mbus->colorspace; > > + pix->xfer_func = mbus->xfer_func; > > + pix->ycbcr_enc = mbus->ycbcr_enc; > > + pix->quantization = mbus->quantization; > > + pix->field = mbus->field; > > + > > + return ret; > > +} > > + > > +int imx_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix, > > + const struct v4l2_mbus_framefmt *mbus, > > + const struct imx_media_pixfmt *cc, > > + enum imx_media_device_type type) > > +{ > > + switch (type) { > > + case DEVICE_TYPE_IMX56: > > + return imx56_media_mbus_fmt_to_pix_fmt(pix, mbus, cc); > > + case DEVICE_TYPE_IMX78: > > + return imx78_media_mbus_fmt_to_pix_fmt(pix, mbus, cc); > > + } > > + return -EINVAL; > > +} > > > > EXPORT_SYMBOL_GPL(imx_media_mbus_fmt_to_pix_fmt); > > > > void imx_media_free_dma_buf(struct device *dev, > > > > -- > > 2.25.1