From: Daniel Vetter Subject: Re: [PATCH] drm: Don't pass negative delta to ktime_sub_ns() Date: Thu, 13 Jun 2013 09:40:41 +0200 Message-ID: <20130613074041.GK22870@phenom.ffwll.local> References: <1371031124-8867-1-git-send-email-michel@daenzer.net> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-ea0-f171.google.com (mail-ea0-f171.google.com [209.85.215.171]) by gabe.freedesktop.org (Postfix) with ESMTP id D1AC3E5D75 for ; Thu, 13 Jun 2013 00:40:45 -0700 (PDT) Received: by mail-ea0-f171.google.com with SMTP id m14so7473493eaj.2 for ; Thu, 13 Jun 2013 00:40:45 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1371031124-8867-1-git-send-email-michel@daenzer.net> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Michel =?iso-8859-1?Q?D=E4nzer?= Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On Wed, Jun 12, 2013 at 11:58:44AM +0200, Michel D=E4nzer wrote: > From: Michel D=E4nzer > = > It takes an unsigned value. This happens not to blow up on 64-bit > architectures, but it does on 32-bit, causing > drm_calc_vbltimestamp_from_scanoutpos() to calculate totally bogus > timestamps for vblank events. Which in turn causes e.g. gnome-shell to > hang after a DPMS off cycle with current xf86-video-ati Git. > = > Cc: stable@vger.kernel.org > Signed-off-by: Michel D=E4nzer Our paranoid flip tester apparently hit this: Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=3D59339 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=3D59836 Tested-by: shui yangwei Cheers, Daniel > --- > drivers/gpu/drm/drm_irq.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > = > diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c > index a6a8643..39665f8 100644 > --- a/drivers/gpu/drm/drm_irq.c > +++ b/drivers/gpu/drm/drm_irq.c > @@ -708,7 +708,10 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm= _device *dev, int crtc, > /* Subtract time delta from raw timestamp to get final > * vblank_time timestamp for end of vblank. > */ > - etime =3D ktime_sub_ns(etime, delta_ns); > + if (delta_ns < 0) > + etime =3D ktime_add_ns(etime, -delta_ns); > + else > + etime =3D ktime_sub_ns(etime, delta_ns); > *vblank_time =3D ktime_to_timeval(etime); > = > DRM_DEBUG("crtc %d : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep= ]\n", > -- = > 1.8.3 > = > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel -- = Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch