Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4070296yba; Wed, 17 Apr 2019 04:04:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqznz3Wc9eRz2uBk10ppaBeR/YBghpygq6FNUj6XIlYgMxyHD6t6L7KxybX6RHH1Xv1RrD0y X-Received: by 2002:a17:902:bb84:: with SMTP id m4mr48711509pls.302.1555499059763; Wed, 17 Apr 2019 04:04:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555499059; cv=none; d=google.com; s=arc-20160816; b=mHc3ptZNuukYTGmFWTaWpm3U1jECerKN6H7HQsC8HLVy5JNJ6z3w+eCFoEaVFzmSs4 0wkG7TNh/cPOgzwh/9wDIOHJsms13tDt5XHDpK1wLyJbyuOvqZPObffB9UmU/QnK43T/ qRP+8xLudfExMN8A2qQKLSyjvbJ01k+xaLvr1UgeEOr61DRbjUijo0k/uqhx1PK1oziP ghhwROc1SYDpErZbjQufAxFyE4+GoHIWHpn8rW2aVH9ha2ELFuZQ3WXW0fY6Wt6YigWV QN19VBE1h8m46l0q6dE9FQPUFgUZyVjYzpVDx/XrAfUDUiUPwQgYtvE9pnEQVsSH0Gfz fyJg== 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=uCziweOidMa5U3Q1bDY7Ca7sBvhbSqLxOwZ/6T/eOZY=; b=VLjBjakVwuOrH4ab8+264lFwj/GBlzOvyi7bcorUJeeQgU8meTsb4vktMBsMeRzGcO NIGn3zakxTPPVCfajUIin0jHbs3jmUTzZjmUPYCt8a3sD3J0+IJoUcTperNIVzyj+4GZ oOLdQxaysWITtQa+5oTSuEQtIFUrtkPZBIRHfzpU1b96qr1BwAXRysF5KODplNCGacyg J9a+a4w2LQ8fHVBqk5As+DJAPOl3+8/xDv+7Qp+wBWs016A7ed0rMDKhkHQWbyyxbuEy jKz0eE6IHKoyiAWHfkkAQaoUpxRbD7JZnajH4Gy//muNRce9iQ9qx5bQaGNs0ixtY5PB d65g== 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 p1si34475797plo.212.2019.04.17.04.04.04; Wed, 17 Apr 2019 04:04:19 -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 S1731906AbfDQLBY (ORCPT + 99 others); Wed, 17 Apr 2019 07:01:24 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:55319 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726695AbfDQLBY (ORCPT ); Wed, 17 Apr 2019 07:01:24 -0400 Received: from localhost (aaubervilliers-681-1-42-238.w90-88.abo.wanadoo.fr [90.88.160.238]) (Authenticated sender: maxime.ripard@bootlin.com) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 38D5A200003; Wed, 17 Apr 2019 11:01:19 +0000 (UTC) Date: Wed, 17 Apr 2019 13:01:19 +0200 From: Maxime Ripard To: Maarten Lankhorst Cc: Daniel Vetter , David Airlie , Sean Paul , Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Laurent Pinchart , Thomas Petazzoni , Paul Kocialkowski , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Emil Velikov Subject: Re: [PATCH 04/20] drm/fourcc: Pass the format_info pointer to drm_format_plane_width/height Message-ID: <20190417110119.ygp6h7kpzzo5a27l@flea> References: <194fd02a37172de6f2a799fee5c98ced5e7e9d76.1555487650.git-series.maxime.ripard@bootlin.com> <776131c6-b8be-4302-ea9a-f7d84203f28c@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dcwfro6eoycpkuuy" Content-Disposition: inline In-Reply-To: <776131c6-b8be-4302-ea9a-f7d84203f28c@linux.intel.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --dcwfro6eoycpkuuy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Apr 17, 2019 at 12:47:48PM +0200, Maarten Lankhorst wrote: > > +/** > > + * drm_format_info_plane_width - width of the plane given the first plane > > + * @format: pixel format info > > + * @width: width of the first plane > > + * @plane: plane index > > + * > > + * Returns: > > + * The width of @plane, given that the width of the first plane is @width. > > + */ > > +static inline > > +int drm_format_info_plane_width(const struct drm_format_info *info, int width, > > + int plane) > > +{ > > + if (!info || plane >= info->num_planes) > > + return 0; > > + > > + if (plane == 0) > > + return width; > > + > > + return width / info->hsub; > > +} > > + > > +/** > > + * drm_format_info_plane_height - height of the plane given the first plane > > + * @format: pixel format info > > + * @height: height of the first plane > > + * @plane: plane index > > + * > > + * Returns: > > + * The height of @plane, given that the height of the first plane is @height. > > + */ > > +static inline > > +int drm_format_info_plane_height(const struct drm_format_info *info, int height, > > + int plane) > > +{ > > + if (!info || plane >= info->num_planes) > > + return 0; > > + > > + if (plane == 0) > > + return height; > > + > > + return height / info->vsub; > > +} > > Why the null checks? None of the other inlines for drm_format_info > perform them. Unless I'm mistaken, the subsampling only applies to the planes with the chrominance, which are always >= 1. Therefore the plane 0 is always the luminance, to which the subsampling doesn't apply. Or are you talking about something else? Maxime -- Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --dcwfro6eoycpkuuy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCXLcHfwAKCRDj7w1vZxhR xSpmAPwKXGZNhBp2kZZZWrU1vBO0LBQUPntCvgviU70XWrnWGwEA6PwNOBbw5jIs rDUiFVXJb415RVz6MZcP8QAJlhQleAY= =4vey -----END PGP SIGNATURE----- --dcwfro6eoycpkuuy--