OLD | NEW |
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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 settings.scrollbar_fade_duration_ms = 300; | 401 settings.scrollbar_fade_duration_ms = 300; |
402 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 402 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
403 } | 403 } |
404 settings.renderer_settings.highp_threshold_min = 2048; | 404 settings.renderer_settings.highp_threshold_min = 2048; |
405 // Android WebView handles root layer flings itself. | 405 // Android WebView handles root layer flings itself. |
406 settings.ignore_root_layer_flings = using_synchronous_compositor; | 406 settings.ignore_root_layer_flings = using_synchronous_compositor; |
407 // Memory policy on Android WebView does not depend on whether device is | 407 // Memory policy on Android WebView does not depend on whether device is |
408 // low end, so always use default policy. | 408 // low end, so always use default policy. |
409 bool use_low_memory_policy = | 409 bool use_low_memory_policy = |
410 base::SysInfo::IsLowEndDevice() && !using_synchronous_compositor; | 410 base::SysInfo::IsLowEndDevice() && !using_synchronous_compositor; |
411 // RGBA_4444 textures are only enabled by default for low end devices | |
412 // and are disabled for Android WebView as it doesn't support the format. | |
413 settings.renderer_settings.use_rgba_4444_textures = use_low_memory_policy; | |
414 if (use_low_memory_policy) { | 411 if (use_low_memory_policy) { |
415 // On low-end we want to be very carefull about killing other | 412 // On low-end we want to be very carefull about killing other |
416 // apps. So initially we use 50% more memory to avoid flickering | 413 // apps. So initially we use 50% more memory to avoid flickering |
417 // or raster-on-demand. | 414 // or raster-on-demand. |
418 settings.max_memory_for_prepaint_percentage = 67; | 415 settings.max_memory_for_prepaint_percentage = 67; |
| 416 |
| 417 // RGBA_4444 textures are only enabled by default for low end devices |
| 418 // and are disabled for Android WebView as it doesn't support the format. |
| 419 settings.renderer_settings.memory_efficient_format = |
| 420 settings.renderer_settings.memory_efficient_format_with_alpha = |
| 421 cc::RGBA_4444; |
419 } else { | 422 } else { |
420 // On other devices we have increased memory excessively to avoid | 423 // On other devices we have increased memory excessively to avoid |
421 // raster-on-demand already, so now we reserve 50% _only_ to avoid | 424 // raster-on-demand already, so now we reserve 50% _only_ to avoid |
422 // raster-on-demand, and use 50% of the memory otherwise. | 425 // raster-on-demand, and use 50% of the memory otherwise. |
423 settings.max_memory_for_prepaint_percentage = 50; | 426 settings.max_memory_for_prepaint_percentage = 50; |
424 } | 427 } |
425 // Webview does not own the surface so should not clear it. | 428 // Webview does not own the surface so should not clear it. |
426 settings.renderer_settings.should_clear_root_render_pass = | 429 settings.renderer_settings.should_clear_root_render_pass = |
427 !using_synchronous_compositor; | 430 !using_synchronous_compositor; |
428 | 431 |
(...skipping 15 matching lines...) Expand all Loading... |
444 settings.scrollbar_fade_duration_ms = 300; | 447 settings.scrollbar_fade_duration_ms = 300; |
445 #endif | 448 #endif |
446 | 449 |
447 if (cmd->HasSwitch(switches::kEnableLowResTiling)) | 450 if (cmd->HasSwitch(switches::kEnableLowResTiling)) |
448 settings.create_low_res_tiling = true; | 451 settings.create_low_res_tiling = true; |
449 if (cmd->HasSwitch(switches::kDisableLowResTiling)) | 452 if (cmd->HasSwitch(switches::kDisableLowResTiling)) |
450 settings.create_low_res_tiling = false; | 453 settings.create_low_res_tiling = false; |
451 if (cmd->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) | 454 if (cmd->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) |
452 settings.use_external_begin_frame_source = true; | 455 settings.use_external_begin_frame_source = true; |
453 | 456 |
454 settings.renderer_settings.use_rgba_4444_textures |= | 457 if (cmd->HasSwitch(switches::kEnableRGBA4444Textures)) { |
455 cmd->HasSwitch(switches::kEnableRGBA4444Textures); | 458 settings.renderer_settings.memory_efficient_format = |
456 settings.renderer_settings.use_rgba_4444_textures &= | 459 settings.renderer_settings.memory_efficient_format_with_alpha = |
457 !cmd->HasSwitch(switches::kDisableRGBA4444Textures); | 460 cc::RGBA_4444; |
| 461 } |
| 462 if (cmd->HasSwitch(switches::kDisableRGBA4444Textures)) { |
| 463 settings.renderer_settings.memory_efficient_format = |
| 464 settings.renderer_settings.memory_efficient_format_with_alpha = |
| 465 cc::RGBA_8888; // No memory efficient format. |
| 466 } |
| 467 |
| 468 if (cmd->HasSwitch(cc::switches::kEnableTileCompression)) { |
| 469 settings.renderer_settings.memory_efficient_format = cc::ETC1; |
| 470 } |
458 | 471 |
459 if (widget_->for_oopif()) { | 472 if (widget_->for_oopif()) { |
460 // TODO(simonhong): Apply BeginFrame scheduling for OOPIF. | 473 // TODO(simonhong): Apply BeginFrame scheduling for OOPIF. |
461 // See crbug.com/471411. | 474 // See crbug.com/471411. |
462 settings.use_external_begin_frame_source = false; | 475 settings.use_external_begin_frame_source = false; |
463 } | 476 } |
464 | 477 |
465 settings.max_staging_buffer_usage_in_bytes = 32 * 1024 * 1024; // 32MB | 478 settings.max_staging_buffer_usage_in_bytes = 32 * 1024 * 1024; // 32MB |
466 // Use 1/4th of staging buffers on low-end devices. | 479 // Use 1/4th of staging buffers on low-end devices. |
467 if (base::SysInfo::IsLowEndDevice()) | 480 if (base::SysInfo::IsLowEndDevice()) |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 #endif | 1129 #endif |
1117 return actual; | 1130 return actual; |
1118 } | 1131 } |
1119 | 1132 |
1120 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( | 1133 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( |
1121 float device_scale) { | 1134 float device_scale) { |
1122 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); | 1135 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); |
1123 } | 1136 } |
1124 | 1137 |
1125 } // namespace content | 1138 } // namespace content |
OLD | NEW |