From patchwork Mon Feb 8 01:13:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 8246141 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id ADF199F38B for ; Mon, 8 Feb 2016 01:14:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C9F2E201D3 for ; Mon, 8 Feb 2016 01:14:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id AEAC1201FE for ; Mon, 8 Feb 2016 01:14:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 101A86E32A; Sun, 7 Feb 2016 17:14:50 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by gabe.freedesktop.org (Postfix) with ESMTPS id 168046E32D for ; Sun, 7 Feb 2016 17:14:49 -0800 (PST) Received: by mail-wm0-f67.google.com with SMTP id p63so13219695wmp.1 for ; Sun, 07 Feb 2016 17:14: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=oQBKre05b0WM0PIPY0QF+medFoYBmgfUp+gSID2f758=; b=aehrYwRHXWtZmheLahN/pfu6fdctVX2bXRIji0eXcz7NyKcJuTE3G8czu1AkAxiDqK lHx2WjeikunSRMdYwqY+DAftFv9FQh7NnwsCrMLBLU4Vl5b/y5A6zzSW4/0fDC3vaXfv Iw7WKPFnAS+XNbcoYOGcf5aRz8HJISWc8UhgWJTAUYDDusFbt+rRLnS7wxHCUv5eN2Lo h2KgQe7bGABo3l8tkxmVvi2WXzPRi06t+BmJW5xQrgM1LS0fvCcFaeTcQecDcj+A6DzM icZzo5teZmN3LMDj9sDRhXbN5QrfPusqFeuSH5qSzH+697+Be+JkqzM4uyLwVQ8cExT1 A6jQ== 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=oQBKre05b0WM0PIPY0QF+medFoYBmgfUp+gSID2f758=; b=EkyccQQxXYJ3h5pDTfV1rOqu/3dZnG0akTgNHCwrQ6h/42UwnG01GEzUafhxT4z7y+ exCxYTj0n+jGJ/4CnfDY5ud51BETdKyalyODX9KsUgmW20hq8lGO4jdStlEACSTIMCrN +fjwCosE///GMqNvWXVTvyN5Dc7t9ZUM9c6OB1BiqUXmuvQvF3Kn1DyzC50eFXX9uyLI YNQOCAYI3gkLJbMaS42FTANBappelJUr2FYiE0bijlvQ7a24mVC2ApWaKXodz6dVb3c3 lAZs0wxadR0TsAzmIAy9JywbMx7zwiYXbiDCf0s1h9ozA6IcYOhRmRJLe/fy5AuAxkk0 2d1g== X-Gm-Message-State: AG10YOS0zOj7967UopLYH7TKRal6iDAzE+ahAJeozYay5Lh/yRWsR2v8m63mlomirgj3pQ== X-Received: by 10.194.117.134 with SMTP id ke6mr28470918wjb.94.1454894087879; Sun, 07 Feb 2016 17:14:47 -0800 (PST) Received: from twisty.fritz.box (x4d02db5e.dyn.telefonica.de. [77.2.219.94]) by smtp.gmail.com with ESMTPSA id b5sm9486380wmh.15.2016.02.07.17.14.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 07 Feb 2016 17:14:46 -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() Date: Mon, 8 Feb 2016 02:13:27 +0100 Message-Id: <1454894009-15466-5-git-send-email-mario.kleiner.de@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454894009-15466-1-git-send-email-mario.kleiner.de@gmail.com> References: <1454894009-15466-1-git-send-email-mario.kleiner.de@gmail.com> Cc: daniel.vetter@ffwll.ch, michel@daenzer.net, linux@bernd-steinhauser.de, 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.3 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. Signed-off-by: Mario Kleiner 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 Reviewed-by: Daniel Vetter --- drivers/gpu/drm/drm_irq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 5c27ad3..fb17c45 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -1492,8 +1492,8 @@ 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 || + (!dev->vblank_disable_immediate && drm_vblank_offdelay > 0)) WARN_ON(drm_vblank_enable(dev, pipe)); spin_unlock_irqrestore(&dev->vbl_lock, irqflags); }