Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3224393ybd; Fri, 28 Jun 2019 05:06:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqwO4Yiz5NNXph4ObKiFvIQsj2ctRcPnf/WjlKAOoacbLs6Q7+3j7MORmItoeONh3kfFq9RH X-Received: by 2002:a17:902:2926:: with SMTP id g35mr11102612plb.269.1561723597527; Fri, 28 Jun 2019 05:06:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561723597; cv=none; d=google.com; s=arc-20160816; b=nboyRLWLLN1GkOJzA/+B4G2plbrVuXgtvycD69De54uoSyjliK6lb/Zkh66Ulda5uO 2q8RKRrZQlEwjiBq1rBK0sctJG0vpBCJv/xEkqAu7KM4AbaCFaME5862XcMdRxGP1y8T pJJUYmKK+bJOY3yYdlMQ7hQu0nWd3+B1mLTsFQIEq2NkrfK0ONpNiUTcc8dmAYRVoHTX MA+ehHlrUZh9XtVvc6ddMJ6UpiEH6X1Noh3GwbVQusJQ4AIPReuUbExSoLc3kUHRsKuY S2sYSxBvnLbV2hsgH9lh+kT7mJI1AavcSjMgwrLQaGpM6ynGqEp7ia351zLDTMXCbnFO 7hqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=9AHSnR3QN34qM/4+pq9Fo6sNvPIdN6Y1TfUsCMb0l68=; b=iMImMPnhiaBF73D2en/zfqjis/Nq8lCXa0x3ob12hlYLe5V4ROGlzZ0nCNfjpXRaUQ K4ra2YrQC3QOyqD4rwX0Z4/6x1lnY6ZeCP5kMk0S/zteWPMMa4BW8Bf1RU6KITamckrh b2Z9tpT4llFVSiBNhD2byp4LkXGsFhivwRwUWUjq+heoGDFiI4JfiidtcGYF0WTdW4Id SnAr7y0NSVSLFowr6fPCo1vfaK3ve2XJd6+poor+HWuCNcjrr9UeBrIrkKvVlXKDKUyc 36H2BBUMX59xeeSfrKUvp2LQIj+PCKNgVJ3VOw4AH9c7zF/04mUZ8DfE38S6sVk13z/0 RCig== 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=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g15si2085653pjv.54.2019.06.28.05.06.13; Fri, 28 Jun 2019 05:06:37 -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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727031AbfF1MGF (ORCPT + 99 others); Fri, 28 Jun 2019 08:06:05 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:54012 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726909AbfF1MGD (ORCPT ); Fri, 28 Jun 2019 08:06:03 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: bbeckett) with ESMTPSA id 1F45D289C5D From: Robert Beckett To: dri-devel@lists.freedesktop.org Cc: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org, Philipp Zabel , Robert Beckett Subject: [PATCH v4 2/2] Revert "drm/vblank: Do not update vblank count if interrupts are already disabled." Date: Fri, 28 Jun 2019 13:05:32 +0100 Message-Id: X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If interrupts are already disabled, then the timestamp for the vblank does not get updated, causing a stale timestamp to be reported to userland while disabling crtcs. This reverts commit 68036b08b91bc491ccc308f902616a570a49227c. Signed-off-by: Robert Beckett --- drivers/gpu/drm/drm_vblank.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c index 7dabb2bdb733..aeb9734d7799 100644 --- a/drivers/gpu/drm/drm_vblank.c +++ b/drivers/gpu/drm/drm_vblank.c @@ -371,25 +371,23 @@ void drm_vblank_disable_and_save(struct drm_device *dev, unsigned int pipe) spin_lock_irqsave(&dev->vblank_time_lock, irqflags); /* - * Update vblank count and disable vblank interrupts only if the - * interrupts were enabled. This avoids calling the ->disable_vblank() - * operation in atomic context with the hardware potentially runtime - * suspended. + * Only disable vblank interrupts if they're enabled. This avoids + * calling the ->disable_vblank() operation in atomic context with the + * hardware potentially runtime suspended. */ - if (!vblank->enabled) - goto out; + if (vblank->enabled) { + __disable_vblank(dev, pipe); + vblank->enabled = false; + } /* - * Update the count and timestamp to maintain the + * Always update the count and timestamp to maintain the * appearance that the counter has been ticking all along until * this time. This makes the count account for the entire time * between drm_crtc_vblank_on() and drm_crtc_vblank_off(). */ drm_update_vblank_count(dev, pipe, false); - __disable_vblank(dev, pipe); - vblank->enabled = false; -out: spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); } -- 2.18.0