OLD | NEW |
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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 const char* kGpuCompositingFeatureName = "gpu_compositing"; | 28 const char* kGpuCompositingFeatureName = "gpu_compositing"; |
29 const char* kWebGLFeatureName = "webgl"; | 29 const char* kWebGLFeatureName = "webgl"; |
30 const char* kRasterizationFeatureName = "rasterization"; | 30 const char* kRasterizationFeatureName = "rasterization"; |
31 const char* kThreadedRasterizationFeatureName = "threaded_rasterization"; | 31 const char* kThreadedRasterizationFeatureName = "threaded_rasterization"; |
32 const char* kMultipleRasterThreadsFeatureName = "multiple_raster_threads"; | 32 const char* kMultipleRasterThreadsFeatureName = "multiple_raster_threads"; |
33 | 33 |
34 const int kMinRasterThreads = 1; | 34 const int kMinRasterThreads = 1; |
35 const int kMaxRasterThreads = 64; | 35 const int kMaxRasterThreads = 64; |
36 | 36 |
| 37 const int kMinMSAASampleCount = 0; |
| 38 |
37 struct GpuFeatureInfo { | 39 struct GpuFeatureInfo { |
38 std::string name; | 40 std::string name; |
39 bool blocked; | 41 bool blocked; |
40 bool disabled; | 42 bool disabled; |
41 std::string disabled_description; | 43 std::string disabled_description; |
42 bool fallback_to_software; | 44 bool fallback_to_software; |
43 }; | 45 }; |
44 | 46 |
45 const GpuFeatureInfo GetGpuFeatureInfo(size_t index, bool* eof) { | 47 const GpuFeatureInfo GetGpuFeatureInfo(size_t index, bool* eof) { |
46 const base::CommandLine& command_line = | 48 const base::CommandLine& command_line = |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 if (!command_line.HasSwitch(switches::kNumRasterThreads)) | 254 if (!command_line.HasSwitch(switches::kNumRasterThreads)) |
253 return 0; | 255 return 0; |
254 std::string string_value = | 256 std::string string_value = |
255 command_line.GetSwitchValueASCII(switches::kNumRasterThreads); | 257 command_line.GetSwitchValueASCII(switches::kNumRasterThreads); |
256 int force_num_raster_threads = 0; | 258 int force_num_raster_threads = 0; |
257 if (base::StringToInt(string_value, &force_num_raster_threads) && | 259 if (base::StringToInt(string_value, &force_num_raster_threads) && |
258 force_num_raster_threads >= kMinRasterThreads && | 260 force_num_raster_threads >= kMinRasterThreads && |
259 force_num_raster_threads <= kMaxRasterThreads) { | 261 force_num_raster_threads <= kMaxRasterThreads) { |
260 return force_num_raster_threads; | 262 return force_num_raster_threads; |
261 } else { | 263 } else { |
262 LOG(WARNING) << "Failed to parse switch " << | 264 DLOG(WARNING) << "Failed to parse switch " << |
263 switches::kNumRasterThreads << ": " << string_value; | 265 switches::kNumRasterThreads << ": " << string_value; |
264 return 0; | 266 return 0; |
265 } | 267 } |
266 } | 268 } |
267 | 269 |
268 bool IsGpuRasterizationEnabled() { | 270 bool IsGpuRasterizationEnabled() { |
269 const base::CommandLine& command_line = | 271 const base::CommandLine& command_line = |
270 *base::CommandLine::ForCurrentProcess(); | 272 *base::CommandLine::ForCurrentProcess(); |
271 | 273 |
272 if (!IsImplSidePaintingEnabled()) | 274 if (!IsImplSidePaintingEnabled()) |
(...skipping 25 matching lines...) Expand all Loading... |
298 #if defined(OS_ANDROID) | 300 #if defined(OS_ANDROID) |
299 return false; | 301 return false; |
300 #else | 302 #else |
301 const base::CommandLine& command_line = | 303 const base::CommandLine& command_line = |
302 *base::CommandLine::ForCurrentProcess(); | 304 *base::CommandLine::ForCurrentProcess(); |
303 | 305 |
304 return command_line.HasSwitch(switches::kUseSurfaces); | 306 return command_line.HasSwitch(switches::kUseSurfaces); |
305 #endif | 307 #endif |
306 } | 308 } |
307 | 309 |
| 310 int GpuRasterizationMSAASampleCount() { |
| 311 const base::CommandLine& command_line = |
| 312 *base::CommandLine::ForCurrentProcess(); |
| 313 |
| 314 if (!command_line.HasSwitch(switches::kGpuRasterizationMSAASampleCount)) |
| 315 return 0; |
| 316 std::string string_value = command_line.GetSwitchValueASCII( |
| 317 switches::kGpuRasterizationMSAASampleCount); |
| 318 int msaa_sample_count = 0; |
| 319 if (base::StringToInt(string_value, &msaa_sample_count) && |
| 320 msaa_sample_count >= kMinMSAASampleCount) { |
| 321 return msaa_sample_count; |
| 322 } else { |
| 323 DLOG(WARNING) << "Failed to parse switch " |
| 324 << switches::kGpuRasterizationMSAASampleCount << ": " |
| 325 << string_value; |
| 326 return 0; |
| 327 } |
| 328 } |
| 329 |
308 base::DictionaryValue* GetFeatureStatus() { | 330 base::DictionaryValue* GetFeatureStatus() { |
309 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); | 331 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); |
310 std::string gpu_access_blocked_reason; | 332 std::string gpu_access_blocked_reason; |
311 bool gpu_access_blocked = | 333 bool gpu_access_blocked = |
312 !manager->GpuAccessAllowed(&gpu_access_blocked_reason); | 334 !manager->GpuAccessAllowed(&gpu_access_blocked_reason); |
313 | 335 |
314 base::DictionaryValue* feature_status_dict = new base::DictionaryValue(); | 336 base::DictionaryValue* feature_status_dict = new base::DictionaryValue(); |
315 | 337 |
316 bool eof = false; | 338 bool eof = false; |
317 for (size_t i = 0; !eof; ++i) { | 339 for (size_t i = 0; !eof; ++i) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 } | 422 } |
401 } | 423 } |
402 return problem_list; | 424 return problem_list; |
403 } | 425 } |
404 | 426 |
405 std::vector<std::string> GetDriverBugWorkarounds() { | 427 std::vector<std::string> GetDriverBugWorkarounds() { |
406 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(); | 428 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(); |
407 } | 429 } |
408 | 430 |
409 } // namespace content | 431 } // namespace content |
OLD | NEW |