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 <memory> | 7 #include <memory> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/debug/crash_logging.h" | 11 #include "base/debug/crash_logging.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/string_piece.h" |
14 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
16 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
17 #include "base/sys_info.h" | 18 #include "base/sys_info.h" |
18 #include "gpu/config/gpu_blacklist.h" | 19 #include "gpu/config/gpu_blacklist.h" |
19 #include "gpu/config/gpu_control_list_jsons.h" | 20 #include "gpu/config/gpu_control_list_jsons.h" |
20 #include "gpu/config/gpu_crash_keys.h" | 21 #include "gpu/config/gpu_crash_keys.h" |
21 #include "gpu/config/gpu_driver_bug_list.h" | 22 #include "gpu/config/gpu_driver_bug_list.h" |
22 #include "gpu/config/gpu_feature_type.h" | 23 #include "gpu/config/gpu_feature_type.h" |
23 #include "gpu/config/gpu_finch_features.h" | 24 #include "gpu/config/gpu_finch_features.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 GpuControlList::kCurrentOsOnly); | 102 GpuControlList::kCurrentOsOnly); |
102 std::set<int> workarounds = list->MakeDecision( | 103 std::set<int> workarounds = list->MakeDecision( |
103 GpuControlList::kOsAny, std::string(), gpu_info); | 104 GpuControlList::kOsAny, std::string(), gpu_info); |
104 GpuDriverBugList::AppendWorkaroundsFromCommandLine( | 105 GpuDriverBugList::AppendWorkaroundsFromCommandLine( |
105 &workarounds, *command_line); | 106 &workarounds, *command_line); |
106 if (!workarounds.empty()) { | 107 if (!workarounds.empty()) { |
107 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, | 108 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, |
108 IntSetToString(workarounds)); | 109 IntSetToString(workarounds)); |
109 } | 110 } |
110 | 111 |
111 std::set<std::string> disabled_extensions; | |
112 std::vector<std::string> buglist_disabled_extensions = | 112 std::vector<std::string> buglist_disabled_extensions = |
113 list->GetDisabledExtensions(); | 113 list->GetDisabledExtensions(); |
114 disabled_extensions.insert(buglist_disabled_extensions.begin(), | 114 std::set<base::StringPiece> disabled_extensions( |
115 buglist_disabled_extensions.end()); | 115 buglist_disabled_extensions.begin(), buglist_disabled_extensions.end()); |
116 | 116 |
| 117 // Must be outside if statement to remain in scope (referenced by |
| 118 // |disabled_extensions|). |
| 119 std::string command_line_disable_gl_extensions; |
117 if (command_line->HasSwitch(switches::kDisableGLExtensions)) { | 120 if (command_line->HasSwitch(switches::kDisableGLExtensions)) { |
118 std::vector<std::string> existing_disabled_extensions = base::SplitString( | 121 command_line_disable_gl_extensions = |
119 command_line->GetSwitchValueASCII(switches::kDisableGLExtensions), " ", | 122 command_line->GetSwitchValueASCII(switches::kDisableGLExtensions); |
120 base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 123 std::vector<base::StringPiece> existing_disabled_extensions = |
| 124 base::SplitStringPiece(command_line_disable_gl_extensions, " ", |
| 125 base::TRIM_WHITESPACE, |
| 126 base::SPLIT_WANT_NONEMPTY); |
121 disabled_extensions.insert(existing_disabled_extensions.begin(), | 127 disabled_extensions.insert(existing_disabled_extensions.begin(), |
122 existing_disabled_extensions.end()); | 128 existing_disabled_extensions.end()); |
123 } | 129 } |
124 | 130 |
125 if (!disabled_extensions.empty()) { | 131 if (!disabled_extensions.empty()) { |
126 std::vector<std::string> v(disabled_extensions.begin(), | 132 std::vector<base::StringPiece> v(disabled_extensions.begin(), |
127 disabled_extensions.end()); | 133 disabled_extensions.end()); |
128 command_line->AppendSwitchASCII(switches::kDisableGLExtensions, | 134 command_line->AppendSwitchASCII(switches::kDisableGLExtensions, |
129 base::JoinString(v, " ")); | 135 base::JoinString(v, " ")); |
130 } | 136 } |
131 } | 137 } |
132 | 138 |
133 void StringToFeatureSet( | 139 void StringToFeatureSet( |
134 const std::string& str, std::set<int>* feature_set) { | 140 const std::string& str, std::set<int>* feature_set) { |
135 StringToIntSet(str, feature_set); | 141 StringToIntSet(str, feature_set); |
136 } | 142 } |
137 | 143 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 gpu_info.vertex_shader_version); | 225 gpu_info.vertex_shader_version); |
220 #if defined(OS_MACOSX) | 226 #if defined(OS_MACOSX) |
221 base::debug::SetCrashKeyValue(crash_keys::kGPUGLVersion, gpu_info.gl_version); | 227 base::debug::SetCrashKeyValue(crash_keys::kGPUGLVersion, gpu_info.gl_version); |
222 #elif defined(OS_POSIX) | 228 #elif defined(OS_POSIX) |
223 base::debug::SetCrashKeyValue(crash_keys::kGPUVendor, gpu_info.gl_vendor); | 229 base::debug::SetCrashKeyValue(crash_keys::kGPUVendor, gpu_info.gl_vendor); |
224 base::debug::SetCrashKeyValue(crash_keys::kGPURenderer, gpu_info.gl_renderer); | 230 base::debug::SetCrashKeyValue(crash_keys::kGPURenderer, gpu_info.gl_renderer); |
225 #endif | 231 #endif |
226 } | 232 } |
227 | 233 |
228 } // namespace gpu | 234 } // namespace gpu |
OLD | NEW |