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

Unified Diff: content/browser/gpu/compositor_util.cc

Issue 1143473002: Re-land: content: Use NumberOfProcessors() / 2 raster threads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gpu/compositor_util.cc
diff --git a/content/browser/gpu/compositor_util.cc b/content/browser/gpu/compositor_util.cc
index a96cdeae4138e43adcfdccc3760e963dc2cce6a9..55bb0646ac5b4a52245807064263ed7623ed9a93 100644
--- a/content/browser/gpu/compositor_util.cc
+++ b/content/browser/gpu/compositor_util.cc
@@ -10,6 +10,7 @@
#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"
@@ -210,14 +211,17 @@ bool IsImplSidePaintingEnabled() {
}
int NumberOfRendererRasterThreads() {
- 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 =
+ int num_raster_threads = cc::MathUtil::ClampToRange(
+ base::SysInfo::NumberOfProcessors() / 2,
+ kMinRasterThreads, kMaxRasterThreads);
danakj 2015/05/13 20:01:23 nit: how about do the computation for a number her
reveman 2015/05/13 20:24:35 I did that first but didn't like it as it's alread
+
+ // 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 =
IsZeroCopyUploadEnabled() || IsOneCopyUploadEnabled();
- if (base::SysInfo::NumberOfProcessors() >= 4 && allow_extra_thread)
- num_raster_threads = 2;
+ if (async_uploads_is_used)
+ num_raster_threads = std::max(kMinRasterThreads, num_raster_threads - 1);
int force_num_raster_threads = ForceNumberOfRendererRasterThreads();
if (force_num_raster_threads)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698