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

Issue 2213333002: SkLite* (Closed)

Created:
4 years, 4 months ago by mtklein_C
Modified:
4 years, 4 months ago
Reviewers:
djsollen, mtklein, reed1
CC:
herb_g, reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

SkLite* SkLiteRecorder, a new SkCanvas, fills out SkLiteDL, a new SkDrawable. This SkDrawable is a display list similar to SkRecord and SkBigPicture / SkRecordedDrawable, but with a few new design points inspired by Android and slimming paint: 1) SkLiteDL is structured as one big contiguous array rather than the two layer structure of SkRecord. This trades away flexibility and large-op-count performance for better data locality for small to medium size pictures. 2) We keep a global freelist of SkLiteDLs, both reusing the SkLiteDL struct itself and its contiguous byte array. This keeps the expected number of mallocs per display list allocation <1 (really, ~0) for cyclical use cases. These two together mean recording is faster. Measuring against the code we use at head, SkLiteRecorder trends about ~3x faster across various size pictures, matching speed at 0 draws and beating the special-case 1-draw pictures we have today. (I.e. we won't need those special case implementations anymore, because they're slower than this new generic code.) This new strategy records 10 drawRects() in about the same time the old strategy took for 2. This strategy stays the winner until at least 500 drawRect()s on my laptop, where I stopped checking. A simpler alternative to freelisting is also possible (but not implemented here), where we allow the client to manually reset() an SkLiteDL for reuse when its refcnt is 1. That's essentially what we're doing with the freelist, except tracking what's available for reuse globally instead of making the client do it. This code is not fully capable yet, but most of the key design points are there. The internal structure of SkLiteDL is the area I expect to be most volatile (anything involving Op), but its interface and the whole of SkLiteRecorder ought to be just about done. You can run nanobench --match picture_overhead as a demo. Everything it exercises is fully fleshed out, so what it tests is an apples-to-apples comparison as far as recording costs go. I have not yet compared playback performance. It should be simple to wrap this into an SkPicture subclass if we want. I won't start proposing we replace anything old with anything new quite yet until I have more ducks in a row, but this does look pretty promising (similar to the SkRecord over old SkPicture change a couple years ago) and I'd like to land, experiment, iterate, especially with an eye toward Android. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2213333002 Committed: https://skia.googlesource.com/skia/+/9c5052f16b249d2b7674ea86bd24ed0038ccc61f

Patch Set 1 #

Patch Set 2 : more #

Patch Set 3 : more ideas #

Patch Set 4 : drawables are free from the tyranny of pictures #

Patch Set 5 : no longer needed #

Patch Set 6 : simplify #

Patch Set 7 : add a canvas #

Patch Set 8 : skip in Op #

Patch Set 9 : should be most of SkLiteRecorder #

Patch Set 10 : builds again #

Patch Set 11 : fix refcnt bugs #

Patch Set 12 : expand benches #

Patch Set 13 : sk_sp, small stuff #

Patch Set 14 : copies #

Patch Set 15 : If we put skip first, that means we can tail call into SkPaint(const SkPaint&) for most draws. #

Patch Set 16 : test and fix #

Patch Set 17 : nicer #

Patch Set 18 : fix include #

Patch Set 19 : annoying... #

Unified diffs Side-by-side diffs Delta from patch set Stats (+643 lines, -14 lines) Patch
M bench/PictureOverheadBench.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +36 lines, -9 lines 0 comments Download
M dm/DM.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +1 line, -0 lines 0 comments Download
M dm/DMSrcSink.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +6 lines, -0 lines 0 comments Download
M dm/DMSrcSink.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +22 lines, -0 lines 0 comments Download
M gyp/core.gypi View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M include/core/SkCanvas.h View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M include/core/SkRefCnt.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -5 lines 0 comments Download
A src/core/SkLiteDL.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +86 lines, -0 lines 0 comments Download
A src/core/SkLiteDL.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 15 1 chunk +150 lines, -0 lines 0 comments Download
A src/core/SkLiteRecorder.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +85 lines, -0 lines 0 comments Download
A src/core/SkLiteRecorder.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +188 lines, -0 lines 0 comments Download
A tests/SkLiteDLTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +64 lines, -0 lines 0 comments Download

Messages

Total messages: 33 (24 generated)
mtklein_C
4 years, 4 months ago (2016-08-05 20:17:41 UTC) #11
mtklein_C
Just a quick update in case you have already started reading. I just updated the ...
4 years, 4 months ago (2016-08-05 20:53:45 UTC) #15
reed1
seems very easy to read. lgtm esp. since it doesn't affect any other code-flow (so ...
4 years, 4 months ago (2016-08-05 22:01:08 UTC) #18
mtklein
> Using SkTDArray, which will just memmove/memcpy when it has to grow. Very fast, > ...
4 years, 4 months ago (2016-08-05 22:08:00 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2213333002/270001
4 years, 4 months ago (2016-08-05 22:12:36 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2213333002/330001
4 years, 4 months ago (2016-08-06 19:17:28 UTC) #26
commit-bot: I haz the power
Try jobs failed on following builders: Build-Win-MSVC-x86_64-Debug-Trybot on master.client.skia.compile (JOB_FAILED, http://build.chromium.org/p/client.skia.compile/builders/Build-Win-MSVC-x86_64-Debug-Trybot/builds/10558)
4 years, 4 months ago (2016-08-06 19:24:58 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2213333002/350001
4 years, 4 months ago (2016-08-06 19:30:29 UTC) #31
commit-bot: I haz the power
4 years, 4 months ago (2016-08-06 19:52:00 UTC) #33
Message was sent while issue was closed.
Committed patchset #19 (id:350001) as
https://skia.googlesource.com/skia/+/9c5052f16b249d2b7674ea86bd24ed0038ccc61f

Powered by Google App Engine
This is Rietveld 408576698