| 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/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_piece.h" |
| 13 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
| 14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 15 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
| 16 #include "gpu/config/gpu_blacklist.h" | 17 #include "gpu/config/gpu_blacklist.h" |
| 17 #include "gpu/config/gpu_control_list_jsons.h" | 18 #include "gpu/config/gpu_control_list_jsons.h" |
| 18 #include "gpu/config/gpu_driver_bug_list.h" | 19 #include "gpu/config/gpu_driver_bug_list.h" |
| 19 #include "gpu/config/gpu_feature_type.h" | 20 #include "gpu/config/gpu_feature_type.h" |
| 20 #include "gpu/config/gpu_finch_features.h" | 21 #include "gpu/config/gpu_finch_features.h" |
| 21 #include "gpu/config/gpu_info_collector.h" | 22 #include "gpu/config/gpu_info_collector.h" |
| 22 #include "gpu/config/gpu_switches.h" | 23 #include "gpu/config/gpu_switches.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 GpuControlList::kCurrentOsOnly); | 99 GpuControlList::kCurrentOsOnly); |
| 99 std::set<int> workarounds = list->MakeDecision( | 100 std::set<int> workarounds = list->MakeDecision( |
| 100 GpuControlList::kOsAny, std::string(), gpu_info); | 101 GpuControlList::kOsAny, std::string(), gpu_info); |
| 101 GpuDriverBugList::AppendWorkaroundsFromCommandLine( | 102 GpuDriverBugList::AppendWorkaroundsFromCommandLine( |
| 102 &workarounds, *command_line); | 103 &workarounds, *command_line); |
| 103 if (!workarounds.empty()) { | 104 if (!workarounds.empty()) { |
| 104 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, | 105 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, |
| 105 IntSetToString(workarounds)); | 106 IntSetToString(workarounds)); |
| 106 } | 107 } |
| 107 | 108 |
| 108 std::set<std::string> disabled_extensions; | |
| 109 std::vector<std::string> buglist_disabled_extensions = | 109 std::vector<std::string> buglist_disabled_extensions = |
| 110 list->GetDisabledExtensions(); | 110 list->GetDisabledExtensions(); |
| 111 disabled_extensions.insert(buglist_disabled_extensions.begin(), | 111 std::set<base::StringPiece> disabled_extensions( |
| 112 buglist_disabled_extensions.end()); | 112 buglist_disabled_extensions.begin(), buglist_disabled_extensions.end()); |
| 113 | 113 |
| 114 // Must be outside if statement to remain in scope (referenced by |
| 115 // |disabled_extensions|). |
| 116 std::string command_line_disable_gl_extensions; |
| 114 if (command_line->HasSwitch(switches::kDisableGLExtensions)) { | 117 if (command_line->HasSwitch(switches::kDisableGLExtensions)) { |
| 115 std::vector<std::string> existing_disabled_extensions = base::SplitString( | 118 command_line_disable_gl_extensions = |
| 116 command_line->GetSwitchValueASCII(switches::kDisableGLExtensions), " ", | 119 command_line->GetSwitchValueASCII(switches::kDisableGLExtensions); |
| 117 base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 120 std::vector<base::StringPiece> existing_disabled_extensions = |
| 121 base::SplitStringPiece(command_line_disable_gl_extensions, " ", |
| 122 base::TRIM_WHITESPACE, |
| 123 base::SPLIT_WANT_NONEMPTY); |
| 118 disabled_extensions.insert(existing_disabled_extensions.begin(), | 124 disabled_extensions.insert(existing_disabled_extensions.begin(), |
| 119 existing_disabled_extensions.end()); | 125 existing_disabled_extensions.end()); |
| 120 } | 126 } |
| 121 | 127 |
| 122 if (!disabled_extensions.empty()) { | 128 if (!disabled_extensions.empty()) { |
| 123 std::vector<std::string> v(disabled_extensions.begin(), | 129 std::vector<base::StringPiece> v(disabled_extensions.begin(), |
| 124 disabled_extensions.end()); | 130 disabled_extensions.end()); |
| 125 command_line->AppendSwitchASCII(switches::kDisableGLExtensions, | 131 command_line->AppendSwitchASCII(switches::kDisableGLExtensions, |
| 126 base::JoinString(v, " ")); | 132 base::JoinString(v, " ")); |
| 127 } | 133 } |
| 128 } | 134 } |
| 129 | 135 |
| 130 void StringToFeatureSet( | 136 void StringToFeatureSet( |
| 131 const std::string& str, std::set<int>* feature_set) { | 137 const std::string& str, std::set<int>* feature_set) { |
| 132 StringToIntSet(str, feature_set); | 138 StringToIntSet(str, feature_set); |
| 133 } | 139 } |
| 134 | 140 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 199 } |
| 194 | 200 |
| 195 // Currently only used for GPU rasterization. | 201 // Currently only used for GPU rasterization. |
| 196 gpu_feature_info.status_values[GPU_FEATURE_TYPE_GPU_RASTERIZATION] = | 202 gpu_feature_info.status_values[GPU_FEATURE_TYPE_GPU_RASTERIZATION] = |
| 197 GetGpuRasterizationFeatureStatus(blacklisted_features, command_line); | 203 GetGpuRasterizationFeatureStatus(blacklisted_features, command_line); |
| 198 | 204 |
| 199 return gpu_feature_info; | 205 return gpu_feature_info; |
| 200 } | 206 } |
| 201 | 207 |
| 202 } // namespace gpu | 208 } // namespace gpu |
| OLD | NEW |