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=-8.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT 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 48D71C48BD3 for ; Wed, 26 Jun 2019 14:30:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 1DC092133F for ; Wed, 26 Jun 2019 14:30:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rzHbBi7A"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="ATxugIl2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1DC092133F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0t2b3FSAaYAU0oFRfQ6Lu9nQGwU0vr51cpAGKKgr/WM=; b=rzHbBi7ASx7xjL dJJU9PtNKUov5JSdn3RpVufElmi3z7kmbLl/LPheWpfcHz0n/ZoFjEykcK39k2F0yxnW7p4rMfCd7 IT3Mp20y78FLNFrPkQMlP+DACBOWXWNsW7CCVAucYyEBuUP9erjTeVTeMPgwy7PHX3vuA3tlJ25I7 MS3uhTR9L1ytH9zBNsX7Au+b1uECJXsjFDBCuse1aLdkomeEOI3yHnSTpLBpsUN5sJaJF5k7xz/1X ASWR3qRLkkh8VBW1BUdR9pdnm6WC7ovSKv3zT8NA93SjErydat0vL2OGnrQO4RJpF7NzU1mXz3oc8 Djfb4nJuxrfxGNbj7a5g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hg8wT-0004kN-9p; Wed, 26 Jun 2019 14:30:33 +0000 Received: from mail-ed1-x544.google.com ([2a00:1450:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hg8wP-0004jo-P7 for linux-arm-kernel@lists.infradead.org; Wed, 26 Jun 2019 14:30:31 +0000 Received: by mail-ed1-x544.google.com with SMTP id w13so3695031eds.4 for ; Wed, 26 Jun 2019 07:30:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=oycxIMhWeOjgRZ0/QzcUw1Wm4NjGiCorky0TzSRYEqE=; b=ATxugIl2SCaT9srbmP+Rni5GHifDKlPGbXR7cYJH8NZJPoLZdG+YoE+KGlga5ijBjN 0IaYYsPbZbhlbZ+tgs7ixOM0KKMv+5E5aECiVHH+fBYMy1syTxMjneNp9IDNlk7a/jbe M++g+/H/ce1vcxRfKzoZWLaBkn7ISoij6+edI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=oycxIMhWeOjgRZ0/QzcUw1Wm4NjGiCorky0TzSRYEqE=; b=sNlZd8juv4o2Gw4qwEvemex+JOFvHvyuhSwhPh48EKTWCIxCrvgt0QvZQ0lerpvPAc 3HxyRdM6urn/JUy31Nd1X6uPO0vGrTgA3lieDLxkNKLUqrmDcwTOauDNoL5/xBdT42Vk 8Mw6WsYeNcV6xpdbXP9D5RvQ1aLL+YvZIrrqnf1yQBt+YsJ1OJUt6ZzS4c5GsCsT/xfG TMGPKEq/m2o3PjsJGIjhIq7Kd5cYXxkZOh53P36/kfx5nASiU7GIpDsCv3Wx4V7dr+YC y7jGuu4YdO8wCymuCb9ksSSd4Q7w38qVKEE9TREDt4DjhcITS0DTpWyfxXpxTwuMjz0L N15A== X-Gm-Message-State: APjAAAXrQ5fc7ZW7uTruSWnpB0HwHamLjBiloAAYvV2hwPRaPq5gY5Nt UuYeXpGd1P1sJWsoNQ1JCNHnSQ== X-Google-Smtp-Source: APXvYqzNFt6g8HxgwDJyHbLTfRt/7BCAd97Ph8ib/VE+AghliKNlIAXkR9U7cf7MH6mNrMRncjwmSA== X-Received: by 2002:a05:6402:2cb:: with SMTP id b11mr5612295edx.281.1561559427848; Wed, 26 Jun 2019 07:30:27 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id j10sm3037251ejk.23.2019.06.26.07.30.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 26 Jun 2019 07:30:27 -0700 (PDT) Date: Wed, 26 Jun 2019 16:30:25 +0200 From: Daniel Vetter To: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Subject: Re: [PATCH v3 3/4] drm/vblank: estimate vblank while disabling vblank if interrupt disabled Message-ID: <20190626143025.GN12905@phenom.ffwll.local> Mail-Followup-To: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Robert Beckett , Maxime Ripard , Sean Paul , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, David Airlie , NXP Linux Team , Pengutronix Kernel Team , Shawn Guo , linux-arm-kernel@lists.infradead.org References: <20190626132732.GP5942@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190626132732.GP5942@intel.com> X-Operating-System: Linux phenom 4.19.0-5-amd64 User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190626_073029_822162_F180DC0C X-CRM114-Status: GOOD ( 23.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robert Beckett , Maxime Ripard , Shawn Guo , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, David Airlie , NXP Linux Team , Pengutronix Kernel Team , Sean Paul , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jun 26, 2019 at 04:27:32PM +0300, Ville Syrj=E4l=E4 wrote: > On Tue, Jun 25, 2019 at 06:59:14PM +0100, Robert Beckett wrote: > > If interrupts are disabled (e.g. via vblank_disable_fn) and we come to > > disable vblank, update the vblank count to best guess as to what it > > would be had the interrupts remained enabled, and update the timesamp to > > now. > > = > > This avoids a stale vblank event being sent while disabling crtcs during > > atomic modeset. > > = > > Fixes: 68036b08b91bc ("drm/vblank: Do not update vblank count if interr= upts > > are already disabled.") > = > I don't understand that commit. drm_vblank_off() should be called > when the power is still present, so it looks to me like that > commit is actually wrong. So I think we may want to just revert > it and figure out what the actual bug was. Hm yeah we might need a power domain get/put around our drm_crtc_vblank_off() call to make sure it dtrt. Revert sounds like a good idea instead of adding more kludges ... a-b: me on the revert, even though I did ack the original patch too. -Daniel > = > > = > > Signed-off-by: Robert Beckett > > --- > > drivers/gpu/drm/drm_vblank.c | 16 +++++++++++++++- > > 1 file changed, 15 insertions(+), 1 deletion(-) > > = > > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c > > index 7dabb2bdb733..db68b8cbf797 100644 > > --- a/drivers/gpu/drm/drm_vblank.c > > +++ b/drivers/gpu/drm/drm_vblank.c > > @@ -375,9 +375,23 @@ void drm_vblank_disable_and_save(struct drm_device= *dev, unsigned int pipe) > > * interrupts were enabled. This avoids calling the ->disable_vblank() > > * operation in atomic context with the hardware potentially runtime > > * suspended. > > + * If interrupts are disabled (e.g. via blank_disable_fn) then make > > + * best guess as to what it would be now and make sure we have an up > > + * to date timestamp. > > */ > > - if (!vblank->enabled) > > + if (!vblank->enabled) { > > + ktime_t now =3D ktime_get(); > > + u32 diff =3D 0; > > + if (vblank->framedur_ns) { > > + u64 diff_ns =3D ktime_to_ns(ktime_sub(now, vblank->time)); > > + diff =3D DIV_ROUND_CLOSEST_ULL(diff_ns, > > + vblank->framedur_ns); > > + } > > + > > + store_vblank(dev, pipe, diff, now, vblank->count); > > + > > goto out; > > + } > > = > > /* > > * Update the count and timestamp to maintain the > > -- = > > 2.18.0 > > = > > _______________________________________________ > > dri-devel mailing list > > dri-devel@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/dri-devel > = > -- = > Ville Syrj=E4l=E4 > Intel > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- = Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel