Commit 3989ae5a authored by chrishtr's avatar chrishtr Committed by Commit bot

[S.P.] Fix rasterize_and_record benchmark to include SkPicture playback time.

BUG=474749

Review URL: https://codereview.chromium.org/1069503002

Cr-Commit-Position: refs/heads/master@{#324151}
parent 6b0124f4
...@@ -105,21 +105,21 @@ scoped_ptr<MicroBenchmarkImpl> RasterizeAndRecordBenchmark::CreateBenchmarkImpl( ...@@ -105,21 +105,21 @@ scoped_ptr<MicroBenchmarkImpl> RasterizeAndRecordBenchmark::CreateBenchmarkImpl(
void RasterizeAndRecordBenchmark::RunOnLayer(PictureLayer* layer) { void RasterizeAndRecordBenchmark::RunOnLayer(PictureLayer* layer) {
DCHECK(host_); DCHECK(host_);
gfx::Rect visible_content_rect = gfx::ScaleToEnclosingRect( gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect(
layer->visible_content_rect(), 1.f / layer->contents_scale_x()); layer->visible_content_rect(), 1.f / layer->contents_scale_x());
if (visible_content_rect.IsEmpty()) if (visible_layer_rect.IsEmpty())
return; return;
if (host_->settings().use_display_lists) { if (host_->settings().use_display_lists) {
RunOnDisplayListLayer(layer, visible_content_rect); RunOnDisplayListLayer(layer, visible_layer_rect);
} else { } else {
RunOnPictureLayer(layer, visible_content_rect); RunOnPictureLayer(layer, visible_layer_rect);
} }
} }
void RasterizeAndRecordBenchmark::RunOnPictureLayer( void RasterizeAndRecordBenchmark::RunOnPictureLayer(
PictureLayer* layer, PictureLayer* layer,
const gfx::Rect& visible_content_rect) { const gfx::Rect& visible_layer_rect) {
ContentLayerClient* painter = layer->client(); ContentLayerClient* painter = layer->client();
DCHECK(host_ && !host_->settings().use_display_lists); DCHECK(host_ && !host_->settings().use_display_lists);
...@@ -141,7 +141,7 @@ void RasterizeAndRecordBenchmark::RunOnPictureLayer( ...@@ -141,7 +141,7 @@ void RasterizeAndRecordBenchmark::RunOnPictureLayer(
kTimeCheckInterval); kTimeCheckInterval);
scoped_refptr<Picture> picture; scoped_refptr<Picture> picture;
do { do {
picture = Picture::Create(visible_content_rect, painter, tile_grid_size, picture = Picture::Create(visible_layer_rect, painter, tile_grid_size,
false, mode); false, mode);
if (memory_used) { if (memory_used) {
// Verify we are recording the same thing each time. // Verify we are recording the same thing each time.
...@@ -161,7 +161,7 @@ void RasterizeAndRecordBenchmark::RunOnPictureLayer( ...@@ -161,7 +161,7 @@ void RasterizeAndRecordBenchmark::RunOnPictureLayer(
if (mode == RecordingSource::RECORD_NORMALLY) { if (mode == RecordingSource::RECORD_NORMALLY) {
record_results_.bytes_used += memory_used; record_results_.bytes_used += memory_used;
record_results_.pixels_recorded += record_results_.pixels_recorded +=
visible_content_rect.width() * visible_content_rect.height(); visible_layer_rect.width() * visible_layer_rect.height();
} }
record_results_.total_best_time[mode_index] += min_time; record_results_.total_best_time[mode_index] += min_time;
} }
...@@ -169,7 +169,7 @@ void RasterizeAndRecordBenchmark::RunOnPictureLayer( ...@@ -169,7 +169,7 @@ void RasterizeAndRecordBenchmark::RunOnPictureLayer(
void RasterizeAndRecordBenchmark::RunOnDisplayListLayer( void RasterizeAndRecordBenchmark::RunOnDisplayListLayer(
PictureLayer* layer, PictureLayer* layer,
const gfx::Rect& visible_content_rect) { const gfx::Rect& visible_layer_rect) {
ContentLayerClient* painter = layer->client(); ContentLayerClient* painter = layer->client();
DCHECK(host_ && host_->settings().use_display_lists); DCHECK(host_ && host_->settings().use_display_lists);
...@@ -207,8 +207,9 @@ void RasterizeAndRecordBenchmark::RunOnDisplayListLayer( ...@@ -207,8 +207,9 @@ void RasterizeAndRecordBenchmark::RunOnDisplayListLayer(
kTimeCheckInterval); kTimeCheckInterval);
do { do {
display_list = painter->PaintContentsToDisplayList(visible_content_rect, display_list = painter->PaintContentsToDisplayList(visible_layer_rect,
painting_control); painting_control);
display_list->CreateAndCacheSkPicture();
if (memory_used) { if (memory_used) {
// Verify we are recording the same thing each time. // Verify we are recording the same thing each time.
...@@ -228,7 +229,7 @@ void RasterizeAndRecordBenchmark::RunOnDisplayListLayer( ...@@ -228,7 +229,7 @@ void RasterizeAndRecordBenchmark::RunOnDisplayListLayer(
if (mode_index == RecordingSource::RECORD_NORMALLY) { if (mode_index == RecordingSource::RECORD_NORMALLY) {
record_results_.bytes_used += memory_used; record_results_.bytes_used += memory_used;
record_results_.pixels_recorded += record_results_.pixels_recorded +=
visible_content_rect.width() * visible_content_rect.height(); visible_layer_rect.width() * visible_layer_rect.height();
} }
record_results_.total_best_time[mode_index] += min_time; record_results_.total_best_time[mode_index] += min_time;
} }
......
...@@ -38,9 +38,9 @@ class RasterizeAndRecordBenchmark : public MicroBenchmark { ...@@ -38,9 +38,9 @@ class RasterizeAndRecordBenchmark : public MicroBenchmark {
private: private:
void RunOnDisplayListLayer(PictureLayer* layer, void RunOnDisplayListLayer(PictureLayer* layer,
const gfx::Rect& visible_content_rect); const gfx::Rect& visible_layer_rect);
void RunOnPictureLayer(PictureLayer* layer, void RunOnPictureLayer(PictureLayer* layer,
const gfx::Rect& visible_content_rect); const gfx::Rect& visible_layer_rect);
void RecordRasterResults(scoped_ptr<base::Value> results); void RecordRasterResults(scoped_ptr<base::Value> results);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment