Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp816pxk; Wed, 2 Sep 2020 12:38:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxM2+znuN5FnES3ZfUNjeQRxVxrhTyeB57joayoorOt2n6sT9eNVOSjZepDXcjUUEHPl1TE X-Received: by 2002:a17:906:1719:: with SMTP id c25mr1643790eje.487.1599075504549; Wed, 02 Sep 2020 12:38:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599075504; cv=none; d=google.com; s=arc-20160816; b=B3po7om0UxjyVhzJWWfatMwHWGs9EOYLktBO+eFRLX41m5xMic+XYnOUUoKHWz37yf fIfxer9WPSIkSnkj1g9p/QGJe6jJKoWmktiq896YcVJBGOP2seinPrWpLuw9UQoOrWtD yPLGmkiqek5Lnw/Ap0NVF+5w3qC2C69d+fi1iWcIsJnR8iBbRmIcR0Lukp4AreZiVNGf fzZu1yQfrAVo1/1FSJ5nDA/k7tff/8dCQ0mJY4uZEYkX3zV3M/NvITjf44FKWxMH+Qji BgEa23EGjZJeYMPtu+QmQ08w4F7e2Y86qWPR/8geJ97jIMCcgibuM8mekkW86ur+Fj8E cvhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=xU/XjSIfk+mtw7xME/AR1cpDo57ZqRYe/6NoAfYzO+c=; b=jnrjyi2lShdUTx22lZKnL3oEK4FqgkVkUAk7gEbWUHz1isREzkVLl71jq97N2ADB01 xOd6P4geAOwF+/AeraAf+Y0MWYh0+bRR/hmPkH1WVhpDRWZflfu7djCrqlJpU4bnRvmj 1nVbk0QNVaQQmBZRF60H6TWm7mgrguR3ZZk2XEfKopeddeRO/17DAVUNUkKYJf9f58SX lVmcZ/aAIzcpE+FOkgUQ5jOtctTuTvYLMzArBjxbcjNXuWp31K7mqyGv9B9xm31nkze/ ahmYEpibE5AYet0Ik18OSJq89SwoFUzPNQV9KFPbO20C66qXoh4iKd+IoEg2HM0TYKvu rHCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=i03AgT4i; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=QuIkt6sZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o9si343786ejr.637.2020.09.02.12.37.59; Wed, 02 Sep 2020 12:38:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=i03AgT4i; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=QuIkt6sZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727869AbgIBR76 (ORCPT + 99 others); Wed, 2 Sep 2020 13:59:58 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:43001 "EHLO wout2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726397AbgIBR75 (ORCPT ); Wed, 2 Sep 2020 13:59:57 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id B8318E79; Wed, 2 Sep 2020 13:59:55 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 02 Sep 2020 13:59:56 -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=x U/XjSIfk+mtw7xME/AR1cpDo57ZqRYe/6NoAfYzO+c=; b=i03AgT4ivAfJ/jHS3 GMUbbu/yP1GleoS4P/wqklP2VoMsZcfaJmMdf1j5b9s1sH0k+iU8KjVZFOFIOSvn hyo2Updc1Xl94j+4VgzOmC24jpHrHgZNcV53hQNCPrc/M2143wsbwwUR49cMyaq2 KoniiwbL9xDdITzqznx8d7MGRaCjPdD/FqhhaCCsGYJ4zZav46mdrjk/+L7iQ/7M I3ZHeKoYB/XVgn9KortRulwY6Gi8KRM8BojaDBB6nmFfs0jOnhRZYJGmXvMG3/ov QiU/vtFs8NNRLMNcWa+Uvku9+xyUNvHI4weiMj8L0HzP7xjjCKiHmcxSLzpaE41a 8X+SA== 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=xU/XjSIfk+mtw7xME/AR1cpDo57ZqRYe/6NoAfYzO +c=; b=QuIkt6sZfykgPlDBvKbjxdL4TgQ4PM9x4J5c0aSk901p0JIwlf3n93LvW rRH197HTjiOmGgJABeKObWgfhgxZqpF+Bu02DkTuRWWQndCTZ/fRBJmCB46n1O53 UaQpJLjZn1h4d1fOP5CsjoEJcSgm0kjSIJZwaFNvYfYSAn6CwUbydSB+GcxVIDg2 yIhMnAM82KO7T/7U8kn29wBG+hsFGQnojN2DKJSs5MbR29PPO9Nd3hCHlp7TfeSE jWUf5QqeUzzFv7/qE/70rX2OPbsmCJHuS6vy3KBqRZ8/bikeAAJU/9dTZ0jEHPpe JsCxi3GGN5Z4ROeEL3e8VB/8dqWHA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudefledguddvtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggugfgjsehtqhertddttddvnecuhfhrohhmpeforgig ihhmvgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrf grthhtvghrnhepveehueehkeekffdtudevveehteffhfdugefhveekgeekheeigffgvdek heehieehnecuffhomhgrihhnpegsohhothhlihhnrdgtohhmnecukfhppeeltddrkeelrd eikedrjeeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 7A6EC3280059; Wed, 2 Sep 2020 13:59:54 -0400 (EDT) Date: Wed, 2 Sep 2020 19:59:52 +0200 From: Maxime Ripard To: Dave Stevenson Cc: Nicolas Saenz Julienne , Eric Anholt , DRI Development , linux-rpi-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, LKML , Tim Gover , Phil Elwell Subject: Re: [PATCH v4 13/78] drm/vc4: kms: Convert to for_each_new_crtc_state Message-ID: <20200902175952.gf6siofkw7vgjkj3@gilmour.lan> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! On Wed, Jul 29, 2020 at 04:02:06PM +0100, Dave Stevenson wrote: > Hi Maxime >=20 > On Wed, 8 Jul 2020 at 18:42, Maxime Ripard wrote: > > > > The vc4 atomic commit loop has an handrolled loop that is basically > > identical to for_each_new_crtc_state, let's convert it to that helper. > > > > Signed-off-by: Maxime Ripard > > --- > > drivers/gpu/drm/vc4/vc4_kms.c | 9 ++++----- > > 1 file changed, 4 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_km= s.c > > index 210cc2408087..717673b18132 100644 > > --- a/drivers/gpu/drm/vc4/vc4_kms.c > > +++ b/drivers/gpu/drm/vc4/vc4_kms.c > > @@ -152,14 +152,13 @@ vc4_atomic_complete_commit(struct drm_atomic_stat= e *state) > > struct drm_device *dev =3D state->dev; > > struct vc4_dev *vc4 =3D to_vc4_dev(dev); > > struct vc4_hvs *hvs =3D vc4->hvs; > > - struct vc4_crtc *vc4_crtc; > > + struct drm_crtc_state *new_crtc_state; > > + struct drm_crtc *crtc; > > int i; > > > > - for (i =3D 0; i < dev->mode_config.num_crtc; i++) { > > - if (!state->crtcs[i].ptr || !state->crtcs[i].commit) > > - continue; > > + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { > > + struct vc4_crtc *vc4_crtc =3D to_vc4_crtc(crtc); >=20 > for_each_new_crtc_in_state doesn't check !state->crtcs[i].commit as > the hand rolled loop did. Sorry, this is my lack of knowledge, but > does that actually make any real difference? >=20 > I see nothing wrong in calling vc4_hvs_mask_underrun multiple times > anyway, so it's most likely going to be harmless anyway, but wanted to > query it. Sorry for not getting back to this earlier. I don't really know :) It looks like the commit pointer is always going to be !NULL in our case: https://elixir.bootlin.com/linux/latest/source/include/drm/drm_crtc.h#L385 The only case where it seems to be checked is when using for_each_old_crtc_in_state, and when the commit pointer is being accessed, and we're in neither of those cases. Since I don't really know though, I guess we can remain on the safe side and keep it for now. Maxime