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

Side by Side Diff: content/renderer/gpu/render_widget_compositor.cc

Issue 1379783002: Allow one-copy task tile worker pool to use compressed textures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove needs_conversion, fix tile size unit test and move modulo 4 DCHECK (for tests) Created 5 years 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/renderer/gpu/render_widget_compositor.h" 5 #include "content/renderer/gpu/render_widget_compositor.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 settings.scrollbar_fade_duration_ms = 300; 398 settings.scrollbar_fade_duration_ms = 300;
399 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); 399 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128);
400 } 400 }
401 settings.renderer_settings.highp_threshold_min = 2048; 401 settings.renderer_settings.highp_threshold_min = 2048;
402 // Android WebView handles root layer flings itself. 402 // Android WebView handles root layer flings itself.
403 settings.ignore_root_layer_flings = using_synchronous_compositor; 403 settings.ignore_root_layer_flings = using_synchronous_compositor;
404 // Memory policy on Android WebView does not depend on whether device is 404 // Memory policy on Android WebView does not depend on whether device is
405 // low end, so always use default policy. 405 // low end, so always use default policy.
406 bool use_low_memory_policy = 406 bool use_low_memory_policy =
407 base::SysInfo::IsLowEndDevice() && !using_synchronous_compositor; 407 base::SysInfo::IsLowEndDevice() && !using_synchronous_compositor;
408 // RGBA_4444 textures are only enabled by default for low end devices
409 // and are disabled for Android WebView as it doesn't support the format.
410 settings.renderer_settings.use_rgba_4444_textures = use_low_memory_policy;
411 if (use_low_memory_policy) { 408 if (use_low_memory_policy) {
412 // On low-end we want to be very carefull about killing other 409 // On low-end we want to be very carefull about killing other
413 // apps. So initially we use 50% more memory to avoid flickering 410 // apps. So initially we use 50% more memory to avoid flickering
414 // or raster-on-demand. 411 // or raster-on-demand.
415 settings.max_memory_for_prepaint_percentage = 67; 412 settings.max_memory_for_prepaint_percentage = 67;
413
414 // RGBA_4444 textures are only enabled by default for low end devices
415 // and are disabled for Android WebView as it doesn't support the format.
416 if (!cmd->HasSwitch(switches::kDisableRGBA4444Textures))
417 settings.renderer_settings.preferred_tile_format = cc::RGBA_4444;
416 } else { 418 } else {
417 // On other devices we have increased memory excessively to avoid 419 // On other devices we have increased memory excessively to avoid
418 // raster-on-demand already, so now we reserve 50% _only_ to avoid 420 // raster-on-demand already, so now we reserve 50% _only_ to avoid
419 // raster-on-demand, and use 50% of the memory otherwise. 421 // raster-on-demand, and use 50% of the memory otherwise.
420 settings.max_memory_for_prepaint_percentage = 50; 422 settings.max_memory_for_prepaint_percentage = 50;
421 } 423 }
422 // Webview does not own the surface so should not clear it. 424 // Webview does not own the surface so should not clear it.
423 settings.renderer_settings.should_clear_root_render_pass = 425 settings.renderer_settings.should_clear_root_render_pass =
424 !using_synchronous_compositor; 426 !using_synchronous_compositor;
425 427
(...skipping 15 matching lines...) Expand all
441 settings.scrollbar_fade_duration_ms = 300; 443 settings.scrollbar_fade_duration_ms = 300;
442 #endif 444 #endif
443 445
444 if (cmd->HasSwitch(switches::kEnableLowResTiling)) 446 if (cmd->HasSwitch(switches::kEnableLowResTiling))
445 settings.create_low_res_tiling = true; 447 settings.create_low_res_tiling = true;
446 if (cmd->HasSwitch(switches::kDisableLowResTiling)) 448 if (cmd->HasSwitch(switches::kDisableLowResTiling))
447 settings.create_low_res_tiling = false; 449 settings.create_low_res_tiling = false;
448 if (cmd->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) 450 if (cmd->HasSwitch(cc::switches::kEnableBeginFrameScheduling))
449 settings.use_external_begin_frame_source = true; 451 settings.use_external_begin_frame_source = true;
450 452
451 settings.renderer_settings.use_rgba_4444_textures |= 453 if (cmd->HasSwitch(switches::kEnableRGBA4444Textures) &&
452 cmd->HasSwitch(switches::kEnableRGBA4444Textures); 454 !cmd->HasSwitch(switches::kDisableRGBA4444Textures)) {
453 settings.renderer_settings.use_rgba_4444_textures &= 455 settings.renderer_settings.preferred_tile_format = cc::RGBA_4444;
454 !cmd->HasSwitch(switches::kDisableRGBA4444Textures); 456 }
457
458 if (cmd->HasSwitch(cc::switches::kEnableTileCompression)) {
459 settings.renderer_settings.preferred_tile_format = cc::ETC1;
460 }
455 461
456 if (widget_->for_oopif()) { 462 if (widget_->for_oopif()) {
457 // TODO(simonhong): Apply BeginFrame scheduling for OOPIF. 463 // TODO(simonhong): Apply BeginFrame scheduling for OOPIF.
458 // See crbug.com/471411. 464 // See crbug.com/471411.
459 settings.use_external_begin_frame_source = false; 465 settings.use_external_begin_frame_source = false;
460 } 466 }
461 467
462 settings.max_staging_buffer_usage_in_bytes = 32 * 1024 * 1024; // 32MB 468 settings.max_staging_buffer_usage_in_bytes = 32 * 1024 * 1024; // 32MB
463 // Use 1/4th of staging buffers on low-end devices. 469 // Use 1/4th of staging buffers on low-end devices.
464 if (base::SysInfo::IsLowEndDevice()) 470 if (base::SysInfo::IsLowEndDevice())
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 #endif 1119 #endif
1114 return actual; 1120 return actual;
1115 } 1121 }
1116 1122
1117 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( 1123 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor(
1118 float device_scale) { 1124 float device_scale) {
1119 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); 1125 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale);
1120 } 1126 }
1121 1127
1122 } // namespace content 1128 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698