Texture cache compaction
Categories
(Core :: Graphics: WebRender, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox95 | --- | fixed |
People
(Reporter: nical, Assigned: nical)
References
(Blocks 1 open bug)
Details
Attachments
(7 files, 1 obsolete file)
(deleted),
image/svg+xml
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details |
The majority of pages fit in a single cache texture for images and a single one for glyphs. However some push us over the limit and trigger an the allocation of a new large 2k by 2k texture. So far so good, however what tends to happen is that after a while both textures are mostly empty but there is a handful of items in each textures keeping them allocated forever and we never get to reclaim that memory even though we don't need it.
It would be useful to copy items from a texture to another when the source textures has less than 20% of its space allocated and the destination is less than half full or some other simple heuristic.
We could decide to only trigger this on "cheap" frames (less than N picture tiles invalidated), and on memory pressure events.
Assignee | ||
Comment 1•3 years ago
|
||
Assignee | ||
Comment 2•3 years ago
|
||
The newer version contains a few new APIs that will be needed for texture cache compaction:
- An iterator of allocated items.
- A way to associate AllocIds with a stable index.
Assignee | ||
Comment 3•3 years ago
|
||
This will be used in a followup patch to defragment the texture cache.
Depends on D128251
Assignee | ||
Comment 4•3 years ago
|
||
The initial implementation uses the composite shader just like the upload code, but it's a bit messy. I'll add a simpler more specialized shader for that in a followup.
Depends on D128252
Assignee | ||
Comment 5•3 years ago
|
||
Depends on D128253
Assignee | ||
Comment 6•3 years ago
|
||
The previous heuristics would set a threshold in number of allocated bytes per texture type, continuously evict a fixed number of items above the threshold and stop evicting below the threshold.
The new logic lowers the amount of allocated bytes below which we stop evicting, and make eviction above the threshold more progressive, only evicting very cold items if the the cache pressure is low and ramping up how aggressively items a are evicted along with the cache pressure.
In addition, we maintain a minimum of cache pressure until there is a only a single texture atlas allocated for a given shared texture type.
The above combined with the texture cache compaction code ensures that even after a difficult workload, the texture cache eventually settles back to a single texture atlas per type with reasonable fragmentation.
Depends on D128254
Assignee | ||
Comment 7•3 years ago
|
||
Using the composite shader for that was very clunky. It might even be faster thanks to how much simpler the shader is and it's use of texel fetch instead of linear sampling.
Depends on D128255
Updated•3 years ago
|
Comment 9•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/a7a4ab2e72a9
https://hg.mozilla.org/mozilla-central/rev/8d9c84a52b94
https://hg.mozilla.org/mozilla-central/rev/f99634c97a75
https://hg.mozilla.org/mozilla-central/rev/1abf5dd04917
https://hg.mozilla.org/mozilla-central/rev/13af5105d7f6
https://hg.mozilla.org/mozilla-central/rev/e2d91fc7ef84
Description
•