Skip to content

[Skia] Partial repaint still costs ~2x 6.5 for scrolls and small animations on 6.7/6.8 #24791

Open

Description

@MartinZikmund

Current behavior 🐛

Damage regions were meant to make Skia rendering cheaper than 6.5, but on 6.7/6.8 both scrolling and small animations still cost more CPU than 6.5, even with the fixes below. @ramezgerges, this is your area; could you take a look?

Already fixed (open PRs):

What remains (Skia Win32, OpenGL, 250% scale, dotnet-trace sampled thread time):

Scenario 6.5.237 6.8 + all fixes above
Scroll: ItemsRepeater of 2,837 Fluent Buttons, 12 × 60 × 40 px steps, UI-thread total 839 ms 1,270 ms
of which render walk (Compositor.RenderRootVisual) 157 ms 290 ms
of which layout (UpdateLayout) 250 ms 411 ms
Static page + one ProgressRing, process CPU per 3 s ~0.6 s ~1.4 s (noisy machine)

Observations:

  • In the ProgressRing case the overlay now shows only the ring's box as damaged, yet CPU is still ~2× 6.5. Before the SKCanvasVisual fix, the hot thread was the Win32 render thread inside native code under CompositionTarget.Draw.
  • CompositionTarget.Draw clips to the damage and then replays the entire frame picture. Hypothesis (unverified): Skia still walks every op in the picture (save/restore/clip for every realized control) even when the clip is tiny. Separately, the UI thread re-walks and re-records the whole tree each frame for a 60 px change.
  • Master's 2b4457a9ab0 (cull off-viewport leaf visuals) isn't on 6.7/6.8. On the scroll, a large share of visuals sits in the ItemsRepeater cache buffer outside the viewport, which matches mikernet's VerticalCacheLength observation in Scroll frames pay O(realized visuals) Skia path booleans for damage #23984.
  • Managed allocation is flat and GC isn't a factor.

Master (Uno.Sdk 7.0.0-dev.17 = ffcff329eb3, 2026-09-25; includes #23986, 74afcfc6d3b, dbb62a5bc4b, 2b4457a9ab0, 0bc538fec5f). Same harness; the app needs SkiaSharp.Views.Uno.WinUI removed to start (see below). Master defaults Win32 to Vulkan, so both renderers were measured:

Scenario 6.5.237 master (Vulkan) master (OpenGL) 6.8 + fixes
Scroll, process CPU per 60 steps (median, 2 interleaved rounds) 312 / 297 ms 297 / 281 ms 344 / 312 ms 375 / 578 ms
TextBlock updated every 16 ms, process CPU per 3 s (3 rounds) 1,062 / 1,016 / 875 1,219 / 766 / 719 1,250 / 922 / 1,062 1,328 / 1,078 / 734

UI-thread split on master for the scroll (sampled, 12 × 60 steps; startup excluded):

6.5.237 master 6.8 + fixes
render walk 157 ms 224 ms 290 ms
layout 250 ms 415 ms 411 ms
Win32 accessibility 3 ms 355 ms (fixed by #24785) 148 ms

So master is roughly on par with 6.5 in total process CPU for scrolling and simple partial updates. The UI thread still does noticeably more work: layout (+~165 ms, same as 6.8) and accessibility (#24785).

Spinner on master: ProgressRing there renders via generated Composition visuals (d71fa11), not Skottie, so it isn't comparable with 6.x. Its UI-thread render time was 297 ms vs 70 ms on 6.5 (4×), which may be worth a look. Unverified: in a screen capture of the master harness, a TextBlock ticking for 11 s still showed its initial value while CompositionTarget.Rendering kept firing. That could be a presentation or damage under-report on master, or a capture artifact; I couldn't confirm it without intrusive screen captures.

Master harness gotcha: Uno.Sdk 7.0.0-dev.17 implicitly references SkiaSharp.Views.Uno.WinUI 4.151.1, which is built against Uno 5.2 and references the removed Uno.UI.Toolkit. A plain app then hangs silently at startup (no window, no error; FileNotFoundException for Uno.UI.Toolkit inside the generated GlobalStaticResources). Workaround: <PackageReference Remove="SkiaSharp.Views.Uno.WinUI" /> in a target that runs before CollectPackageReferences.

Expected behavior 🎯

With damage regions, a small animation or a scroll should cost no more than on 6.5, ideally less.

How to reproduce it (as minimally and precisely as possible) 🔬

  1. Skia desktop app on Win32. ScrollViewer > ItemsRepeater + UniformGridLayout (MinItemWidth=140, MinItemHeight=90), 2,837 items. Template: a Button (140×90) containing a Grid with a FontIcon and a TextBlock.
  2. Scroll: ChangeView(null, i * 40, null, disableAnimation: true) for i = 1..60 with await Task.Delay(16); measure Process.TotalProcessorTime.
  3. Animation: overlay a 60×60 ProgressRing IsActive="True", measure CPU over 3 s without scrolling. Use FeatureConfiguration.Rendering.DamageRegionOverlay = true to see the damage.
  4. Compare Uno.Sdk 6.5.36 against 6.8 with the PRs above.

Workaround 🛠️

Smaller ItemsRepeater.VerticalCacheLength.

Renderer 🎨

  • Skia
  • Native

Affected platforms 📱💻🖥️

All platforms 🌍

Uno.Sdk version (and other relevant versions) 📦

6.7.22 / 6.8.0-dev.51 plus the PRs above; compared with 6.5.36.

IDE version 🧑‍💻

No response

Anything else we need to know? 💬

Follow-up of #23984. Harness and traces are available from @MartinZikmund on request.

Activity

  1. added
    triage/untriaged
    on Sep 28, 2026
  2. agneszitte commented on Oct 7, 2026

    @agneszitte
    Member

    Status update: the 6.8 fixes for this are now available in Uno.Sdk 6.8.0-dev.60:

    • #24612: scroll-frame damage cost
    • #24788: damage clip as bounds
    • #24786: Win32 layout work
    • #24792: ProgressRing / Lottie repaint

    In our tests, scrolling and small animations are back to the 6.5 level or better.

    Next: once affected users confirm the 6.8-dev build, the same fixes will go into the next 6.7 service release.

    cc @mikernet

  3. added
    7.0
    on Oct 14, 2026
  4. removed
    7.0
    on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

triage/untriaged

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions