From patchwork Fri Feb 12 19:30:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 8296671 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 5CDB9C02AA for ; Fri, 12 Feb 2016 19:31:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 80AAA2044B for ; Fri, 12 Feb 2016 19:31:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 1EE632045E for ; Fri, 12 Feb 2016 19:31:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4A6106EA58; Fri, 12 Feb 2016 11:31:46 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0CD866EA5C for ; Fri, 12 Feb 2016 11:31:45 -0800 (PST) Received: by mail-wm0-f65.google.com with SMTP id c200so4409454wme.0 for ; Fri, 12 Feb 2016 11:31:44 -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=M4ZtoPr4af+lAPRL3GYJylq7mAzSgABdohsXB7eadOY=; b=AYK2b/qm2+RQ+ZnYMmJUlKODufdqGGD6jy8M82GMrCknZnylFKuCu14lj7kLBy0wRr UUHp3o7g1csslwuD7936gmarujJLqOk6CCChN2Mcl5Gvzsf6hKLXIBHhDvIe63Q/HBUR xHQdRK5MSpRgN8hyddDkl1UhPz7lfde+nGj4262hOjjm7yJSwPdE5NWXh35VDEwpz7ev mkd+ZRcMCCnVZI6i1NyoZ3TCXzs5akpncRjD7fRMmeJF0I81oDSypuK3nMstRO3Ja5kb GUhJhKqbL+Aq7hJzN5vpgmCiou2kMr8r1ciUaEmcyJ8fhoS3pjzdUykJwjmcoo14ZK92 nJIQ== 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=M4ZtoPr4af+lAPRL3GYJylq7mAzSgABdohsXB7eadOY=; b=E1M3eHcTYOcgUq3eSpDPIWnfUHsrlZ3PIsUqjmfYvMXxuQYcBYj2YUEDr7/6T2NCdI mNZC2ZZyxr97BgXl1nyYdiu7uNlUiC5TVUt4/hlFms+YG0mN7pC9Ibx/XhTqPxaa7QR2 dRl+B2S+0VhweGPiCjR2jOhicybnVrDQPzNmAwxmXAG9mHEBvkqbc0+9AMPEN/sgfRW6 12prbhG6jWSszKP/RyuswzabHuXL1DcM+wK5YDNDQ7nzvbmqqnpn02T3vThZk25bt4uM AVum+BuvxTUq2x6Oe/29c+XnJvyI14kMIqiQYi+DN52SLLJHbyg0NL+/bLGG7/IY5hGO MtUw== X-Gm-Message-State: AG10YOQMpPFo2z5QOfhNGmVBDZbyvOuUh1zFFPYRy4DhGAHgZPY0dZAdz7p/aQF9xfJZdQ== X-Received: by 10.28.4.134 with SMTP id 128mr4581659wme.96.1455305458771; Fri, 12 Feb 2016 11:30:58 -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.30.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Feb 2016 11:30:58 -0800 (PST) From: Mario Kleiner To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/6] drm: Fix treatment of drm_vblank_offdelay in drm_vblank_on() (v2) Date: Fri, 12 Feb 2016 20:30:30 +0100 Message-Id: <1455305432-28770-5-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: daniel.vetter@ffwll.ch, michel@daenzer.net, stable@vger.kernel.org, alexander.deucher@amd.com, christian.koenig@amd.com, vbabka@suse.cz 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 drm_vblank_offdelay can have three different types of values: < 0 is to be always treated the same as dev->vblank_disable_immediate = 0 is to be treated as "never disable vblanks" > 0 is to be treated as disable immediate if kms driver wants it that way via dev->vblank_disable_immediate. Otherwise it is a disable timeout in msecs. This got broken in Linux 3.18+ for the implementation of drm_vblank_on. If the user specified a value of zero which should always reenable vblank irqs in this function, a kms driver could override the users choice by setting vblank_disable_immediate to true. This patch fixes the regression and keeps the user in control. v2: Only reenable vblank if there are clients left or the user requested to "never disable vblanks" via offdelay 0. Enabling vblanks even in the "delayed disable" case (offdelay > 0) was specifically added by Ville in commit cd19e52aee922 ("drm: Kick start vblank interrupts at drm_vblank_on()"), but after discussion it turns out that this was done by accident. Citing Ville: "I think it just ended up as a mess due to changing some of the semantics of offdelay<0 vs. offdelay==0 vs. disable_immediate during the review of the series. So yeah, given how drm_vblank_put() works now, I'd just make this check for offdelay==0." Signed-off-by: Mario Kleiner Reviewed-by: Daniel Vetter Cc: # 3.18+ Cc: michel@daenzer.net Cc: vbabka@suse.cz Cc: ville.syrjala@linux.intel.com Cc: daniel.vetter@ffwll.ch Cc: dri-devel@lists.freedesktop.org Cc: alexander.deucher@amd.com Cc: christian.koenig@amd.com --- drivers/gpu/drm/drm_irq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 055b0fa..8090989 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -1494,8 +1494,7 @@ void drm_vblank_on(struct drm_device *dev, unsigned int pipe) * re-enable interrupts if there are users left, or the * user wishes vblank interrupts to be enabled all the time. */ - if (atomic_read(&vblank->refcount) != 0 || - (!dev->vblank_disable_immediate && drm_vblank_offdelay == 0)) + if (atomic_read(&vblank->refcount) != 0 || drm_vblank_offdelay == 0) WARN_ON(drm_vblank_enable(dev, pipe)); spin_unlock_irqrestore(&dev->vbl_lock, irqflags); }