Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4217835yba; Wed, 17 Apr 2019 07:06:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVRhEMQFy16k21LX32sX1LqJZRlEEe0WNbKFPFUP3aS+pZkEqXUPAqI5fNK08fLo2Hjgns X-Received: by 2002:a62:1318:: with SMTP id b24mr88605246pfj.201.1555509993981; Wed, 17 Apr 2019 07:06:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555509993; cv=none; d=google.com; s=arc-20160816; b=hyXCMr3DzFoLWIT3/APovloXhTxjaVq6RiobQGLwgeHYedQP3HxU1lL5WyPbBko+qb CSvORYEx1Hx6JWRRTspcmhnRRnwnltygQhdA/UAO5DdhvRNrVqTKhyLtf7ijhahx817j PkPB+khYnjpD+zZP23LFx953jHM0xeFUyi501KEVACEXdw1FVfXCeLkF1JqBAllfY4G2 aCHYUwyxLvz8Ju1z2Yekx1CsduySZZGDmuz5QRvnZSaITy4YNobgY+JONY6xpw+7lMCQ ClaqMwgao8Yl7tqm6hEptHOrC1a+bqlZx95aEi0vUHDmO+67LIJMy3iet2x2WM/mPJK2 xgXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id; bh=9e3ElMAmVVtBzvp5mEf/R2NUOGWxTE1FhE3FhrHxOGc=; b=BJC8MVylXbiZrtjnGIEmGbLe2BoWekiasaowoXOQGHGX1SmOIOOQVUBQRM49iZF6Dh 0xCc14EoyOhemupcrUdjanotwTgF5DVcnKRyo8uHPAotG9xn55NyP2yDRlpENk5kG1RG Ex3CQcRcv6NQqAIgN0hIxyIgFfkpHAYNOLFwtKqD17rlf7EG/+tb0phizEa8F4GAnHse HUlJVrSE8KRIfQ6U0DX6i4OSRPCm1zYk1ERad6usyYoePKhCJXK6N5893wMAaDkjvedr VXc4gRvkDgiREO9Z1GlANoVLxZGa+tS6jrneWzTr/sfcDPrgi4Ar3YdHn4SE7zNeBsJy zSpA== 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 y17si50265766plr.204.2019.04.17.07.06.18; Wed, 17 Apr 2019 07:06:33 -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 S1732404AbfDQODO (ORCPT + 99 others); Wed, 17 Apr 2019 10:03:14 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:51849 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731743AbfDQODN (ORCPT ); Wed, 17 Apr 2019 10:03:13 -0400 X-Originating-IP: 90.88.160.238 Received: from aptenodytes (aaubervilliers-681-1-42-238.w90-88.abo.wanadoo.fr [90.88.160.238]) (Authenticated sender: paul.kocialkowski@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id BCEC5FF814; Wed, 17 Apr 2019 14:03:08 +0000 (UTC) Message-ID: <6b4d5c3bd1a6f58ce21bc79518e72ec00a1eed97.camel@bootlin.com> Subject: Re: [PATCH 06/20] lib: Add video format information library From: Paul Kocialkowski To: Maxime Ripard 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 Date: Wed, 17 Apr 2019 16:03:08 +0200 In-Reply-To: <20190417124833.psdri6laune5y2ti@flea> References: <7dbdcb1b54a442e2d77a34bd449b52bbaf903157.camel@bootlin.com> <20190417124833.psdri6laune5y2ti@flea> Organization: Bootlin Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Wed, 2019-04-17 at 14:48 +0200, Maxime Ripard wrote: > 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. Fair enough then. My point was mostly about format vs fmt, so one option could be to use "compat_fmt" or such, but do whatever you feel is right, I don't care too much about it. > > > +/** > > > + * 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. Okay, it seems that I was just confused for no particular reason and stride, pitch, bytesperline and linesize are all just synonyms. So feel free to pick whichever you see fit :) Cheers, Paul -- Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com