Bug 166258 - Scrolling/Swipping through a document with Skia Metal on is choppy/slow; smooth with Skia Raster
Summary: Scrolling/Swipping through a document with Skia Metal on is choppy/slow; smoo...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
25.8.0.0 alpha0+
Hardware: x86-64 (AMD64) macOS (All)
: medium normal
Assignee: Patrick (volunteer)
URL:
Whiteboard: target:25.8.0
Keywords: perf
Depends on:
Blocks:
 
Reported: 2025-04-20 00:47 UTC by Telesto
Modified: 2025-05-16 20:45 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file (12.17 KB, application/vnd.oasis.opendocument.text)
2025-04-25 20:18 UTC, Telesto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2025-04-20 00:47:35 UTC
Description:
Scrolling/Swipping through a document with Skia Vulkan on is choppy/slow; smooth with Skia Raster

Steps to Reproduce:
1. Download the Writer Guide ODT: https://nextcloud.documentfoundation.org/s/xbZcLTEd6tjsMaW
2. Scroll through the document

Actual Results:
Laggy

Expected Results:
Smooth. Similar to Skia Raster


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 7fac8458e35620b9855cc6c68a9675159a849b65
CPU threads: 8; OS: macOS 14.7.4; UI render: Skia/Metal; VCL: osx
Locale: nl-NL (nl_NL.UTF-8); UI: en-US
Calc: threaded
Comment 1 V Stuart Foote 2025-04-20 13:05:11 UTC
This is kind of expected. Think about the raster framing needed to scroll the view ports. Each "view" gets calculated, but then they are streamed one view at a time. With the Vulkan, each view (even though a vector rendering) must be cached.

IIUC with skia raster framing the "views" are just being cached, with vector framing they get recalculated (though faster HA)--the resulting "scroll" appears choppy.

Additionally, older less capable GPU and limited memory can make the frames being calculated appear to be choppy/slow.  More modern GPU with plenty of graphics RAM can do a better job.
Comment 2 Telesto 2025-04-20 18:49:18 UTC
Also with
Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: ad5cb7e99f574c17811ef7d5419b35a95ed82696
CPU threads: 8; OS: macOS 14.7.4; UI render: Skia/Metal; VCL: osx
Locale: nl-NL (nl_NL.UTF-8); UI: en-US
Calc: threaded

fine with
Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: c69b16a0f859d71a101e2c138887e7975ec71e2a
CPU threads: 8; OS: macOS 14.7.4; UI render: Skia/Metal; VCL: osx
Locale: nl-NL (nl_NL.UTF-8); UI: en-US
Calc: threaded
Comment 3 Telesto 2025-04-24 22:37:47 UTC
Also with
Version: 25.2.0.3 (X86_64) / LibreOffice Community
Build ID: e1cf4a87eb02d755bce1a01209907ea5ddc8f069
CPU threads: 8; OS: macOS 14.7.4; UI render: Skia/Metal; VCL: osx
Locale: nl-NL (nl_NL.UTF-8); UI: en-US
Calc: threaded
Comment 4 Telesto 2025-04-25 20:15:47 UTC
Bisected to: d75f72f99cc5a5e408f7e8a76bae3e32fc37c91b is the first bad commit
commit d75f72f99cc5a5e408f7e8a76bae3e32fc37c91b
Author: libreoffice <libreoffice@libreoffices-MacBook-Air.local>
Date:   Sat Dec 21 08:31:44 2024 +0100

    source c585b697b583fa0f8cdadeab594c31d270367ba7
    
    source c585b697b583fa0f8cdadeab594c31d270367ba7

 .../Contents/Frameworks/libvclplug_osxlo.dylib     | Bin 1051808 -> 1051808 bytes
 LibreOffice.app/Contents/Resources/setuprc         |   2 +-
 LibreOffice.app/Contents/Resources/versionrc       |   2 +-
 3 files changed, 2 insertions(+), 2 deletions(-)
Comment 5 Telesto 2025-04-25 20:18:42 UTC
Created attachment 200532 [details]
Example file

File used for the bibisect.
Comment 6 Patrick (volunteer) 2025-04-25 22:16:29 UTC
(In reply to Telesto from comment #4)
>     source c585b697b583fa0f8cdadeab594c31d270367ba7

I can confirm that disabling throttling of Skia/Metal flushing stops this bug from occurring in my local master build. Unfortunately, that causes the Calc and Impress bugs in tdf#163945 to reappear:

Version: 25.8.0.0.alpha0+ (AARCH64) / LibreOffice Community
Build ID: 648d97619c921d2f94a91e2932712063ca37646f
CPU threads: 8; OS: macOS 15.4.1; UI render: Skia/Metal; VCL: osx
Locale: en-CA (en_CA.UTF-8); UI: en-US
Calc: threaded

What is surprising to me is that the purpose of commit c585b697b583fa0f8cdadeab594c31d270367ba7 was to throttle the rate of Skia/Metal flushing to avoid the type of "flooding the Metal drawing queue" problem described in comment 1. But for this bug, throttling is the problem so now I have to figure out how to bypass the throttling for this bug but not for tdf#163945.
Comment 7 Commit Notification 2025-04-27 14:55:51 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a24789f747dc998bd4fd1c0110a89e791ee051c2

tdf#166258 Refactor throttling of Skia/Metal flushes

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Patrick (volunteer) 2025-04-27 14:59:00 UTC
I have committed a fix for this bug and the fix should be in tomorrow's (28 April 2025) nightly master builds:

https://dev-builds.libreoffice.org/daily/master/current.html

Note for macOS testers: the nightly master build installer does *not* overwrite any LibreOffice official versions. Instead, it will be installed as a separate application called "LibreOfficeDev" in the /Applications folder.

Because this is a "test" build, you will need to do the following steps before you launch the LibreOfficeDev application:

1. Go to the Finder and navigate to the /Applications/Utilities folder
2. Launch the "Terminal" application
3. Paste the following command in the Terminal application window and press the Return key to execute the command:

   xattr -d com.apple.quarantine /Applications/LibreOfficeDev.app
Comment 9 Telesto 2025-05-02 07:51:13 UTC
Working fine
Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 9f308ba42f44e7d8e2f73a92923b0374e39083aa
CPU threads: 8; OS: macOS 14.7.4; UI render: Skia/Metal; VCL: osx
Locale: nl-NL (nl_NL.UTF-8); UI: en-US
Calc: threaded
Comment 10 Patrick (volunteer) 2025-05-15 17:03:57 UTC
I reimplemented my fix for this bug because the last group of fixes caused tdf#163945 to reoccur. So can anyone test that this bug does not reoccur in the current nightly master build? The commit should be in today's (15 May 2025) nightly master builds:

https://dev-builds.libreoffice.org/daily/master/current.html

Note for macOS testers: the nightly master build installer does *not* overwrite any LibreOffice official versions. Instead, it will be installed as a separate application called "LibreOfficeDev" in the /Applications folder.

Because this is a "test" build, you will need to do the following steps before you launch the LibreOfficeDev application:

1. Go to the Finder and navigate to the /Applications/Utilities folder
2. Launch the "Terminal" application
3. Paste the following command in the Terminal application window and press the Return key to execute the command:

   xattr -d com.apple.quarantine /Applications/LibreOfficeDev.app
Comment 11 Telesto 2025-05-16 20:45:02 UTC
Working fine
Version: 25.8.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 5c7b3f5dc1f14081eed380999dc029a500784d55
CPU threads: 8; OS: macOS 14.7.4; UI render: Skia/Metal; VCL: osx
Locale: nl-NL (nl_NL.UTF-8); UI: en-US
Calc: threaded

Thanks for the fix!