Closed
Bug 835284
Opened 12 years ago
Closed 2 years ago
Cache rasterized tiled gradients
Categories
(Core :: Graphics, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: avih, Unassigned)
References
Details
(Keywords: perf, Whiteboard: [Australis:P5][Australis:M-])
Attachments
(3 files, 2 obsolete files)
4.00 KB,
patch
|
Details | Diff | Splinter Review | |
11.81 KB,
patch
|
Details | Diff | Splinter Review | |
163.87 KB,
image/png
|
Details |
Bug 826422 accelerates tiled gradients greatly by drawing the tile once, then using it as a fill pattern for the entire area.
This bug is about caching this single tile raster, which proves to provide further significant speedup (x10 - x20 on relevant scenarios). This bug builds on bug 826422.
Attached is a (incorrect but enough as) proof of concept tiles cache. E.g. it accelerates scrolling from top to bottom using the KB on http://lea.verou.me/css3patterns/ - PaintGradient goes down at the profiler from 18% to less than 1%, and I observed similar speedups on other relevant scenarios.
Bug 743847 is more generic (cache some rasterized gradients).
Bug 772917 is Cairo only.
My approach is to enhance the existing patterns cache, such as some of the cached pattern items will also hold a cached tile raster.
Invalidation policy will probably be dropping LRU item[s]. Number of cached items would either be fixed, or - for better memory usage predictability - limited by overall number of cached pixels.
Reporter | ||
Comment 1•12 years ago
|
||
Enhance and use the patterns cache to also hold tile raster if possibly. Debug patch which enables changing mode using a preference ("default", tile brush, tile brush + caching).
The patterns cache items invalidate soon enough, practically making it roughly equivalent to 10 cached tile rasters at the previous proof of concept patch. This seems enough for most practical cases.
Attachment #707000 -
Attachment is obsolete: true
Reporter | ||
Comment 2•12 years ago
|
||
Same as the previous patch with the debug stuff removed. (Note that the previous debug patch defaults to "old" behavior if the pref isn't changed).
Waiting with the r? until bug 826422 lands, as this patch is on top of it.
Attachment #707208 -
Attachment is obsolete: true
Reporter | ||
Comment 3•12 years ago
|
||
Posting this patch for reference only. It contains some debug code, and also some more tab-animation debug at tabbrowser.xml (unrelated to gradients cache - but can measure rendering improvements - repeat tab open/close and average measurements).
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #6)
> Comment on attachment 706115 [details] [diff] [review]
> Don't do any of this if pattern->mCoversTile. That's already pretty fast and
> handles non-pixel-aligned tiles perfectly.
Despite the above from bug 826422 comment #6, this patch "tricks" the gradient calculation into setting pattern->mCoversTile=false for cases of strict horizontal/vertical linear gradients, and also caches a 1px tile for each such gradient. This allows, among other cases, to cache tabstrip-tabs gradient tiles (1px wide) and so once cached, all tab animation are just tiling existing cached rasters without any concrete gradients calculations.
The resulting tab animation paint times are almost halved, and temporary memory usage is decreased dramatically (on my specific test pattern, from 500MB with legacy down to 5MB with 1px tiles after several animations).
Interestingly, the speedup is only noticeable when compiler optimizations are enabled. Not sure why.
Reporter | ||
Comment 4•12 years ago
|
||
Reporter | ||
Comment 5•12 years ago
|
||
As for the excessive memory usage with legacy paint, see bug 837542 (possible reasons: too many pattern-cache misses, several different gradients per animation frame, possibly too much data per cache item for the case of tab background).
Updated•12 years ago
|
Blocks: australis-tabs-perf
Updated•11 years ago
|
Whiteboard: [Australis:P?][Australis:M?]
Updated•11 years ago
|
Whiteboard: [Australis:P?][Australis:M?] → [Australis:P5][Australis:M?]
Updated•11 years ago
|
Whiteboard: [Australis:P5][Australis:M?] → [Australis:P5][Australis:M-]
Comment 6•3 years ago
|
||
The bug assignee didn't login in Bugzilla in the last 7 months, so the assignee is being reset.
Assignee: avihpit → nobody
Status: ASSIGNED → NEW
Updated•2 years ago
|
Severity: normal → S3
Comment 7•2 years ago
|
||
WebRender does this
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•