Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp534062pxk; Wed, 2 Sep 2020 08:10:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2GIxG/zrQr7equU3SUGtu0s9ySZmliBnHPa/3nRqpmKdd3Q+C9k2Z2Q5xnr2zXmfcpJwr X-Received: by 2002:a50:ed16:: with SMTP id j22mr563629eds.104.1599059422818; Wed, 02 Sep 2020 08:10:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599059422; cv=none; d=google.com; s=arc-20160816; b=q4OJTjExGDzCRRtBW2MuJGVrh5lr/46Mh13GH5a8mXxC/X0vmPHT5V9RG3KKnXdnc3 sUTaVHaQKbVw0Wc5okbYb4n+T9T25z/SzhA++sLKX/8S/UZL5XAunQjcP0vrD3lgzGXU QL5WgVg9wemE2oXRn1jH5eCqVlw1Ie0qyjUPFpeT3aCmsofPBIxjfwmcHPvFmI40TcDG CG3tbYKuoLHoKFl6jGLj50QDruTprE31815uufrk1/KRuGk25WPiT9nGjoSWUQPEfiNx T08aMCZMJIeAj4tEHRxE/9i/4cbSrsO4unuS63NBQzIlSXgYHOfrcKKclM3WAes0jyKG X6OA== 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=4N199FQkobK337JX6NaJjdNJ1TwKdtxIk6GC3btyUAo=; b=EeRXjlDX0NoXF738aQJyFoKS4K67gv4Cf14cZf+6kxAQ2LTMS5Hs0d/Evss1FnGcQc fVa1V3cbAauZEQo23J+DgLczcxo4FvPl1UxCeCholhQREwQR5F1yrXFsVu5EbEBbpX2r Su0FQy5zBnm8PVkObUxf7WXXnaQUTJqo0R33zo10PrLisvbgZXFFMN46hattSVNUqi4p 4ZPGSyFedmC/2QLnFmkHxGoreeM7IhOZg0Srv/CHPDsvo/AqzFhVL5kesaVyG+RcauFB RtTJOfIxYIRyunnJHAM+aS6BZTWPMeYO+4+0tpp/1m6ZvilDPcmj9iYfbjai7V8YI1J5 rHsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=SrtOi2z2; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=N1VBIZ8P; 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 a7si2743051ejd.422.2020.09.02.08.09.59; Wed, 02 Sep 2020 08:10:22 -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=SrtOi2z2; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=N1VBIZ8P; 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 S1727004AbgIBPJS (ORCPT + 99 others); Wed, 2 Sep 2020 11:09:18 -0400 Received: from wnew2-smtp.messagingengine.com ([64.147.123.27]:46063 "EHLO wnew2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727999AbgIBPIU (ORCPT ); Wed, 2 Sep 2020 11:08:20 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 7C661D60; Wed, 2 Sep 2020 11:08:18 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 02 Sep 2020 11:08:19 -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=4N199FQkobK337JX6NaJjdNJ1Tw KdtxIk6GC3btyUAo=; b=SrtOi2z2ChvWDa5tfPeHqVKrp4mbVQpRikdJdgBfpOz o0YaLxKUyDs1BIzNFBguzce7mRb94WVHA1yC/MZ3LsaxstPiOr89MogRkE/s3DOs vkTSgdxq/RrP/2H3N4EEGFl4SqAG6PxC7oHkdepfrl8rEkS6Y4cGZfBotCPIwFzM EHGILdmS5wl7H/a75BVLRLUuEqRMdL9+iCltpqDdqVuxkJalXizEsX18siL4aoxk o5xXZkSLPBpoHZ3M8u9gGhRPRhUeeg2bfehXJE6ay6r0sZJcEbS8WeFyTVkNhkEO hO9QsnheUtvinvBx1w1FN77YreldZTmsJ2ek0QF05Nw== 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=4N199F QkobK337JX6NaJjdNJ1TwKdtxIk6GC3btyUAo=; b=N1VBIZ8P6SLnobJU5o2z+L /gBzJFAGdFyxD8WbjLE47L5YubPdoEGOMccvcUDsCEqb/6sZOdhrOqbdbdE8lEIk gvNPqygOfMGKrIXSoDC1dCvcjj9Gc4/jAGbeyYwjDrJ5D0tLfEbdkJE3UzbYz4vE ODCiOUPgFied2mUnwMpa8sRhf6jg9zgq47CUw5S2Om7F6Ftqe98spSNwnOzuld6f Ebrzo+QMFGYzHeTeNH3vCXZSVlmF7FHtoMJxnFxiXd36EQqKLi8mqC83bksMSlWc 7RlJhw168GIEQNtavO/sN5rFX/68GpCylawSRY2e+hmZi1PqUELicQKDsgooU54Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudefledgkeehucetufdoteggodetrfdotf 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 DC828328005E; Wed, 2 Sep 2020 11:08:16 -0400 (EDT) Date: Wed, 2 Sep 2020 17:08:15 +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: <20200902150815.kw3nynnlvgrrcygc@gilmour.lan> References: <20200729144251.us6a2pgkjjmm53ov@gilmour.lan> <20200825150606.utlynhzo664bwksy@gilmour.lan> <20200901095829.64a5hjghf3mlsyvo@gilmour.lan> <27a549fe-e38d-f9a2-2677-ae5b5dc1aa45@i2se.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="cdchspgt6i3o3s2q" Content-Disposition: inline In-Reply-To: <27a549fe-e38d-f9a2-2677-ae5b5dc1aa45@i2se.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --cdchspgt6i3o3s2q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 01, 2020 at 06:31:07PM +0200, Stefan Wahren wrote: > Hi Maxime, >=20 > Am 01.09.20 um 11:58 schrieb Maxime Ripard: > > 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 wro= te: > >>>>>>> In order to avoid pixels getting stuck in the (unflushable) FIFO = between > >>>>>>> the HVS and the PV, we need to add some delay after disabling the= PV output > >>>>>>> and before disabling the HDMI controller. 20ms seems to be good e= nough 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= /vc4_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 dr= m_crtc *crtc, > >>>>>>> ret =3D wait_for(!(CRTC_READ(PV_V_CONTROL) & PV_VCONTROL_= VIDEN), 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 g= ood > >>>>> 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, ev= en > >>> though it's backed by an HR timer so the resolution is not a jiffy. A= re > >>> we certain that we're going to be in that range? > >> you are right there is no guarantee about the upper wake up time. > >> > >> 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. >=20 > i don't want to delay this series. >=20 > Could you please add a small comment to the delay to clarify the timing > is very sensitive? I will, thanks! Maxime --cdchspgt6i3o3s2q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCX0+1XwAKCRDj7w1vZxhR xTExAQDs1BYdGeS/lvk546x1sgn6AifEwOlrVxDSeMO/QWhu3wD/RfIhHhh1s1j1 DfqNBjaatkPCQAZkursDakHjOFFOYQI= =bDzq -----END PGP SIGNATURE----- --cdchspgt6i3o3s2q--