Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Issue 414483003: Implement a persistent uniqueID-based cache for SkImageFilter. (Closed)

Created:
6 years, 5 months ago by Stephen White
Modified:
6 years, 4 months ago
Reviewers:
bsalomon, mtklein
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Project:
skia
Visibility:
Public.

Description

Implement a persistent uniqueID-based cache for SkImageFilter. Add a unique ID to SkImageFilter, and use it as part of a persistent cache of image-filtered results. This is used for caching frame-to-frame coherent filters. We also keep track of which filter subtrees do not reference the src input, and use a GenID of zero for the src input in that case. That way, subtrees which are not dependent on the filter input can be cached independently of it. This gives approximately a 4X speedup on letmespellitoutforyou.com/samples/svg/filter_terrain.svg on Z620 and Nexus10. The cache key consists of the uniqueID of the filter, the clip bounds, the CTM and the genID of the input bitmap. Since this does not yet handle the case where the input primitives (and part of the resulting filter tree) are unchanged, we have to keep around the external cache for that painting case. When the work to cache unchanging input primitives is done, the old cache can be removed, and the new UniqueIDCache will be renamed to Cache. Committed: https://skia.googlesource.com/skia/+/55b6d8be997a447ef9ce0f029697677a940bfc24

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : Use a new generation ID for cross-process reads. #

Patch Set 4 : Remove extraneous whitespace #

Patch Set 5 : Remove useless #include #

Patch Set 6 : Clean up destruction of the ImageFilterCache. #

Total comments: 12

Patch Set 7 : Fixed re: mtklein@'s review comments #

Patch Set 8 : Changes per review comments on the SHA1 patch (377673002) #

Patch Set 9 : Minor cleanup; move GenIDCache::Key to .cpp #

Patch Set 10 : Update to ToT #

Patch Set 11 : 100-col fixes #

Patch Set 12 : Rework GPU cache to be transient #

Patch Set 13 : Undo some unnecessary reformatting. #

Total comments: 8

Patch Set 14 : Changes re: Brian's comments #

Total comments: 1

Patch Set 15 : Updated to ToT #

Patch Set 16 : Add a compile-time assert for tight packing of Key #

Patch Set 17 : Fix 100-cols #

Total comments: 1

Patch Set 18 : Don't use UniqueID zero. #

Total comments: 2

Patch Set 19 : uint32_t -> int32_t to match sk_atomic_inc() #

Patch Set 20 : Add missing #include for no-GPU build #

Patch Set 21 : Bump the picture version and add backwards-compatible reading support #

Patch Set 22 : Fix cross-process issue (revert those changes to HEAD^^) #

Unified diffs Side-by-side diffs Delta from patch set Stats (+216 lines, -31 lines) Patch
M include/core/SkBitmapDevice.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +2 lines, -0 lines 0 comments Download
M include/core/SkDevice.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +2 lines, -0 lines 0 comments Download
M include/core/SkImageFilter.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 4 chunks +21 lines, -3 lines 0 comments Download
M include/core/SkPicture.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +2 lines, -1 line 0 comments Download
M include/core/SkReadBuffer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +1 line, -0 lines 0 comments Download
M include/gpu/SkGpuDevice.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +2 lines, -0 lines 0 comments Download
M src/core/SkBitmapDevice.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +6 lines, -0 lines 0 comments Download
M src/core/SkCanvas.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +4 lines, -14 lines 0 comments Download
M src/core/SkImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 8 chunks +161 lines, -7 lines 0 comments Download
M src/gpu/SkGpuDevice.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 4 chunks +14 lines, -4 lines 0 comments Download
M tests/ImageFilterTest.cpp View 1 chunk +1 line, -2 lines 0 comments Download

Messages

Total messages: 34 (0 generated)
Stephen White
Mike, Brian: PTAL. This is a simplification of the previous SHA1-based cache to use a ...
6 years, 5 months ago (2014-07-22 19:52:22 UTC) #1
mtklein
Most of my same questions from the old CL still apply, though clearly we can ...
6 years, 5 months ago (2014-07-22 20:09:21 UTC) #2
Stephen White
Thanks for your comments. https://codereview.chromium.org/414483003/diff/90001/include/core/SkImageFilter.h File include/core/SkImageFilter.h (right): https://codereview.chromium.org/414483003/diff/90001/include/core/SkImageFilter.h#newcode340 include/core/SkImageFilter.h:340: private: On 2014/07/22 20:09:20, mtklein ...
6 years, 5 months ago (2014-07-22 20:33:47 UTC) #3
mtklein
Thanks! This is starting to make sense to me. Going to mull it a bit ...
6 years, 5 months ago (2014-07-22 20:43:10 UTC) #4
Stephen White
On 2014/07/22 20:33:47, Stephen White wrote: > This is actually crucially important. Blink maintains a ...
6 years, 5 months ago (2014-07-22 20:47:17 UTC) #5
mtklein
> Just to follow up on myself: if SkPaint is no longer flattened into > ...
6 years, 5 months ago (2014-07-22 21:50:50 UTC) #6
Stephen White
New patch up. After some offline discussion with Brian, the consensus is not to persist ...
6 years, 5 months ago (2014-07-24 20:41:42 UTC) #7
bsalomon
https://codereview.chromium.org/414483003/diff/230001/include/core/SkImageFilter.h File include/core/SkImageFilter.h (right): https://codereview.chromium.org/414483003/diff/230001/include/core/SkImageFilter.h#newcode64 include/core/SkImageFilter.h:64: class GenIDCache : public SkRefCnt { This guy could ...
6 years, 5 months ago (2014-07-25 14:11:58 UTC) #8
Stephen White
Thanks for your review. https://codereview.chromium.org/414483003/diff/230001/include/core/SkImageFilter.h File include/core/SkImageFilter.h (right): https://codereview.chromium.org/414483003/diff/230001/include/core/SkImageFilter.h#newcode64 include/core/SkImageFilter.h:64: class GenIDCache : public SkRefCnt ...
6 years, 5 months ago (2014-07-25 17:34:17 UTC) #9
Stephen White
New patch up: - renamed GenID -> UniqueID where appropriate - added comments - fixed ...
6 years, 5 months ago (2014-07-25 17:57:52 UTC) #10
bsalomon
https://codereview.chromium.org/414483003/diff/250001/src/core/SkImageFilter.cpp File src/core/SkImageFilter.cpp (right): https://codereview.chromium.org/414483003/diff/250001/src/core/SkImageFilter.cpp#newcode32 src/core/SkImageFilter.cpp:32: struct SkImageFilter::UniqueIDCache::Key { Maybe there should be a static ...
6 years, 4 months ago (2014-07-28 15:07:29 UTC) #11
Stephen White
On 2014/07/28 15:07:29, bsalomon wrote: > https://codereview.chromium.org/414483003/diff/250001/src/core/SkImageFilter.cpp > File src/core/SkImageFilter.cpp (right): > > https://codereview.chromium.org/414483003/diff/250001/src/core/SkImageFilter.cpp#newcode32 > ...
6 years, 4 months ago (2014-07-29 15:42:40 UTC) #12
Stephen White
On 2014/07/29 15:42:40, Stephen White wrote: > On 2014/07/28 15:07:29, bsalomon wrote: > > > ...
6 years, 4 months ago (2014-07-29 15:49:47 UTC) #13
bsalomon
lgtm
6 years, 4 months ago (2014-07-29 19:46:11 UTC) #14
mtklein
https://codereview.chromium.org/414483003/diff/310001/src/core/SkImageFilter.cpp File src/core/SkImageFilter.cpp (right): https://codereview.chromium.org/414483003/diff/310001/src/core/SkImageFilter.cpp#newcode29 src/core/SkImageFilter.cpp:29: return sk_atomic_inc(&gImageFilterUniqueID); return 1+sk_atomic_inc(...) ? The first time you ...
6 years, 4 months ago (2014-07-30 14:15:39 UTC) #15
Stephen White
On 2014/07/30 14:15:39, mtklein wrote: > https://codereview.chromium.org/414483003/diff/310001/src/core/SkImageFilter.cpp > File src/core/SkImageFilter.cpp (right): > > https://codereview.chromium.org/414483003/diff/310001/src/core/SkImageFilter.cpp#newcode29 > ...
6 years, 4 months ago (2014-07-30 14:50:59 UTC) #16
bsalomon
On 2014/07/30 14:50:59, Stephen White wrote: > On 2014/07/30 14:15:39, mtklein wrote: > > > ...
6 years, 4 months ago (2014-07-30 14:55:21 UTC) #17
Stephen White
On 2014/07/30 14:55:21, bsalomon wrote: > On 2014/07/30 14:50:59, Stephen White wrote: > > On ...
6 years, 4 months ago (2014-07-30 15:11:10 UTC) #18
mtklein
Ah, sorry to get confused and us off track. LGTM https://codereview.chromium.org/414483003/diff/330001/src/core/SkImageFilter.cpp File src/core/SkImageFilter.cpp (right): https://codereview.chromium.org/414483003/diff/330001/src/core/SkImageFilter.cpp#newcode31 ...
6 years, 4 months ago (2014-07-30 15:29:20 UTC) #19
bsalomon
lgtm
6 years, 4 months ago (2014-07-30 15:38:28 UTC) #20
Stephen White
On 2014/07/30 15:29:20, mtklein wrote: > Ah, sorry to get confused and us off track. ...
6 years, 4 months ago (2014-07-30 15:46:07 UTC) #21
mtklein
> So that it doesn't require a second pass through the do-loop on first call, ...
6 years, 4 months ago (2014-07-30 15:54:21 UTC) #22
Stephen White
The CQ bit was checked by senorblanco@chromium.org
6 years, 4 months ago (2014-07-30 16:42:51 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/senorblanco@chromium.org/414483003/350001
6 years, 4 months ago (2014-07-30 16:43:28 UTC) #24
Stephen White
The CQ bit was checked by senorblanco@chromium.org
6 years, 4 months ago (2014-07-30 16:47:23 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/senorblanco@chromium.org/414483003/370001
6 years, 4 months ago (2014-07-30 16:47:31 UTC) #26
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: Test-Ubuntu13.10-ShuttleA-NoGPU-x86_64-Debug-Trybot on tryserver.skia ...
6 years, 4 months ago (2014-07-30 16:59:07 UTC) #27
Stephen White
On 2014/07/30 16:59:07, I haz the power (commit-bot) wrote: > FYI, CQ is re-trying this ...
6 years, 4 months ago (2014-07-30 17:02:10 UTC) #28
Stephen White
The CQ bit was unchecked by senorblanco@chromium.org
6 years, 4 months ago (2014-07-30 17:02:15 UTC) #29
Stephen White
OK, I think I've fixed this. Brian, would you mind taking another look to see ...
6 years, 4 months ago (2014-07-30 17:12:29 UTC) #30
bsalomon
On 2014/07/30 17:12:29, Stephen White wrote: > OK, I think I've fixed this. Brian, would ...
6 years, 4 months ago (2014-07-30 18:21:19 UTC) #31
Stephen White
The CQ bit was checked by senorblanco@chromium.org
6 years, 4 months ago (2014-07-30 18:21:30 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/senorblanco@chromium.org/414483003/410001
6 years, 4 months ago (2014-07-30 18:22:22 UTC) #33
commit-bot: I haz the power
6 years, 4 months ago (2014-07-30 18:26:52 UTC) #34
Message was sent while issue was closed.
Change committed as 55b6d8be997a447ef9ce0f029697677a940bfc24

Powered by Google App Engine
This is Rietveld 408576698