From patchwork Fri Feb 12 19:30:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 8296691 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 39CE3C02AA for ; Fri, 12 Feb 2016 19:31:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 54D3320461 for ; Fri, 12 Feb 2016 19:31:53 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 632DF2044B for ; Fri, 12 Feb 2016 19:31:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 908E56EA5E; Fri, 12 Feb 2016 11:31:51 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id CF8466EA5E for ; Fri, 12 Feb 2016 11:31:49 -0800 (PST) Received: by mail-wm0-f66.google.com with SMTP id c200so4409725wme.0 for ; Fri, 12 Feb 2016 11:31:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xQIdnndXIsFvQKJRC5sO1g9QVF2VUULNud65HPgjfuc=; b=hWZxhZ4STGD2M0x7DdTTiAa6QLd/YazflFlIOXdulkQSTqboPnucpMzMROmYYKpv17 NqarveymcL81RN/w4f+DXevQerTFOI+lBhoUNwuHUjUSNA0W+Is24V+q9qk4CewgsTan 5xnPRKald3YpQEpjZjnXmaPwC7KqIUQxTWKRaQNlyGhUKcb+suuEg+R4lW+5ooWAWAdr XiqctxVAhFP2S/TWcsSay+l8D/GicJ2uZ67jFMyr0n/WuXwmebFFNU0j7WR2lWBLxULm eo9yqL9RNF/NBat/O9vA7zT+vcz40AnSx8e9cV+jjc1AEA7xsbJbfD9P7WW9Tsm4rnEd 4Ixw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xQIdnndXIsFvQKJRC5sO1g9QVF2VUULNud65HPgjfuc=; b=WXCA9HtkXphOWFmK+n5AKW2mQy7Efk1AO3c1Du84WKOPPVPJDdHrY517HXpDd8LaaZ +t959gYX9QHd7aKgAbKv4GRBluD0ybl6TmABv+9LVHXA912Hf43GNWB8zG6OD53mKSTZ h/7i0+yuPC7DzQej9adIlI6zd2xRBXVwJBUJwL35ER29Ai6Uryz9ZADWCFB51bxLQq4T twb16VJCgXzVaA1JrICjzpQP72G6U10SJNewyCTvX2m4/V1+QF7pGINEeUmLleUA17eG jrh/56cu2a0vJoKnpE8EVM85jNt6uj9VhZFx7xy+GX/VpaIo7dk3QEyYXxC3wLa/eqWi HHGg== X-Gm-Message-State: AG10YOTCblcp5wYlYq5RvzmPKw3DaoGUlDSUu5rQwoV/eB78czShWR4fkGpPGMzcL37ryA== X-Received: by 10.28.92.195 with SMTP id q186mr4553047wmb.37.1455305463644; Fri, 12 Feb 2016 11:31:03 -0800 (PST) Received: from twisty.cin.medizin.uni-tuebingen.de (cin-11.medizin.uni-tuebingen.de. [134.2.118.242]) by smtp.gmail.com with ESMTPSA id v78sm3637797wmv.23.2016.02.12.11.31.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Feb 2016 11:31:02 -0800 (PST) From: Mario Kleiner To: dri-devel@lists.freedesktop.org Subject: [PATCH 6/6] drm/nouveau/display: Enable vblank irqs after display engine is on again. Date: Fri, 12 Feb 2016 20:30:32 +0100 Message-Id: <1455305432-28770-7-git-send-email-mario.kleiner.de@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1455305432-28770-1-git-send-email-mario.kleiner.de@gmail.com> References: <1455305432-28770-1-git-send-email-mario.kleiner.de@gmail.com> Cc: Ben Skeggs , stable@vger.kernel.org, daniel.vetter@ffwll.ch X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the display resume path, move the calls to drm_vblank_on() after the point when the display engine is running again. Since changes were made to drm_update_vblank_count() in Linux 4.4+ to emulate hw vblank counters via vblank timestamping, the function drm_vblank_on() now needs working high precision vblank timestamping and therefore working scanout position queries at time of call. These don't work before the display engine gets restarted, causing miscalculation of vblank counter increments and thereby large forward jumps in vblank count at display resume. These jumps can cause client hangs on resume, or desktop hangs in the case of composited desktops. Fix this Linux 4.4 regression by reordering calls accordingly. Signed-off-by: Mario Kleiner Cc: # 4.4+ Cc: Ben Skeggs Cc: ville.syrjala@linux.intel.com Cc: daniel.vetter@ffwll.ch Cc: dri-devel@lists.freedesktop.org Reviewed-by: Daniel Vetter --- drivers/gpu/drm/nouveau/nouveau_display.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 18676b8..1f8e51b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -634,10 +634,6 @@ nouveau_display_resume(struct drm_device *dev, bool runtime) nv_crtc->lut.depth = 0; } - /* Make sure that drm and hw vblank irqs get resumed if needed. */ - for (head = 0; head < dev->mode_config.num_crtc; head++) - drm_vblank_on(dev, head); - /* This should ensure we don't hit a locking problem when someone * wakes us up via a connector. We should never go into suspend * while the display is on anyways. @@ -647,6 +643,10 @@ nouveau_display_resume(struct drm_device *dev, bool runtime) drm_helper_resume_force_mode(dev); + /* Make sure that drm and hw vblank irqs get resumed if needed. */ + for (head = 0; head < dev->mode_config.num_crtc; head++) + drm_vblank_on(dev, head); + list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);