Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1121129yba; Tue, 2 Apr 2019 02:45:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZV0LMQ1tPzNBlcpoyNHR3AA24PAH+fz1PdGD6Xit8C2EQoxQTtvXMJ4KN7fVIbScRJI/g X-Received: by 2002:a65:6283:: with SMTP id f3mr66825695pgv.108.1554198311964; Tue, 02 Apr 2019 02:45:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554198311; cv=none; d=google.com; s=arc-20160816; b=MsNxPI+mKvlHQFDaINBXY7gQKSSS96GY/kRh42q+TIR3RVZzM2UFPQ21heCrY+5mIZ x9fEJIsDEjZjNn3aUAl8NHQAQ+02CV2wStk4W3y1+OInnzxdoEra+/wTN59tf7Ww5uXu 5fPALwWQ8xmGQ5lzwfz1Q06QdHV6tE61TEgKoju4wSOSPngX8nXpUC5GmlTs6KUeYNBM DjvKdbcFFWYGkugvwn9Spsf/WhPEM/I66rMa4Hn+Ax3X/evBiShZ/McjKBP2a7Hm9/wo AuKMNVe/f2tKs5i1ezCdacJJuj/KTHr9cdNha1T1Dw1WFFHiiBotfLwjFxy0PdQD98bK uoVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=aVFK2/nfa1Y7zwZTbvajIIekUF/axJJ/WuHM1N8l/l0=; b=zMCHJxc9dIz8a9QvQUygiJX7riwuc6Rz1ELtPf5/bnRnW+fxVcHS+aI1t/Rytq3qMc I/CuRyCAeKEvZuWgKtUUKMZuOYqHT4qf6C4ga+8iSRA4iy9aCIVwdjtiJ7D+5/1TTNL5 WeDdRw3IeQFZKZmt1n7nV6FNFrgF6La+z55S4RZomgw0mvgjfimcC0CA6mZdsvDDnYy9 QoC9uPc69haTHoKlMKu6RycDt7wUCXS1Y2uq1KhzP4k9FMB72Hpu7S1nrnn9dR+GEgaK Y01b0PZbXSbMXTXcPohxFfHrIH9/STufhMg10vmz0AkspGpSaI7/xYKimizFz8RQh6/e ML8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NFq3bliU; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i65si11340286plb.438.2019.04.02.02.44.56; Tue, 02 Apr 2019 02:45:11 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NFq3bliU; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729218AbfDBJng (ORCPT + 99 others); Tue, 2 Apr 2019 05:43:36 -0400 Received: from mail-vs1-f66.google.com ([209.85.217.66]:43256 "EHLO mail-vs1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726503AbfDBJng (ORCPT ); Tue, 2 Apr 2019 05:43:36 -0400 Received: by mail-vs1-f66.google.com with SMTP id i207so7348981vsd.10; Tue, 02 Apr 2019 02:43:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aVFK2/nfa1Y7zwZTbvajIIekUF/axJJ/WuHM1N8l/l0=; b=NFq3bliUUYwEDLgqg/dqYv0Fpgh6GuhbFe23GJlotxPaKqJKToZsDp2XIFIczLC3d9 6Qu7ByAwdx6fczC9gy2MRrk9wP+rXqR2prCBpgxsJqILiQsvNjeGvuEhEDe/SGf25SuB B69YERays3UuZ5Ol2m4g1+kVPZElSP8Puub8vogcE/ku9Tjk3mLueVKPJ4OR405k7EXv cDYrMgMc6yPEVvgCZQxROr/fOMj0LJwn66Wj3fBcR5PxkXCSXzJcGEM8Gr6ZZp0SmGvb 2MlSOn0b+M+a87KJGfzVaOi6BVofK8QazeS2cfiWUil4+KmfdUjjThvy0ux4N+7HkgQ5 uAGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aVFK2/nfa1Y7zwZTbvajIIekUF/axJJ/WuHM1N8l/l0=; b=ic7c9KaJ5HRTUTcva0KdWuzDp40QMY6/Pme+qJsaBg4J9dz920OEC91FcusnjzTXAf HLvqLkBdg5kbSkKykHbcTG+vmtelRPWqqPygAu73hL847tk72EGGAmQcs1EKWce0Lkoy 0dvYx1pw6mDZoFYtYBSHC7+V4hG5elI1x+bWM4g4nDghBWrXeTmmPOpi/tDYB5hBY0sT wP4A5IDmbjTBQqXDU6rO6Oo2Ic44+IuxqNsv4mAyFPXxdOMJ8q6t8OZ1d3f/ognkDQU4 DnsBklu/an5cBsPoci38P78tqAJxoxuTYG0ibF5MHtNO2FGjk603+r7X+yzQK2VA7SkS bVlw== X-Gm-Message-State: APjAAAVFBxR8ed1oKhLsjrFKSNLXegnYwlzce07RyGK86y4buqS1Fdo6 73chyd5bkms2iT9TEjDJpZO1gk57dKBGUmMnN+I= X-Received: by 2002:a67:e9cc:: with SMTP id q12mr40767849vso.208.1554198214884; Tue, 02 Apr 2019 02:43:34 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Emil Velikov Date: Tue, 2 Apr 2019 10:43:31 +0100 Message-ID: Subject: Re: [RFC PATCH 01/20] drm: Remove users of drm_format_num_planes To: Maxime Ripard Cc: Daniel Vetter , David Airlie , Maarten Lankhorst , Sean Paul , Mauro Carvalho Chehab , Sakari Ailus , "Linux-Kernel@Vger. Kernel. Org" , ML dri-devel , Paul Kocialkowski , Hans Verkuil , Laurent Pinchart , Thomas Petazzoni , linux-media@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Maxime, On Tue, 19 Mar 2019 at 21:57, Maxime Ripard wrote: > > drm_format_num_planes() is basically a lookup in the drm_format_info table > plus an access to the num_planes field 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 drm_format_num_planes 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. > I'm not fan of the duplicated loop-ups either. > -int drm_format_num_planes(uint32_t format) > -{ > - const struct drm_format_info *info; > - > - info = drm_format_info(format); > - return info ? info->num_planes : 1; > -} > -EXPORT_SYMBOL(drm_format_num_planes); > - The existing users are not updated to cater for the num_planes != 0 case... Which seems non-existent scenario since all the current format descriptions have 1+ planes. Should we add a test (alike the ones in 6/20) to ensure, that no entry has 0 planes? Is it even worth it or I'm a bit too paranoid? The above comments apply to 2/20. With the name suggestions by Paul, patches 1 to 5 (incl.) are: Reviewed-by: Emil Velikov HTH Emil