Commit 55eaae18 authored by reveman's avatar reveman Committed by Commit bot

Revert of content: Use NumberOfProcessors() / 2 raster threads. (patchset #2...

Revert of content: Use NumberOfProcessors() / 2 raster threads. (patchset #2 id:20001 of https://codereview.chromium.org/1143473002/)

Reason for revert:
Incorrect logic for determining if async uploads is used

Original issue's description:
> content: Use NumberOfProcessors() / 2 raster threads.
>
> 4 raster threads improve performance on 8 core machines.
> 8 core machines might not be a priority but it seems
> like an unnecessary limitation to have.
>
> BUG=
>
> Committed: https://crrev.com/4a0177a1dba8197f61021ff3b4f9426e45faaa62
> Cr-Commit-Position: refs/heads/master@{#330427}

TBR=danakj@chromium.org,enne@chromium.org,piman@chromium.org,vmpstr@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review URL: https://codereview.chromium.org/1136633006

Cr-Commit-Position: refs/heads/master@{#330520}
parent 93ef7cd2
......@@ -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* kThreadedRasterizationFeatureName = "threaded_rasterization";
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 @@ bool IsImplSidePaintingEnabled() {
}
int NumberOfRendererRasterThreads() {
int num_raster_threads = base::SysInfo::NumberOfProcessors() / 2;
int num_raster_threads = 1;
// 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 =
// 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;
if (base::SysInfo::NumberOfProcessors() >= 4 && allow_extra_thread)
num_raster_threads = 2;
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
int force_num_raster_threads = ForceNumberOfRendererRasterThreads();
if (force_num_raster_threads)
num_raster_threads = force_num_raster_threads;
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);
return num_raster_threads;
}
bool IsOneCopyUploadEnabled() {
......@@ -260,6 +249,26 @@ bool IsZeroCopyUploadEnabled() {
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() {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
......@@ -374,9 +383,7 @@ base::DictionaryValue* GetFeatureStatus() {
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 ||
......
......@@ -49,6 +49,10 @@ CONTENT_EXPORT bool IsForceGpuRasterizationEnabled();
// Returns the number of raster threads to use for compositing.
CONTENT_EXPORT int NumberOfRendererRasterThreads();
// Returns the number of raster threads to use for compositing that are forced
// by the command line.
CONTENT_EXPORT int ForceNumberOfRendererRasterThreads();
// Returns true if using cc Surfaces is allowed.
CONTENT_EXPORT bool UseSurfacesEnabled();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment