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

Issue 286273002: Optimize CSS box-shadow performance by caching the SkMask of the blur effect. (Closed)

Created:
6 years, 7 months ago by Jun Jiang
Modified:
5 years, 4 months ago
CC:
skia-review_googlegroups.com
Visibility:
Public.

Description

Optimize CSS box-shadow performance by caching the SkMask of the blur effect. BUG=173807

Patch Set 1 #

Total comments: 5

Patch Set 2 : add mutex for thread-safe and use SkDiscardableMemory #

Total comments: 5

Patch Set 3 : re-use SkScaledImageCache and remove memory limit #

Patch Set 4 : add changes to avoid subclassing of SkMask #

Patch Set 5 : rebase with latest skia in git instead of svn trunk #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+282 lines, -26 lines) Patch
M include/core/SkMask.h View 1 2 3 1 chunk +6 lines, -0 lines 1 comment Download
M include/core/SkMaskFilter.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M src/core/SkMaskFilter.cpp View 1 2 3 4 2 chunks +12 lines, -10 lines 1 comment Download
M src/core/SkScaledImageCache.cpp View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M src/effects/SkBlurMask.h View 1 2 3 2 chunks +6 lines, -1 line 1 comment Download
M src/effects/SkBlurMask.cpp View 1 2 3 7 chunks +83 lines, -6 lines 1 comment Download
M src/effects/SkBlurMaskFilter.cpp View 1 2 3 8 chunks +172 lines, -7 lines 3 comments Download

Messages

Total messages: 32 (0 generated)
Jun Jiang
Sorry for the delay. The network is not quite stable today and most time was ...
6 years, 7 months ago (2014-05-16 16:51:29 UTC) #1
reveman
Just some general comments from the pov of how this will impact chromium. Skia folks ...
6 years, 7 months ago (2014-05-16 18:49:16 UTC) #2
junj
Hi, reveman. Thanks for your comments and suggestions. https://codereview.chromium.org/286273002/diff/1/src/effects/SkBlurMaskFilter.cpp File src/effects/SkBlurMaskFilter.cpp (right): https://codereview.chromium.org/286273002/diff/1/src/effects/SkBlurMaskFilter.cpp#newcode166 src/effects/SkBlurMaskFilter.cpp:166: SkBlurMaskFilterImpl::BlurMaskRecordList ...
6 years, 7 months ago (2014-05-19 12:54:49 UTC) #3
reveman
https://codereview.chromium.org/286273002/diff/1/src/effects/SkBlurMaskFilter.cpp File src/effects/SkBlurMaskFilter.cpp (right): https://codereview.chromium.org/286273002/diff/1/src/effects/SkBlurMaskFilter.cpp#newcode169 src/effects/SkBlurMaskFilter.cpp:169: unsigned SkBlurMaskFilterImpl::fMaxImageMemorySize = 2 * 1024 * 1024; On ...
6 years, 7 months ago (2014-05-19 14:09:37 UTC) #4
Jun Jiang
I have added mutex for thread-safe access and used SkDiscardableMemory as suggested. Verified on Linux ...
6 years, 7 months ago (2014-05-22 09:14:57 UTC) #5
Jun Jiang
Add more people in the loop for review.
6 years, 7 months ago (2014-05-22 09:16:39 UTC) #6
tomhudson
https://codereview.chromium.org/286273002/diff/20001/src/core/SkMaskFilter.cpp File src/core/SkMaskFilter.cpp (left): https://codereview.chromium.org/286273002/diff/20001/src/core/SkMaskFilter.cpp#oldcode226 src/core/SkMaskFilter.cpp:226: SkMask::FreeImage(patch.fMask.fImage); NinePatch doesn't inherit from BlurMaskRecord, so you aren't ...
6 years, 7 months ago (2014-05-22 10:01:49 UTC) #7
reed1
6 years, 7 months ago (2014-05-22 12:31:52 UTC) #8
reed1
adding weight to SkMask is tricky, as we use that for text blits as well. ...
6 years, 7 months ago (2014-05-22 19:16:52 UTC) #9
Jun Jiang
@tomhudson, thanks for your comments. https://codereview.chromium.org/286273002/diff/20001/src/core/SkMaskFilter.cpp File src/core/SkMaskFilter.cpp (left): https://codereview.chromium.org/286273002/diff/20001/src/core/SkMaskFilter.cpp#oldcode226 src/core/SkMaskFilter.cpp:226: SkMask::FreeImage(patch.fMask.fImage); On 2014/05/22 10:01:50, ...
6 years, 7 months ago (2014-05-23 02:06:27 UTC) #10
Jun Jiang
On 2014/05/22 19:16:52, reed1 wrote: > adding weight to SkMask is tricky, as we use ...
6 years, 7 months ago (2014-05-23 02:22:57 UTC) #11
reveman
Just some discardable memory related comments. I'm not the right person to comment on the ...
6 years, 7 months ago (2014-05-23 02:31:29 UTC) #12
Jun Jiang
On 2014/05/23 02:31:29, reveman wrote: > Just some discardable memory related comments. > > I'm ...
6 years, 7 months ago (2014-05-26 04:28:47 UTC) #13
reed1
On 2014/05/26 04:28:47, Jun Jiang wrote: > On 2014/05/23 02:31:29, reveman wrote: > > Just ...
6 years, 7 months ago (2014-05-27 13:42:33 UTC) #14
junj
On 2014/05/27 13:42:33, reed1 wrote: > On 2014/05/26 04:28:47, Jun Jiang wrote: > > On ...
6 years, 6 months ago (2014-06-04 14:27:57 UTC) #15
reed1
tried to apply locally, and failed to merge. can you rebase? Off hand, the virtual ...
6 years, 6 months ago (2014-06-04 15:14:38 UTC) #16
junj
On 2014/06/04 15:14:38, reed1 wrote: > tried to apply locally, and failed to merge. can ...
6 years, 6 months ago (2014-06-04 15:28:09 UTC) #17
Jun Jiang
On 2014/06/04 15:28:09, junj wrote: > On 2014/06/04 15:14:38, reed1 wrote: > > tried to ...
6 years, 6 months ago (2014-06-05 08:42:42 UTC) #18
Jun Jiang
On 2014/06/05 08:42:42, Jun Jiang wrote: > On 2014/06/04 15:28:09, junj wrote: > > On ...
6 years, 6 months ago (2014-06-05 11:15:38 UTC) #19
reed1
Why do you need a cache besides SkScaledImageCache? https://codereview.chromium.org/286273002/diff/60001/src/core/SkMaskFilter.cpp File src/core/SkMaskFilter.cpp (right): https://codereview.chromium.org/286273002/diff/60001/src/core/SkMaskFilter.cpp#newcode222 src/core/SkMaskFilter.cpp:222: SkScaledImageCache::Unlock( ...
6 years, 6 months ago (2014-06-09 14:55:34 UTC) #20
Stephen White
https://codereview.chromium.org/286273002/diff/60001/include/core/SkMask.h File include/core/SkMask.h (right): https://codereview.chromium.org/286273002/diff/60001/include/core/SkMask.h#newcode139 include/core/SkMask.h:139: struct SkDiscardableMemoryMask { Naming nit: instead of baking "discardable ...
6 years, 6 months ago (2014-06-09 18:03:58 UTC) #21
reed1
I am also not in favor of using stl for collections. My high-level question about ...
6 years, 6 months ago (2014-06-09 19:08:36 UTC) #22
junj
On 2014/06/09 14:55:34, reed1 wrote: > Why do you need a cache besides SkScaledImageCache? > ...
6 years, 6 months ago (2014-06-10 14:33:12 UTC) #23
reed1
On 2014/06/10 14:33:12, junj wrote: > On 2014/06/09 14:55:34, reed1 wrote: > > Why do ...
6 years, 6 months ago (2014-06-10 14:35:35 UTC) #24
junj
On 2014/06/09 18:03:58, Stephen White wrote: > https://codereview.chromium.org/286273002/diff/60001/include/core/SkMask.h > File include/core/SkMask.h (right): > > https://codereview.chromium.org/286273002/diff/60001/include/core/SkMask.h#newcode139 ...
6 years, 6 months ago (2014-06-10 14:42:05 UTC) #25
Stephen White
On 2014/06/10 14:33:12, junj wrote: > On 2014/06/09 14:55:34, reed1 wrote: > > Why do ...
6 years, 6 months ago (2014-06-10 14:42:32 UTC) #26
junj
On 2014/06/10 14:35:35, reed1 wrote: > On 2014/06/10 14:33:12, junj wrote: > > On 2014/06/09 ...
6 years, 6 months ago (2014-06-10 14:52:45 UTC) #27
reed1
mtklein is pretty good a thinking about skia's keys and caches...
6 years, 6 months ago (2014-06-10 15:46:47 UTC) #28
junj
On 2014/06/10 15:46:47, reed1 wrote: > mtklein is pretty good a thinking about skia's keys ...
6 years, 6 months ago (2014-06-16 13:24:45 UTC) #29
mtklein
On 2014/06/16 13:24:45, junj wrote: > On 2014/06/10 15:46:47, reed1 wrote: > > mtklein is ...
6 years, 6 months ago (2014-06-16 14:23:31 UTC) #30
mtklein
> In fact, I am not quite sure on why Key::operator<() uses fGenID for comparison ...
6 years, 6 months ago (2014-06-16 14:25:01 UTC) #31
junj
6 years, 5 months ago (2014-07-18 06:02:00 UTC) #32
On 2014/06/16 14:25:01, mtklein wrote:
> > In fact, I am not quite sure on why Key::operator<() uses fGenID for
> comparison while
> > Key::operator==() uses fHash for comparison. It seems to me it is OK to use
> fGenID for
> > both cases.
> 
> I think what you're seeing in operator< and operator== is some low-level byte
> punning.  In operator<, we're reading 28 bytes starting from &fGenID: this
> covers fGenID, fScaleX, fScaleY, and fBounds.  So it's, compare all the data,
> except skip the hash.  In operator==, we're comparing _all_ the data,
including
> the hash.  Presumably the hash is there only as an accelerator for operator==?

> Putting it first means a hash mismatch lets us short-circuit the rest of
> operator==.  Arguably, these functions should be written out to compare each
of
> the fields in turn explictly, or should use a function like memcmp if we're
> going to stick with the byte thinking.

Hi, mtklein. Thanks for your comments.

Sorry for my late reply since I was busy dealing with some urgent stuff in this
whole month. To move this issue forward, my colleague
QianKun(qiankun.miao@intel.com) will continue to follow this and move it
forward.

Powered by Google App Engine
This is Rietveld 408576698