Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1600973pxk; Tue, 1 Sep 2020 02:59:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMc+ycH4J0r+qb6E0MxbLqqSrWk/TWPY9HgQbAFLegGgsj2lNjUbatEH0Li65XZJQQrfXs X-Received: by 2002:a17:907:271a:: with SMTP id w26mr813905ejk.402.1598954377510; Tue, 01 Sep 2020 02:59:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598954377; cv=none; d=google.com; s=arc-20160816; b=BHRZTBahv9362a/YXN4H7Ktjix9SqsQvv4Pwd7l0wKD77EZaR/yaU7s4a2HET2tMz7 nFpepTpdSTrnREdBldr/VeNNW7YPFKW3ffg1ICwn5ebgL+rEEjSZ7n4OJHWw5bns11aZ RT1JCP+v3R/155hFzsQ5qAZxSf818vfjg3WMGSE3dFWqGTApRPFXRvV75D7C747X9h4X 8sQprkmsnjRKnwqV8TjRLoX9HSdjVz51um8SLflSAMk68kNRDxyDkpsRWHijG0luWHgx mz/myuUmCFykra4os7cCgUIhQjGoKEEW96ORDx3BsI+TEXbXcQA38K4UUYW3fTjSUkUW TYYA== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=+iAh4aljY3pCe+asolVpEIJfMGIjY9QIjsrE3sOKCtE=; b=0UOvvas22ATnEjI0f304ApDm8TOKBIbJq3NgyOnt8vL9sG+U/NAj0zXTuW9T303zmH KvVzwx5TC7WWoT8dSx86Z2ItHl+EWv9r5DhDnnTgYBreNgOT9gE0Gj7dbLUgPB8nGpM/ Fz0J8nXPnAHAgH+nVJntBkCs/YaUD99qkdnbTcG/uaYV8c8A//laAXF26bXDXfAxPLNt ziLeb2Nfh3NcFVTBvqkaba4f9DMFsVbtSLboonwyEkgq7KtrvU7JDzzOlX+/eG5IB8rt +YF5dWDF/14Rb6Cd596bYTsa0Q/QjWsB8PS0F6luROxAqlYvadRKYgn8xfOvQkP2WLhg ZkbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=dygodJFo; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b="UB1kD/0u"; 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 l9si386394ejf.462.2020.09.01.02.59.13; Tue, 01 Sep 2020 02:59:37 -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=dygodJFo; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b="UB1kD/0u"; 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 S1726091AbgIAJ6e (ORCPT + 99 others); Tue, 1 Sep 2020 05:58:34 -0400 Received: from wnew3-smtp.messagingengine.com ([64.147.123.17]:35269 "EHLO wnew3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725848AbgIAJ6d (ORCPT ); Tue, 1 Sep 2020 05:58:33 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id E92ADEBD; Tue, 1 Sep 2020 05:58:31 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 01 Sep 2020 05:58:32 -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:in-reply-to; s=fm3; bh=+iAh4aljY3pCe+asolVpEIJfMGI jY9QIjsrE3sOKCtE=; b=dygodJFonFvm51AMycgBuf+IRqbIhNDlFi5LBR92pIB pVf+mHYo2ZKNjyYdDFll1x9jCyaT2pe3VsrUxuRqb1C8ETRGa0LNpehxt/dL/tu/ 4IPEq5iOi4mGDZ2rYLFQHI8FiZyiyhC5uaZmGflY2+qRvwdpezZuRQ9+hmqqYBkm 3/zwPrqgN7HW3RiEPOvo4RIIQIgahfVRFjbNNDj942dzXkagMAItjM/l3Ezq7Zh+ Vkke+1RzqaaaNh/yZP9fWlX+rE3aVAMgNA5oNTGnzPUxELfszvvpRLjHd1o5oH2u HeNirwY17E9e52j13hitbMAszN8Q9/nmwhcg4lUaGTA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=+iAh4a ljY3pCe+asolVpEIJfMGIjY9QIjsrE3sOKCtE=; b=UB1kD/0uql71evFTo8AJRF vouAnnP2gdCeXifw2lVkkHPiWXuOsn0QpWIn1LHe0Ap5zQmJ95ivAirb0aLwboGI rPbuVjjfGBBvq7vZKu4amHkqOJKtycLNiDdvfMSiC71XlLctZsO7GCySmGT7H6PI j5tA6x6ux2o9NV84i9skBK9tWygQgCvZOftCqcBpV8kU8iRIHqNWpfm8/E/VAXZj tQbConwxmbO16sV78/aS5ggQV1Ezav8REmWTA5AgCHTQpgDWreXU8Pc7AZr2+uuz h4LrVQ6qXXhVr+LebLzRYR9WGYb5eM00dq/eZEV7I1/8AGdju2bsVEONpL+lCLlA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudefjedgvdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepleekgeehhfdutdeljefgleejffehfffgieejhffgueefhfdtveetgeehieeh gedunecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh 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 583D93280060; Tue, 1 Sep 2020 05:58:30 -0400 (EDT) Date: Tue, 1 Sep 2020 11:58:29 +0200 From: Maxime Ripard To: Stefan Wahren Cc: Tim Gover , Dave Stevenson , LKML , DRI Development , Eric Anholt , bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, Phil Elwell , Nicolas Saenz Julienne , linux-rpi-kernel@lists.infradead.org Subject: Re: [PATCH v4 29/78] drm/vc4: crtc: Add a delay after disabling the PixelValve output Message-ID: <20200901095829.64a5hjghf3mlsyvo@gilmour.lan> References: <20200729144251.us6a2pgkjjmm53ov@gilmour.lan> <20200825150606.utlynhzo664bwksy@gilmour.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="gko6mttywam5g2hb" Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --gko6mttywam5g2hb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Stefan On Tue, Aug 25, 2020 at 11:30:58PM +0200, Stefan Wahren wrote: > Am 25.08.20 um 17:06 schrieb Maxime Ripard: > > Hi Stefan, > > > > On Wed, Jul 29, 2020 at 05:50:31PM +0200, Stefan Wahren wrote: > >> Am 29.07.20 um 16:42 schrieb Maxime Ripard: > >>> Hi, > >>> > >>> On Wed, Jul 29, 2020 at 03:09:21PM +0100, Dave Stevenson wrote: > >>>> On Wed, 8 Jul 2020 at 18:43, Maxime Ripard wrote: > >>>>> In order to avoid pixels getting stuck in the (unflushable) FIFO be= tween > >>>>> the HVS and the PV, we need to add some delay after disabling the P= V output > >>>>> and before disabling the HDMI controller. 20ms seems to be good eno= ugh so > >>>>> let's use that. > >>>>> > >>>>> Signed-off-by: Maxime Ripard > >>>>> --- > >>>>> drivers/gpu/drm/vc4/vc4_crtc.c | 2 ++ > >>>>> 1 file changed, 2 insertions(+) > >>>>> > >>>>> diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/v= c4_crtc.c > >>>>> index d0b326e1df0a..7b178d67187f 100644 > >>>>> --- a/drivers/gpu/drm/vc4/vc4_crtc.c > >>>>> +++ b/drivers/gpu/drm/vc4/vc4_crtc.c > >>>>> @@ -403,6 +403,8 @@ static void vc4_crtc_atomic_disable(struct drm_= crtc *crtc, > >>>>> ret =3D wait_for(!(CRTC_READ(PV_V_CONTROL) & PV_VCONTROL_VI= DEN), 1); > >>>>> WARN_ONCE(ret, "Timeout waiting for !PV_VCONTROL_VIDEN\n"); > >>>>> > >>>>> + mdelay(20); > >>>> mdelay for 20ms seems a touch unfriendly as it's a busy wait. Can we > >>>> not msleep instead? > >>> Since the timing was fairly critical, sleeping didn't seem like a good > >>> solution since there's definitely some chance you overshoot and end up > >>> with a higher time than the one you targeted. > >> usleep_range(min, max) isn't a solution? > > My understanding of usleep_range was that you can still overshoot, even > > though it's backed by an HR timer so the resolution is not a jiffy. Are > > we certain that we're going to be in that range? >=20 > you are right there is no guarantee about the upper wake up time. >=20 > And it's not worth the effort to poll the FIFO state until its empty > (using 20 ms as timeout)? I know this isn't really a great argument there, but getting this to work has been quite painful, and the timing is very sensitive. If we fail to wait for enough time, there's going to be a pixel shift that we can't get rid of unless we reboot, which is pretty bad (and would fail any CI test that checks for the output integrity). I know busy-looping for 20ms isn't ideal, but it's not really in a hot-path (it's only done when changing a mode), with the sync time of the display likely to be much more than that, and if it can avoid having to look into it ever again or avoid random failures, I'd say it's worth it. Maxime --gko6mttywam5g2hb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCX04bRQAKCRDj7w1vZxhR xW3HAP49wZn0aa04HikR94/0ojilhpDXd01fDhWp5vQNPKerGwEAjBoqFGrVZZ3e UhBx+aeqO0CmnV+unyE9Fc/YCfCx0gc= =2JLx -----END PGP SIGNATURE----- --gko6mttywam5g2hb--