Bug 264966 - [GTK] Slow CSS animations and dropped frames when animating `transition-property: transform, filter;` on `filter: opacity` with more than 2 large images
Summary: [GTK] Slow CSS animations and dropped frames when animating `transition-prope...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: Other
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL: https://www.kepstin.ca/dump/loupe-cro...
Keywords: Performance
Depends on:
Blocks: GLibPerformance
  Show dependency treegraph
 
Reported: 2023-11-16 10:51 PST by Jeff Fortin
Modified: 2023-11-17 10:04 PST (History)
3 users (show)

See Also:


Attachments
sysprof capture (4.26 MB, application/x-xz)
2023-11-16 10:51 PST, Jeff Fortin
no flags Details
sysprof screenshot - flame chart (277.04 KB, image/png)
2023-11-16 10:53 PST, Jeff Fortin
no flags Details
sysprof screenshot - callgraph, part 1 (288.06 KB, image/png)
2023-11-16 10:53 PST, Jeff Fortin
no flags Details
sysprof screenshot - callgraph, part 2 (249.26 KB, image/png)
2023-11-16 10:53 PST, Jeff Fortin
no flags Details
sysprof screenshot - graphics/compositing marks (311.37 KB, image/png)
2023-11-16 10:54 PST, Jeff Fortin
no flags Details
sysprof screenshot - flame chart (318.35 KB, image/png)
2023-11-16 11:00 PST, Jeff Fortin
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Fortin 2023-11-16 10:51:52 PST
Created attachment 468621 [details]
sysprof capture

Visiting https://www.kepstin.ca/dump/loupe-crossfade-demo/ (or specifically https://www.kepstin.ca/dump/loupe-crossfade-demo/stacked.html if the parent link stops working) with Epiphany 45.0 on Fedora 39 with the Wayland GNOME session, you can see that the slide animations stop working after the second image because they are so slow that they have to drop frames. This is dependent on the amount of images on that page.

The problem does not occur with Firefox on the same machines.

Attaching a sysprof capture that I recorded with my laptop with Intel Kabylake graphics. It seems related to cairo and pixman.
Comment 1 Jeff Fortin 2023-11-16 10:53:04 PST
Created attachment 468622 [details]
sysprof screenshot - flame chart
Comment 2 Jeff Fortin 2023-11-16 10:53:43 PST
Created attachment 468623 [details]
sysprof screenshot - callgraph, part 1
Comment 3 Jeff Fortin 2023-11-16 10:53:57 PST
Created attachment 468624 [details]
sysprof screenshot - callgraph, part 2
Comment 4 Jeff Fortin 2023-11-16 10:54:18 PST
Created attachment 468625 [details]
sysprof screenshot - graphics/compositing marks
Comment 5 Jeff Fortin 2023-11-16 11:00:49 PST
Created attachment 468626 [details]
sysprof screenshot - flame chart

This one actually includes the top of the chart, whereas the previous one was hidden by scrolling
Comment 6 Calvin Walton 2023-11-16 11:38:12 PST
Hi, I'm the author of the affected page.

I figured out the particular thing that was causing the performance issue - I was using a CSS transition with `transition-property: transform, filter;` set, and then transitioning from `filter: opacity(0%);` to `filter: opacity(100%);` and vice-versa. It looks like the opacity filter is hitting a very slow software fallback.

When I changed the page to transition the `opacity` property rather than use a filter, performance improved substantially. The current version of the links posted earlier reflect this updated.

The original version of the page which exhibits this issue has a permanent link here: https://www.kepstin.ca/dump/loupe-crossfade-demo/stacked-webkitgtk-filter.html
Comment 7 Carlos Garcia Campos 2023-11-17 01:38:57 PST
The problem is the interpolation quality, we render the images with the default interpolation quality, that uses CAIRO_FILTER_GOOD, giving high quality results but it's very slow when downscaling high resolution images. There's code in WebKit to use low interpolation quality when there's a resize animation or the view is being resized, but doesn't handle this case of CSS transition filter animation. When using the opacity property, the image is rendered once using default interpolation quality and then the effect is done by the GPU, that's why it works better.