OLD | NEW |
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2010 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 "chrome/gpu/gpu_info_collector.h" | 5 #include "chrome/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 "app/gfx/gl/gl_bindings.h" | 10 #include "app/gfx/gl/gl_bindings.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 DCHECK(gpu_info); | 130 DCHECK(gpu_info); |
131 | 131 |
132 // TODO(zmo): need to consider the case where we are running on top of | 132 // TODO(zmo): need to consider the case where we are running on top of |
133 // desktop GL and GL_ARB_robustness extension is available. | 133 // desktop GL and GL_ARB_robustness extension is available. |
134 gpu_info->SetCanLoseContext( | 134 gpu_info->SetCanLoseContext( |
135 gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); | 135 gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); |
136 gpu_info->SetLevel(GPUInfo::kComplete); | 136 gpu_info->SetLevel(GPUInfo::kComplete); |
137 return CollectGraphicsInfoGL(gpu_info); | 137 return CollectGraphicsInfoGL(gpu_info); |
138 } | 138 } |
139 | 139 |
| 140 bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info) { |
| 141 DCHECK(gpu_info); |
| 142 |
| 143 gpu_info->SetLevel(GPUInfo::kPartial); |
| 144 |
| 145 bool rt = true; |
| 146 if (!CollectVideoCardInfo(gpu_info)) |
| 147 rt = false; |
| 148 |
| 149 // TODO(zmo): if vendor is ATI, consider passing /etc/ati/amdpcsdb.default |
| 150 // for driver information. |
| 151 |
| 152 return rt; |
| 153 } |
| 154 |
140 bool CollectVideoCardInfo(GPUInfo* gpu_info) { | 155 bool CollectVideoCardInfo(GPUInfo* gpu_info) { |
141 DCHECK(gpu_info); | 156 DCHECK(gpu_info); |
142 | 157 |
143 // TODO(zmo): be more flexible about library name. | 158 // TODO(zmo): be more flexible about library name. |
144 PciInterface* interface = InitializeLibPci("libpci.so.3"); | 159 PciInterface* interface = InitializeLibPci("libpci.so.3"); |
145 if (interface == NULL) | 160 if (interface == NULL) |
146 return false; | 161 return false; |
147 | 162 |
148 PciAccess* access = (interface->pci_alloc)(); | 163 PciAccess* access = (interface->pci_alloc)(); |
149 DCHECK(access != NULL); | 164 DCHECK(access != NULL); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 if (pos == 0) | 248 if (pos == 0) |
234 return false; | 249 return false; |
235 if (pos != std::string::npos) | 250 if (pos != std::string::npos) |
236 driver_version = driver_version.substr(0, pos); | 251 driver_version = driver_version.substr(0, pos); |
237 | 252 |
238 gpu_info->SetDriverInfo(pieces[1], driver_version); | 253 gpu_info->SetDriverInfo(pieces[1], driver_version); |
239 return true; | 254 return true; |
240 } | 255 } |
241 | 256 |
242 } // namespace gpu_info_collector | 257 } // namespace gpu_info_collector |
OLD | NEW |