Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4152770yba; Wed, 17 Apr 2019 05:50:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4VI1vFSZ73skw7IlHmL+zcMxb1oAwUE+MGB9X/Dh8jpNSMI4aCTzrVHDTlarox1y7/eVE X-Received: by 2002:a62:6ec6:: with SMTP id j189mr7607961pfc.195.1555505404334; Wed, 17 Apr 2019 05:50:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555505404; cv=none; d=google.com; s=arc-20160816; b=gcWrsiDpfDaQg9xkit7tAMvH9k1qdVz+N+K9ui0S3ld+KP0plmU16xUrxkTHQwN9Lq dIRZTq2jiCM3lSSwcPAhWn2IHXrliQTQZfWKIlSX96N0SkDYTxMGOTe9lrqbklr8nIKj bVlYEMmeWpeFrF6drCfte0pOAitLXRzqRjUa6tOHQFIXokBcdwc6jLYQXczXRaShF6FA Bh0Jx2CjmZ5Xu+9c8ZI6NuH0CAYnZeKv1+kKLotWHoXbxPXsaTvNh/+RTWWlg/reETvG ud+dZ4MPx1Xo7yMzIsXwH9rqCnqcuCwMVlGYQ+3vxVDjBkOf5ZSLDigfC6au0+PI42iY dTvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=PAWYG9PDljQuoOnyvT7VDdd7iK42xJVwfYxv3ZYD1tg=; b=vaY39BQAQniBC0S9drUgQnI34eB6f+FMPyBIQe3Jsfg3bfdHh1SYgaaZuRW0pegFwT +/gNPHHc+NrlmAFsvkBwcYW5fM7MCmTmiAZ4O/Ghzh84AowiFbxsebzGQVFMcaBwd1cg hhuy4xctF0XVlPvyE69WcvWKPbUPLokiXJL3Uj+jWBeYirg4x5lYFaQMuHSG10tjbp8j J93Oh/X4FueZu/CCAudr7Q+SDR2l+x6EMWcNdKG8DYMxwR2MmCcGKNv9nP0akZU3wMxK q25Lgt8JVx7DeOJofNEst1RT95dhXzg14pjODBCiYAd/88JeZashdj6VPkmjfw93y0vv Ayow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k193si49889834pga.319.2019.04.17.05.49.48; Wed, 17 Apr 2019 05:50:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732143AbfDQMsj (ORCPT + 99 others); Wed, 17 Apr 2019 08:48:39 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:39705 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732110AbfDQMsi (ORCPT ); Wed, 17 Apr 2019 08:48:38 -0400 X-Originating-IP: 90.88.160.238 Received: from localhost (aaubervilliers-681-1-42-238.w90-88.abo.wanadoo.fr [90.88.160.238]) (Authenticated sender: maxime.ripard@bootlin.com) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 1F2FCE000D; Wed, 17 Apr 2019 12:48:33 +0000 (UTC) Date: Wed, 17 Apr 2019 14:48:33 +0200 From: Maxime Ripard To: Paul Kocialkowski Cc: Daniel Vetter , David Airlie , Maarten Lankhorst , Sean Paul , Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Laurent Pinchart , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: Re: [PATCH 06/20] lib: Add video format information library Message-ID: <20190417124833.psdri6laune5y2ti@flea> References: <7dbdcb1b54a442e2d77a34bd449b52bbaf903157.camel@bootlin.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nzk3qglhrunplm4n" Content-Disposition: inline In-Reply-To: <7dbdcb1b54a442e2d77a34bd449b52bbaf903157.camel@bootlin.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --nzk3qglhrunplm4n Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, On Wed, Apr 17, 2019 at 02:34:54PM +0200, Paul Kocialkowski wrote: > > +struct image_format_info { > > + union { > > + /** > > + * @drm_fmt: > > + * > > + * DRM 4CC format identifier (DRM_FORMAT_*) > > + */ > > + u32 drm_fmt; > > Could we call this one format_drm for consistency with the one below? The deprecated "format" field will go away at some point, so I'm not sure the consistency is an argument there. > > +/** > > + * image_format_info_min_pitch - computes the minimum required pitch in bytes > > + * @info: pixel format info > > + * @plane: plane index > > + * @buffer_width: buffer width in pixels > > + * > > + * Returns: > > + * The minimum required pitch in bytes for a buffer by taking into consideration > > + * the pixel format information and the buffer width. > > + */ > > +static inline > > +uint64_t image_format_info_min_pitch(const struct image_format_info *info, > > + int plane, unsigned int buffer_width) > > +{ > > + if (!info || plane < 0 || plane >= info->num_planes) > > + return 0; > > + > > + return DIV_ROUND_UP_ULL((u64)buffer_width * info->char_per_block[plane], > > + image_format_info_block_width(info, plane) * > > + image_format_info_block_height(info, plane)); > > I'm not sure I understand how this works: char_per_block is 0 for > almost all formats and this doesn't take in account the cpp. Am I > missing something here? I guess it doesn't. That's the DRM function here, without any modification, but from a quick look at the current users of that function, there's nobody that uses the value directly. So you might be right there. > Also, this might be a good occasion to discuss what meaning we want to > give "stride" and "pitch": should one be in bytes and the other in bit, > etc? I keep forgetting what each API expects. pitch is documented as bytes, and the function computing the stride I added did too. I'll remove the stride one. Maxime -- Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --nzk3qglhrunplm4n Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCXLcgoQAKCRDj7w1vZxhR xet/AQCSCvVjvVy0KOdrvdGBPOkE3GNfPVLFhSS22wzFu2LrDgD7BgEuGXnlEy5A TU2rY1ykkmylePOcPVt6+uy73y542Qg= =DUXa -----END PGP SIGNATURE----- --nzk3qglhrunplm4n--