summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-28 07:19:10 +0000
committerreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-28 07:19:10 +0000
commitd616de0124e94e4cdf85a0229f4aa84aca8dc85d (patch)
tree6ab20c4239612c875d363fb1669062b692b00b56 /cc
parent9503f4cbd81296353b4776c7ad3f67f9885bee67 (diff)
downloadchromium_src-d616de0124e94e4cdf85a0229f4aa84aca8dc85d.zip
chromium_src-d616de0124e94e4cdf85a0229f4aa84aca8dc85d.tar.gz
chromium_src-d616de0124e94e4cdf85a0229f4aa84aca8dc85d.tar.bz2
cc: Add command line switches for impl-side painting constants.
This adds necessary command line switches for adjusting the amount of prepainting allowed with impl-side painting. BUG=178317 Review URL: https://chromiumcodereview.appspot.com/12594033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191112 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/base/switches.cc6
-rw-r--r--cc/base/switches.h2
-rw-r--r--cc/layers/picture_layer_impl.cc5
-rw-r--r--cc/resources/picture_layer_tiling.cc5
-rw-r--r--cc/resources/picture_layer_tiling.h3
-rw-r--r--cc/resources/picture_layer_tiling_set.cc6
-rw-r--r--cc/resources/picture_layer_tiling_set.h3
-rw-r--r--cc/resources/tile_manager.cc27
-rw-r--r--cc/resources/tile_manager.h2
-rw-r--r--cc/resources/tile_priority.cc6
-rw-r--r--cc/resources/tile_priority.h3
-rw-r--r--cc/test/fake_picture_layer_tiling_client.cc1
-rw-r--r--cc/trees/layer_tree_host_impl.cc1
-rw-r--r--cc/trees/layer_tree_settings.cc5
-rw-r--r--cc/trees/layer_tree_settings.h2
15 files changed, 52 insertions, 25 deletions
diff --git a/cc/base/switches.cc b/cc/base/switches.cc
index 3011c4a..86b10b1 100644
--- a/cc/base/switches.cc
+++ b/cc/base/switches.cc
@@ -70,6 +70,12 @@ const char kUseColorEstimator[] = "use-color-estimator";
const char kLowResolutionContentsScaleFactor[] =
"low-resolution-contents-scale-factor";
+// Max distance from visible for prepaint tiles.
+const char kMaxPrepaintTileDistance[] = "max-prepaint-tile-distance";
+
+// Max tiles allowed for each tilings interest area.
+const char kMaxTilesForInterestArea[] = "max-tiles-for-interest-area";
+
// Causes the compositor to render to textures which are then sent to the parent
// through the texture mailbox mechanism.
// Requires --enable-compositor-frame-message.
diff --git a/cc/base/switches.h b/cc/base/switches.h
index 8e6deef..145f933 100644
--- a/cc/base/switches.h
+++ b/cc/base/switches.h
@@ -36,6 +36,8 @@ CC_EXPORT extern const char kSlowDownRasterScaleFactor[];
CC_EXPORT extern const char kUseColorEstimator[];
CC_EXPORT extern const char kLowResolutionContentsScaleFactor[];
CC_EXPORT extern const char kCompositeToMailbox[];
+CC_EXPORT extern const char kMaxPrepaintTileDistance[];
+CC_EXPORT extern const char kMaxTilesForInterestArea[];
// Switches for both the renderer and ui compositors.
CC_EXPORT extern const char kEnablePartialSwap[];
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index f39fd41..606d3d9 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -269,6 +269,8 @@ void PictureLayerImpl::UpdateTilePriorities() {
layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE;
bool store_screen_space_quads_on_tiles =
layer_tree_impl()->debug_state().trace_all_rendered_frames;
+ size_t max_tiles_for_interest_area =
+ layer_tree_impl()->settings().max_tiles_for_interest_area;
tilings_->UpdateTilePriorities(
tree,
layer_tree_impl()->device_viewport_size(),
@@ -281,7 +283,8 @@ void PictureLayerImpl::UpdateTilePriorities() {
current_screen_space_transform,
current_source_frame_number,
current_frame_time,
- store_screen_space_quads_on_tiles);
+ store_screen_space_quads_on_tiles,
+ max_tiles_for_interest_area);
last_screen_space_transform_ = current_screen_space_transform;
last_bounds_ = bounds();
diff --git a/cc/resources/picture_layer_tiling.cc b/cc/resources/picture_layer_tiling.cc
index fd4ce83..e25b86b 100644
--- a/cc/resources/picture_layer_tiling.cc
+++ b/cc/resources/picture_layer_tiling.cc
@@ -332,7 +332,8 @@ void PictureLayerTiling::UpdateTilePriorities(
const gfx::Transform& current_screen_transform,
int current_source_frame_number,
double current_frame_time,
- bool store_screen_space_quads_on_tiles) {
+ bool store_screen_space_quads_on_tiles,
+ size_t max_tiles_for_interest_area) {
if (ContentRect().IsEmpty())
return;
@@ -362,7 +363,7 @@ void PictureLayerTiling::UpdateTilePriorities(
gfx::Size tile_size = tiling_data_.max_texture_size();
int64 prioritized_rect_area =
- TilePriority::kNumTilesToCoverWithInflatedViewportRectForPrioritization *
+ max_tiles_for_interest_area *
tile_size.width() * tile_size.height();
gfx::Rect prioritized_rect = ExpandRectEquallyToAreaBoundedBy(
diff --git a/cc/resources/picture_layer_tiling.h b/cc/resources/picture_layer_tiling.h
index a2423e9..743c064 100644
--- a/cc/resources/picture_layer_tiling.h
+++ b/cc/resources/picture_layer_tiling.h
@@ -138,7 +138,8 @@ class CC_EXPORT PictureLayerTiling {
const gfx::Transform& current_screen_transform,
int current_source_frame_number,
double current_frame_time,
- bool store_screen_space_quads_on_tiles);
+ bool store_screen_space_quads_on_tiles,
+ size_t max_tiles_for_interest_area);
// Copies the src_tree priority into the dst_tree priority for all tiles.
// The src_tree priority is reset to the lowest priority possible. This
diff --git a/cc/resources/picture_layer_tiling_set.cc b/cc/resources/picture_layer_tiling_set.cc
index 67173ba..8d98d66 100644
--- a/cc/resources/picture_layer_tiling_set.cc
+++ b/cc/resources/picture_layer_tiling_set.cc
@@ -275,7 +275,8 @@ void PictureLayerTilingSet::UpdateTilePriorities(
const gfx::Transform& current_screen_transform,
int current_source_frame_number,
double current_frame_time,
- bool store_screen_space_quads_on_tiles) {
+ bool store_screen_space_quads_on_tiles,
+ size_t max_tiles_for_interest_area) {
gfx::RectF viewport_in_layer_space = gfx::ScaleRect(
viewport_in_content_space,
1.f / current_layer_contents_scale,
@@ -294,7 +295,8 @@ void PictureLayerTilingSet::UpdateTilePriorities(
current_screen_transform,
current_source_frame_number,
current_frame_time,
- store_screen_space_quads_on_tiles);
+ store_screen_space_quads_on_tiles,
+ max_tiles_for_interest_area);
}
}
diff --git a/cc/resources/picture_layer_tiling_set.h b/cc/resources/picture_layer_tiling_set.h
index 44b1585..a619a1e 100644
--- a/cc/resources/picture_layer_tiling_set.h
+++ b/cc/resources/picture_layer_tiling_set.h
@@ -62,7 +62,8 @@ class CC_EXPORT PictureLayerTilingSet {
const gfx::Transform& current_screen_transform,
int current_source_frame_number,
double current_frame_time,
- bool store_screen_space_quads_on_tiles);
+ bool store_screen_space_quads_on_tiles,
+ size_t max_tiles_for_interest_area);
void DidBecomeActive();
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc
index b959bac..9682213 100644
--- a/cc/resources/tile_manager.cc
+++ b/cc/resources/tile_manager.cc
@@ -51,7 +51,9 @@ const int kRunCheapTasksTimeMs = 6;
// Determine bin based on three categories of tiles: things we need now,
// things we need soon, and eventually.
-inline TileManagerBin BinFromTilePriority(const TilePriority& prio) {
+inline TileManagerBin BinFromTilePriority(
+ const TilePriority& prio,
+ float max_distance_in_content_space) {
if (!prio.is_live)
return NEVER_BIN;
@@ -60,8 +62,7 @@ inline TileManagerBin BinFromTilePriority(const TilePriority& prio) {
const float kBackflingGuardDistancePixels = 314.0f;
// Explicitly limit how far ahead we will prepaint to limit memory usage.
- if (prio.distance_to_visible_in_pixels >
- TilePriority::kMaxDistanceInContentSpace)
+ if (prio.distance_to_visible_in_pixels > max_distance_in_content_space)
return NEVER_BIN;
if (prio.time_to_visible_in_seconds == 0 ||
@@ -151,6 +152,7 @@ TileManager::TileManager(
TileManagerClient* client,
ResourceProvider* resource_provider,
size_t num_raster_threads,
+ size_t max_prepaint_tile_distance,
bool use_cheapness_estimator,
bool use_color_estimator,
bool prediction_benchmarking,
@@ -163,6 +165,7 @@ TileManager::TileManager(
bytes_pending_upload_(0),
has_performed_uploads_since_last_flush_(false),
ever_exceeded_memory_budget_(false),
+ max_prepaint_tile_distance_(max_prepaint_tile_distance),
use_cheapness_estimator_(use_cheapness_estimator),
use_color_estimator_(use_color_estimator),
prediction_benchmarking_(prediction_benchmarking),
@@ -342,15 +345,23 @@ void TileManager::ManageTiles() {
prio[HIGH_PRIORITY_BIN].time_to_visible_in_seconds;
mts.distance_to_visible_in_pixels =
prio[HIGH_PRIORITY_BIN].distance_to_visible_in_pixels;
- mts.bin[HIGH_PRIORITY_BIN] = BinFromTilePriority(prio[HIGH_PRIORITY_BIN]);
- mts.bin[LOW_PRIORITY_BIN] = BinFromTilePriority(prio[LOW_PRIORITY_BIN]);
- mts.gpu_memmgr_stats_bin = BinFromTilePriority(tile->combined_priority());
+ mts.bin[HIGH_PRIORITY_BIN] = BinFromTilePriority(
+ prio[HIGH_PRIORITY_BIN],
+ max_prepaint_tile_distance_);
+ mts.bin[LOW_PRIORITY_BIN] = BinFromTilePriority(
+ prio[LOW_PRIORITY_BIN],
+ max_prepaint_tile_distance_);
+ mts.gpu_memmgr_stats_bin = BinFromTilePriority(
+ tile->combined_priority(),
+ max_prepaint_tile_distance_);
DidTileTreeBinChange(tile,
- bin_map[BinFromTilePriority(tile->priority(ACTIVE_TREE))],
+ bin_map[BinFromTilePriority(tile->priority(ACTIVE_TREE),
+ max_prepaint_tile_distance_)],
ACTIVE_TREE);
DidTileTreeBinChange(tile,
- bin_map[BinFromTilePriority(tile->priority(PENDING_TREE))],
+ bin_map[BinFromTilePriority(tile->priority(PENDING_TREE),
+ max_prepaint_tile_distance_)],
PENDING_TREE);
for (int i = 0; i < NUM_BIN_PRIORITIES; ++i)
diff --git a/cc/resources/tile_manager.h b/cc/resources/tile_manager.h
index 1166c04..59ee72f 100644
--- a/cc/resources/tile_manager.h
+++ b/cc/resources/tile_manager.h
@@ -76,6 +76,7 @@ class CC_EXPORT TileManager : public WorkerPoolClient {
TileManager(TileManagerClient* client,
ResourceProvider *resource_provider,
size_t num_raster_threads,
+ size_t max_prepaint_tile_distance,
bool use_cheapess_estimator,
bool use_color_estimator,
bool prediction_benchmarking,
@@ -213,6 +214,7 @@ class CC_EXPORT TileManager : public WorkerPoolClient {
RenderingStatsInstrumentation* rendering_stats_instrumentation_;
+ size_t max_prepaint_tile_distance_;
bool use_cheapness_estimator_;
bool use_color_estimator_;
int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS];
diff --git a/cc/resources/tile_priority.cc b/cc/resources/tile_priority.cc
index 932434f..809accd 100644
--- a/cc/resources/tile_priority.cc
+++ b/cc/resources/tile_priority.cc
@@ -60,12 +60,6 @@ inline void IntersectPositiveHalfplane(Range* out,
namespace cc {
-const float TilePriority::kMaxDistanceInContentSpace = 4096.0f;
-
-// At 256x256 tiles, 128 tiles cover an area of 2048x4096 pixels.
-const int64 TilePriority::
- kNumTilesToCoverWithInflatedViewportRectForPrioritization = 128;
-
scoped_ptr<base::Value> WhichTreeAsValue(WhichTree tree) {
switch (tree) {
case ACTIVE_TREE:
diff --git a/cc/resources/tile_priority.h b/cc/resources/tile_priority.h
index d14f311..3466d17 100644
--- a/cc/resources/tile_priority.h
+++ b/cc/resources/tile_priority.h
@@ -96,9 +96,6 @@ struct CC_EXPORT TilePriority {
scoped_ptr<base::Value> AsValue() const;
- static const float kMaxDistanceInContentSpace;
- static const int64 kNumTilesToCoverWithInflatedViewportRectForPrioritization;
-
static inline float manhattanDistance(const gfx::RectF& a,
const gfx::RectF& b) {
// Compute the union explicitly.
diff --git a/cc/test/fake_picture_layer_tiling_client.cc b/cc/test/fake_picture_layer_tiling_client.cc
index 9bdd3f8..94302f2 100644
--- a/cc/test/fake_picture_layer_tiling_client.cc
+++ b/cc/test/fake_picture_layer_tiling_client.cc
@@ -26,6 +26,7 @@ FakePictureLayerTilingClient::FakePictureLayerTilingClient()
: tile_manager_(&tile_manager_client_,
NULL,
1,
+ 4096,
false,
false,
false,
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index ffcb3b3..3b2764f 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1268,6 +1268,7 @@ bool LayerTreeHostImpl::InitializeRenderer(
tile_manager_.reset(new TileManager(this,
resource_provider.get(),
settings_.num_raster_threads,
+ settings_.max_prepaint_tile_distance,
settings_.use_cheapness_estimator,
settings_.use_color_estimator,
settings_.prediction_benchmarking,
diff --git a/cc/trees/layer_tree_settings.cc b/cc/trees/layer_tree_settings.cc
index 6b069ab..2969ae5 100644
--- a/cc/trees/layer_tree_settings.cc
+++ b/cc/trees/layer_tree_settings.cc
@@ -47,7 +47,10 @@ LayerTreeSettings::LayerTreeSettings()
default_tile_size(gfx::Size(256, 256)),
max_untiled_layer_size(gfx::Size(512, 512)),
minimum_occlusion_tracking_size(gfx::Size(160, 160)),
- use_pinch_zoom_scrollbars(false) {
+ use_pinch_zoom_scrollbars(false),
+ max_prepaint_tile_distance(4096),
+ // At 256x256 tiles, 128 tiles cover an area of 2048x4096 pixels.
+ max_tiles_for_interest_area(128) {
// TODO(danakj): Renable surface caching when we can do it more realiably.
// crbug.com/170713
cache_render_pass_contents = false;
diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h
index 6ce749e..1ba2af5 100644
--- a/cc/trees/layer_tree_settings.h
+++ b/cc/trees/layer_tree_settings.h
@@ -53,6 +53,8 @@ class CC_EXPORT LayerTreeSettings {
gfx::Size max_untiled_layer_size;
gfx::Size minimum_occlusion_tracking_size;
bool use_pinch_zoom_scrollbars;
+ size_t max_prepaint_tile_distance;
+ size_t max_tiles_for_interest_area;
LayerTreeDebugState initial_debug_state;
};