From patchwork Wed Aug 6 01:22:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 4682841 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8EE59C0338 for ; Wed, 6 Aug 2014 01:23:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CAC3C20170 for ; Wed, 6 Aug 2014 01:23:53 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 013F22018E for ; Wed, 6 Aug 2014 01:23:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2284F6E56C; Tue, 5 Aug 2014 18:23:52 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by gabe.freedesktop.org (Postfix) with ESMTP id 8C92C6E56C for ; Tue, 5 Aug 2014 18:23:50 -0700 (PDT) Received: by mail-wi0-f182.google.com with SMTP id d1so2350854wiv.9 for ; Tue, 05 Aug 2014 18:23:49 -0700 (PDT) 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=hbnWIDbywV2+xD0q/xoj68LVPpy3Oyiqofom9Wr5qXM=; b=q2wsHGTiJy7Nb42uC6GSXVxHDUABrlvPjc/cwawUMFRGiJ93qYMnqn5muomzxktp4N udZUahT19bCACDz5PZBH2HO4rz/9HHsGw+qlikl/9OfLyigoPfzvHGAfrbeAYGSvdVYD Y5iU0WkzdUAdt2AY7Bhkp+Z9U0wtxEv6uwcYdioJMU8o5vO4TmPhfdu974ZNnjYTR0R0 vnrd0Hbu3Rxpp194QJ23cAO6PvgcSH/jZIWa5KyrGYFidKK/OlSQQrYwFPSiC1P779tc rI2NBBAOT0Cdq45dI6xf6xQC8MUR9GX9E5eJjIshr72YxTJKXpw1FbslPJeieZwaX0HM 1Wpg== X-Received: by 10.194.71.52 with SMTP id r20mr10472541wju.113.1407288229726; Tue, 05 Aug 2014 18:23:49 -0700 (PDT) Received: from twisty.fritz.box (stgt-4d02fac6.pool.mediaWays.net. [77.2.250.198]) by mx.google.com with ESMTPSA id wi9sm7913539wjc.23.2014.08.05.18.23.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Aug 2014 18:23:49 -0700 (PDT) From: Mario Kleiner To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/3] drm: Fix emitted vblank timestamps in drm_vblank_off() Date: Wed, 6 Aug 2014 03:22:45 +0200 Message-Id: <1407288166-19881-3-git-send-email-mario.kleiner.de@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1407288166-19881-1-git-send-email-mario.kleiner.de@gmail.com> References: <1407288166-19881-1-git-send-email-mario.kleiner.de@gmail.com> Cc: airlied@redhat.com, stable@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 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.8 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 Move the query for vblank count and time before the vblank_disable_and_save(), because the disable fn will invalidate the vblank timestamps, so all emitted events would carry an invalid zero timestamp instead of the timestamp of the vblank of vblank disable. This could confuse clients. Signed-off-by: Mario Kleiner Cc: stable@vger.kernel.org --- drivers/gpu/drm/drm_irq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 553a58c..89e91e3 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -1019,13 +1019,14 @@ void drm_vblank_off(struct drm_device *dev, int crtc) unsigned long irqflags; unsigned int seq; + /* Get 'now' vblank ts before it gets cleared by vblank disable */ + seq = drm_vblank_count_and_time(dev, crtc, &now); + spin_lock_irqsave(&dev->vbl_lock, irqflags); vblank_disable_and_save(dev, crtc); wake_up(&dev->vblank[crtc].queue); /* Send any queued vblank events, lest the natives grow disquiet */ - seq = drm_vblank_count_and_time(dev, crtc, &now); - spin_lock(&dev->event_lock); list_for_each_entry_safe(e, t, &dev->vblank_event_list, base.link) { if (e->pipe != crtc)