Bug 399208 - Okular has an extemely high latency when scrolling with a wacom tablet
Summary: Okular has an extemely high latency when scrolling with a wacom tablet
Status: RESOLVED UPSTREAM
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 1.5.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-29 11:22 UTC by Keziolio
Modified: 2019-04-05 16:35 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 19.04.0


Attachments
path (3.08 KB, patch)
2018-10-29 17:57 UTC, Keziolio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Keziolio 2018-09-29 11:22:58 UTC
SUMMARY
When scrolling with a wacom tablet, the pages move slower than the input, accumulating up to dozens of seconds of latency, rendering the software unusable

STEPS TO REPRODUCE
1. Attach a wacom tablet to the pc
2. Open a pdf document in okular
3. Scroll the document with the wacom tablet and notice the sluggishness

OBSERVED RESULT
I made a video
https://youtu.be/BJEZYtXhhMI

EXPECTED RESULT
It should move the page without latency, I can mind low framerate since i'm with a 4k screen on intel graphics but this is bad
IMPORTANT: It was working fine at the beginning of this year! So the regression is somewhat recent
I tried with a new user and on another pc and the problem is confirmed

SOFTWARE VERSIONS
KDE Plasma Version: 5.13.5
KDE Frameworks Version: 5.50.0
Qt Version: 5.11.2
I'm using arch linux so it has always been recent and close to upstream

ADDITIONAL INFORMATION
Looking at ksysguard when okular is moving by itself, I see xorg hogging a cpu core at 100%, okular is using 2% of the cpu, so is kwin_x11
Wayland is not an option on my setup
Comment 1 Albert Astals Cid 2018-09-30 23:05:32 UTC
Not major
Comment 2 Christoph Feck 2018-10-11 14:42:35 UTC
Which update exactly broke it? You could git-bisect Okular changes, but since you mention 'xorg' process has 100%, it probably is a video driver issue.
Comment 3 Keziolio 2018-10-12 19:35:05 UTC
I compiled okular 1.1.3 and 1.0.3 and the problem was still present, I'm pretty sure that the regression was more recent than that...

So where should I look?

I haven't noticed this kind of slowdown in other parts of the system, there's something that breaks okular in a specific way...


I think the problem can be worked around by consuming the input as fast as possible and updating the page position once every screen refresh, I can mind a bad framerate but not 30+ seconds of latency, I think this is still an okular issue, but I was not even able to find the relevant file/function in the okular source code and it's not that well documented, if someone can help in that regard that'll be great



This is the output of perf top when the latency is rolling:

Samples: 347K of event 'cycles:ppp', 4000 Hz, Event count (approx.): 74074580252
Overhead  Shared Object                            Symbol
  34.75%  [kernel]                                 [k] copy_user_enhanced_fast_string
   3.13%  [kernel]                                 [k] __check_object_size        
   1.64%  libc-2.28.so                             [.] __memmove_avx_unaligned_erms
   1.38%  [kernel]                                 [k] __radix_tree_lookup        
   1.03%  perf                                     [.] hpp__sort_overhead
Comment 4 Keziolio 2018-10-13 16:53:21 UTC
I tried with the nvidia card in my hybrid graphics laptop, running okular with bumblebee, the problem is reproduced (it can still be an intel bug, idk)

I tried in my tablet with a touchscreen (and intel soc), and the problem is reproduced, so it's not only the wacom tablet that causes the bug, but probably everything that works like a touchscreen
Comment 5 Albert Astals Cid 2018-10-29 17:54:11 UTC
Why did you assign the bug to yourself?

If you do that the rest of the world stops getting emails, so don't do that.
Comment 6 Keziolio 2018-10-29 17:57:26 UTC
sorry :C 

I made a patch that fixes the issue, can you look into it?
Comment 7 Keziolio 2018-10-29 17:57:40 UTC
Created attachment 115966 [details]
path
Comment 8 Albert Astals Cid 2018-10-29 18:10:38 UTC
Please use Phabricator for patches

https://community.kde.org/Get_Involved/development#Submitting_your_first_patch
Comment 9 Keziolio 2018-11-19 23:27:52 UTC
It seems that it's Qt's job to avoid this issue, or, at least, there's a difference in how Qt handles the mouse vs the touch thing

I opened a Qt bug report for this issue: https://bugreports.qt.io/browse/QTBUG-71708

So I'm closing this for now
Comment 10 Nate Graham 2019-04-05 16:35:30 UTC
Git commit 5ef54e97ecd2e2a7557de9cb5e07c55a172b55e1 by Nate Graham, on behalf of Kezi Olio.
Committed on 05/04/2019 at 16:34.
Pushed by ngraham into branch 'Applications/19.04'.

Set Qt::AA_CompressTabletEvents attribute to avoid latency when scrolling with a tablet

Summary:

See also: https://bugreports.qt.io/browse/QTBUG-71708

Enabling this option _vastly_ improves the user experience on wacom tablets and touchscreens

Reviewers: #okular

Subscribers: sander, aacid, okular-devel, #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D16519

M  +1    -0    shell/main.cpp

https://commits.kde.org/okular/5ef54e97ecd2e2a7557de9cb5e07c55a172b55e1