From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93F26C12002 for ; Fri, 16 Jul 2021 07:30:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 16EFF613DF for ; Fri, 16 Jul 2021 07:30:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 16EFF613DF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 920626E92D; Fri, 16 Jul 2021 07:30:53 +0000 (UTC) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by gabe.freedesktop.org (Postfix) with ESMTPS id B04946E92D for ; Fri, 16 Jul 2021 07:30:51 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id BD3D75C015E; Fri, 16 Jul 2021 03:30:48 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 16 Jul 2021 03:30:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:content-transfer-encoding:in-reply-to; s=fm3; bh=9 cu5nt0G2+zON1HSxnAUZmT6I2/KCuA1/XNq5Jbxq68=; b=ZTZmABM8xyt1Rqud0 yW55wutkGz+6GaC6nXzJVMRKnCJicBOEAe3ojqyoHefN52V1FLpSMKnfRcF7qJH/ 7uoMNY9Gg2IX2T3REgbynivXOVD+xFl6nPWXWjH5BpO4oOtSiK+HMby6kg/goNLT 1vmEPI26OOVdBvF/nKXGfqkWE3F6hrxD/083y7GhYT5NLN+cQhc1uwcbV+aHHsxR AV+wx+HIGd8M3bdAVGgkPLF8o1aTWI8NECAKzYhtKFcMizG0HPKYHdrk4VIwHhdx 5HjQf546ji/qqpOkcv9bTdxiTCKWedWCPgP2dR/UfQaKf1fGz2n3udrCGBau2GEk bj/hQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=9cu5nt0G2+zON1HSxnAUZmT6I2/KCuA1/XNq5Jbxq 68=; b=dK8/h7ZwzqtJYUlT0zUsGRlZcEkULX1/ew/COYkVWU900kvrzp6C7TICB oy8pTwgHxi1WmbnBYUATpBGsD6ZrcgDow849GqA6ps+FGHDcUODzrNqyLCJ9D0e0 qjck3NmtRA1fkiZNasEXjl8qrJhIBrCoPz977YfdSVv/kKmHyy167tB/AKTumQNs b8vW1TETDxY0ZSsCyeaiPv4d3cgbWgG7sqXpYjhf+Oa1tZHFGMvNUPWeXg7smePa rEvlg3fJ6JtgFDTnzUThb8JqpAVOYOZ1g3jCw3TlglaCdf7jmw9jw5VroJoq7qp4 +dL5iAMzlrqMUGrXYqRnKk+9CTf+g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddvgdduudegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtugfgjgesthhqredttddtvdenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpefgjeettdejgffgffdvteeutdehtdehgeehueetkeefgefhtdetjeekledu gedvudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 16 Jul 2021 03:30:46 -0400 (EDT) Date: Fri, 16 Jul 2021 09:30:44 +0200 From: Maxime Ripard To: Thomas Zimmermann Subject: Re: [PATCH 1/5] drm: Define DRM_FORMAT_MAX_PLANES Message-ID: <20210716073044.ff3avcrd5swruele@gilmour> References: <20210715180133.3675-1-tzimmermann@suse.de> <20210715180133.3675-2-tzimmermann@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20210715180133.3675-2-tzimmermann@suse.de> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hamohammed.sa@gmail.com, rodrigosiqueiramelo@gmail.com, airlied@linux.ie, dri-devel@lists.freedesktop.org, melissa.srw@gmail.com, noralf@tronnes.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi, On Thu, Jul 15, 2021 at 08:01:29PM +0200, Thomas Zimmermann wrote: > DRM uses a magic number of 4 for the maximum number of planes per color > format. Declare this constant via DRM_FORMAT_MAX_PLANES and update the > related code. >=20 > Signed-off-by: Thomas Zimmermann > --- > drivers/gpu/drm/drm_gem_framebuffer_helper.c | 14 ++++++++------ > include/drm/drm_fourcc.h | 13 +++++++++---- > include/drm/drm_framebuffer.h | 8 ++++---- > include/drm/drm_gem_atomic_helper.h | 2 +- > 4 files changed, 22 insertions(+), 15 deletions(-) >=20 > diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c b/drivers/gpu/d= rm/drm_gem_framebuffer_helper.c > index e2c68822e05c..975a3df0561e 100644 > --- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c > +++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c > @@ -48,7 +48,7 @@ > struct drm_gem_object *drm_gem_fb_get_obj(struct drm_framebuffer *fb, > unsigned int plane) > { > - if (plane >=3D 4) > + if (plane >=3D ARRAY_SIZE(fb->obj)) > return NULL; This doesn't look related to what's mentionned in the commit log though? > return fb->obj[plane]; > @@ -62,7 +62,8 @@ drm_gem_fb_init(struct drm_device *dev, > struct drm_gem_object **obj, unsigned int num_planes, > const struct drm_framebuffer_funcs *funcs) > { > - int ret, i; > + unsigned int i; > + int ret; > =20 > drm_helper_mode_fill_fb_struct(dev, fb, mode_cmd); > =20 > @@ -86,9 +87,9 @@ drm_gem_fb_init(struct drm_device *dev, > */ > void drm_gem_fb_destroy(struct drm_framebuffer *fb) > { > - int i; > + size_t i; > =20 > - for (i =3D 0; i < 4; i++) > + for (i =3D 0; i < ARRAY_SIZE(fb->obj); i++) > drm_gem_object_put(fb->obj[i]); Ditto Both these changes look fine though, but I guess you should just mention it Maxime