| Index: content/browser/gpu/compositor_util.cc
|
| diff --git a/content/browser/gpu/compositor_util.cc b/content/browser/gpu/compositor_util.cc
|
| index 86227475a6f4cdb3129e3ce707379574e5a322da..a96cdeae4138e43adcfdccc3760e963dc2cce6a9 100644
|
| --- a/content/browser/gpu/compositor_util.cc
|
| +++ b/content/browser/gpu/compositor_util.cc
|
| @@ -10,7 +10,6 @@
|
| #include "base/strings/string_number_conversions.h"
|
| #include "base/sys_info.h"
|
| #include "build/build_config.h"
|
| -#include "cc/base/math_util.h"
|
| #include "cc/base/switches.h"
|
| #include "content/browser/gpu/gpu_data_manager_impl.h"
|
| #include "content/public/common/content_switches.h"
|
| @@ -33,7 +32,7 @@
|
| const char* kMultipleRasterThreadsFeatureName = "multiple_raster_threads";
|
|
|
| const int kMinRasterThreads = 1;
|
| -const int kMaxRasterThreads = 16;
|
| +const int kMaxRasterThreads = 64;
|
|
|
| const int kMinMSAASampleCount = 0;
|
|
|
| @@ -211,30 +210,20 @@
|
| }
|
|
|
| int NumberOfRendererRasterThreads() {
|
| - int num_raster_threads = base::SysInfo::NumberOfProcessors() / 2;
|
| -
|
| - // Async uploads is used when neither zero-copy nor one-copy is enabled and
|
| - // it uses its own thread, so reduce the number of raster threads when async
|
| - // uploads is in use.
|
| - bool async_uploads_is_used =
|
| + int num_raster_threads = 1;
|
| +
|
| + // Async uploads uses its own thread, so allow an extra thread when async
|
| + // uploads is not in use.
|
| + bool allow_extra_thread =
|
| IsZeroCopyUploadEnabled() || IsOneCopyUploadEnabled();
|
| - if (async_uploads_is_used)
|
| - --num_raster_threads;
|
| -
|
| - const base::CommandLine& command_line =
|
| - *base::CommandLine::ForCurrentProcess();
|
| -
|
| - if (command_line.HasSwitch(switches::kNumRasterThreads)) {
|
| - std::string string_value = command_line.GetSwitchValueASCII(
|
| - switches::kNumRasterThreads);
|
| - if (!base::StringToInt(string_value, &num_raster_threads)) {
|
| - DLOG(WARNING) << "Failed to parse switch " <<
|
| - switches::kNumRasterThreads << ": " << string_value;
|
| - }
|
| - }
|
| -
|
| - return cc::MathUtil::ClampToRange(num_raster_threads, kMinRasterThreads,
|
| - kMaxRasterThreads);
|
| + if (base::SysInfo::NumberOfProcessors() >= 4 && allow_extra_thread)
|
| + num_raster_threads = 2;
|
| +
|
| + int force_num_raster_threads = ForceNumberOfRendererRasterThreads();
|
| + if (force_num_raster_threads)
|
| + num_raster_threads = force_num_raster_threads;
|
| +
|
| + return num_raster_threads;
|
| }
|
|
|
| bool IsOneCopyUploadEnabled() {
|
| @@ -258,6 +247,26 @@
|
| const base::CommandLine& command_line =
|
| *base::CommandLine::ForCurrentProcess();
|
| return command_line.HasSwitch(switches::kEnableZeroCopy);
|
| +}
|
| +
|
| +int ForceNumberOfRendererRasterThreads() {
|
| + const base::CommandLine& command_line =
|
| + *base::CommandLine::ForCurrentProcess();
|
| +
|
| + if (!command_line.HasSwitch(switches::kNumRasterThreads))
|
| + return 0;
|
| + std::string string_value =
|
| + command_line.GetSwitchValueASCII(switches::kNumRasterThreads);
|
| + int force_num_raster_threads = 0;
|
| + if (base::StringToInt(string_value, &force_num_raster_threads) &&
|
| + force_num_raster_threads >= kMinRasterThreads &&
|
| + force_num_raster_threads <= kMaxRasterThreads) {
|
| + return force_num_raster_threads;
|
| + } else {
|
| + DLOG(WARNING) << "Failed to parse switch " <<
|
| + switches::kNumRasterThreads << ": " << string_value;
|
| + return 0;
|
| + }
|
| }
|
|
|
| bool IsGpuRasterizationEnabled() {
|
| @@ -374,9 +383,7 @@
|
| status += "_force";
|
| }
|
| if (gpu_feature_info.name == kMultipleRasterThreadsFeatureName) {
|
| - const base::CommandLine& command_line =
|
| - *base::CommandLine::ForCurrentProcess();
|
| - if (command_line.HasSwitch(switches::kNumRasterThreads))
|
| + if (ForceNumberOfRendererRasterThreads() > 0)
|
| status += "_force";
|
| }
|
| if (gpu_feature_info.name == kThreadedRasterizationFeatureName ||
|
|
|