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

Side by Side Diff: content/browser/gpu/compositor_util.cc

Issue 2020243004: content: Rename num raster threads -> num worker threads. Base URL: https://chromium.googlesource.com/chromium/src.git@categorized_worker_pool_3
Patch Set: build break Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/gpu/compositor_util.h" 5 #include "content/browser/gpu/compositor_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 17 matching lines...) Expand all
28 28
29 static bool IsGpuRasterizationBlacklisted() { 29 static bool IsGpuRasterizationBlacklisted() {
30 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); 30 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
31 return manager->IsFeatureBlacklisted( 31 return manager->IsFeatureBlacklisted(
32 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION); 32 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION);
33 } 33 }
34 34
35 const char kGpuCompositingFeatureName[] = "gpu_compositing"; 35 const char kGpuCompositingFeatureName[] = "gpu_compositing";
36 const char kWebGLFeatureName[] = "webgl"; 36 const char kWebGLFeatureName[] = "webgl";
37 const char kRasterizationFeatureName[] = "rasterization"; 37 const char kRasterizationFeatureName[] = "rasterization";
38 const char kMultipleRasterThreadsFeatureName[] = "multiple_raster_threads"; 38 const char kMultipleWorkerThreadsFeatureName[] = "multiple_worker_threads";
39 const char kNativeGpuMemoryBuffersFeatureName[] = "native_gpu_memory_buffers"; 39 const char kNativeGpuMemoryBuffersFeatureName[] = "native_gpu_memory_buffers";
40 40
41 const int kMinRasterThreads = 1; 41 const int kMinRasterThreads = 1;
42 const int kMaxRasterThreads = 4; 42 const int kMaxRasterThreads = 4;
43 43
44 const int kMinMSAASampleCount = 0; 44 const int kMinMSAASampleCount = 0;
45 45
46 struct GpuFeatureInfo { 46 struct GpuFeatureInfo {
47 std::string name; 47 std::string name;
48 bool blocked; 48 bool blocked;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 false}, 119 false},
120 #endif 120 #endif
121 {kRasterizationFeatureName, 121 {kRasterizationFeatureName,
122 IsGpuRasterizationBlacklisted() && !IsGpuRasterizationEnabled() && 122 IsGpuRasterizationBlacklisted() && !IsGpuRasterizationEnabled() &&
123 !IsForceGpuRasterizationEnabled(), 123 !IsForceGpuRasterizationEnabled(),
124 !IsGpuRasterizationEnabled() && !IsForceGpuRasterizationEnabled() && 124 !IsGpuRasterizationEnabled() && !IsForceGpuRasterizationEnabled() &&
125 !IsGpuRasterizationBlacklisted(), 125 !IsGpuRasterizationBlacklisted(),
126 "Accelerated rasterization has been disabled, either via blacklist," 126 "Accelerated rasterization has been disabled, either via blacklist,"
127 " about:flags or the command line.", 127 " about:flags or the command line.",
128 true}, 128 true},
129 {kMultipleRasterThreadsFeatureName, false, 129 {kMultipleWorkerThreadsFeatureName, false,
130 NumberOfRendererRasterThreads() == 1, "Raster is using a single thread.", 130 NumberOfRendererWorkerThreads() == 1,
131 false}, 131 "Worker pool is using a single thread.", false},
132 {kNativeGpuMemoryBuffersFeatureName, false, 132 {kNativeGpuMemoryBuffersFeatureName, false,
133 !BrowserGpuMemoryBufferManager::IsNativeGpuMemoryBuffersEnabled(), 133 !BrowserGpuMemoryBufferManager::IsNativeGpuMemoryBuffersEnabled(),
134 "Native GpuMemoryBuffers have been disabled, either via about:flags" 134 "Native GpuMemoryBuffers have been disabled, either via about:flags"
135 " or command line.", 135 " or command line.",
136 true}, 136 true},
137 }; 137 };
138 DCHECK(index < arraysize(kGpuFeatureInfo)); 138 DCHECK(index < arraysize(kGpuFeatureInfo));
139 *eof = (index == arraysize(kGpuFeatureInfo) - 1); 139 *eof = (index == arraysize(kGpuFeatureInfo) - 1);
140 return kGpuFeatureInfo[index]; 140 return kGpuFeatureInfo[index];
141 } 141 }
142 142
143 } // namespace 143 } // namespace
144 144
145 int NumberOfRendererRasterThreads() { 145 int NumberOfRendererWorkerThreads() {
146 int num_processors = base::SysInfo::NumberOfProcessors(); 146 int num_processors = base::SysInfo::NumberOfProcessors();
147 147
148 #if defined(OS_ANDROID) 148 #if defined(OS_ANDROID)
149 // Android may report 6 to 8 CPUs for big.LITTLE configurations. 149 // Android may report 6 to 8 CPUs for big.LITTLE configurations.
150 // Limit the number of raster threads based on maximum of 4 big cores. 150 // Limit the number of worker threads based on maximum of 4 big cores.
151 num_processors = std::min(num_processors, 4); 151 num_processors = std::min(num_processors, 4);
152 #endif 152 #endif
153 153
154 int num_raster_threads = num_processors / 2; 154 int num_worker_threads = num_processors / 2;
155 155
156 #if defined(OS_ANDROID) 156 #if defined(OS_ANDROID)
157 // Limit the number of raster threads to 1 on Android. 157 // Limit the number of worker threads to 1 on Android.
158 // TODO(reveman): Remove this when we have a better mechanims to prevent 158 // TODO(reveman): Remove this when we have a better mechanism to prevent
159 // pre-paint raster work from slowing down non-raster work. crbug.com/504515 159 // pre-paint raster work from slowing down non-raster work. crbug.com/504515
160 num_raster_threads = 1; 160 num_worker_threads = 1;
161 #endif 161 #endif
162 162
163 const base::CommandLine& command_line = 163 const base::CommandLine& command_line =
164 *base::CommandLine::ForCurrentProcess(); 164 *base::CommandLine::ForCurrentProcess();
165 165
166 if (command_line.HasSwitch(switches::kNumRasterThreads)) { 166 if (command_line.HasSwitch(switches::kNumWorkerThreads)) {
167 std::string string_value = command_line.GetSwitchValueASCII( 167 std::string string_value =
168 switches::kNumRasterThreads); 168 command_line.GetSwitchValueASCII(switches::kNumWorkerThreads);
169 if (!base::StringToInt(string_value, &num_raster_threads)) { 169 if (!base::StringToInt(string_value, &num_worker_threads)) {
170 DLOG(WARNING) << "Failed to parse switch " << 170 DLOG(WARNING) << "Failed to parse switch " << switches::kNumWorkerThreads
171 switches::kNumRasterThreads << ": " << string_value; 171 << ": " << string_value;
172 } 172 }
173 } 173 }
174 174
175 return cc::MathUtil::ClampToRange(num_raster_threads, kMinRasterThreads, 175 return cc::MathUtil::ClampToRange(num_worker_threads, kMinRasterThreads,
176 kMaxRasterThreads); 176 kMaxRasterThreads);
177 } 177 }
178 178
179 bool IsZeroCopyUploadEnabled() { 179 bool IsZeroCopyUploadEnabled() {
180 const base::CommandLine& command_line = 180 const base::CommandLine& command_line =
181 *base::CommandLine::ForCurrentProcess(); 181 *base::CommandLine::ForCurrentProcess();
182 #if defined(OS_MACOSX) 182 #if defined(OS_MACOSX)
183 return !command_line.HasSwitch(switches::kDisableZeroCopy); 183 return !command_line.HasSwitch(switches::kDisableZeroCopy);
184 #else 184 #else
185 return command_line.HasSwitch(switches::kEnableZeroCopy); 185 return command_line.HasSwitch(switches::kEnableZeroCopy);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 status += "_off"; 326 status += "_off";
327 } else { 327 } else {
328 status = "enabled"; 328 status = "enabled";
329 if (gpu_feature_info.name == kWebGLFeatureName && 329 if (gpu_feature_info.name == kWebGLFeatureName &&
330 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING)) 330 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING))
331 status += "_readback"; 331 status += "_readback";
332 if (gpu_feature_info.name == kRasterizationFeatureName) { 332 if (gpu_feature_info.name == kRasterizationFeatureName) {
333 if (IsForceGpuRasterizationEnabled()) 333 if (IsForceGpuRasterizationEnabled())
334 status += "_force"; 334 status += "_force";
335 } 335 }
336 if (gpu_feature_info.name == kMultipleRasterThreadsFeatureName) { 336 if (gpu_feature_info.name == kMultipleWorkerThreadsFeatureName) {
337 const base::CommandLine& command_line = 337 const base::CommandLine& command_line =
338 *base::CommandLine::ForCurrentProcess(); 338 *base::CommandLine::ForCurrentProcess();
339 if (command_line.HasSwitch(switches::kNumRasterThreads)) 339 if (command_line.HasSwitch(switches::kNumWorkerThreads))
340 status += "_force"; 340 status += "_force";
341 } 341 }
342 if (gpu_feature_info.name == kMultipleRasterThreadsFeatureName) 342 if (gpu_feature_info.name == kMultipleWorkerThreadsFeatureName)
343 status += "_on"; 343 status += "_on";
344 } 344 }
345 if (gpu_feature_info.name == kWebGLFeatureName && 345 if (gpu_feature_info.name == kWebGLFeatureName &&
346 (gpu_feature_info.blocked || gpu_access_blocked) && 346 (gpu_feature_info.blocked || gpu_access_blocked) &&
347 manager->ShouldUseSwiftShader()) { 347 manager->ShouldUseSwiftShader()) {
348 status = "unavailable_software"; 348 status = "unavailable_software";
349 } 349 }
350 350
351 feature_status_dict->SetString( 351 feature_status_dict->SetString(
352 gpu_feature_info.name.c_str(), status.c_str()); 352 gpu_feature_info.name.c_str(), status.c_str());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 } 393 }
394 } 394 }
395 return problem_list; 395 return problem_list;
396 } 396 }
397 397
398 std::vector<std::string> GetDriverBugWorkarounds() { 398 std::vector<std::string> GetDriverBugWorkarounds() {
399 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(); 399 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds();
400 } 400 }
401 401
402 } // namespace content 402 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698