Skip to content

RasterCache could reuse or combine (i.e. atlas) SkSurfaces during composited scale animations #83189

@ds84182

Description

@ds84182

cc @dnfield @flar

Currently, the RasterCache allocates SkSurfaces tightly fitting the content being rasterized. Skia then tries to match an existing allocation in GrResourceCache using requested resolution. During a scale animation, this typically results in a resource miss. A simple scale+opacity route transition can fill up Skia's resource cache, increasing memory usage until the cache hits its limit.

One mitigation I tested was changing RasterCache to round up pixel resolutions to a multiple of 64. Increasing the tile size reduces the number of allocations needed, but has diminishing returns for small composited/raster cached content. I may send out a PR for the mitigation to see how it affects benchmarks.

A more complete solution would be using a rect packing algorithm such as https://blackpawn.com/texts/lightmaps/ to place RasterCache content on a small set of large surfaces, similar to how its done in Cobalt's OffscreenTargetManager.

I'll work on a minimal dart:ui-only test-case + RenderDoc capture for this tonight.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: performanceRelates to speed or footprint issues (see "perf:" labels)engineflutter/engine related. See also e: labels.perf: memoryPerformance issues related to memoryteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions