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

Issue 1370323002: Implement SkImageFilter::Cache with SkResourceCache. (Closed)

Created:
5 years, 2 months ago by mtklein_C
Modified:
5 years, 1 month ago
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Implement SkImageFilter::Cache with SkResourceCache. The single global cache now uses the global SkResourceCache, and any Create()ed cache uses a local SkResourceCache. No real public API changes (and only deletes). I don't see any pixel diffs on .skps or GMs. Don't see any significant perf difference on 8888 or gpu configs. DM peak memory usage did drop by about 113M, close to the 128M cache size. BUG=skia:3662 Landing PS8 temporarily to trigger the perf bots. TBR=reed@google.com Committed: https://skia.googlesource.com/skia/+/75135d8ae1aa12e8e6bfce63291e5e876a77546f Perf impact of PS8 looks pretty darn neutral: https://perf.skia.org/kernel/?query=bench_type%3Dplayback%26source_type%3Dskp%26sub_result%3Dmin_ms&commit1=242397a1c95e34e3e2e5e85c85c81090317115cb&commit2=75135d8ae1aa12e8e6bfce63291e5e876a77546f https://perf.skia.org/#4252

Patch Set 1 #

Patch Set 2 : no friend #

Patch Set 3 : tweaks #

Patch Set 4 : remove purge #

Patch Set 5 : include SkPixelRef #

Patch Set 6 : Copy if allocator and getDiscardable() dont agree #

Patch Set 7 : force the copy to try it on the perf bots #

Patch Set 8 : alternative force #

Patch Set 9 : restore conditional #

Patch Set 10 : rearrange, comment #

Patch Set 11 : build #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+94 lines, -85 lines) Patch
M include/core/SkImageFilter.h View 1 2 3 2 chunks +0 lines, -4 lines 0 comments Download
M src/core/SkImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 3 chunks +94 lines, -80 lines 3 comments Download
M src/core/SkResourceCache.cpp View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 41 (13 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1370323002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1370323002/40001
5 years, 2 months ago (2015-09-28 21:29:58 UTC) #2
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared-Trybot on client.skia (JOB_FAILED, http://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared-Trybot/builds/3393)
5 years, 2 months ago (2015-09-28 21:30:39 UTC) #4
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1370323002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1370323002/80001
5 years, 2 months ago (2015-09-28 21:35:55 UTC) #6
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 2 months ago (2015-09-28 21:42:12 UTC) #8
mtklein_C
5 years, 2 months ago (2015-09-28 21:45:43 UTC) #10
reed1
Question : where/how does the bitmap get Allocated? To switch over to SkResourceCache, they all ...
5 years, 2 months ago (2015-09-29 17:30:55 UTC) #11
mtklein
On 2015/09/29 17:30:55, reed1 wrote: > Question : where/how does the bitmap get Allocated? To ...
5 years, 2 months ago (2015-09-29 18:23:53 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1370323002/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1370323002/120001
5 years, 2 months ago (2015-09-29 19:04:46 UTC) #14
commit-bot: I haz the power
Try jobs failed on following builders: Build-Win-MSVC-x86-Debug-Trybot on client.skia.compile (JOB_FAILED, http://build.chromium.org/p/client.skia.compile/builders/Build-Win-MSVC-x86-Debug-Trybot/builds/3463) Build-Win-MSVC-x86_64-Debug-Trybot on client.skia.compile (JOB_FAILED, ...
5 years, 2 months ago (2015-09-29 19:06:51 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1370323002/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1370323002/140001
5 years, 2 months ago (2015-09-29 19:09:31 UTC) #18
commit-bot: I haz the power
Committed patchset #8 (id:140001) as https://skia.googlesource.com/skia/+/75135d8ae1aa12e8e6bfce63291e5e876a77546f
5 years, 2 months ago (2015-09-29 19:15:55 UTC) #19
mtklein_C
A revert of this CL (patchset #8 id:140001) has been created in https://codereview.chromium.org/1381523002/ by mtklein@chromium.org. ...
5 years, 2 months ago (2015-09-29 19:16:48 UTC) #20
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1370323002/180001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1370323002/180001
5 years, 2 months ago (2015-09-30 12:57:20 UTC) #22
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: Build-Ubuntu-GCC-x86_64-Release-Trybot on client.skia.compile (JOB_FAILED, http://build.chromium.org/p/client.skia.compile/builders/Build-Ubuntu-GCC-x86_64-Release-Trybot/builds/3480)
5 years, 2 months ago (2015-09-30 12:57:57 UTC) #24
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1370323002/200001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1370323002/200001
5 years, 2 months ago (2015-09-30 13:05:08 UTC) #26
mtklein_C
PTAL Looks like the hack of just copying as needed is working out fine.
5 years, 2 months ago (2015-09-30 13:10:10 UTC) #27
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 2 months ago (2015-09-30 13:12:43 UTC) #29
Stephen White
I love this approach, but I think we need to try to get rid of ...
5 years, 2 months ago (2015-10-13 16:50:08 UTC) #31
reed1
Stephen, mike was trying this out because the current situation is pretty bad (given the ...
5 years, 2 months ago (2015-10-13 18:55:13 UTC) #32
mtklein
On 2015/10/13 18:55:13, reed1 wrote: > Stephen, mike was trying this out because the current ...
5 years, 2 months ago (2015-10-14 15:19:55 UTC) #33
Stephen White
On 2015/10/14 15:19:55, mtklein wrote: > On 2015/10/13 18:55:13, reed1 wrote: > > Stephen, mike ...
5 years, 2 months ago (2015-10-14 16:10:32 UTC) #34
mtklein
> Great, thanks. Note that that one (and image_filter_dag bench in Skia) test > whether ...
5 years, 2 months ago (2015-10-14 16:28:04 UTC) #35
Stephen White
On 2015/10/14 16:28:04, mtklein wrote: > > Great, thanks. Note that that one (and image_filter_dag ...
5 years, 2 months ago (2015-10-14 16:46:19 UTC) #36
mtklein
Agree that https://codereview.chromium.org/1401173006/ shows that the copy is significant compared to trivial image filters.
5 years, 2 months ago (2015-10-14 17:02:54 UTC) #37
Stephen White
On 2015/10/14 16:10:32, Stephen White wrote: > On 2015/10/14 15:19:55, mtklein wrote: > > On ...
5 years, 2 months ago (2015-10-20 16:08:13 UTC) #38
mtklein
On 2015/10/20 16:08:13, Stephen White wrote: > On 2015/10/14 16:10:32, Stephen White wrote: > > ...
5 years, 2 months ago (2015-10-20 16:21:42 UTC) #39
Stephen White
On 2015/10/20 16:21:42, mtklein wrote: > On 2015/10/20 16:08:13, Stephen White wrote: > > On ...
5 years, 2 months ago (2015-10-20 19:46:34 UTC) #40
mtklein
5 years, 2 months ago (2015-10-20 19:55:44 UTC) #41
On 2015/10/20 19:46:34, Stephen White wrote:
> On 2015/10/20 16:21:42, mtklein wrote:
> > On 2015/10/20 16:08:13, Stephen White wrote:
> > > On 2015/10/14 16:10:32, Stephen White wrote:
> > > > On 2015/10/14 15:19:55, mtklein wrote:
> > > > > On 2015/10/13 18:55:13, reed1 wrote:
> > > > > > Stephen, mike was trying this out because the current situation is
> > pretty
> > > > bad
> > > > > > (given the size of the cache and that it is not discardable).
> > > > > > 
> > > > > > I think I understand the direction you're suggesting, about plumbing
> the
> > > > > > allocator. Perhaps you could sketch an alternate CL, given your
> > > > understanding
> > > > > of
> > > > > > how/where devices/bitmaps are allocated today.
> > > > 
> > > > Off the top of my head, I think have SkRasterDevice create discardable
> > memory
> > > > when it sees the "fForImageFilter" in the CreateInfo might work,
assuming
> > > > devices
> > > > have access to the discardable memory pool. That wouldn't require any
API
> > > > changes,
> > > > I think.
> > > > 
> > > > Another option would be to have DeviceProxy::createDevice() allocate a
> > > > discardable
> > > > bitmap, and wrap a device around that (if devices can be wrapped around
> > > bitmaps
> > > > still?). 
> > > > That'd be less intrusive, but it wouldn't work for the GPU side. Maybe a
> > > > createDiscardableDevice()
> > > > on SkDevice? I dunno.
> > > 
> > > I've realized there's a problem with both of these approaches: they
require
> > that
> > > all image filters go through the proxy->createDevice() path to allocate
> > bitmaps.
> > > The GPU
> > > and generic Skia filters already do, but filters with custom pixel loops
> often
> > > use 
> > > tryAllocPixels() directly on the destination SkBitmap.
> > > 
> > > I've put up a patch here to switch them over:
> > > https://codereview.chromium.org/1414843003
> > > 
> > > > > I also agree that threading an allocator through is the best design,
and
> > the
> > > > way
> > > > > I'd write it from scratch today.  I stopped short because I wasn't
> willing
> > > to
> > > > > invest the effort to do that.  And, that land-and-revert of PS 8 makes
> it
> > > look
> > > > > like the copy may not be a problem (PS 8 forced the copy, just like
it'd
> > > > happen
> > > > > in Chrome).  Think running that patch through CT would be a good way
of
> > > > > answering that for Chrome?  If it's no big deal, it might be nice to
> land
> > > > first
> > > > > to get this memory accounted for, then finesse the copy later.  I'd
even
> > go
> > > as
> > > > > far as landing it with an unconditional copy, to both simplify the
code
> > and
> > > > make
> > > > > sure everyone's testing the same paths for correctness and
performance.
> > > > 
> > > > The other place this copy is going to hit us is Canvas, which in the
> display
> > > > list canvas
> > > > mode uses an image filter when it needs to resize the canvas for
zooming,
> > etc.
> > > > It shouldn't be caching at all, but right now it is, which means with
this
> > > > change we'll 
> > > > be doing a copy of the canvas backing store on every frame, AFAICT.
> > > > 
> > > > > While you're thinking, I'll get going on building Chrome with this
patch
> > to
> > > > see
> > > > > how filter_terrain.svg fares.
> > > > 
> > > > Great, thanks. Note that that one (and image_filter_dag bench in Skia)
> test
> > > > whether caching is functional (bound on a heavy blur which is done 5
times
> > or
> > > > 1 time if it's working), but may not be affected by the copy, since
> they're
> > > > dominated by the blur. We have a paucity of image filter benches, sadly.
> > 
> > Just out of curiosity, does this look neutral to you?
> >
>
https://doc-0jeti-135dm-s-googleusercontent.commondatastorage.googleapis.com/...
> 
> I don't have access to that link.

Weird.  Can you get to it from here
http://build.chromium.org/p/client.skia.fyi/builders/CT-Perf-10k-Linux-RR-Par...
 ?  (CT Perf Results)

Powered by Google App Engine
This is Rietveld 408576698