From patchwork Sat Sep 13 16:25:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 4899771 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4FEDF9F32F for ; Sat, 13 Sep 2014 16:21:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D723B200DE for ; Sat, 13 Sep 2014 16:26:01 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E267E2018E for ; Sat, 13 Sep 2014 16:26:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B6FB56E282; Sat, 13 Sep 2014 09:25:59 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com [74.125.82.45]) by gabe.freedesktop.org (Postfix) with ESMTP id 6DA266E235; Sat, 13 Sep 2014 09:25:57 -0700 (PDT) Received: by mail-wg0-f45.google.com with SMTP id z12so2109730wgg.16 for ; Sat, 13 Sep 2014 09:25:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; bh=Z2Fo9/oIeZmHkOET18P9ZUxHtYUvBr6n9O27onWvYtc=; b=krtjiI7v8W811mmlklp7nqNK8OjZbbuMYpMLUg1zwHJKEG2H7zuav7DP2//C0cA69H n7QljtK+rHMcnc3+N74QwLnlj9NLtNi6+60MddxAhUoyJ+Kw/PT7xPVHNPY+/9dedwp5 5ft9vkszWIp0g9qfzzrILNOTZcPoaxndNYkTVrDRwMIu4uXh/Q4/WC8usrv70lKCbqYX UxzyYqK4dmZ0SbeGgq85bxUMDORURWsEiGj0U0iLuQtC6H41wdLDNhvHjZGUFO2vJgAJ 3xf/EHsV5AOikrtvxnfcPc/SctozjIG8vJuC088Y8ABLAzciyiVX9N6ODaJxLXzI+WEd rZDQ== X-Received: by 10.194.60.240 with SMTP id k16mr20926204wjr.109.1410625556340; Sat, 13 Sep 2014 09:25:56 -0700 (PDT) Received: from [10.38.138.20] (connect.tuebingen.mpg.de. [192.124.26.250]) by mx.google.com with ESMTPSA id mx19sm5357368wic.3.2014.09.13.09.25.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Sep 2014 09:25:55 -0700 (PDT) Message-ID: <54147012.40609@gmail.com> Date: Sat, 13 Sep 2014 18:25:54 +0200 From: Mario Kleiner User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 MIME-Version: 1.0 To: ville.syrjala@linux.intel.com, dri-devel@lists.freedesktop.org Subject: Re: [PATCH 14/19] drm: Don't update vblank timestamp when the counter didn't change References: <1407325803-6944-1-git-send-email-ville.syrjala@linux.intel.com> <1407325803-6944-15-git-send-email-ville.syrjala@linux.intel.com> In-Reply-To: <1407325803-6944-15-git-send-email-ville.syrjala@linux.intel.com> Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org, Dave Airlie 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-6.6 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 The current drm-next misses Ville's original Patch 14/19, the one i first objected, then objected to my objection. It is needed to avoid actual regressions. Attached a trivially rebased (v2) of Ville's patch to go on top of drm-next, also as tgz in case my e-mail client mangles the patch again, because it's one of those "email hates me" weeks. -mario On 08/06/2014 01:49 PM, ville.syrjala@linux.intel.com wrote: > From: Ville Syrjälä > > If we already have a timestamp for the current vblank counter, don't > update it with a new timestmap. Small errors can creep in between two > timestamp queries for the same vblank count, which could be confusing to > userspace when it queries the timestamp for the same vblank sequence > number twice. > > This problem gets exposed when the vblank disable timer is not used > (or is set to expire quickly) and thus we can get multiple vblank > disable<->enable transition during the same frame which would all > attempt to update the timestamp with the latest estimate. > > Testcase: igt/kms_flip/flip-vs-expired-vblank > Signed-off-by: Ville Syrjälä > --- > drivers/gpu/drm/drm_irq.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c > index af33df1..0523f5b 100644 > --- a/drivers/gpu/drm/drm_irq.c > +++ b/drivers/gpu/drm/drm_irq.c > @@ -106,6 +106,9 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc) > DRM_DEBUG("enabling vblank interrupts on crtc %d, missed %d\n", > crtc, diff); > > + if (diff == 0) > + return; > + > /* Reinitialize corresponding vblank timestamp if high-precision query > * available. Skip this step if query unsupported or failed. Will > * reinitialize delayed at next vblank interrupt in that case. From c0a5228a7fc43d4c3615a471c340b68bcb2caa16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= Date: Wed, 6 Aug 2014 14:49:57 +0300 Subject: [PATCH] drm: Don't update vblank timestamp when the counter didn't change (v2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If we already have a timestamp for the current vblank counter, don't update it with a new timestmap. Small errors can creep in between two timestamp queries for the same vblank count, which could be confusing to userspace when it queries the timestamp for the same vblank sequence number twice. This problem gets exposed when the vblank disable timer is not used (or is set to expire quickly) and thus we can get multiple vblank disable<->enable transition during the same frame which would all attempt to update the timestamp with the latest estimate. Testcase: igt/kms_flip/flip-vs-expired-vblank Signed-off-by: Ville Syrjälä Reviewed-by: Mario Kleiner v2:Mario: Trivial rebase on top of current drm-next (13-Sep-2014) Signed-off-by: Mario Kleiner --- drivers/gpu/drm/drm_irq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 80ff94a..e73cbda 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -126,6 +126,9 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc) DRM_DEBUG("updating vblank count on crtc %d, missed %d\n", crtc, diff); + if (diff == 0) + return; + /* Reinitialize corresponding vblank timestamp if high-precision query * available. Skip this step if query unsupported or failed. Will * reinitialize delayed at next vblank interrupt in that case. -- 1.9.1