Bug 352019 - Qt5 drag pixmaps lag behind mouse cursor
Summary: Qt5 drag pixmaps lag behind mouse cursor
Status: RESOLVED NOT A BUG
Alias: None
Product: kwin
Classification: Plasma
Component: scene-opengl (show other bugs)
Version: 5.4.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL: http://galactica.no-ip.org/index.php/...
Keywords:
: 352051 356061 361296 363356 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-08-30 13:19 UTC by Soukyuu
Modified: 2016-06-04 14:25 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
qdbus org.kde.KWin /KWin supportInformation (5.40 KB, text/plain)
2015-08-30 13:22 UTC, Soukyuu
Details
qdbus org.kde.KWin /KWin supportInformation output (55.49 KB, text/plain)
2015-09-03 12:37 UTC, Artur O.
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Soukyuu 2015-08-30 13:19:02 UTC
As per [1], dragging items on 5.4 makes them lag behind the cursor (also see linked video). Issue did not happen on 5.3.2

Items affected:
* folders and items in dolphin.
* plasma add widgets (dragging it from the menu to drop on the desktop)
* plasma items on panels etc

[1] https://bbs.archlinux.org/viewtopic.php?pid=1556899#p1556899

Reproducible: Always

Steps to Reproduce:
1. Have compositing enabled
2. Drag an item

Actual Results:  
Item lags behind mouse cursor

Expected Results:  
Item sticks to mouse cursor

nvidia 340xx drivers, latest arch linux packages. Compositing is using GLX. Switching to XRender doesn't trigger the issue. I've had something similar happen on pre-5.4, but with compositing DISabled. Now it's happening while it's ENabled instead.
Comment 1 Soukyuu 2015-08-30 13:22:07 UTC
Created attachment 94287 [details]
qdbus org.kde.KWin /KWin supportInformation
Comment 2 Thomas Lübking 2015-08-30 17:06:40 UTC
- is eg. moving windows equally slow?
- does maybe simply restarting the compositor (w/o changing the backend) help as well?
> Painting blocks for vertical retrace:  no
Though not directly related, what's the output of "grep -i triple /var/log/Xorg.0.log"?
Comment 3 Soukyuu 2015-08-30 23:44:03 UTC
- moving windows is fast, as usual
- kwin_x11 --replace or toggling with shift+alt+f12 doesn't do anything
- output for "grep -i triple /var/log/Xorg.0.log" was empty, but after I added the TrippleBuffer option trying to get fluid mpv playback it changed to:
[     4.405] (**) NVIDIA(0): Option "TripleBuffer"

Issue still persists though.
Comment 4 Soukyuu 2015-08-31 00:13:59 UTC
Make that "[     4.378] (**) NVIDIA(0): Option "TripleBuffer" "True"", noticed I forgot to add the "True" part. There is a slight improvement with 5.4.0, but 5.3.2 is now less responsive.
Comment 5 Thomas Lübking 2015-08-31 06:21:12 UTC
Ok, since windows move as expected and also the display updates in other regions, it's not kwin or the driver lagging frames; we must assume that the client has indeed trouble to reposition the item.

The only "interaction" with kwin I could atm. think of is KWIN_EXPLICIT_SYNC.

- Did you also test the impact of "export KWIN_EXPLICIT_SYNC=0" on this?
- How's CPU load while dragging those items?


https://forum.kde.org/viewtopic.php?f=111&t=128058
Comment 6 Soukyuu 2015-08-31 11:08:59 UTC
- export KWIN_EXPLICIT_SYNC=0 makes things even better, but still lagging
- CPU usage is about 36% on an AMD X4 970BE@3.5GHz, it only uses the 2.65GHz clock rate at most, though. Highest offender is xorg with ~22%, followed by dolphin ~6% and kwin ~5%

It seems that moving on a straight line has the least impact, but any curved movement makes it lag very badly.
Comment 7 Thomas Lübking 2015-09-01 13:51:46 UTC
Is this KF/5 dolphin and in case: does dragging items from some Qt4/KDE4 application (kdebase-konqueror uses the KDE4 dolphinpart) lag as well?
Comment 8 Soukyuu 2015-09-01 15:26:42 UTC
It's not just dolphin, but yes, kf5
And yes, konqueror doesn't lag, the item sticks to the cursor at all times.
Comment 9 Thomas Lübking 2015-09-01 15:43:52 UTC
This smells like some problem in Qt5 input handling in the client (dolphin) like it queues the mouse movements and then handles them one-by-one, with far too much delay between the individual events (instead of eg. dropping all events but the last)

(The alternative of KWin handling unmanaged geometry changes too slow would affect the KDE4 drags likewise)

The "did not happen in 5.3.2" claim may be a red herring then (for arch shipped dolphin/4 at that time)?

The "far too much delay" will be caused by some opengl/x11/xcb collision, but don't ask me what.
Do you use xf86-input-evdev or xf86-input-libinput as mouse driver?
Comment 10 Soukyuu 2015-09-01 15:50:22 UTC
> The "did not happen in 5.3.2" claim may be a red herring then (for arch shipped dolphin/4 at that time)?

Yes, arch shipped dolphin/4 (15.04) at that time. However, I don't remember dragging widgets to the desktop be affected before 5.4, so maybe it's valid after all?

> Do you use xf86-input-evdev or xf86-input-libinput as mouse driver?

xf86-input-evdev, according to pacman.
Comment 11 alfaflo 2015-09-02 19:09:54 UTC
I've the same problem: openSUSE 13.2 with Plasma 5.4 and KDE applications 15.08
With former release (Plasma 5.3 and KDE applications 15.04) it worked smooth as Soukyuu described it.
I also have a nvidia card with proprietary drivers installed.
Comment 12 Thomas Lübking 2015-09-02 19:54:57 UTC
Which nvidia driver (I'm, on 352.30)
Random guess: Do you use a mouse or a touchpad?
Comment 13 Christoph Feck 2015-09-03 10:01:29 UTC
*** Bug 352051 has been marked as a duplicate of this bug. ***
Comment 14 Artur O. 2015-09-03 12:29:48 UTC
This happens also in Teamspeak3 etc. Installed Gnome Classic and I could drag icons fast again so its something in KF5 that affects pretty much every application.

I also noticed that if you toggle compositing off it also happens sometimes when dragging Windows. 

Also updated link to video: http://galactica.no-ip.org/index.php/s/6aYCybuQBmXQuXU
(had expiration date set)
Comment 15 Artur O. 2015-09-03 12:37:40 UTC
Created attachment 94371 [details]
qdbus org.kde.KWin /KWin supportInformation output

Also forgot, this happens with mouse.
(In gnome classic i only tested dragging the desktop icons)
Comment 16 Thomas Lübking 2015-09-03 13:22:19 UTC
> You are correct, disabling compositing also shows this when moving windows. Im confused about this.

I'd say there's a problem with xcb event processing in Qt5 applications (ie. they receive the mouse event too late)
It's weird though that this affects either uncomposited KWin or composited DnD.

Arch has few updates for me in the pipeline - let's see what happens ;-)
Comment 17 alfaflo 2015-09-03 13:36:37 UTC
(In reply to Thomas Lübking from comment #12)
> Which nvidia driver (I'm, on 352.30)
> Random guess: Do you use a mouse or a touchpad?

nvidia driver 340.76 (I think latest one for 9XXX series...)
I'm using a mouse but touchpad is activated in parallel.
Comment 18 Thomas Lübking 2015-09-03 14:18:45 UTC
Nope, no lagging here :-(
Comment 19 alfaflo 2015-09-03 16:29:14 UTC
(In reply to alfaflo from comment #17)
> (In reply to Thomas Lübking from comment #12)
> > Which nvidia driver (I'm, on 352.30)
> > Random guess: Do you use a mouse or a touchpad?
> 
> nvidia driver 340.76 (I think latest one for 9XXX series...)
> I'm using a mouse but touchpad is activated in parallel.

Hello Thomas

I've tried the integrated touch pad and there is no lag - the icons "follow" the cursor instantly. Problem only exists using the mouse (Logitech G400 optical mouse)...
Comment 20 Thomas Lübking 2015-09-03 18:03:15 UTC
A-ha!

Wild guess #2 - can you lower (or just alter) the resolution of that device?
(try https://wiki.archlinux.org/index.php/Lomoco if it doesn't have a HW button)

----
So let's record our rodents:
Me never dropped my Logitech MX500 (and yes: it is from 2002 or so) but also tried a broken MS-Tech crapdevice (the wheel survived ~1 month *lol*) and neither get that problem.
Comment 21 Soukyuu 2015-09-03 18:38:11 UTC
I'm using a Revoltec FightMouse Elite (*rolls eyes at the name* the mouse itself is great, never getting a non-ceramic feet mous ever again). It has a hardware switch for dpi, but going from highest to lowest doesn't change the behavior for me.

Just guessing, but since you seem to not be getting the issue, maybe our cards (260GTX, alfaflo's 9 series) display this issue because they're older and some sort of operation is horribly inefficient on them?
Comment 22 Soukyuu 2015-09-03 18:41:42 UTC
Well, this is interesting. Just tried an old Logitech V550 (no dpi switch) and it doesn't show the behavior! So it might be related to resolution... but why is it only a problem in kf5?
Comment 23 Thomas Lübking 2015-09-03 19:11:32 UTC
More like a problem how either Qt5 or libinput or evdev (or the chain) handles high resolution mouse input events. (The GPU doesn't matter, KWin is perfectly up-to-date on frames - or at least not that horribly lazy)

What might be interesting is the uncomposited lag in KWin - the window isn't actually moved until you release it when the compositor is up (we only reposition the texture and avoid X11 since that's n-times faster)
So it might be indeed a problem with "too many events" in the X11 event queue (causing problems when having to reposition an actual window; the client, ie. dolphin or kwin for windows, still gets all events in time and as expected)

Can you alter the resolution of your mouse? (lomoco is afaik only for logitech)
Or did maybe the xinput manipulation (when plugging in the device) alone "fix it" and now it works with your elitist rodent as well?
Comment 24 Artur O. 2015-09-03 19:20:59 UTC
(In reply to Thomas Lübking from comment #23)
> More like a problem how either Qt5 or libinput or evdev (or the chain)
> handles high resolution mouse input events. (The GPU doesn't matter, KWin is
> perfectly up-to-date on frames - or at least not that horribly lazy)
> 
> What might be interesting is the uncomposited lag in KWin - the window isn't
> actually moved until you release it when the compositor is up (we only
> reposition the texture and avoid X11 since that's n-times faster)
> So it might be indeed a problem with "too many events" in the X11 event
> queue (causing problems when having to reposition an actual window; the
> client, ie. dolphin or kwin for windows, still gets all events in time and
> as expected)
> 
> Can you alter the resolution of your mouse? (lomoco is afaik only for
> logitech)
> Or did maybe the xinput manipulation (when plugging in the device) alone
> "fix it" and now it works with your elitist rodent as well?
More likely a QT issue then since I can launch dolphin4 in arch and not experience the issue at all. While having Dolphin from KF5 running at the same time and have this issue.
Comment 25 Thomas Lübking 2015-09-03 19:39:27 UTC
And does your Qt4 use libinput or xcb?
(Be warned that I'm on Archlinux as well - I know the answer ;-)


What's clear is that despite the GL compositor is somehow™ a trigger for DnD lagginess, the bug won't be in either Dolphin or KWin, but somewhere int Qt5 and its dependencies.

Do you recall whether this already happened with Qt 5.4?
Comment 26 Soukyuu 2015-09-03 20:01:25 UTC
> Or did maybe the xinput manipulation (when plugging in the device) alone "fix it" and now it works with your elitist rodent as well?
My elitist rodent still behaves as before, and there doesn't seem to be a way to change it otherwise that I know of.

> Do you recall whether this already happened with Qt 5.4?
I did use to compile dolphin-git pre-Qt 5.5 and I don't remember such issues.
Comment 27 alfaflo 2015-09-03 20:13:39 UTC
(In reply to Thomas Lübking from comment #20)
> A-ha!
> 
> Wild guess #2 - can you lower (or just alter) the resolution of that device?
> (try https://wiki.archlinux.org/index.php/Lomoco if it doesn't have a HW
> button)
> 
lomoco doesn't support my Logitech mouse but I've tried another one (Logitech M325 cordless) and I drag'n drop works fine. So it's definitive related to specific input devices... (at least at my system)
Comment 28 Thomas Lübking 2015-09-04 21:53:22 UTC
Gotcha!

One needs a high frequency repainting OpenGL client (some plasmoids tend to do that, cpu graph et al - figured when running glxgears) and dragging lags.

W/o compositing, it's only notable when dragging "something" across the GL view (in my case a DnD icon across glxgears), but with GL compositing, you're always dragging something across *the* GL view (being the compositor)

Indeed only Qt5 drags are affected, dolphinpart-4 (still used in konqueror) is lag-free.

=> I can confirm the bug, but it's between the nvidia driver and Qt5 for sure.

No idea how the input devices come to play in addition, but at least it's now reproducible >-)
Comment 29 Soukyuu 2015-09-05 11:38:48 UTC
I'm getting gradually weary of having an nvidia card, especially a legacy one because if it's really a driver problem, then it won't be fixed anymore. Any chance for some workaround?
Comment 30 Thomas Lübking 2015-09-05 12:38:14 UTC
Certainly not from KWin ("how?"), but since only Qt5 seems affected, it should be addressable there.

Actually my previous description was wrong, though:
- it *only* lags *above* a high frequency repainting areas
- the graphics context below is irrelevant (tried pong from xscreensaver, no GL, as well as VDPAU video overlay)
- it seems completely irrelevant whether I've an (opengl) compositor enabled or not (it's still *only* lagging above the high frequency update window in either case)

Also i can "openbox --replace&" and get the very same behavior (Qt5 DnD lags above glxgears/mplayer)
Comment 31 Thomas Lübking 2015-09-05 12:45:46 UTC
PS: CPU is fully loaded and distributed between dolphin and X11 (when compositing, a *bit* more KWin as well, but it's clearly limited between X11 and dolphin)
Comment 32 alfaflo 2015-09-05 14:44:38 UTC
(In reply to Thomas Lübking from comment #30)
> Certainly not from KWin ("how?"), but since only Qt5 seems affected, it
> should be addressable there.

Thank you Thomas for creating a new Qt bug-report. :-)
Comment 33 Soukyuu 2015-09-07 13:45:53 UTC
Btw, I just tested with nouveau and it doesn't have the problem except when draging a pixmap over a title bar of a window...
Comment 34 Artur O. 2015-10-14 01:14:59 UTC
So it's Nvidia issue that QT triggers? How do we proceed, should we post on their dev forums? Just tried latest beta driver 358.09 and the issue is still there.
Comment 35 Artur O. 2015-10-14 01:25:53 UTC
Also forgot to add; tested with another mouse found it interesting. 

Using Logitech G9x 1000Hz and the result is the video I posted.
Using Microsoft BT nano mouse it does not show that _until_ i drag the icon over Steam window when it's showing my Library, or as someone else reported when hovering over title-bars, tabs in chromium etc.
Comment 36 Thomas Lübking 2015-10-14 07:03:35 UTC
Please see the referenced https://bugreports.qt.io/browse/QTBUG-48122
Comment 37 FiNeX 2016-01-20 23:12:52 UTC
I'm experiencing lag on drag and drop on dolphin and between kde apps, like from dolphin to kate. Moreover the big lag is when I try to move "qmmp" window. The window needs about 5 to 10 seconds to be repainted on the new position.

( intel i7 4770k, logitech m500, nvidia gtx 660 with current archlinux packages )
Comment 38 alfaflo 2016-03-22 20:52:51 UTC
latest update (plasma 5.6 & qt 5.6) fixed it for me
by the way: plasma is now smooth like never before - thanks guys!

florian
Comment 39 Artur O. 2016-03-28 04:29:32 UTC
(In reply to alfaflo from comment #38)
> latest update (plasma 5.6 & qt 5.6) fixed it for me
> by the way: plasma is now smooth like never before - thanks guys!
> 
> florian

(In reply to Thomas Lübking from comment #36)
> Please see the referenced https://bugreports.qt.io/browse/QTBUG-48122

I can confirm this also. After Arch updated to QT 5.6 and Plasma 5.6 with the rest the issue is now fixed for me too.

Looking at https://bugreports.qt.io/browse/QTBUG-48122 it seems it's not related to this issue or that it was somehow fixed by another issue in QT and that 48122 was not the "leading" cause of the lag.
Comment 40 alfaflo 2016-03-28 05:37:45 UTC
(In reply to alfaflo from comment #38)
> latest update (plasma 5.6 & qt 5.6) fixed it for me
> by the way: plasma is now smooth like never before - thanks guys!
> 
> florian

An additional note: it seems that it's not fully gone. Compared to using noveau there's still a (very) little  "lag" but I think for daily use it's not a problem.
Comment 41 alfaflo 2016-03-28 05:38:23 UTC
(In reply to alfaflo from comment #38)
> latest update (plasma 5.6 & qt 5.6) fixed it for me
> by the way: plasma is now smooth like never before - thanks guys!
> 
> florian

An additional note: it seems that it's not fully gone. Compared to using noveau there's still a (very) little  "lag" but I think for daily use it's not a problem.
Comment 42 Artur O. 2016-03-28 05:40:00 UTC
(In reply to alfaflo from comment #41)
> (In reply to alfaflo from comment #38)
> > latest update (plasma 5.6 & qt 5.6) fixed it for me
> > by the way: plasma is now smooth like never before - thanks guys!
> > 
> > florian
> 
> An additional note: it seems that it's not fully gone. Compared to using
> noveau there's still a (very) little  "lag" but I think for daily use it's
> not a problem.

Do you mean the slight lag of like couple pixels? About the same as Window drag?
Comment 43 alfaflo 2016-03-28 05:52:32 UTC
> Do you mean the slight lag of like couple pixels? About the same as Window
> drag?
Yes, just a couple of pixels. A few days ago I've tested nouveau and noticed no "lag" but as 3D performance is "non-existent", I've switched back to proprietary driver :-)
Comment 44 Thomas Lübking 2016-03-28 08:13:14 UTC
it's important to check the behavior over animated content (drag it across an unsynced glxgears) - the everyday nastiness could be mitigated by a less updating desktop window (removed animations in indicators etc)

didn't try, though
Comment 45 alfaflo 2016-03-28 13:45:25 UTC
(In reply to Thomas Lübking from comment #44)
> it's important to check the behavior over animated content (drag it across
> an unsynced glxgears) - the everyday nastiness could be mitigated by a less
> updating desktop window (removed animations in indicators etc)
> 
> didn't try, though

hm... "lag" gets bigger if I drag an icon over glxgears but still much better than in plasma <5.6.
So it's not fixed but at least it doesn't prevent useful drag'n drop.
Comment 46 Artur O. 2016-03-28 16:35:08 UTC
(In reply to Thomas Lübking from comment #44)
> it's important to check the behavior over animated content (drag it across
> an unsynced glxgears) - the everyday nastiness could be mitigated by a less
> updating desktop window (removed animations in indicators etc)
> 
> didn't try, though

(In reply to alfaflo from comment #45)
> (In reply to Thomas Lübking from comment #44)
> > it's important to check the behavior over animated content (drag it across
> > an unsynced glxgears) - the everyday nastiness could be mitigated by a less
> > updating desktop window (removed animations in indicators etc)
> > 
> > didn't try, though
> 
> hm... "lag" gets bigger if I drag an icon over glxgears but still much
> better than in plasma <5.6.
> So it's not fixed but at least it doesn't prevent useful drag'n drop.
Well this is weird.
For me, lag gets quite bigger just by having glxgears open on the desktop (not as much as before 5.6 but noticeable. 
No actual change if I drag over the glx window or if I minimize the glxgears window. 

Still having the same mouse, and reducing the polling rate to 250MHz from 1000MHz and no lag is noticeable again no matter if I got glxgears open or not.
Comment 47 Thomas Lübking 2016-04-13 15:15:43 UTC
*** Bug 361296 has been marked as a duplicate of this bug. ***
Comment 48 Thomas Lübking 2016-04-16 09:27:04 UTC
*** Bug 361296 has been marked as a duplicate of this bug. ***
Comment 49 Elvis Angelaccio 2016-06-04 14:25:05 UTC
*** Bug 356061 has been marked as a duplicate of this bug. ***
Comment 50 Elvis Angelaccio 2016-06-04 14:25:57 UTC
*** Bug 363356 has been marked as a duplicate of this bug. ***