| 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_info_collector.h" | 5 #include "gpu/config/gpu_info_collector.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 IdentifyActiveGPU(gpu_info); | 170 IdentifyActiveGPU(gpu_info); |
| 171 return CollectDriverInfoGL(gpu_info); | 171 return CollectDriverInfoGL(gpu_info); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void MergeGPUInfoGL(GPUInfo* basic_gpu_info, | 174 void MergeGPUInfoGL(GPUInfo* basic_gpu_info, |
| 175 const GPUInfo& context_gpu_info) { | 175 const GPUInfo& context_gpu_info) { |
| 176 DCHECK(basic_gpu_info); | 176 DCHECK(basic_gpu_info); |
| 177 // Copy over GPUs because which one is active could change. | 177 // Copy over GPUs because which one is active could change. |
| 178 basic_gpu_info->gpu = context_gpu_info.gpu; | 178 basic_gpu_info->gpu = context_gpu_info.gpu; |
| 179 basic_gpu_info->secondary_gpus = context_gpu_info.secondary_gpus; | |
| 180 | 179 |
| 181 basic_gpu_info->gl_renderer = context_gpu_info.gl_renderer; | 180 basic_gpu_info->gl_renderer = context_gpu_info.gl_renderer; |
| 182 basic_gpu_info->gl_vendor = context_gpu_info.gl_vendor; | 181 basic_gpu_info->gl_vendor = context_gpu_info.gl_vendor; |
| 183 basic_gpu_info->gl_version = context_gpu_info.gl_version; | 182 basic_gpu_info->gl_version = context_gpu_info.gl_version; |
| 184 basic_gpu_info->gl_extensions = context_gpu_info.gl_extensions; | 183 basic_gpu_info->gl_extensions = context_gpu_info.gl_extensions; |
| 185 basic_gpu_info->pixel_shader_version = | 184 basic_gpu_info->pixel_shader_version = |
| 186 context_gpu_info.pixel_shader_version; | 185 context_gpu_info.pixel_shader_version; |
| 187 basic_gpu_info->vertex_shader_version = | 186 basic_gpu_info->vertex_shader_version = |
| 188 context_gpu_info.vertex_shader_version; | 187 context_gpu_info.vertex_shader_version; |
| 189 basic_gpu_info->max_msaa_samples = | 188 basic_gpu_info->max_msaa_samples = |
| 190 context_gpu_info.max_msaa_samples; | 189 context_gpu_info.max_msaa_samples; |
| 191 basic_gpu_info->gl_ws_vendor = context_gpu_info.gl_ws_vendor; | 190 basic_gpu_info->gl_ws_vendor = context_gpu_info.gl_ws_vendor; |
| 192 basic_gpu_info->gl_ws_version = context_gpu_info.gl_ws_version; | 191 basic_gpu_info->gl_ws_version = context_gpu_info.gl_ws_version; |
| 193 basic_gpu_info->gl_ws_extensions = context_gpu_info.gl_ws_extensions; | 192 basic_gpu_info->gl_ws_extensions = context_gpu_info.gl_ws_extensions; |
| 194 basic_gpu_info->gl_reset_notification_strategy = | 193 basic_gpu_info->gl_reset_notification_strategy = |
| 195 context_gpu_info.gl_reset_notification_strategy; | 194 context_gpu_info.gl_reset_notification_strategy; |
| 196 | 195 |
| 196 if (!context_gpu_info.secondary_gpus.empty()) |
| 197 basic_gpu_info->secondary_gpus = context_gpu_info.secondary_gpus; |
| 197 if (!context_gpu_info.driver_vendor.empty()) | 198 if (!context_gpu_info.driver_vendor.empty()) |
| 198 basic_gpu_info->driver_vendor = context_gpu_info.driver_vendor; | 199 basic_gpu_info->driver_vendor = context_gpu_info.driver_vendor; |
| 199 if (!context_gpu_info.driver_version.empty()) | 200 if (!context_gpu_info.driver_version.empty()) |
| 200 basic_gpu_info->driver_version = context_gpu_info.driver_version; | 201 basic_gpu_info->driver_version = context_gpu_info.driver_version; |
| 201 | 202 |
| 202 basic_gpu_info->can_lose_context = context_gpu_info.can_lose_context; | 203 basic_gpu_info->can_lose_context = context_gpu_info.can_lose_context; |
| 203 basic_gpu_info->sandboxed = context_gpu_info.sandboxed; | 204 basic_gpu_info->sandboxed = context_gpu_info.sandboxed; |
| 204 basic_gpu_info->direct_rendering = context_gpu_info.direct_rendering; | 205 basic_gpu_info->direct_rendering = context_gpu_info.direct_rendering; |
| 205 basic_gpu_info->in_process_gpu = context_gpu_info.in_process_gpu; | 206 basic_gpu_info->in_process_gpu = context_gpu_info.in_process_gpu; |
| 206 basic_gpu_info->context_info_state = context_gpu_info.context_info_state; | 207 basic_gpu_info->context_info_state = context_gpu_info.context_info_state; |
| 207 basic_gpu_info->initialization_time = context_gpu_info.initialization_time; | 208 basic_gpu_info->initialization_time = context_gpu_info.initialization_time; |
| 208 basic_gpu_info->video_decode_accelerator_capabilities = | 209 basic_gpu_info->video_decode_accelerator_capabilities = |
| 209 context_gpu_info.video_decode_accelerator_capabilities; | 210 context_gpu_info.video_decode_accelerator_capabilities; |
| 210 basic_gpu_info->video_encode_accelerator_supported_profiles = | 211 basic_gpu_info->video_encode_accelerator_supported_profiles = |
| 211 context_gpu_info.video_encode_accelerator_supported_profiles; | 212 context_gpu_info.video_encode_accelerator_supported_profiles; |
| 212 basic_gpu_info->jpeg_decode_accelerator_supported = | 213 basic_gpu_info->jpeg_decode_accelerator_supported = |
| 213 context_gpu_info.jpeg_decode_accelerator_supported; | 214 context_gpu_info.jpeg_decode_accelerator_supported; |
| 214 } | 215 } |
| 215 | 216 |
| 216 void IdentifyActiveGPU(GPUInfo* gpu_info) { | 217 void IdentifyActiveGPU(GPUInfo* gpu_info) { |
| 217 const std::string kNVidiaName = "nvidia"; | 218 const std::string kNVidiaName = "nvidia"; |
| 219 const std::string kNouveauName = "nouveau"; |
| 218 const std::string kIntelName = "intel"; | 220 const std::string kIntelName = "intel"; |
| 219 const std::string kAMDName = "amd"; | 221 const std::string kAMDName = "amd"; |
| 220 const std::string kATIName = "ati"; | 222 const std::string kATIName = "ati"; |
| 221 const std::string kVendorNames[] = { | 223 const std::string kRadeonName = "radeon"; |
| 222 kNVidiaName, kIntelName, kAMDName, kATIName}; | 224 const std::string kVendorNames[] = {kNVidiaName, kNouveauName, kIntelName, |
| 225 kAMDName, kATIName, kRadeonName}; |
| 223 | 226 |
| 224 const uint32_t kNVidiaID = 0x10de; | 227 const uint32_t kNVidiaID = 0x10de; |
| 225 const uint32_t kIntelID = 0x8086; | 228 const uint32_t kIntelID = 0x8086; |
| 226 const uint32_t kAMDID = 0x1002; | 229 const uint32_t kAMDID = 0x1002; |
| 227 const uint32_t kATIID = 0x1002; | 230 const uint32_t kATIID = 0x1002; |
| 228 const uint32_t kVendorIDs[] = {kNVidiaID, kIntelID, kAMDID, kATIID}; | 231 const uint32_t kVendorIDs[] = {kNVidiaID, kNVidiaID, kIntelID, |
| 232 kAMDID, kATIID, kAMDID}; |
| 229 | 233 |
| 230 DCHECK(gpu_info); | 234 DCHECK(gpu_info); |
| 231 if (gpu_info->secondary_gpus.size() == 0) | 235 if (gpu_info->secondary_gpus.size() == 0) |
| 232 return; | 236 return; |
| 233 | 237 |
| 234 uint32_t active_vendor_id = 0; | 238 uint32_t active_vendor_id = 0; |
| 235 if (!gpu_info->gl_vendor.empty()) { | 239 if (!gpu_info->gl_vendor.empty()) { |
| 236 std::string gl_vendor_lower = base::ToLowerASCII(gpu_info->gl_vendor); | 240 std::string gl_vendor_lower = base::ToLowerASCII(gpu_info->gl_vendor); |
| 237 int index = StringContainsName( | 241 int index = StringContainsName( |
| 238 gl_vendor_lower, kVendorNames, arraysize(kVendorNames)); | 242 gl_vendor_lower, kVendorNames, arraysize(kVendorNames)); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 265 for (size_t ii = 0; ii < gpu_info->secondary_gpus.size(); ++ii) { | 269 for (size_t ii = 0; ii < gpu_info->secondary_gpus.size(); ++ii) { |
| 266 if (active_vendor_id == gpu_info->secondary_gpus[ii].vendor_id) { | 270 if (active_vendor_id == gpu_info->secondary_gpus[ii].vendor_id) { |
| 267 gpu_info->secondary_gpus[ii].active = true; | 271 gpu_info->secondary_gpus[ii].active = true; |
| 268 return; | 272 return; |
| 269 } | 273 } |
| 270 } | 274 } |
| 271 } | 275 } |
| 272 | 276 |
| 273 } // namespace gpu | 277 } // namespace gpu |
| 274 | 278 |
| OLD | NEW |