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" | |
12 #include "base/logging.h" | 11 #include "base/logging.h" |
13 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/string_split.h" | 13 #include "base/strings/string_split.h" |
15 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
16 #include "base/strings/stringprintf.h" | |
17 #include "base/sys_info.h" | 15 #include "base/sys_info.h" |
18 #include "gpu/config/gpu_blacklist.h" | 16 #include "gpu/config/gpu_blacklist.h" |
19 #include "gpu/config/gpu_control_list_jsons.h" | 17 #include "gpu/config/gpu_control_list_jsons.h" |
20 #include "gpu/config/gpu_driver_bug_list.h" | 18 #include "gpu/config/gpu_driver_bug_list.h" |
21 #include "gpu/config/gpu_feature_type.h" | 19 #include "gpu/config/gpu_feature_type.h" |
22 #include "gpu/config/gpu_finch_features.h" | 20 #include "gpu/config/gpu_finch_features.h" |
23 #include "gpu/config/gpu_info_collector.h" | 21 #include "gpu/config/gpu_info_collector.h" |
24 #include "gpu/config/gpu_switches.h" | 22 #include "gpu/config/gpu_switches.h" |
25 #include "ui/gl/gl_switches.h" | 23 #include "ui/gl/gl_switches.h" |
26 #include "ui/gl/gpu_switching_manager.h" | 24 #include "ui/gl/gpu_switching_manager.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // Gpu Rasterization on platforms that are not fully enabled is controlled by | 84 // Gpu Rasterization on platforms that are not fully enabled is controlled by |
87 // a finch experiment. | 85 // a finch experiment. |
88 if (!base::FeatureList::IsEnabled(features::kDefaultEnableGpuRasterization)) | 86 if (!base::FeatureList::IsEnabled(features::kDefaultEnableGpuRasterization)) |
89 return kGpuFeatureStatusDisabled; | 87 return kGpuFeatureStatusDisabled; |
90 | 88 |
91 return kGpuFeatureStatusEnabled; | 89 return kGpuFeatureStatusEnabled; |
92 } | 90 } |
93 | 91 |
94 } // namespace anonymous | 92 } // namespace anonymous |
95 | 93 |
96 namespace crash_keys { | |
97 | |
98 #if !defined(OS_ANDROID) | |
99 const char kGPUVendorID[] = "gpu-venid"; | |
100 const char kGPUDeviceID[] = "gpu-devid"; | |
101 #endif | |
102 const char kGPUDriverVersion[] = "gpu-driver"; | |
103 const char kGPUPixelShaderVersion[] = "gpu-psver"; | |
104 const char kGPUVertexShaderVersion[] = "gpu-vsver"; | |
105 #if defined(OS_MACOSX) | |
106 const char kGPUGLVersion[] = "gpu-glver"; | |
107 #elif defined(OS_POSIX) | |
108 const char kGPUVendor[] = "gpu-gl-vendor"; | |
109 const char kGPURenderer[] = "gpu-gl-renderer"; | |
110 #endif | |
111 | |
112 } // namespace crash_keys | |
113 | |
114 void ApplyGpuDriverBugWorkarounds(const GPUInfo& gpu_info, | 94 void ApplyGpuDriverBugWorkarounds(const GPUInfo& gpu_info, |
115 base::CommandLine* command_line) { | 95 base::CommandLine* command_line) { |
116 std::unique_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); | 96 std::unique_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); |
117 list->LoadList(kGpuDriverBugListJson, | 97 list->LoadList(kGpuDriverBugListJson, |
118 GpuControlList::kCurrentOsOnly); | 98 GpuControlList::kCurrentOsOnly); |
119 std::set<int> workarounds = list->MakeDecision( | 99 std::set<int> workarounds = list->MakeDecision( |
120 GpuControlList::kOsAny, std::string(), gpu_info); | 100 GpuControlList::kOsAny, std::string(), gpu_info); |
121 GpuDriverBugList::AppendWorkaroundsFromCommandLine( | 101 GpuDriverBugList::AppendWorkaroundsFromCommandLine( |
122 &workarounds, *command_line); | 102 &workarounds, *command_line); |
123 if (!workarounds.empty()) { | 103 if (!workarounds.empty()) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 list->MakeDecision(GpuControlList::kOsAny, std::string(), gpu_info); | 192 list->MakeDecision(GpuControlList::kOsAny, std::string(), gpu_info); |
213 } | 193 } |
214 | 194 |
215 // Currently only used for GPU rasterization. | 195 // Currently only used for GPU rasterization. |
216 gpu_feature_info.status_values[GPU_FEATURE_TYPE_GPU_RASTERIZATION] = | 196 gpu_feature_info.status_values[GPU_FEATURE_TYPE_GPU_RASTERIZATION] = |
217 GetGpuRasterizationFeatureStatus(blacklisted_features, command_line); | 197 GetGpuRasterizationFeatureStatus(blacklisted_features, command_line); |
218 | 198 |
219 return gpu_feature_info; | 199 return gpu_feature_info; |
220 } | 200 } |
221 | 201 |
222 void SetKeysForCrashLogging(const GPUInfo& gpu_info) { | |
223 #if !defined(OS_ANDROID) | |
224 base::debug::SetCrashKeyValue( | |
225 crash_keys::kGPUVendorID, | |
226 base::StringPrintf("0x%04x", gpu_info.gpu.vendor_id)); | |
227 base::debug::SetCrashKeyValue( | |
228 crash_keys::kGPUDeviceID, | |
229 base::StringPrintf("0x%04x", gpu_info.gpu.device_id)); | |
230 #endif | |
231 base::debug::SetCrashKeyValue(crash_keys::kGPUDriverVersion, | |
232 gpu_info.driver_version); | |
233 base::debug::SetCrashKeyValue(crash_keys::kGPUPixelShaderVersion, | |
234 gpu_info.pixel_shader_version); | |
235 base::debug::SetCrashKeyValue(crash_keys::kGPUVertexShaderVersion, | |
236 gpu_info.vertex_shader_version); | |
237 #if defined(OS_MACOSX) | |
238 base::debug::SetCrashKeyValue(crash_keys::kGPUGLVersion, gpu_info.gl_version); | |
239 #elif defined(OS_POSIX) | |
240 base::debug::SetCrashKeyValue(crash_keys::kGPUVendor, gpu_info.gl_vendor); | |
241 base::debug::SetCrashKeyValue(crash_keys::kGPURenderer, gpu_info.gl_renderer); | |
242 #endif | |
243 } | |
244 | |
245 } // namespace gpu | 202 } // namespace gpu |
OLD | NEW |