| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/gpu/gpu_info_collector.h" | 5 #include "content/gpu/gpu_info_collector.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 switches::kGpuNoContextLost)) { | 175 switches::kGpuNoContextLost)) { |
| 176 gpu_info->can_lose_context = false; | 176 gpu_info->can_lose_context = false; |
| 177 } else { | 177 } else { |
| 178 // TODO(zmo): need to consider the case where we are running on top | 178 // TODO(zmo): need to consider the case where we are running on top |
| 179 // of desktop GL and GL_ARB_robustness extension is available. | 179 // of desktop GL and GL_ARB_robustness extension is available. |
| 180 gpu_info->can_lose_context = | 180 gpu_info->can_lose_context = |
| 181 (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); | 181 (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); |
| 182 } | 182 } |
| 183 | 183 |
| 184 gpu_info->finalized = true; | 184 gpu_info->finalized = true; |
| 185 return CollectGraphicsInfoGL(gpu_info); | 185 bool rt = CollectGraphicsInfoGL(gpu_info); |
| 186 } | |
| 187 | |
| 188 bool CollectPreliminaryGraphicsInfo(content::GPUInfo* gpu_info) { | |
| 189 DCHECK(gpu_info); | |
| 190 | |
| 191 bool rt = true; | |
| 192 if (!CollectVideoCardInfo(gpu_info)) | |
| 193 rt = false; | |
| 194 | 186 |
| 195 if (gpu_info->vendor_id == 0x1002) { // ATI | 187 if (gpu_info->vendor_id == 0x1002) { // ATI |
| 196 std::string ati_driver_version = CollectDriverVersionATI(); | 188 std::string ati_driver_version = CollectDriverVersionATI(); |
| 197 if (ati_driver_version != "") { | 189 if (ati_driver_version != "") { |
| 198 gpu_info->driver_vendor = "ATI / AMD"; | 190 gpu_info->driver_vendor = "ATI / AMD"; |
| 199 gpu_info->driver_version = ati_driver_version; | 191 gpu_info->driver_version = ati_driver_version; |
| 200 } | 192 } |
| 201 } | 193 } |
| 202 | 194 |
| 203 return rt; | 195 return rt; |
| 204 } | 196 } |
| 205 | 197 |
| 198 bool CollectPreliminaryGraphicsInfo(content::GPUInfo* gpu_info) { |
| 199 DCHECK(gpu_info); |
| 200 |
| 201 return CollectVideoCardInfo(gpu_info); |
| 202 } |
| 203 |
| 206 bool CollectVideoCardInfo(content::GPUInfo* gpu_info) { | 204 bool CollectVideoCardInfo(content::GPUInfo* gpu_info) { |
| 207 DCHECK(gpu_info); | 205 DCHECK(gpu_info); |
| 208 | 206 |
| 209 if (IsPciSupported() == false) { | 207 if (IsPciSupported() == false) { |
| 210 VLOG(1) << "PCI bus scanning is not supported"; | 208 VLOG(1) << "PCI bus scanning is not supported"; |
| 211 return false; | 209 return false; |
| 212 } | 210 } |
| 213 | 211 |
| 214 // TODO(zmo): be more flexible about library name. | 212 // TODO(zmo): be more flexible about library name. |
| 215 PciInterface* interface = InitializeLibPci("libpci.so.3"); | 213 PciInterface* interface = InitializeLibPci("libpci.so.3"); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 return false; | 312 return false; |
| 315 if (pos != std::string::npos) | 313 if (pos != std::string::npos) |
| 316 driver_version = driver_version.substr(0, pos); | 314 driver_version = driver_version.substr(0, pos); |
| 317 | 315 |
| 318 gpu_info->driver_vendor = pieces[1]; | 316 gpu_info->driver_vendor = pieces[1]; |
| 319 gpu_info->driver_version = driver_version; | 317 gpu_info->driver_version = driver_version; |
| 320 return true; | 318 return true; |
| 321 } | 319 } |
| 322 | 320 |
| 323 } // namespace gpu_info_collector | 321 } // namespace gpu_info_collector |
| OLD | NEW |