Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4192618yba; Wed, 17 Apr 2019 06:35:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxkravhG3EB9ZsLCCKx4qGdixv+euVWAJhw/9KtD9KMw7Nq8CoueQMNkSzlLO3mr2T8Inif X-Received: by 2002:a63:f218:: with SMTP id v24mr84402289pgh.326.1555508120936; Wed, 17 Apr 2019 06:35:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555508120; cv=none; d=google.com; s=arc-20160816; b=GX2bfDabZLUVXMEg9obyFo6iuRGG+v6DITi+SYA8uRDCf7K/k8LhHlBiamGimNikZe lXvA6ikABwa7pCYQnkws+PoxFdz7vL4WqMXkyJ/lNk+nMTl1maGsEdrbAJi4T5nBUZtR lVMQg2z6jiydacAE9xN1VaeP/WiVmlHFIA0xfUOxH7+WmJ+38B/T3ztozK1QEFhaEtQf g7qb1GfXN666I9hNC+TUi8tayuhV71QMrfpz24ZkJ50lmMQkIDIUOFVIGJC2qeiqSbuL v98zrb3I03xm/n8p2pwNU5EF1+ltRG9lapNhf/wnM9/bImdcqcCeHwSMdBDXvPhcDKG2 /y4A== 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 :references:in-reply-to:date:cc:to:from:subject:message-id; bh=92VnekdmgfXVnUeHEr2/Peg1KdMpA0XVRjXQzmP+0O0=; b=H/KKqB5LHe0W3DeQ/jjbMPp/f7dYNqlQRbBeOyOkhpD8D2yKT3V1VxZKd6CWaROE3w ZrhTTlraYQu0hMTfJVp9enChdAolykD6vVbvWtLerMmo4SK2VvYKrKCj8/RH2Ct141tz bLnQ8sFYNYN+R22mwI2W0KhJD6rr1l8pb8q68OaB/BASjfa39oKXL1n9wzejiQfYepF+ NYIeHV7yRi9/IIb1K3FDEuIAE6cHndYuiuYRCOog05S35ZvxqpKPzyEbCG0BS7BamFkE T46yTn+qgthwahAuug4ayMsCl5U1k27yFjAtsWbPQXTkhZjjfk9Z0SCrcy0IHIq0ggWj O7SQ== 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 e5si31935812plb.249.2019.04.17.06.35.05; Wed, 17 Apr 2019 06:35:20 -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 S1732290AbfDQNce (ORCPT + 99 others); Wed, 17 Apr 2019 09:32:34 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:57425 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729356AbfDQNce (ORCPT ); Wed, 17 Apr 2019 09:32:34 -0400 Received: from lupine.hi.pengutronix.de ([2001:67c:670:100:3ad5:47ff:feaf:1a17] helo=lupine) by metis.ext.pengutronix.de with esmtp (Exim 4.89) (envelope-from ) id 1hGkfm-0003SU-5Y; Wed, 17 Apr 2019 15:32:22 +0200 Message-ID: <1555507937.6446.10.camel@pengutronix.de> Subject: Re: [PATCH 02/20] drm: Remove users of drm_format_(horz|vert)_chroma_subsampling From: Philipp Zabel To: Maxime Ripard , Daniel Vetter , David Airlie , Maarten Lankhorst , Sean Paul , Mauro Carvalho Chehab Cc: 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 Date: Wed, 17 Apr 2019 15:32:17 +0200 In-Reply-To: <749889cdf957406c86c1791c5bc2a00c3cb1be53.1555487650.git-series.maxime.ripard@bootlin.com> References: <749889cdf957406c86c1791c5bc2a00c3cb1be53.1555487650.git-series.maxime.ripard@bootlin.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1+deb9u1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:3ad5:47ff:feaf:1a17 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2019-04-17 at 09:54 +0200, Maxime Ripard wrote: > drm_format_horz_chroma_subsampling and drm_format_vert_chroma_subsampling > are basically a lookup in the drm_format_info table plus an access to the > hsub and vsub fields of the appropriate entry. > > Most drivers are using this function while having access to the entry > already, which means that we will perform an unnecessary lookup. Removing > the call to these functions is therefore more efficient. > > Some drivers will not have access to that entry in the function, but in > this case the overhead is minimal (we just have to call drm_format_info() > to perform the lookup) and we can even avoid multiple, inefficient lookups > in some places that need multiple fields from the drm_format_info > structure. > > This is amplified by the fact that most of the time the callers will have > to retrieve both the vsub and hsub fields, meaning that they would perform > twice the lookup. > > Reviewed-by: Emil Velikov > Reviewed-by: Paul Kocialkowski > Signed-off-by: Maxime Ripard Reviewed-by: Philipp Zabel Just one small suggestion: [...] > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > index 20a9c296d027..345d5cb5e956 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > @@ -317,21 +317,18 @@ static void scl_vop_cal_scl_fac(struct vop *vop, const struct vop_win_data *win, > uint32_t src_w, uint32_t src_h, uint32_t dst_w, > uint32_t dst_h, uint32_t pixel_format) > { > + const struct drm_format_info *info = drm_format_info(pixel_format); The only call site in vop_plane_atomic_update passes fb->format->format as pixel_format parameter, so this could be simplified even further by replacing the uint32_t pixelformat argument with a const struct drm_format_info *info, and passing fb->format directly instead. regards Philipp