Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp814724ybd; Wed, 26 Jun 2019 06:29:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+QdQ0meEs4JMgsjZyO4NOkaKfavncHOD0c/MeQLCKNMPtZ6UT419NH1FaZ7E/WjX8ny2i X-Received: by 2002:a17:90a:342c:: with SMTP id o41mr4792315pjb.1.1561555766020; Wed, 26 Jun 2019 06:29:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561555766; cv=none; d=google.com; s=arc-20160816; b=RQ8oeSAi14Qu3ycHW4mmQRz3viPhxZgSfobOdvhPWsONIPTaDdFdhunTLzQU00Xjkp 2hya3xwqZRGHwC+5MYutgtuoHdTY3mmEYd4UZMVS89laxhuwkWEfg+jUdFtuGkr+5agO i2twBM7HRamdpCo1rn9dPKx85XnGox5zKiefB/FPN6iTDYcAklDDLDhhACDlAtcy2dQi /ASbqs+fCVg5HrTwNkI58D9L0A7MkHXaVXQS6Go9JvS3LTPAPaCieWMlrX9e4yW8kZyU x1Ddxr8Y+77ne05nAjnlBuRIYU6M+RUdk8AQSVmsGQduR/wFpjkeDF8CdU4oKOFYZPrW DaIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=/VR6TkKFvJi+InH1WWjxEb/Bl232/kA2R7Jjx3/4YDw=; b=HZ5Qg6A9scoti9IlWqcjAoDwthJnOsidIN5ulfKdjIWJlspEtjSrFjLsFtWUuEruyh I6gHNQl/lIg321JNbPnvU0Q85b9WHzHbdkLwFNTrO1+a5CnPudBhW/HOVfOyJC7fWJxF svAipSzYWAMMY0Ec4up4D1Nbafe8cKgMptWzQEv0ZFAc1VZwOrQD9we+7jGzBPVA9gSz xGWba8ioUMateQUKlIEcQ34rvRU0dnEeNMFqzaJauBt4OE5wqGDkM/SghMCNkbxbw7WZ 6ASzqxO6Owcc54YQKXKiDdRLd3Ig0mjOFmobL3i0oZvtziu8tFEBMNGos9FIZWoGUsbK b5eA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g15si1958463pjv.54.2019.06.26.06.29.09; Wed, 26 Jun 2019 06:29:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727489AbfFZN1l (ORCPT + 99 others); Wed, 26 Jun 2019 09:27:41 -0400 Received: from mga04.intel.com ([192.55.52.120]:59673 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726104AbfFZN1k (ORCPT ); Wed, 26 Jun 2019 09:27:40 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jun 2019 06:27:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,420,1557212400"; d="scan'208";a="170066599" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by FMSMGA003.fm.intel.com with SMTP; 26 Jun 2019 06:27:33 -0700 Received: by stinkbox (sSMTP sendmail emulation); Wed, 26 Jun 2019 16:27:32 +0300 Date: Wed, 26 Jun 2019 16:27:32 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Robert Beckett Cc: dri-devel@lists.freedesktop.org, Maxime Ripard , Shawn Guo , linux-kernel@vger.kernel.org, David Airlie , NXP Linux Team , Sean Paul , Pengutronix Kernel Team , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 3/4] drm/vblank: estimate vblank while disabling vblank if interrupt disabled Message-ID: <20190626132732.GP5942@intel.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 interrupts > 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. > > 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 = ktime_get(); > + u32 diff = 0; > + if (vblank->framedur_ns) { > + u64 diff_ns = ktime_to_ns(ktime_sub(now, vblank->time)); > + diff = 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?l? Intel