From patchwork Mon Dec 18 10:24:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhinakaran Pandiyan X-Patchwork-Id: 10118741 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 297E5603FA for ; Mon, 18 Dec 2017 10:25:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1714C28F4A for ; Mon, 18 Dec 2017 10:25:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B02728F59; Mon, 18 Dec 2017 10:25:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ABF6E28F4A for ; Mon, 18 Dec 2017 10:25:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 78CB989FA9; Mon, 18 Dec 2017 10:25:16 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pl0-x241.google.com (mail-pl0-x241.google.com [IPv6:2607:f8b0:400e:c01::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id F184689FA9 for ; Mon, 18 Dec 2017 10:25:15 +0000 (UTC) Received: by mail-pl0-x241.google.com with SMTP id 1so3088728plv.0 for ; Mon, 18 Dec 2017 02:25:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ZJif0fBUOZe0Edmz2Tkey1WWoSSlqNVXO9Vu+DajmlQ=; b=ke2TzXkgiGBrg7ExK35+2J/9QBIFpxUiB3px0ZfLfan7PZNYtkfa3PEU8JgaSXFXQj SZlyJlv230sRn+69BqlHjfcIrF71cJW4H4dkp5KmoORYRwfr5mpNDBpSp9PtP8X0KHpo N45xQzbews6lirrb44OebYR5DJsUCmy9a23fk3t2LjCaYGIC6e+zC3z1EC+fmUprdu8K DqtwKoKg0sgS6xYZMvoyZYBbv6nYOA57ykY5qDbu0Bj1chHKR3xLadg5qh+LuUu1GYDM miuka1oRIB5ziq0VYKDBhV6WxqO8UnSp1tZsFcWxYImkXOJpFsCP5gb7164yrY6+OhoF 4k6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ZJif0fBUOZe0Edmz2Tkey1WWoSSlqNVXO9Vu+DajmlQ=; b=OXel176rUsxMrMZn8I+JcVb1cFu2TPwklr4CBlBITnSD5magXPK2ONnz46PlmpJgMI v+y63y/O17BWWw41jWzUXMcx9EVDbZiu3wKddLQuSGpDStwyXSbE6TAxCl7kUIqgdTuc cnHY08pmC4SsAaEaGki1nAGqc+cgClByZm1WMkMaggF8w0i3h3eV2a37PjqJvjNDoIk3 S0g+rRGCdkXSx7L2vVtrN1lkyA17cFY4Wt7XuF3PSppMCUyQhkB631bGfjuneBskN3Yt sBbOvqdLzra/ibmQbjO92rQVhwafEppCT84HzqZkq2pAMGk11qdRggCUBM8XKBjtxkut nDbw== X-Gm-Message-State: AKGB3mK8632D0fZWapwIv5roY5eQ6uDHiN3nV+uxEaKyGsfe18oNvlrS /c3iGe2yrKewKj4PN+Dx9ehAdg== X-Google-Smtp-Source: ACJfBos2EjveTWLs26GV/MGF2+veISFpD+oMscVdnhRl2WR/wYY3XHo7MSGmfajx6tQIjNDnPxfINQ== X-Received: by 10.84.246.140 with SMTP id m12mr21888251pll.74.1513592714975; Mon, 18 Dec 2017 02:25:14 -0800 (PST) Received: from localhost.localdomain ([2601:1c0:5402:5a00:d047:2358:10ac:f41c]) by smtp.gmail.com with ESMTPSA id u125sm21206499pgc.94.2017.12.18.02.25.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Dec 2017 02:25:13 -0800 (PST) From: Dhinakaran Pandiyan X-Google-Original-From: Dhinakaran Pandiyan To: intel-gfx@lists.freedesktop.org Date: Mon, 18 Dec 2017 02:24:41 -0800 Message-Id: <20171218102445.2709-1-dhinakaran.pandiyan@intel.com> X-Mailer: git-send-email 2.11.0 Cc: Dhinakaran Pandiyan Subject: [Intel-gfx] [CI v2 1/5] drm/vblank: Do not update vblank counts if vblanks are already disabled. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Updating the vblank counts requires register reads and these reads may not return meaningful values after the vblank interrupts are disabled as the device may go to low power state. An additional change would be to allow the driver to save the vblank counts before entering a low power state, but that's for the future. Also, disable vblanks after reading the HW counter in the case where _crtc_vblank_off() is disabling vblanks. Signed-off-by: Dhinakaran Pandiyan --- drivers/gpu/drm/drm_vblank.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c index 32d9bcf5be7f..7eee82c06ed8 100644 --- a/drivers/gpu/drm/drm_vblank.c +++ b/drivers/gpu/drm/drm_vblank.c @@ -347,23 +347,14 @@ void drm_vblank_disable_and_save(struct drm_device *dev, unsigned int pipe) spin_lock_irqsave(&dev->vblank_time_lock, irqflags); /* - * 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) { - __disable_vblank(dev, pipe); - vblank->enabled = false; - } - - /* - * Always update the count and timestamp to maintain the + * 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; spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); } @@ -1122,8 +1113,12 @@ void drm_crtc_vblank_off(struct drm_crtc *crtc) pipe, vblank->enabled, vblank->inmodeset); /* Avoid redundant vblank disables without previous - * drm_crtc_vblank_on(). */ - if (drm_core_check_feature(dev, DRIVER_ATOMIC) || !vblank->inmodeset) + * drm_crtc_vblank_on() and only disable them if they're enabled. This + * avoids calling the ->disable_vblank() operation in atomic context + * with the hardware potentially runtime suspended. + */ + if ((drm_core_check_feature(dev, DRIVER_ATOMIC) || !vblank->inmodeset) && + vblank->enabled) drm_vblank_disable_and_save(dev, pipe); wake_up(&vblank->queue);