[Bug 1267977] Re: Extreme jerkiness with kwin compositing on Nvidia binary driver after upgrading to 4.11.5.

Bug Watch Updater 1267977 at bugs.launchpad.net
Sat Feb 1 22:07:36 UTC 2014


Launchpad has imported 51 comments from the remote bug at
https://bugs.kde.org/show_bug.cgi?id=329821.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2014-01-10T19:28:35+00:00 Michael Marley wrote:

On my Kubuntu 14.04 (Trusty) system with an Nvidia graphics card and
version 331.20 of the binary driver, I began having a problem with very
jerky/juddery graphics after updating from kde-workspace 4.11.4 to
4.11.5.  (The rest of the system is on 4.12.)  About every half-second
or so, everything moving or animating on the screen jerks very
noticeably.  This occurs for both OpenGL things like glxgears and for 2D
things like scrolling in Firefox.

Looking through the changelog for 4.11.5, it would seem that the issue
probably would have been caused by this:
https://git.reviewboard.kde.org/r/114162/.  However, using the
KWIN_USE_BUFFER_AGE=0 environment variable does not eliminate the
jerkiness.  It does, however, introduce tearing, unless I set "Tearing
Prevention (VSync)" to "Full Scene Repaints."

Reproducible: Always

Steps to Reproduce:
1. Get a system with an Nvidia graphics card and install a GLX_EXT_BUFFER_AGE-supporting driver version.
2. Install/upgrade to kwin 4.11.5.
3. Launch glxgears
Actual Results:  
glxgears should run smoothly without dropping any frames.

Expected Results:  
glxgears jerks noticeably about twice every second.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/0

------------------------------------------------------------------------
On 2014-01-10T19:32:56+00:00 Thomas-luebking wrote:

please provide the output of "qdbus org.kde.kwin /KWin
supportInformation", "env | grep GL" and "grep -i triple
/var/log/Xorg.0.log"

you may also blindly try
export __GL_YIELD="USLEEP"
kwin --replace &

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/2

------------------------------------------------------------------------
On 2014-01-10T19:36:08+00:00 Michael Marley wrote:

I already had __GL_YIELD set to USLEEP and triple buffering turned on in
my xorg.conf.

When I tried to run your first command, I got "qdbus: could not find a
Qt installation of ''", but I think this is an unrelated issue with my
system that I am troubleshooting now.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/3

------------------------------------------------------------------------
On 2014-01-10T19:36:58+00:00 Michael Marley wrote:

I also tried all combinations of __GL_YIELD and triple-buffering
settings, but none had any effect.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/4

------------------------------------------------------------------------
On 2014-01-10T19:37:16+00:00 Thomas-luebking wrote:

install the qtchooser package (also there's maybe "qdbus-qt4")

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/5

------------------------------------------------------------------------
On 2014-01-10T19:39:12+00:00 Michael Marley wrote:

Thanks, that worked.  Here is the output:
http://pastebin.kde.org/pgzbj8jy4

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/6

------------------------------------------------------------------------
On 2014-01-10T19:58:03+00:00 Thomas-luebking wrote:

it says: "KWin version: 4.11.4"?
Also the determined tearing prevention is frontbuffer re-usage (likely from "auto")

what happens if you disable buffer_age, set tearing prevention to none
(cheap, full repaints - *not* front buffer copying nor automatic) and
restart "kwin --replace&"?

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/8

------------------------------------------------------------------------
On 2014-01-10T20:00:09+00:00 Michael Marley wrote:

Yeah, sorry about that.  I downgraded back to 4.11.4 to get rid of the
jerking.  If you want, I can upgrade back to 4.11.5 and run the command
again.

On 4.11.5, if I disable buffer_age and set full repaints, I get smooth
motion and no tearing.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/9

------------------------------------------------------------------------
On 2014-01-10T20:04:35+00:00 Thomas-luebking wrote:

what about jerkyness for no buffer_age and front buffer re-usage?

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/10

------------------------------------------------------------------------
On 2014-01-10T20:07:25+00:00 Michael Marley wrote:

With that combination, I get both tearing and jerkiness.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/11

------------------------------------------------------------------------
On 2014-01-10T20:10:18+00:00 Michael Marley wrote:

Additionally, it seems that with those settings, the tearing and the
jerkiness are "synchronized."  At the same time glxgears jerks, the line
of tearing appears on the konsole window I am dragging above it.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/12

------------------------------------------------------------------------
On 2014-01-10T20:12:54+00:00 Thomas-luebking wrote:

-> buffer_age on and tearing prevention to none?

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/13

------------------------------------------------------------------------
On 2014-01-10T20:17:52+00:00 Michael Marley wrote:

In that mode, 2D applications like Firefox are smooth but with lots of
tearing.  glxgears tears heavily in the middle 1/3 of the screen.  It is
jerky in the area that tears but smooth otherwise.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/14

------------------------------------------------------------------------
On 2014-01-10T20:20:22+00:00 Thomas-luebking wrote:

-> "only when cheap" (what should be the case for buffer_age)

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/15

------------------------------------------------------------------------
On 2014-01-10T20:22:09+00:00 Michael Marley wrote:

That setting produces the same results as Automatic.  (Everything jerks
twice a second, no tearing.)

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/16

------------------------------------------------------------------------
On 2014-01-13T17:48:44+00:00 Michael Marley wrote:

I just tried with the newly-released Nvidia 331.38 driver and the bug
still occurs.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/17

------------------------------------------------------------------------
On 2014-01-13T20:13:28+00:00 Thomas-luebking wrote:

Random guess:
1. ensure that triple buffering is really enabled:
  grep -i triple /var/log/Xorg.0.log
2. next convince kwin about it
   export KWIN_TRIPLE_BUFFER=1
   kwin --replace &

The problem here is that full scene repaints do not seem to cause a
problem, so it cannot be swapping by itself (though you should ensure
that flipping is enabled in nvidia-settings, GL settings page) and
either frontbuffer reading or buffer_age.

What's even more weird is that you claim tearing for frontbuffer reading, what can only have two pot. causes:
1. no flipping (see above)
2. tearing in the client (activate the "show paint" effect, it's worthless for buffer_age or full scene repaints, though)

But either case would also apply to full scene repaints.

One last resort: try to disable blurring.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/18

------------------------------------------------------------------------
On 2014-01-13T21:03:51+00:00 Michael Marley wrote:

Thanks!  The "export KWIN_TRIPLE_BUFFER=1" thing completely clears up
the jerkiness!

I still consider this a bug though, because the jerkiness occurs even
when I have triple buffering turned off in xorg.conf.  Perhaps kwin
should be able to automatically detect when triple buffering is taking
place?

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/19

------------------------------------------------------------------------
On 2014-01-13T21:40:57+00:00 Thomas-luebking wrote:

*sigh*

It does try to detect whether triple buffering is enabled and that is (in a way) crucial to know.
Unfortunately there's no "legal" way to know this, so it's measured at runtime and that used to work nicely in the past (and still does here)

-> Can you please check how much time buffer swapping takes during the
detection?

To do so, you'd have to run "kdebugdialog --fullmode", filter for kwin
(1212) and redirect all output to some file, e.g. /tmp/kwin.dbg

The file will after a short time (500 screen updates) contain a "Triple
buffering detection" line which will indicate whether triple buffering
is assumed to be available and the mean blocking time of
glSwapBuffers().

related bug #322060 and bug #329297

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/20

------------------------------------------------------------------------
On 2014-01-14T19:08:22+00:00 Michael Marley wrote:

I tried this but I do not get any such message about triple buffering.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/21

------------------------------------------------------------------------
On 2014-01-14T20:15:41+00:00 Thomas-luebking wrote:

Sorry, I should have mentioned that you must *not* export
KWIN_TRIPLE_BUFFER or the heuristic detection won't take place at all.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/22

------------------------------------------------------------------------
On 2014-01-14T21:07:32+00:00 Michael Marley wrote:

I tried again just to make sure, but even when I comment out the export
from my .profile and reboot, I still don't get anything about triple
buffering detection in the debug output.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/23

------------------------------------------------------------------------
On 2014-01-14T22:24:09+00:00 Thomas-luebking wrote:

it requires 500 full repaints - if you did not enable buffer_age or full
scene repaints or frontbuffer copying as tearing prevention, this can
last quite a while.

Can you attach the generated file?

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/24

------------------------------------------------------------------------
On 2014-01-14T22:26:38+00:00 Michael Marley wrote:

I do have buffer_age enabled, and I waited at least 5 minutes before
checking the file.  I am going to have to go away in just a minute, but
I will test it again when I get a chance.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/25

------------------------------------------------------------------------
On 2014-01-20T13:53:34+00:00 Michael Marley wrote:

Created attachment 84748
KWin debugging output with KWIN_TRIPLE_BUFFER undefined

Sorry for the delay.  Here is the output.  I commented out the
KWIN_TRIPLE_BUFFER in my ,profile, rebooted, and ran glxgears in
fullscreen for about 30 seconds to make sure it had rendered enough
frames.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/26

------------------------------------------------------------------------
On 2014-01-20T18:15:34+00:00 Michael Marley wrote:

I have also noticed that after enabling KWIN_TRIPLE_BUFFER, sometimes I
get more lag between the cursor and the window when dragging windows
around the screen, especially if I drag the window in circles.  It isn't
that bad, but I thought you should know anyway.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/27

------------------------------------------------------------------------
On 2014-01-20T20:55:42+00:00 Thomas-luebking wrote:

something is fishy here.

a) please provide
- /var/log/Xorg.0.log
- glxinfo > my.glxinfo
- nvidia-settings -q all > my.nvsettings
- cat /proc/`pidof kwin`/environ > my.kwinenv

b) did you really redirect *all* level outputs for 1212/kwin in
"kdebugdialog --fullmode"?

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/28

------------------------------------------------------------------------
On 2014-01-20T21:07:32+00:00 Michael Marley wrote:

Created attachment 84755
Xorg.0.log

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/29

------------------------------------------------------------------------
On 2014-01-20T21:08:38+00:00 Michael Marley wrote:

Created attachment 84756
my.glxinfo

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/30

------------------------------------------------------------------------
On 2014-01-20T21:09:02+00:00 Michael Marley wrote:

Created attachment 84757
my.kwinenv

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/31

------------------------------------------------------------------------
On 2014-01-20T21:09:34+00:00 Michael Marley wrote:

Created attachment 84758
my.nvsettings

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/32

------------------------------------------------------------------------
On 2014-01-20T21:12:16+00:00 Michael Marley wrote:

I did redirect all the output for "1212 kwin" to that file.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/33

------------------------------------------------------------------------
On 2014-01-20T22:11:08+00:00 Thomas-luebking wrote:

You're overriding FSAA (multisampling), it's not re-overridden by an enviroment in kwin.
So unless you've an application profile for kwin in nvidia settings that sets GLFSAAMode to 0x0, that will cause some significant GPU load.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/34

------------------------------------------------------------------------
On 2014-01-20T22:33:25+00:00 Michael Marley wrote:

I do in fact have an application profile configured for kwin that turns
AA and AF off.  Sorry, I forgot to mention that.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/35

------------------------------------------------------------------------
On 2014-01-24T21:27:41+00:00 Thomas-luebking wrote:

grrrr... it's because the buffer_age patch exits the paint function early and completely bypasses the triple buffer detection.
Can/Do you want to try a patch?

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/36

------------------------------------------------------------------------
On 2014-01-24T21:40:34+00:00 Michael Marley wrote:

Sure, I can try a patch.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/37

------------------------------------------------------------------------
On 2014-01-24T21:43:00+00:00 Thomas-luebking wrote:

See here:
https://git.reviewboard.kde.org/r/115306/

Sorry that it took so long (that's apparently why everyone says that
early exits are evil ;-)

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/38

------------------------------------------------------------------------
On 2014-01-24T21:44:06+00:00 Michael Marley wrote:

OK, compiling now.  This may take a while; my compile box is an old Core
2 Duo machine.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/39

------------------------------------------------------------------------
On 2014-01-24T23:35:00+00:00 Michael Marley wrote:

Thanks, this patch works!  After a few seconds, the log message
indicates that kwin detected triple buffering and the jerkiness clears
up.

However, I still am getting that lag I was talking about earlier when
dragging windows.  That only started happening after buffer_age was
introduced.  Should I file another bug for that?

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/40

------------------------------------------------------------------------
On 2014-01-25T14:22:11+00:00 Thomas-luebking wrote:

Does the lagging ever occur during a session or only right after login?

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/41

------------------------------------------------------------------------
On 2014-01-25T14:31:44+00:00 Michael Marley wrote:

It can happen anytime, but doesn't always happen.  A pretty reliable way
to reproduce it for me is to drag a window around in large circles on
the screen at a rate of about one circle per second.  When I do that,
the window lags quite a ways behind the mouse cursor.  Curiously, I
haven't noticed any lag when doing other things, such as dragging
scrollbars or playing games.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/42

------------------------------------------------------------------------
On 2014-01-25T14:42:21+00:00 Thomas-luebking wrote:

Circular movement is just a good way to outpace systems, so that's not
too special.

When this happens, does
- re-initiating a new drag
- restaring the compositor (Shift+Alt+F12 twice)
stop it?

Is there exceptonally high CPU load?

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/43

------------------------------------------------------------------------
On 2014-01-25T15:06:03+00:00 Michael Marley wrote:

During the dragging, kwin is using about 8% of the CPU and Xorg is using
about 4% (both as measured by htop.)  I don't even have to restart
compositing to make the lag go away.  If I stop dragging the window, it
goes away immediately.  Also, this didn't happen before buffer_age was
introduced.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/44

------------------------------------------------------------------------
On 2014-01-25T15:07:47+00:00 Thomas-luebking wrote:

(In reply to comment #42)
> I don't even have to restart
> compositing to make the lag go away.  If I stop dragging the window, it goes
> away immediately.

Just to be absolutely certain about this:
that means a subsequent drag does not show this symptom?

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/45

------------------------------------------------------------------------
On 2014-01-25T15:08:56+00:00 Michael Marley wrote:

Not unless I start dragging it in circles again.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/46

------------------------------------------------------------------------
On 2014-01-25T15:15:38+00:00 Thomas-luebking wrote:

That means it's permanent.
Try to toggle compositing off. Still laggy?
Toggle compositing on again. Still laggy?

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/47

------------------------------------------------------------------------
On 2014-01-25T15:19:13+00:00 Michael Marley wrote:

With compositing off, there is no lag.  When I re-enable it, the lag
comes back.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/48

------------------------------------------------------------------------
On 2014-01-26T20:13:46+00:00 Thomas-luebking wrote:

I guess it feels like moving through jelly, the window follows the mouse
- it does not hang and then jump to the mouse position?

Dev note:
This would mean we load the swapbuffer with too many swaps what can basically have two reasons:

1. misdetection/overridden refreshrate/MaxFPS
2. triplebuffer misdetection (assumed to be NOT available, while it indeed is)

According to the present debug output, the refreshrate is detected as
60Hz (what is supported by the nvidia-settings query) - so it had to be
3buf detection, just that comment #25 explicitly states that this
occurred WITH KWIN_TRIPLE_BUFFER=1 ...

So there must be a third reason to overcommit frames (could be broken
paint time calculation)

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/49

------------------------------------------------------------------------
On 2014-01-26T20:24:34+00:00 Michael Marley wrote:

My monitor does run at 60Hz and I do have KWIN_TRIPLE_BUFFER=1 set, so
that sounds right.

And moving through jelly is a good description.  It is still smooth, but
just is smooth farther behind the mouse cursor than it was before
buffer_age was introduced.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/50

------------------------------------------------------------------------
On 2014-01-29T02:55:59+00:00 Michael Marley wrote:

I just discovered a reliable way to reproduce the lag at any time.  If I
run an application that is playing a video or doing any kind of
continuous animation, it makes all window dragging lag in exactly the
same way I described with the circular dragging earlier.

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/51

------------------------------------------------------------------------
On 2014-01-29T19:22:36+00:00 Thomas-luebking wrote:

Git commit bb9f76e1aede42fcd51edf298e4d8a0b942ff6ac by Thomas Lübking.
Committed on 24/01/2014 at 21:29.
Pushed by luebking into branch 'KDE/4.11'.

merge buffer_age render into general render code

avoiding the blocking swapinterval detection causes
issues in the timing strategy and prevents protection
against CPU overload on the nvidia blob
FIXED-IN: 4.11.6
REVIEW: 115306

M  +8    -10   kwin/eglonxbackend.cpp
M  +8    -10   kwin/glxbackend.cpp

http://commits.kde.org/kde-
workspace/bb9f76e1aede42fcd51edf298e4d8a0b942ff6ac

Reply at: https://bugs.launchpad.net/ubuntu/+source/kde-
workspace/+bug/1267977/comments/52


** Changed in: kdebase-workspace
       Status: Unknown => Fix Released

** Changed in: kdebase-workspace
   Importance: Unknown => Medium

-- 
You received this bug notification because you are a member of Kubuntu
Bugs, which is subscribed to kde-workspace in Ubuntu.
https://bugs.launchpad.net/bugs/1267977

Title:
  Extreme jerkiness with kwin compositing on Nvidia binary driver after
  upgrading to 4.11.5.

To manage notifications about this bug go to:
https://bugs.launchpad.net/kdebase-workspace/+bug/1267977/+subscriptions




More information about the kubuntu-bugs mailing list