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 "gpu/config/gpu_util.h" | 5 #include "gpu/config/gpu_util.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
| 9 #include "base/command_line.h" |
9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "gpu/command_buffer/service/gpu_switches.h" |
| 13 #include "gpu/config/gpu_control_list_jsons.h" |
| 14 #include "gpu/config/gpu_driver_bug_list.h" |
| 15 #include "gpu/config/gpu_info_collector.h" |
10 #include "ui/gl/gl_switches.h" | 16 #include "ui/gl/gl_switches.h" |
11 | 17 |
12 namespace gpu { | 18 namespace gpu { |
13 | 19 |
| 20 namespace { |
| 21 |
| 22 // Combine the integers into a string, seperated by ','. |
| 23 std::string IntSetToString(const std::set<int>& list) { |
| 24 std::string rt; |
| 25 for (std::set<int>::const_iterator it = list.begin(); |
| 26 it != list.end(); ++it) { |
| 27 if (!rt.empty()) |
| 28 rt += ","; |
| 29 rt += base::IntToString(*it); |
| 30 } |
| 31 return rt; |
| 32 } |
| 33 |
| 34 } // namespace anonymous |
| 35 |
14 GpuSwitchingOption StringToGpuSwitchingOption( | 36 GpuSwitchingOption StringToGpuSwitchingOption( |
15 const std::string& switching_string) { | 37 const std::string& switching_string) { |
16 if (switching_string == switches::kGpuSwitchingOptionNameAutomatic) | 38 if (switching_string == switches::kGpuSwitchingOptionNameAutomatic) |
17 return GPU_SWITCHING_OPTION_AUTOMATIC; | 39 return GPU_SWITCHING_OPTION_AUTOMATIC; |
18 if (switching_string == switches::kGpuSwitchingOptionNameForceIntegrated) | 40 if (switching_string == switches::kGpuSwitchingOptionNameForceIntegrated) |
19 return GPU_SWITCHING_OPTION_FORCE_INTEGRATED; | 41 return GPU_SWITCHING_OPTION_FORCE_INTEGRATED; |
20 if (switching_string == switches::kGpuSwitchingOptionNameForceDiscrete) | 42 if (switching_string == switches::kGpuSwitchingOptionNameForceDiscrete) |
21 return GPU_SWITCHING_OPTION_FORCE_DISCRETE; | 43 return GPU_SWITCHING_OPTION_FORCE_DISCRETE; |
22 return GPU_SWITCHING_OPTION_UNKNOWN; | 44 return GPU_SWITCHING_OPTION_UNKNOWN; |
23 } | 45 } |
(...skipping 11 matching lines...) Expand all Loading... |
35 } | 57 } |
36 } | 58 } |
37 | 59 |
38 void MergeFeatureSets(std::set<int>* dst, const std::set<int>& src) { | 60 void MergeFeatureSets(std::set<int>* dst, const std::set<int>& src) { |
39 DCHECK(dst); | 61 DCHECK(dst); |
40 if (src.empty()) | 62 if (src.empty()) |
41 return; | 63 return; |
42 dst->insert(src.begin(), src.end()); | 64 dst->insert(src.begin(), src.end()); |
43 } | 65 } |
44 | 66 |
| 67 void ApplyGpuDriverBugWorkarounds(CommandLine* command_line) { |
| 68 GPUInfo gpu_info; |
| 69 CollectBasicGraphicsInfo(&gpu_info); |
| 70 |
| 71 GpuDriverBugList* list = GpuDriverBugList::Create(); |
| 72 list->LoadList("0", kGpuDriverBugListJson, |
| 73 GpuControlList::kCurrentOsOnly); |
| 74 std::set<int> workarounds = list->MakeDecision( |
| 75 GpuControlList::kOsAny, std::string(), gpu_info); |
| 76 if (!workarounds.empty()) { |
| 77 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, |
| 78 IntSetToString(workarounds)); |
| 79 } |
| 80 } |
| 81 |
45 } // namespace gpu | 82 } // namespace gpu |
OLD | NEW |