Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4076490yba; Wed, 17 Apr 2019 04:11:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXNYMOmZVfZPDIO5zv9mnNQm4VPteyEb7WTDI+nkiWHFQ3EZ4l4dA+6/p250Mqv75f3sH4 X-Received: by 2002:aa7:83d1:: with SMTP id j17mr89940773pfn.78.1555499508536; Wed, 17 Apr 2019 04:11:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555499508; cv=none; d=google.com; s=arc-20160816; b=zmAIDQuq1WGA4go9mtWhEgHbu0QsO+uT7WDSrwWafX+8ETytnTYaN378vQCNgiu1V6 S+L7yZUD1PZL0fSIbAA4ijUQLM+qwSvCR8af3gYnid/v90SFZX+h0ixtp/RjC0IAO/6j HSEtJxQP9VgIoYRdAs/1uNlLrYyWP8oqqUnr3mahg1xrc/J/+5/EOX2dbdC6yPXFVYfQ 7CFchjZa2Haf41KJbNp9nl6qpM+Cpo5DeBe/ts2EvIVWzxryPYOKOsmlTZYzLXgkq+ID miWT3Q0k1476QQ5Qw5QDTlYrUApLDqjfZ0fQGiQg/NAmtEfRfy5CKVvJ95Lcra+Hj978 ltLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=lFzG+NMxiL8PjKifhyb4AKL8+13mfACp9qPM/1Fniqw=; b=lRWArbB8SulTpcN6dVrID8f7OIx3TJuDjIH1ThHI11KefWwC6qs05IUUIJ2RKZi+21 SgEejMu0/xT0GTUCM9k7MQ6w0RntSKrh7jmdjL6CzV9CTMWoYwwGxvnw8t8oKvZ9rcn0 nRRqH8W+8eOPzfKs6klqIPlQ/DV0e3ZmD2m+1W4NSaNf45v42lnf2l86zzAGvmQ0GTM1 H78tOUNuxTnEWAEorWfMsTbaGfcQRfuZjOjwMKD+MPV5cDNuMX5hAsZ9hcjg7wQ5krtH hB9gGlng9wNukgdTJx5dpE9h6xFX2IfQebCif+36X9CI+L9mvzLsnuCTRh+lXVLrKqg0 d+Kw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c20si50165680pls.53.2019.04.17.04.11.33; Wed, 17 Apr 2019 04:11:48 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731843AbfDQLKk (ORCPT + 99 others); Wed, 17 Apr 2019 07:10:40 -0400 Received: from mga17.intel.com ([192.55.52.151]:10951 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726695AbfDQLKk (ORCPT ); Wed, 17 Apr 2019 07:10:40 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Apr 2019 04:10:39 -0700 X-IronPort-AV: E=Sophos;i="5.60,361,1549958400"; d="scan'208";a="135085063" Received: from rauchh-mobl.ger.corp.intel.com (HELO [10.249.32.153]) ([10.249.32.153]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/AES128-SHA; 17 Apr 2019 04:10:35 -0700 Subject: Re: [PATCH 04/20] drm/fourcc: Pass the format_info pointer to drm_format_plane_width/height To: Maxime Ripard 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 References: <194fd02a37172de6f2a799fee5c98ced5e7e9d76.1555487650.git-series.maxime.ripard@bootlin.com> <776131c6-b8be-4302-ea9a-f7d84203f28c@linux.intel.com> <20190417110119.ygp6h7kpzzo5a27l@flea> From: Maarten Lankhorst Message-ID: <8d909dcf-16de-7462-1cc6-2713778ed8b1@linux.intel.com> Date: Wed, 17 Apr 2019 13:10:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190417110119.ygp6h7kpzzo5a27l@flea> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Op 17-04-2019 om 13:01 schreef Maxime Ripard: > 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? The info == NULL check. :)