You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit edcc8e3
Browse filesBrowse the repository at this point in the historyBrowse files
[avio] RenderTargetCache ages once per raster frame
RenderTargetCache documents that textures are kept "for at least one frame"
and dropped after keep-alive "frames". The code did otherwise: Start
released every lease and End aged every entry, and both ran on every Canvas
(Canvas::SetupRenderPass / EndReplay). Each view renders its own Canvas and
toImage snapshots age the cache too, so in Avio's multi-view engine an
entry died after a few foreign Canvases (status-bar offscreens were
re-allocated in 60 of 319 renders at gap 0). flutter#190613 reports
the same misnomer upstream. A nested Canvas's Start could also hand out a
texture its outer Canvas was still rendering into.
Leases and aging are separate now:
- RenderTargetAllocator gains BeginScope/EndScope. A Canvas opens one lease
scope in SetupRenderPass and closes it in EndReplay (or its destructor, so
an abandoned replay still returns its leases). EndScope releases only that
scope's leases; a nested scope never reuses a target an outer scope still
leases; DisableCache counts belong to the scope that set them (fixes the
nested-reset bug where an inner Canvas zeroed an outer DisableCache).
- Start/End keep their documented meaning, frame boundaries: End is the one
aging epoch. The Rasterizer calls it once per raster frame, after every
view (Rasterizer::EndRasterFrameResources). Snapshot Canvases
(DisplayListToTexture, RenderToTarget) never age. The Impeller interop
toolkit's Surface::DrawDisplayList ends one epoch per draw, since no
rasterizer owns its frames.
- Patch 46u's usage report reads leases from the scopes.
No new policy knob. Retention rises by at most the entries unused for
keep-alive raster frames (about 33 ms at 120 Hz).
Idle behaviour: with no raster frames nothing ages, so the last frame's
entries stay until later raster frames age them out. Nothing else frees
them: there is no idle release on the embedder's request, and patch 36's
all-hidden trim frees idle transient attachment sets only, never this
cache.
Tests:
- CanvasFailureTest.CanvasReplayLeasesButNeverAgesRenderTargetCache
(expected red on the base by behavior: three Canvas replays dropped an
unused keep-alive-0 entry)
- CanvasFailureTest.DestroyedCanvasReleasesItsLeaseScope
- RenderTargetCacheResourceTest: ForeignCanvasesWithinOneFrameDoNotAge,
EntryUnusedForKeepAliveFramesIsDropped, ToImageCanvasDoesNotAge,
NestedScopeKeepsOuterLeases, DisableCacheIsPerScope,
ReportReadsLeasesFromScopes (use the new scope API; red as compile
failures on the base)
- The playground CachesUsedTexturesAcrossFrames* tests pass unchanged (they
drive Start/End as frames).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
0 commit comments