Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 26 #include "cc/debug/layer_tree_debug_state.h" | 26 #include "cc/debug/layer_tree_debug_state.h" |
| 27 #include "cc/debug/micro_benchmark.h" | 27 #include "cc/debug/micro_benchmark.h" |
| 28 #include "cc/input/layer_selection_bound.h" | 28 #include "cc/input/layer_selection_bound.h" |
| 29 #include "cc/layers/layer.h" | 29 #include "cc/layers/layer.h" |
| 30 #include "cc/output/begin_frame_args.h" | 30 #include "cc/output/begin_frame_args.h" |
| 31 #include "cc/output/copy_output_request.h" | 31 #include "cc/output/copy_output_request.h" |
| 32 #include "cc/output/copy_output_result.h" | 32 #include "cc/output/copy_output_result.h" |
| 33 #include "cc/output/latency_info_swap_promise.h" | 33 #include "cc/output/latency_info_swap_promise.h" |
| 34 #include "cc/output/swap_promise.h" | 34 #include "cc/output/swap_promise.h" |
| 35 #include "cc/proto/compositor_message.pb.h" | 35 #include "cc/proto/compositor_message.pb.h" |
| 36 #include "cc/resources/platform_color.h" | |
|
reveman
2015/12/02 18:27:18
nit: I don't think you need this with the changes
christiank
2015/12/03 12:57:59
Done.
| |
| 36 #include "cc/resources/single_release_callback.h" | 37 #include "cc/resources/single_release_callback.h" |
| 37 #include "cc/scheduler/begin_frame_source.h" | 38 #include "cc/scheduler/begin_frame_source.h" |
| 38 #include "cc/trees/latency_info_swap_promise_monitor.h" | 39 #include "cc/trees/latency_info_swap_promise_monitor.h" |
| 39 #include "cc/trees/layer_tree_host.h" | 40 #include "cc/trees/layer_tree_host.h" |
| 40 #include "cc/trees/remote_proto_channel.h" | 41 #include "cc/trees/remote_proto_channel.h" |
| 41 #include "components/scheduler/renderer/renderer_scheduler.h" | 42 #include "components/scheduler/renderer/renderer_scheduler.h" |
| 42 #include "content/common/content_switches_internal.h" | 43 #include "content/common/content_switches_internal.h" |
| 43 #include "content/common/gpu/client/context_provider_command_buffer.h" | 44 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 44 #include "content/public/common/content_switches.h" | 45 #include "content/public/common/content_switches.h" |
| 45 #include "content/renderer/input/input_handler_manager.h" | 46 #include "content/renderer/input/input_handler_manager.h" |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 settings.scrollbar_fade_duration_ms = 300; | 402 settings.scrollbar_fade_duration_ms = 300; |
| 402 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 403 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
| 403 } | 404 } |
| 404 settings.renderer_settings.highp_threshold_min = 2048; | 405 settings.renderer_settings.highp_threshold_min = 2048; |
| 405 // Android WebView handles root layer flings itself. | 406 // Android WebView handles root layer flings itself. |
| 406 settings.ignore_root_layer_flings = using_synchronous_compositor; | 407 settings.ignore_root_layer_flings = using_synchronous_compositor; |
| 407 // Memory policy on Android WebView does not depend on whether device is | 408 // Memory policy on Android WebView does not depend on whether device is |
| 408 // low end, so always use default policy. | 409 // low end, so always use default policy. |
| 409 bool use_low_memory_policy = | 410 bool use_low_memory_policy = |
| 410 base::SysInfo::IsLowEndDevice() && !using_synchronous_compositor; | 411 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) { | 412 if (use_low_memory_policy) { |
| 415 // On low-end we want to be very carefull about killing other | 413 // On low-end we want to be very carefull about killing other |
| 416 // apps. So initially we use 50% more memory to avoid flickering | 414 // apps. So initially we use 50% more memory to avoid flickering |
| 417 // or raster-on-demand. | 415 // or raster-on-demand. |
| 418 settings.max_memory_for_prepaint_percentage = 67; | 416 settings.max_memory_for_prepaint_percentage = 67; |
| 417 | |
| 418 // RGBA_4444 textures are only enabled by default for low end devices | |
| 419 // and are disabled for Android WebView as it doesn't support the format. | |
| 420 settings.renderer_settings.preferred_tile_format = cc::RGBA_4444; | |
|
reveman
2015/12/02 18:27:18
nit: if (!cmd->HasSwitch(switches::kDisableRGBA444
christiank
2015/12/03 12:58:00
Done.
| |
| 419 } else { | 421 } else { |
| 420 // On other devices we have increased memory excessively to avoid | 422 // On other devices we have increased memory excessively to avoid |
| 421 // raster-on-demand already, so now we reserve 50% _only_ to avoid | 423 // raster-on-demand already, so now we reserve 50% _only_ to avoid |
| 422 // raster-on-demand, and use 50% of the memory otherwise. | 424 // raster-on-demand, and use 50% of the memory otherwise. |
| 423 settings.max_memory_for_prepaint_percentage = 50; | 425 settings.max_memory_for_prepaint_percentage = 50; |
| 424 } | 426 } |
| 425 // Webview does not own the surface so should not clear it. | 427 // Webview does not own the surface so should not clear it. |
| 426 settings.renderer_settings.should_clear_root_render_pass = | 428 settings.renderer_settings.should_clear_root_render_pass = |
| 427 !using_synchronous_compositor; | 429 !using_synchronous_compositor; |
| 428 | 430 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 444 settings.scrollbar_fade_duration_ms = 300; | 446 settings.scrollbar_fade_duration_ms = 300; |
| 445 #endif | 447 #endif |
| 446 | 448 |
| 447 if (cmd->HasSwitch(switches::kEnableLowResTiling)) | 449 if (cmd->HasSwitch(switches::kEnableLowResTiling)) |
| 448 settings.create_low_res_tiling = true; | 450 settings.create_low_res_tiling = true; |
| 449 if (cmd->HasSwitch(switches::kDisableLowResTiling)) | 451 if (cmd->HasSwitch(switches::kDisableLowResTiling)) |
| 450 settings.create_low_res_tiling = false; | 452 settings.create_low_res_tiling = false; |
| 451 if (cmd->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) | 453 if (cmd->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) |
| 452 settings.use_external_begin_frame_source = true; | 454 settings.use_external_begin_frame_source = true; |
| 453 | 455 |
| 454 settings.renderer_settings.use_rgba_4444_textures |= | 456 if (cmd->HasSwitch(switches::kEnableRGBA4444Textures)) { |
| 455 cmd->HasSwitch(switches::kEnableRGBA4444Textures); | 457 settings.renderer_settings.preferred_tile_format = cc::RGBA_4444; |
| 456 settings.renderer_settings.use_rgba_4444_textures &= | 458 } |
| 457 !cmd->HasSwitch(switches::kDisableRGBA4444Textures); | 459 if (cmd->HasSwitch(switches::kDisableRGBA4444Textures)) { |
|
reveman
2015/12/02 18:27:18
nit: please make setting referred_tile_format to R
christiank
2015/12/03 12:58:00
Done.
| |
| 460 // Assume BGRA is supported here, if the preferred tile format isn't | |
| 461 // supported the compositor will choose the best supported format for us. | |
| 462 settings.renderer_settings.preferred_tile_format = | |
| 463 cc::PlatformColor::BestTextureFormat(true); | |
| 464 } | |
| 465 | |
| 466 if (cmd->HasSwitch(cc::switches::kEnableTileCompression)) { | |
| 467 settings.renderer_settings.preferred_tile_format = cc::ETC1; | |
| 468 } | |
| 458 | 469 |
| 459 if (widget_->for_oopif()) { | 470 if (widget_->for_oopif()) { |
| 460 // TODO(simonhong): Apply BeginFrame scheduling for OOPIF. | 471 // TODO(simonhong): Apply BeginFrame scheduling for OOPIF. |
| 461 // See crbug.com/471411. | 472 // See crbug.com/471411. |
| 462 settings.use_external_begin_frame_source = false; | 473 settings.use_external_begin_frame_source = false; |
| 463 } | 474 } |
| 464 | 475 |
| 465 settings.max_staging_buffer_usage_in_bytes = 32 * 1024 * 1024; // 32MB | 476 settings.max_staging_buffer_usage_in_bytes = 32 * 1024 * 1024; // 32MB |
| 466 // Use 1/4th of staging buffers on low-end devices. | 477 // Use 1/4th of staging buffers on low-end devices. |
| 467 if (base::SysInfo::IsLowEndDevice()) | 478 if (base::SysInfo::IsLowEndDevice()) |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1116 #endif | 1127 #endif |
| 1117 return actual; | 1128 return actual; |
| 1118 } | 1129 } |
| 1119 | 1130 |
| 1120 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( | 1131 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( |
| 1121 float device_scale) { | 1132 float device_scale) { |
| 1122 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); | 1133 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); |
| 1123 } | 1134 } |
| 1124 | 1135 |
| 1125 } // namespace content | 1136 } // namespace content |
| OLD | NEW |