From: Imre Deak <imre.deak@intel.com>
To: "Michel Dänzer" <michel@daenzer.net>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm: Don't pass negative delta to ktime_sub_ns()
Date: Wed, 12 Jun 2013 13:50:54 +0300 [thread overview]
Message-ID: <1371034254.9816.5.camel@ideak-mobl> (raw)
In-Reply-To: <1371031124-8867-1-git-send-email-michel@daenzer.net>
On Wed, 2013-06-12 at 11:58 +0200, Michel Dänzer wrote:
> From: Michel Dänzer <michel.daenzer@amd.com>
>
> 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änzer <michel.daenzer@amd.com>
Yes, I introduced this regression in:
drm: use monotonic time in drm_calc_vbltimestamp_from_scanoutpos
The fix seems to be ok, perhaps you should also mention the regressing
commit in the commit message.
Reviewed-by: Imre Deak <imre.deak@intel.com>
> ---
> 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 = ktime_sub_ns(etime, delta_ns);
> + if (delta_ns < 0)
> + etime = ktime_add_ns(etime, -delta_ns);
> + else
> + etime = ktime_sub_ns(etime, delta_ns);
> *vblank_time = ktime_to_timeval(etime);
>
> DRM_DEBUG("crtc %d : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n",
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2013-06-12 10:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-12 9:58 [PATCH] drm: Don't pass negative delta to ktime_sub_ns() Michel Dänzer
2013-06-12 10:48 ` Chris Wilson
2013-06-12 11:06 ` Chris Wilson
2013-06-12 10:50 ` Imre Deak [this message]
2013-06-13 7:40 ` Daniel Vetter
2013-07-17 11:58 ` Chris Wilson
2013-08-07 8:42 ` Michel Dänzer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1371034254.9816.5.camel@ideak-mobl \
--to=imre.deak@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=michel@daenzer.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).