aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/SKPBench.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2014-12-09 10:27:54 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-09 10:27:54 -0800
commita3e52724ac8b9fa7b48507bff4fa8e558a213e49 (patch)
tree2b12e623f2312602bf737609bb61534e6f7f3a4d /bench/SKPBench.cpp
parent43be354644dfc875baea137027f32d118305817f (diff)
Switch non-MPD nanobench path to use a separate canvas per tile
It is desirable that, when layer hoisting is disabled, the MPD and non-MPD timings be roughly the same. Unfortunately, using a separate canvas for each tile (a requirement for MPD) introduces its own discrepancy into the timing. Using a separate canvas for each tile doesn't seem to make a difference for 8888 (see the non-MPD 8888 column below) but slows down GPU rendering (see the non-MPD GPU column below). Since this is how Chromium renders I propose switching to this regimen (even though it is "slowing down" GPU rendering). nanobench mean times (ms) with layer hoisting disabled (for desk_amazon.skp) 8888 MPD non-MPD 1 canvas (old-style) 0.628 1.71 separate (new-style) 0.795 1.63 GPU MPD non-MPD 1 canvas (old-style) 2.34 1.69 separate (new-style) 2.32 2.66 Review URL: https://codereview.chromium.org/779643002
Diffstat (limited to 'bench/SKPBench.cpp')
-rw-r--r--bench/SKPBench.cpp43
1 files changed, 14 insertions, 29 deletions
diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp
index 222a878950..0219f0bc2e 100644
--- a/bench/SKPBench.cpp
+++ b/bench/SKPBench.cpp
@@ -40,10 +40,6 @@ const char* SKPBench::onGetUniqueName() {
}
void SKPBench::onPerCanvasPreDraw(SkCanvas* canvas) {
- if (!fUseMultiPictureDraw) {
- return;
- }
-
SkIRect bounds;
SkAssertResult(canvas->getClipDeviceBounds(&bounds));
@@ -74,10 +70,6 @@ void SKPBench::onPerCanvasPreDraw(SkCanvas* canvas) {
}
void SKPBench::onPerCanvasPostDraw(SkCanvas* canvas) {
- if (!fUseMultiPictureDraw) {
- return;
- }
-
// Draw the last set of tiles into the master canvas in case we're
// saving the images
for (int i = 0; i < fTileRects.count(); ++i) {
@@ -104,38 +96,31 @@ void SKPBench::onDraw(const int loops, SkCanvas* canvas) {
for (int i = 0; i < loops; i++) {
SkMultiPictureDraw mpd;
- for (int i = 0; i < fTileRects.count(); ++i) {
+ for (int j = 0; j < fTileRects.count(); ++j) {
SkMatrix trans;
- trans.setTranslate(-fTileRects[i].fLeft/fScale,
- -fTileRects[i].fTop/fScale);
- mpd.add(fSurfaces[i]->getCanvas(), fPic, &trans);
+ trans.setTranslate(-fTileRects[j].fLeft/fScale,
+ -fTileRects[j].fTop/fScale);
+ mpd.add(fSurfaces[j]->getCanvas(), fPic, &trans);
}
mpd.draw();
- for (int i = 0; i < fTileRects.count(); ++i) {
- fSurfaces[i]->getCanvas()->flush();
+ for (int j = 0; j < fTileRects.count(); ++j) {
+ fSurfaces[j]->getCanvas()->flush();
}
}
} else {
- SkIRect bounds;
- SkAssertResult(canvas->getClipDeviceBounds(&bounds));
-
- SkAutoCanvasRestore overall(canvas, true/*save now*/);
- canvas->scale(fScale, fScale);
-
for (int i = 0; i < loops; i++) {
- for (int y = bounds.fTop; y < bounds.fBottom; y += FLAGS_benchTile) {
- for (int x = bounds.fLeft; x < bounds.fRight; x += FLAGS_benchTile) {
- SkAutoCanvasRestore perTile(canvas, true/*save now*/);
- canvas->clipRect(SkRect::MakeXYWH(x/fScale, y/fScale,
- FLAGS_benchTile/fScale,
- FLAGS_benchTile/fScale));
- fPic->playback(canvas);
- }
+ for (int j = 0; j < fTileRects.count(); ++j) {
+ SkMatrix trans;
+ trans.setTranslate(-fTileRects[j].fLeft / fScale,
+ -fTileRects[j].fTop / fScale);
+ fSurfaces[j]->getCanvas()->drawPicture(fPic, &trans, NULL);
}
- canvas->flush();
+ for (int j = 0; j < fTileRects.count(); ++j) {
+ fSurfaces[j]->getCanvas()->flush();
+ }
}
}
}