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

Issue 545813002: Picture Recording: fix the performance bottleneck in SkDeferredCanvas::isFullFrame (Closed)

Created:
6 years, 3 months ago by yunchao
Modified:
6 years, 3 months ago
CC:
reviews_skia.org
Base URL:
https://chromium.googlesource.com/skia.git@master
Project:
skia
Visibility:
Public.

Description

Picture Recording: fix the performance bottleneck in SkDeferredCanvas::isFullFrame blink skips all pending commands during picture recording if it is drawing an opaque full-frame geometry or image. This may improve performance for some edge cases. To recognize an opaque full-frame drawing should be cheap enough. Otherwise, the overhead will offset the improvement. Unfortunately, data from perf for content_shell on Nexus7 shows that SkDeferredCanvas::isFullFrame is far from cheap. Table below shows that how much isFullFrame() costs in the whole render process. benchmark percentage my local benchmark(draw 1000 sprites) 4.1% speedReading 2.8% FishIETank(1000 fishes) 1.5% GUIMark3 Bitmap 2.0% By contrast, real recording (SkGPipeCanvas::drawBitmapRectToRect) and real rasterization (GrDrawTarget::drawRect) cost ~4% and ~6% in the whole render process respectively. Apparently, SkDeferredCanvas::isFullFrame() is nontrivial. getDeviceSize() is the main contributor to this hotspot. The change simply save the canvasSize and reuse it among drawings if it is not a fresh frame. This change cut off ~65% (or improved ~2 times) of isFullFrame(). telemetry smoothness canvas_tough_test didn't show obvious improvement or regression. BUG=411166 Committed: https://skia.googlesource.com/skia/+/8e45c3777d886ba3fe239bb549d06b0693692152 Committed: https://skia.googlesource.com/skia/+/49005bf8929dd8ca86431e13414d683b509cd538

Patch Set 1 #

Patch Set 2 : pass skia unittest DeferredCanvas in dm #

Patch Set 3 : use interface in SkDeferredCanvas #

Total comments: 7

Patch Set 4 : coding style + add a interface SkDeferredCanvas::canvasSizeChanged #

Patch Set 5 : expose an API SkDeferredCanvas::getCanvasSize according to reed's suggestion #

Patch Set 6 : add a test case for SkDeferredCanvas::getCanvasSize into tests/DeferredCanvasTest.cpp #

Total comments: 4

Patch Set 7 : nits #

Patch Set 8 : a small fix for memory leak in unit test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+74 lines, -1 line) Patch
M include/utils/SkDeferredCanvas.h View 1 2 3 4 5 6 2 chunks +8 lines, -0 lines 0 comments Download
M src/utils/SkDeferredCanvas.cpp View 1 2 3 4 5 6 4 chunks +12 lines, -1 line 0 comments Download
M tests/DeferredCanvasTest.cpp View 1 2 3 4 5 6 7 2 chunks +54 lines, -0 lines 0 comments Download

Messages

Total messages: 33 (5 generated)
yunchao
PTAL. Thanks a lot! As you know, we discussed the c1k problem in Graphics-dev: https://groups.google.com/a/chromium.org/forum/#!topic/graphics-dev/RzHob5VS8Dg. ...
6 years, 3 months ago (2014-09-05 08:43:13 UTC) #2
reed1
https://codereview.chromium.org/545813002/diff/40001/include/utils/SkDeferredCanvas.h File include/utils/SkDeferredCanvas.h (right): https://codereview.chromium.org/545813002/diff/40001/include/utils/SkDeferredCanvas.h#newcode252 include/utils/SkDeferredCanvas.h:252: SkISize canvasSize; nit: fCanvasSize https://codereview.chromium.org/545813002/diff/40001/src/utils/SkDeferredCanvas.cpp File src/utils/SkDeferredCanvas.cpp (right): https://codereview.chromium.org/545813002/diff/40001/src/utils/SkDeferredCanvas.cpp#newcode636 ...
6 years, 3 months ago (2014-09-05 13:18:33 UTC) #4
Justin Novosad
Thank you for finding this hotspot. This is great. https://codereview.chromium.org/545813002/diff/40001/src/utils/SkDeferredCanvas.cpp File src/utils/SkDeferredCanvas.cpp (right): https://codereview.chromium.org/545813002/diff/40001/src/utils/SkDeferredCanvas.cpp#newcode636 src/utils/SkDeferredCanvas.cpp:636: ...
6 years, 3 months ago (2014-09-05 13:54:50 UTC) #5
tomhudson
On 2014/09/05 13:54:50, junov wrote: > Thank you for finding this hotspot. This is great. ...
6 years, 3 months ago (2014-09-05 14:31:48 UTC) #6
Justin Novosad
On 2014/09/05 14:31:48, tomhudson wrote: > On 2014/09/05 13:54:50, junov wrote: > > Thank you ...
6 years, 3 months ago (2014-09-05 14:58:39 UTC) #7
yunchao
On 2014/09/05 14:58:39, junov wrote: > On 2014/09/05 14:31:48, tomhudson wrote: > > On 2014/09/05 ...
6 years, 3 months ago (2014-09-09 08:32:42 UTC) #8
yunchao
On 2014/09/09 08:32:42, yunchao wrote: > On 2014/09/05 14:58:39, junov wrote: > > On 2014/09/05 ...
6 years, 3 months ago (2014-09-09 08:51:50 UTC) #9
yunchao
Thanks for your reviews. I updated the code accordingly. PTAL. https://codereview.chromium.org/545813002/diff/40001/include/utils/SkDeferredCanvas.h File include/utils/SkDeferredCanvas.h (right): https://codereview.chromium.org/545813002/diff/40001/include/utils/SkDeferredCanvas.h#newcode252 ...
6 years, 3 months ago (2014-09-09 08:58:00 UTC) #10
reed1
Can we instead expose a public getCanvasSize() instead? Under the hood, it can still use ...
6 years, 3 months ago (2014-09-09 13:10:12 UTC) #12
Justin Novosad
On 2014/09/09 13:10:12, reed1 wrote: > Can we instead expose a public getCanvasSize() instead? Under ...
6 years, 3 months ago (2014-09-09 13:31:37 UTC) #13
yunchao
On 2014/09/09 13:31:37, junov wrote: > On 2014/09/09 13:10:12, reed1 wrote: > > Can we ...
6 years, 3 months ago (2014-09-10 13:51:01 UTC) #14
Justin Novosad
On 2014/09/10 13:51:01, yunchao wrote: > On 2014/09/09 13:31:37, junov wrote: > > On 2014/09/09 ...
6 years, 3 months ago (2014-09-10 14:06:15 UTC) #15
reed1
On 2014/09/10 14:06:15, junov wrote: > On 2014/09/10 13:51:01, yunchao wrote: > > On 2014/09/09 ...
6 years, 3 months ago (2014-09-10 14:14:16 UTC) #16
Justin Novosad
On 2014/09/10 14:14:16, reed1 wrote: > Since this has not come up anywhere bug deferredcanvas, ...
6 years, 3 months ago (2014-09-10 14:32:06 UTC) #17
yunchao
On 2014/09/10 14:32:06, junov wrote: > On 2014/09/10 14:14:16, reed1 wrote: > > Since this ...
6 years, 3 months ago (2014-09-11 11:14:47 UTC) #18
reed1
another thought: if we mark the 2 new fields mutable, we can make the public ...
6 years, 3 months ago (2014-09-11 15:38:13 UTC) #19
Justin Novosad
On 2014/09/11 11:14:47, yunchao wrote: > > In addition, I made 2 small revision: > ...
6 years, 3 months ago (2014-09-11 17:14:32 UTC) #20
yunchao
Thanks for your review, reed. I have updated the code accordingly. PTAL. Thanks a lot. ...
6 years, 3 months ago (2014-09-12 10:13:28 UTC) #21
Justin Novosad
On 2014/09/12 10:13:28, yunchao wrote: > Thanks for your review, reed. I have updated the ...
6 years, 3 months ago (2014-09-12 14:41:37 UTC) #22
reed1
change lgtm Question : can "setSurface" really change the size of the backing behind the ...
6 years, 3 months ago (2014-09-12 16:06:36 UTC) #23
Justin Novosad
On 2014/09/12 16:06:36, reed1 wrote: > change lgtm > > Question : can "setSurface" really ...
6 years, 3 months ago (2014-09-12 16:11:41 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/545813002/140001
6 years, 3 months ago (2014-09-15 01:44:06 UTC) #26
commit-bot: I haz the power
Committed patchset #7 (id:140001) as 8e45c3777d886ba3fe239bb549d06b0693692152
6 years, 3 months ago (2014-09-15 01:59:11 UTC) #27
mtklein
A revert of this CL (patchset #7 id:140001) has been created in https://codereview.chromium.org/571053002/ by mtklein@google.com. ...
6 years, 3 months ago (2014-09-15 13:00:04 UTC) #28
tomhudson
On 2014/09/15 13:00:04, mtklein wrote: > The reason for reverting is: This is leaking memory: ...
6 years, 3 months ago (2014-09-15 13:05:38 UTC) #29
yunchao
On 2014/09/15 13:05:38, tomhudson wrote: > On 2014/09/15 13:00:04, mtklein wrote: > > The reason ...
6 years, 3 months ago (2014-09-16 05:20:43 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/545813002/160001
6 years, 3 months ago (2014-09-16 05:22:57 UTC) #32
commit-bot: I haz the power
6 years, 3 months ago (2014-09-16 05:30:44 UTC) #33
Message was sent while issue was closed.
Committed patchset #8 (id:160001) as 49005bf8929dd8ca86431e13414d683b509cd538

Powered by Google App Engine
This is Rietveld 408576698