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

Side by Side Diff: cc/resources/gpu_rasterizer.cc

Issue 895763002: Add a command-line flag to enable threaded GPU rasterization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/resources/gpu_rasterizer.h" 5 #include "cc/resources/gpu_rasterizer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 13 matching lines...) Expand all
24 #include "third_party/skia/include/core/SkSurface.h" 24 #include "third_party/skia/include/core/SkSurface.h"
25 #include "third_party/skia/include/gpu/GrContext.h" 25 #include "third_party/skia/include/gpu/GrContext.h"
26 26
27 namespace cc { 27 namespace cc {
28 28
29 // static 29 // static
30 scoped_ptr<GpuRasterizer> GpuRasterizer::Create( 30 scoped_ptr<GpuRasterizer> GpuRasterizer::Create(
31 ContextProvider* context_provider, 31 ContextProvider* context_provider,
32 ResourceProvider* resource_provider, 32 ResourceProvider* resource_provider,
33 bool use_distance_field_text, 33 bool use_distance_field_text,
34 bool tile_prepare_enabled, 34 bool threaded_gpu_rasterization_enabled,
35 int msaa_sample_count) { 35 int msaa_sample_count) {
36 return make_scoped_ptr<GpuRasterizer>(new GpuRasterizer( 36 return make_scoped_ptr<GpuRasterizer>(new GpuRasterizer(
37 context_provider, resource_provider, use_distance_field_text, 37 context_provider, resource_provider, use_distance_field_text,
38 tile_prepare_enabled, msaa_sample_count)); 38 threaded_gpu_rasterization_enabled, msaa_sample_count));
39 } 39 }
40 40
41 GpuRasterizer::GpuRasterizer(ContextProvider* context_provider, 41 GpuRasterizer::GpuRasterizer(ContextProvider* context_provider,
42 ResourceProvider* resource_provider, 42 ResourceProvider* resource_provider,
43 bool use_distance_field_text, 43 bool use_distance_field_text,
44 bool tile_prepare_enabled, 44 bool threaded_gpu_rasterization_enabled,
45 int msaa_sample_count) 45 int msaa_sample_count)
46 : context_provider_(context_provider), 46 : context_provider_(context_provider),
47 resource_provider_(resource_provider), 47 resource_provider_(resource_provider),
48 use_distance_field_text_(use_distance_field_text), 48 use_distance_field_text_(use_distance_field_text),
49 tile_prepare_enabled_(tile_prepare_enabled), 49 threaded_gpu_rasterization_enabled_(threaded_gpu_rasterization_enabled),
50 msaa_sample_count_(msaa_sample_count) { 50 msaa_sample_count_(msaa_sample_count) {
51 DCHECK(context_provider_); 51 DCHECK(context_provider_);
52 } 52 }
53 53
54 GpuRasterizer::~GpuRasterizer() { 54 GpuRasterizer::~GpuRasterizer() {
55 } 55 }
56 56
57 PrepareTilesMode GpuRasterizer::GetPrepareTilesMode() { 57 PrepareTilesMode GpuRasterizer::GetPrepareTilesMode() {
58 return tile_prepare_enabled_ ? PrepareTilesMode::PREPARE_PRIORITIZED_TILES 58 return threaded_gpu_rasterization_enabled_ ? PrepareTilesMode::PREPARE_NONE
hendrikw 2015/02/02 21:42:57 Should you add a new tile mode here while you're a
vmiura 2015/02/02 21:47:11 I will change to RASTERIZE_PRIORITIZED_TILES, but
danakj 2015/02/02 21:48:38 Can we remove this function and the PREPARE_PRIORI
vmiura 2015/02/02 22:03:22 This function is overloaded in SoftwareRaterizer.
59 : PrepareTilesMode::PREPARE_NONE; 59 : PrepareTilesMode::PREPARE_NONE;
60 } 60 }
61 61
62 void GpuRasterizer::RasterizeTiles( 62 void GpuRasterizer::RasterizeTiles(
63 const TileVector& tiles, 63 const TileVector& tiles,
64 ResourcePool* resource_pool, 64 ResourcePool* resource_pool,
65 ResourceFormat resource_format, 65 ResourceFormat resource_format,
66 const UpdateTileDrawInfoCallback& update_tile_draw_info) { 66 const UpdateTileDrawInfoCallback& update_tile_draw_info) {
67 ScopedGpuRaster gpu_raster(context_provider_); 67 ScopedGpuRaster gpu_raster(context_provider_);
68 68
69 ScopedResourceWriteLocks locks; 69 ScopedResourceWriteLocks locks;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 tile->raster_source()->PlaybackToCanvas(canvas.get(), tile->content_rect(), 141 tile->raster_source()->PlaybackToCanvas(canvas.get(), tile->content_rect(),
142 tile->contents_scale()); 142 tile->contents_scale());
143 canvas->restore(); 143 canvas->restore();
144 144
145 // Add the canvas and recorded picture to |multi_picture_draw_|. 145 // Add the canvas and recorded picture to |multi_picture_draw_|.
146 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); 146 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording());
147 multi_picture_draw_.add(sk_surface->getCanvas(), picture.get()); 147 multi_picture_draw_.add(sk_surface->getCanvas(), picture.get());
148 } 148 }
149 149
150 } // namespace cc 150 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698