Bug 1711477 - Improve the texture cache eviction heuristics. r=gfx-reviewers,kvark.
Bug 1711477 - Improve the texture cache eviction heuristics. r=gfx-reviewers,kvark.

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.

Differential Revision: https://phabricator.services.mozilla.com/D128255

[ghsync] From https://hg.mozilla.org/mozilla-central/rev/13af5105d7f6db5c66721b29bf1357579f7c7780

servo/webrender,servo/webrender,servo/webrender,servo/webrender,servo/webrender,servo/webrender