Bug 153111 - Terrible performance when scrolling on Wayland
Summary: Terrible performance when scrolling on Wayland
Status: RESOLVED DUPLICATE of bug 152911
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
7.4.3.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: perf
Depends on:
Blocks: Wayland KDE, KF5 Scrolling-Performance
  Show dependency treegraph
 
Reported: 2023-01-19 19:56 UTC by linus.kardell
Modified: 2024-05-23 20:55 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description linus.kardell 2023-01-19 19:56:43 UTC
Description:
When I run Libreoffice on, and scroll rapidly back and forth, the performance rapidly drop. Basically, I use two-finger scroll on the touchpad, and rapidly move the fingers back and forth between the bottom and top of the touchpad. The longer I keep doing it, the lower the framerate gets, and if I keep doing it for a while the framerate drops so low that the window is marked as unresponsive. The performance then returns to normal if I stop scrolling for a few seconds. It's easiest to reproduce in Calc, but it happens in other components as well, such as long Writer documents.

Steps to Reproduce:
1. Open Calc on Plasma Wayland
2. Start scrolling rapidly back and forth

Actual Results:
Performance drops severely

Expected Results:
Performance stays as normal


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Operating System: openSUSE Tumbleweed 20230113
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.101.0
Qt Version: 5.15.8
Kernel Version: 6.1.4-1-default (64-bit)
Graphics Platform: Wayland
Processors: 8 × AMD Ryzen 7 3700U with Radeon Vega Mobile Gfx
Memory: 29.3 Gibyte of RAM
Graphics Processor: AMD Radeon Vega 10 Graphics
Manufacturer: Acer
Product Name: Aspire A315-41
System Version: V1.18
Comment 1 Stéphane Guillou (stragu) 2023-01-19 21:08:33 UTC
Thanks Linus.
Do you use some scaling or High DPI setting for your OS/DE display settings?

Please also paste here the info copied from Help > About LibreOffice.
Comment 2 linus.kardell 2023-01-20 19:02:54 UTC
Version: 7.4.3.2 / LibreOffice Community
Build ID: 40(Build:2)
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: kf5 (cairo+wayland)
Locale: sv-SE (sv_SE.UTF-8); UI: sv-SE
Calc: threaded

I can reproduce the issue regardless of whether scaling is enabled or disabled.
Comment 3 Corentin Fleury 2023-04-22 20:28:47 UTC
Version: 7.4.6.2
Build ID: 40(Build:2)
CPU threads: 12; OS: Linux 6.2; UI render: default; VCL: kf5 (cairo+wayland)
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded

I can also reproduce this bug in writer and it is very annoying as the larger the documents gets, the more laggy the scroll becomes.
Comment 4 M. Knepper 2023-05-17 18:56:58 UTC
(In reply to linus.kardell from comment #2)
> Version: 7.4.3.2 / LibreOffice Community
> Build ID: 40(Build:2)
> CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: kf5 (cairo+wayland)
> Locale: sv-SE (sv_SE.UTF-8); UI: sv-SE
> Calc: threaded
> 
> I can reproduce the issue regardless of whether scaling is enabled or
> disabled.

I can reproduce this, as well. It's especially worse at larger resolutions.
Comment 5 Stéphane Guillou (stragu) 2023-05-17 21:27:54 UTC
(In reply to jake.m.knepper from comment #4)
> I can reproduce this, as well. It's especially worse at larger resolutions.

Jake, can you please also paste here the information copied from Help > About LibreOffice?

All: did this start in version 7.4? Are you able to test earlier versions to let us know if this is a regression?
https://downloadarchive.documentfoundation.org/libreoffice/old/
Comment 6 M. Knepper 2023-10-19 17:23:34 UTC
(In reply to Stéphane Guillou (stragu) from comment #5)
> (In reply to jake.m.knepper from comment #4)
> > I can reproduce this, as well. It's especially worse at larger resolutions.
> 
> Jake, can you please also paste here the information copied from Help >
> About LibreOffice?
> 
> All: did this start in version 7.4? Are you able to test earlier versions to
> let us know if this is a regression?
> https://downloadarchive.documentfoundation.org/libreoffice/old/

I am so sorry that I am just now seeing this.

To update: this problem still exists on Fedora 38 and the Fedora 39 beta.


I've updated my hardware, too. Right now I have a 13700k, 32GB DDR5 7200mhz ram, and an RX 7900 XT. 

To replicate, all you need is a 4k monitor.

1. Makes sure your resolution is set to 4k (3840x2160).
2. Open LibreOffice writer.
3. Open a multi-page document of any kind.
4. Begin scrolling.
5. Observe a 50% usage of one or two CPU cores and laggy, choppy performance.

This does not happen on Microsoft word - when scrolling on MS Word, the the CPU usage (as well as GPU usage) stays around 3% tops on any given core. It's also not laggy at all.
Comment 7 Stéphane Guillou (stragu) 2023-12-15 09:18:36 UTC
(In reply to M. Knepper from comment #6)
Please also share the information copied from Help > About LibreOffice, as it tells us which VCL plugin you are using, which seems to matter with this issue.
Which desktop environment do you use? How are you using MS Word on Fedora?
Comment 8 Stéphane Guillou (stragu) 2023-12-15 09:21:33 UTC
(In reply to linus.kardell from comment #2)
> I can reproduce the issue regardless of whether scaling is enabled or
> disabled.

(In reply to Corentin Fleury from comment #3)
> I can also reproduce this bug in writer and it is very annoying as the
> larger the documents gets, the more laggy the scroll becomes.

Linus and Corentin:
- What size displays are you using?
- Does turning off Automatic Spell Checking have any impact?
Comment 9 linus.kardell 2023-12-15 20:50:36 UTC
Version: 7.6.3.1 (X86_64) / LibreOffice Community
Build ID: 60(Build:1)
CPU threads: 8; OS: Linux 6.6; UI render: default; VCL: kf5 (cairo+wayland)
Locale: sv-SE (sv_SE.UTF-8); UI: sv-SE
Calc: threaded

I'm on a 1920x1080 screen, with Calc maximized. Turning off spell check does not seem to help.
Comment 10 Michael Weghorn 2023-12-22 20:24:29 UTC
The discussion in https://gerrit.libreoffice.org/c/core/+/161184/comments/48b136e2_b406d494 may (or may not) be relevant here:

Patricky Luby wrote:
> I did see lagging scrollbar thumb drawing in tdf#155266. Those I had to fix in
> the macOS native event dispatch code by adding more SalFrame::Flush() calls
> after handling a left mouse drag or scrollwheel events. Maybe a similar lack of
> flushing is occurring with Wayland on Linux and/or Windows?
Comment 11 Jeff Fortin Tam 2024-03-23 00:37:04 UTC
Presuming this happens with some document types more than others, and that it still happens for you in 24.2, do you have a "particularly bad" document sample you could provide here that would make it easy for someone like me to test and profile this? Because so far I'm unable to reproduce this with open source AMD graphics with:

Version: 24.2.1.2 (X86_64) / LibreOffice Community
Build ID: db4def46b0453cc22e2d0305797cf981b68ef5ac
CPU threads: 8; OS: Linux 6.7; UI render: default; VCL: gtk3
Flatpak
Calc: threaded
Comment 12 Buovjaga 2024-04-24 15:10:53 UTC

*** This bug has been marked as a duplicate of bug 152911 ***
Comment 13 M. Knepper 2024-05-22 23:03:42 UTC
(In reply to Jeff Fortin Tam from comment #11)
> Presuming this happens with some document types more than others, and that
> it still happens for you in 24.2, do you have a "particularly bad" document
> sample you could provide here that would make it easy for someone like me to
> test and profile this? Because so far I'm unable to reproduce this with open
> source AMD graphics with:
> 
> Version: 24.2.1.2 (X86_64) / LibreOffice Community
> Build ID: db4def46b0453cc22e2d0305797cf981b68ef5ac
> CPU threads: 8; OS: Linux 6.7; UI render: default; VCL: gtk3
> Flatpak
> Calc: threaded

Are you using a 4k resolution? And are you monitoring CPU usage while scrolling?
Comment 14 Jeff Fortin Tam 2024-05-23 01:23:52 UTC
Testing with 4K: not on that particular computer no, but I did test and reproduce another scrolling performance issue with Intel graphics on a 4K monitor in bug #154602 from which I was able to record a profile; that one made it easier to reproduce by providing a sample test file to trigger the slowness on the GTK version.

That said, I've only been able to test the GTK version (provided by Fedora or flathub) so I doubt I'd be able to easily test the KDE/KF5 version. Even without closely monitoring CPU usage, I usually notice non-smooth UI graphics in general.

However, since this was marked as a duplicate of #152911 in the meantime, I'm not sure how relevant it is to profile here rather than there, and I see #152911 has a sample and profiles already...
Comment 15 M. Knepper 2024-05-23 20:55:06 UTC
Interesting. I'm really thinking it's resolution dependent. The higher your resolution, the more CPU scrolling consumes.

I did record a video of this problem happening here.

VIDEO OF BUG IN ACTION: https://www.youtube.com/watch?v=EXyMSzOVsds

Keep an eye on the "CPU %" in HTOP.

Some notes: It doesn't seem to matter if there are 200 pages or 50 pages. Linux kernel and AMD drivers (at least as of distros from the past several years) do not seem to make a difference. The issue exists on Xorg AND Wayland. The issue exists on Libreoffice 7.6+ as far as I've tested, and lastly, distro doesn't seem to matter.

This doesn't seem to happen in other word processors. Word will only use 3% - 5% of my CPU when I'm scrolling, even with a document bigger than what's in LibreOffice.

The issue is reproduceable on Windows 11 Pro, at least for me.

Hardware:
13700k
7900xt
32gb DDR5
2tb SSD NVME

Software/OS:
Fedora 40
Linux 6.8x
LibreOffice 24.2.3.2
hTOP
Gnome 46
Gnome-Terminal
GPU drivers, VCL version, GTK version, etc, etc - whatever is on Fedora 40 as of this video.

Confirmed My Testing With:
2700x
RX 580 8gb
16gb DDR4
1tb SSD SATA
Linux 5.x
LibreOffice 7.6+

Additional Notes: This seems to happen regardless of using gtk, qt, whether it's on Xorg, Wayland, a Debian distro, an Arch distro, etc. I've been able to confirm on different hardware and since version 7.6+ of LibreOffice.

I tested it on 15k words to 50k words, 30 pages to 72 pages - it has high CPU usage either way.