Bug 74195 - [NVCE] Responsivity to input with vsync on is slower after update
Summary: [NVCE] Responsivity to input with vsync on is slower after update
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/nouveau (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Nouveau Project
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-29 20:23 UTC by Jan Janecek
Modified: 2014-02-19 03:34 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Jan Janecek 2014-01-29 20:23:28 UTC
I use compton compositing manager wich uses DRM_IOCTL_WAIT_VBLANK for vsync.
Recently I updated from kernel 3.9 to 3.13 and responsivness (or "input lag" or however it's called) got much worse, mostly noticable when moving windows or scrolling. With kernel 3.13 the windows are 3-5 frames behind mouse when moving, on 3.9 kernel they were only 0-1 frames behind. I also tried kwin, wich had less noticable slowdown (from 1-2 frames behind to 3-5 frames behind).

I tried different kernel versions from nouveau git and found out, that the slowdown was caused by this commit: http://cgit.freedesktop.org/nouveau/linux-2.6/commit/?id=0fa9061ae8c10a9178d696cf48d94c3bf2848f9f

I guess the commit is important and can't be undone, but the bad responsiveness really annoys me, so I would be glad if there is a solution.

GPU is GTX 560 Ti
xserver 1.14.5
xorg-video-nouveau 1.0.10
libdrm 2.4.52
(Debian sid)
Comment 1 Ilia Mirkin 2014-01-29 20:45:21 UTC
On the surface, this should have been a no-op change. You say you tried different kernel versions... is that to say you did a git bisect? e.g. can you confirm that 0fa9061ae8c10a9178d696cf48d94c3bf2848f9f has the issue but 0fa9061ae8c10a9178d696cf48d94c3bf2848f9f^ doesn't?

One small difference that I noticed is that if stat == ~0 in the old code it'll return IRQ_NONE, whereas it will try to handle it in after the patch. I can't imagine that matters here though.

Something to look at is what it is that the drm framework provided with the irq's that's not done by nouveau now.
Comment 2 Jan Janecek 2014-01-29 21:12:36 UTC
I can confirm that 0fa9061ae8c10a9178d696cf48d94c3bf2848f9f has the problem and b9a3140ce8fcd616b02533fbdef375a87a910daf (previous commit) does'nt.
Comment 3 Ilia Mirkin 2014-01-29 22:38:47 UTC
Actually the current code handles the intr == ~0 bit. The only other thing of mild consequence is that drm_device->irq_enabled is no longer set.

Can you try adding

dev->irq_enabled = true;

to nouveau_drm.c:nouveau_drm_load somewhere after things look like they succeed? Or perhaps right before the nouveau_display_create, where it was before the patch. [And in an ideal world, one would also set it to false at some point, e.g. nouveau_drm_unload, but I doubt that's important for this experiment.]
Comment 4 Jan Janecek 2014-01-29 23:08:35 UTC
(In reply to comment #3)
> Actually the current code handles the intr == ~0 bit. The only other thing
> of mild consequence is that drm_device->irq_enabled is no longer set.
> 
> Can you try adding
> 
> dev->irq_enabled = true;
> 
> to nouveau_drm.c:nouveau_drm_load somewhere after things look like they
> succeed? Or perhaps right before the nouveau_display_create, where it was
> before the patch. [And in an ideal world, one would also set it to false at
> some point, e.g. nouveau_drm_unload, but I doubt that's important for this
> experiment.]

This fix solved the problem for 0fa9061ae8c10a9178d696cf48d94c3bf2848f9f! That's great!

I will try if it works for 3.13 too.
Comment 5 Jan Janecek 2014-01-29 23:14:45 UTC
Yes, the fix works for 3.13 too. Thank you so much!
Comment 6 Emil Velikov 2014-01-29 23:21:24 UTC
Great catch Ilia,

from the DocBook [1]

Manual IRQ Registration
  ... They must set the
  <structname>drm_device</structname> <structfield>irq_enabled</structfield>
  field to 1 upon registration of the IRQs, and clear it to 0 after
  unregistering the IRQs.


[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/DocBook/drm.tmpl#n374
Comment 7 Ilia Mirkin 2014-02-19 03:34:19 UTC
The fix is now upstream and will be included in the next 3.14-rc as well as be backported to the affected stable kernels.

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7d3428cd4b2ad51af86fdbdf8284ca38fa95e601


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.