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

Issue 471473002: Optimize CSS box-shadow performance (Closed)

Created:
6 years, 4 months ago by qiankun
Modified:
6 years, 1 month ago
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Project:
skia
Visibility:
Public.

Description

Optimize CSS box-shadow performance Cache the SkMask of blur effect with SkScaledImageCache to improve CSS box-shadow performance. This CL is based on Jun Jiang's CL(https://codereview.chromium.org/286273002). BUG=173807, 425427

Patch Set 1 #

Patch Set 2 : rebase to general imagecache's Key #

Patch Set 3 : based on SkBitmapCache #

Total comments: 2

Patch Set 4 : add SkMaskCache #

Total comments: 10

Patch Set 5 : remove helper getCachedBlurMask #

Patch Set 6 : separate CL #

Patch Set 7 : rebase to general Rec #

Patch Set 8 : use SkBitmap as the cached value #

Patch Set 9 : backed blur mask with a bitmap #

Total comments: 2

Patch Set 10 : add a common base struct to hold fBitmap #

Patch Set 11 : use SkData to hold fImage in SkMask #

Patch Set 12 : clear SkMaskCache API and move SkData out of SkMask #

Patch Set 13 : remove unused SkData field in SkMask #

Patch Set 14 : based on SkCachedData and SkDiscardableMemory #

Patch Set 15 : remove SkCachedData field in SkMask and pass it as 2nd parameter as needed #

Patch Set 16 : store SkMask and SkCachedData in cache #

Total comments: 11
Unified diffs Side-by-side diffs Delta from patch set Stats (+350 lines, -68 lines) Patch
M bench/BlurRectBench.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +2 lines, -2 lines 0 comments Download
M gm/blurrect.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +3 lines, -3 lines 0 comments Download
M gyp/core.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -0 lines 0 comments Download
M include/core/SkMaskFilter.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 chunks +6 lines, -4 lines 2 comments Download
M include/effects/SkEmbossMaskFilter.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M include/effects/SkTableMaskFilter.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M src/core/SkBitmap.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +2 lines, -2 lines 0 comments Download
M src/core/SkDraw.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +2 lines, -2 lines 0 comments Download
A src/core/SkMaskCache.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +40 lines, -0 lines 0 comments Download
A src/core/SkMaskCache.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +150 lines, -0 lines 3 comments Download
M src/core/SkMaskFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 5 chunks +5 lines, -5 lines 0 comments Download
M src/core/SkRasterizer.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M src/core/SkResourceCache.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/SkResourceCache.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +14 lines, -0 lines 0 comments Download
M src/core/SkScalerContext.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +2 lines, -2 lines 0 comments Download
M src/device/xps/SkXPSDevice.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +2 lines, -5 lines 0 comments Download
M src/effects/SkBlurMask.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 chunks +6 lines, -7 lines 0 comments Download
M src/effects/SkBlurMask.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 8 chunks +67 lines, -11 lines 2 comments Download
M src/effects/SkBlurMaskFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 12 chunks +39 lines, -18 lines 4 comments Download
M src/effects/SkEmbossMaskFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +2 lines, -2 lines 0 comments Download
M src/effects/SkTableMaskFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M src/gpu/SkGpuDevice.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 46 (1 generated)
qiankun
Hi reviewers, I did a update to fix comments in https://codereview.chromium.org/286273002. Could you take a ...
6 years, 4 months ago (2014-08-13 09:56:12 UTC) #1
reed1
I like the direction of trying to extend the existing image cache. Adding florin who ...
6 years, 4 months ago (2014-08-15 15:38:42 UTC) #2
tomhudson
On 2014/08/15 15:38:42, reed1 wrote: > I wonder if we can extend the Key w/o ...
6 years, 4 months ago (2014-08-15 16:04:15 UTC) #3
reed1
On 2014/08/15 16:04:15, tomhudson wrote: > On 2014/08/15 15:38:42, reed1 wrote: > > I wonder ...
6 years, 4 months ago (2014-08-15 16:06:23 UTC) #4
reed1
Perhaps I can try posting a faux CL that suggests what I have in mind.
6 years, 4 months ago (2014-08-15 16:07:02 UTC) #5
reed1
This is a draft of my idea. If we land something like it, then this ...
6 years, 4 months ago (2014-08-15 17:16:57 UTC) #6
reed1
On 2014/08/15 17:16:57, reed1 wrote: > This is a draft of my idea. If we ...
6 years, 4 months ago (2014-08-15 17:19:37 UTC) #7
qiankun
On 2014/08/15 15:38:42, reed1 wrote: > I like the direction of trying to extend the ...
6 years, 4 months ago (2014-08-18 10:16:54 UTC) #8
qiankun
I rebased this CL to the general Key. PTAL.
6 years, 4 months ago (2014-08-21 09:03:37 UTC) #9
reed1
I'm glad the generalized key idea seems to be working. I think we can take ...
6 years, 4 months ago (2014-08-21 12:26:13 UTC) #10
reed1
refactor of the base cache https://codereview.chromium.org/483493003/
6 years, 4 months ago (2014-08-21 15:13:56 UTC) #11
qiankun
Updated Cl based on SkBitmapCache, PTAL.
6 years, 4 months ago (2014-08-22 06:28:47 UTC) #12
reed1
I think the maskfilter code should create its own private header/wrapper for the cache. Sort ...
6 years, 4 months ago (2014-08-22 15:43:59 UTC) #13
reed1
lets try to land the cleanups in scaledbitmapcache in its own CL. https://codereview.chromium.org/471473002/diff/40001/src/core/SkScaledImageCache.h File src/core/SkScaledImageCache.h ...
6 years, 4 months ago (2014-08-22 15:45:03 UTC) #14
qiankun
Add SkMaskCache. https://codereview.chromium.org/471473002/diff/40001/src/core/SkScaledImageCache.h File src/core/SkScaledImageCache.h (left): https://codereview.chromium.org/471473002/diff/40001/src/core/SkScaledImageCache.h#oldcode132 src/core/SkScaledImageCache.h:132: * Use (generationID, width, and height) or ...
6 years, 4 months ago (2014-08-25 06:22:03 UTC) #15
reed1
https://codereview.chromium.org/471473002/diff/60001/src/core/SkMaskCache.cpp File src/core/SkMaskCache.cpp (right): https://codereview.chromium.org/471473002/diff/60001/src/core/SkMaskCache.cpp#newcode61 src/core/SkMaskCache.cpp:61: bitmap.installMaskPixels(mask); installMaskPixels does not copy the memory for the ...
6 years, 4 months ago (2014-08-25 11:58:43 UTC) #16
reed1
BTW -- I have an experimental change locally that should resolve the "who owns the ...
6 years, 4 months ago (2014-08-25 14:44:22 UTC) #17
qiankun
Fixed some comments and looking forward to reed's solution for "memory owning" problem. https://codereview.chromium.org/471473002/diff/60001/src/core/SkMaskCache.cpp File ...
6 years, 4 months ago (2014-08-26 08:36:33 UTC) #18
qiankun
New CL based on generic cache was uploaded. PTAL.
6 years, 3 months ago (2014-08-28 07:28:17 UTC) #19
reed1
That looks very clean, thanks. I think now there are two issues remaining. 1. Who ...
6 years, 3 months ago (2014-08-28 20:13:35 UTC) #20
qiankun
On 2014/08/28 20:13:35, reed1 wrote: > That looks very clean, thanks. > > I think ...
6 years, 3 months ago (2014-08-29 09:28:54 UTC) #21
qiankun
Uploaded a new patch. Use bitmap as the real value in blur mask. PTAL.
6 years, 3 months ago (2014-09-04 08:45:16 UTC) #22
reed1
Looks like we could really use a shared find_and_return function. Perhaps all that is needed ...
6 years, 3 months ago (2014-09-04 14:15:39 UTC) #23
qiankun
Upload a new patch to share find_and_return. https://codereview.chromium.org/471473002/diff/160001/src/core/SkBitmapCache.cpp File src/core/SkBitmapCache.cpp (right): https://codereview.chromium.org/471473002/diff/160001/src/core/SkBitmapCache.cpp#newcode86 src/core/SkBitmapCache.cpp:86: virtual size_t ...
6 years, 3 months ago (2014-09-09 03:03:03 UTC) #24
reed1
Definitely don't want to add a bitmap to mask -- that sort of defeats the ...
6 years, 3 months ago (2014-09-09 20:06:51 UTC) #25
qiankun
On 2014/09/09 20:06:51, reed1 wrote: > Definitely don't want to add a bitmap to mask ...
6 years, 3 months ago (2014-09-10 01:56:40 UTC) #26
reed1
On 2014/09/10 01:56:40, qiankun wrote: > On 2014/09/09 20:06:51, reed1 wrote: > > Definitely don't ...
6 years, 3 months ago (2014-09-11 15:53:05 UTC) #27
qiankun
On 2014/09/11 15:53:05, reed1 wrote: > On 2014/09/10 01:56:40, qiankun wrote: > > On 2014/09/09 ...
6 years, 3 months ago (2014-09-15 09:17:04 UTC) #28
qiankun
Ping.
6 years, 3 months ago (2014-09-18 17:50:41 UTC) #29
reed1
I like the simplicity, but mask doesn't have any lifetime management (on purpose) so adding ...
6 years, 3 months ago (2014-09-19 20:46:21 UTC) #30
reed2
Actually, its harder than I thought. We need to allow for the mask pixels to ...
6 years, 3 months ago (2014-09-20 12:51:33 UTC) #32
Stephen White
On 2014/09/20 12:51:33, reed2 wrote: > Actually, its harder than I thought. We need to ...
6 years, 3 months ago (2014-09-20 15:09:39 UTC) #33
qiankun
On 2014/09/20 12:51:33, reed2 wrote: > Actually, its harder than I thought. We need to ...
6 years, 3 months ago (2014-09-23 09:13:10 UTC) #34
reed1
On 2014/09/23 09:13:10, qiankun wrote: > On 2014/09/20 12:51:33, reed2 wrote: > > Actually, its ...
6 years, 3 months ago (2014-09-23 13:46:06 UTC) #35
reveman
On 2014/09/23 09:13:10, qiankun wrote: > On 2014/09/20 12:51:33, reed2 wrote: > > Actually, its ...
6 years, 2 months ago (2014-09-27 03:07:50 UTC) #36
qiankun
Hi reviewers, a new patch is uploaded, which used SkCachedData as cache backend and SkDicardableMemory ...
6 years, 2 months ago (2014-10-15 08:03:07 UTC) #37
reed1
I think it is confusing to add a cachedata field to SkMask, when that struct ...
6 years, 2 months ago (2014-10-15 17:25:03 UTC) #38
qiankun
On 2014/10/15 17:25:03, reed1 wrote: > I think it is confusing to add a cachedata ...
6 years, 2 months ago (2014-10-16 08:48:56 UTC) #39
enne (OOO)
I added issue 425427 to this bug's description as this patch makes a giant performance ...
6 years, 2 months ago (2014-10-21 19:17:29 UTC) #40
reed1
https://codereview.chromium.org/471473002/diff/300001/include/core/SkMaskFilter.h File include/core/SkMaskFilter.h (right): https://codereview.chromium.org/471473002/diff/300001/include/core/SkMaskFilter.h#newcode63 include/core/SkMaskFilter.h:63: SkIPoint* margin, SkCachedData** data) const; What is the contract ...
6 years, 2 months ago (2014-10-21 21:29:49 UTC) #41
reed1
https://codereview.chromium.org/471473002/diff/300001/src/effects/SkBlurMask.cpp File src/effects/SkBlurMask.cpp (right): https://codereview.chromium.org/471473002/diff/300001/src/effects/SkBlurMask.cpp#newcode548 src/effects/SkBlurMask.cpp:548: if (NULL == data) { we have to repeat ...
6 years, 2 months ago (2014-10-21 21:32:55 UTC) #42
reed1
There are so many sites affected with this approach, and at many of them we ...
6 years, 2 months ago (2014-10-21 21:47:06 UTC) #43
reed1
This chain of CLs has been extremely valuable. Inspired and in support of these, we ...
6 years, 2 months ago (2014-10-21 22:22:21 UTC) #44
qiankun
Thanks for your review, reed. I separated SkMaskCache from this CL. You can find it ...
6 years, 2 months ago (2014-10-22 08:25:54 UTC) #45
qiankun
6 years, 1 month ago (2014-10-29 01:56:58 UTC) #46
https://codereview.chromium.org/669993003/ (by reed) and
https://codereview.chromium.org/670063004/ (by Qiankun) have been landed to fix
the poor box shadow performance. So, close this issue.

Powered by Google App Engine
This is Rietveld 408576698