| 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 "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" |
| 11 #include "base/debug/trace_event.h" |
| 11 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/string_piece.h" | 15 #include "base/string_piece.h" |
| 15 #include "base/string_split.h" | 16 #include "base/string_split.h" |
| 16 #include "base/string_tokenizer.h" | 17 #include "base/string_tokenizer.h" |
| 17 #include "base/string_util.h" | 18 #include "base/string_util.h" |
| 18 #include "ui/gl/gl_bindings.h" | 19 #include "ui/gl/gl_bindings.h" |
| 19 #include "ui/gl/gl_context.h" | 20 #include "ui/gl/gl_context.h" |
| 20 #include "ui/gl/gl_implementation.h" | 21 #include "ui/gl/gl_implementation.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 const uint32 kVendorIDNVidia = 0x10de; | 169 const uint32 kVendorIDNVidia = 0x10de; |
| 169 const uint32 kVendorIDAMD = 0x1002; | 170 const uint32 kVendorIDAMD = 0x1002; |
| 170 | 171 |
| 171 } // namespace anonymous | 172 } // namespace anonymous |
| 172 | 173 |
| 173 namespace gpu_info_collector { | 174 namespace gpu_info_collector { |
| 174 | 175 |
| 175 bool CollectGraphicsInfo(content::GPUInfo* gpu_info) { | 176 bool CollectGraphicsInfo(content::GPUInfo* gpu_info) { |
| 176 DCHECK(gpu_info); | 177 DCHECK(gpu_info); |
| 177 | 178 |
| 179 TRACE_EVENT0("gpu", "gpu_info_collector::CollectGraphicsInfo"); |
| 180 |
| 178 if (CommandLine::ForCurrentProcess()->HasSwitch( | 181 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 179 switches::kGpuNoContextLost)) { | 182 switches::kGpuNoContextLost)) { |
| 180 gpu_info->can_lose_context = false; | 183 gpu_info->can_lose_context = false; |
| 181 } else { | 184 } else { |
| 182 // TODO(zmo): need to consider the case where we are running on top | 185 // TODO(zmo): need to consider the case where we are running on top |
| 183 // of desktop GL and GL_ARB_robustness extension is available. | 186 // of desktop GL and GL_ARB_robustness extension is available. |
| 184 gpu_info->can_lose_context = | 187 gpu_info->can_lose_context = |
| 185 (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); | 188 (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); |
| 186 } | 189 } |
| 187 | 190 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 return false; | 327 return false; |
| 325 if (pos != std::string::npos) | 328 if (pos != std::string::npos) |
| 326 driver_version = driver_version.substr(0, pos); | 329 driver_version = driver_version.substr(0, pos); |
| 327 | 330 |
| 328 gpu_info->driver_vendor = pieces[1]; | 331 gpu_info->driver_vendor = pieces[1]; |
| 329 gpu_info->driver_version = driver_version; | 332 gpu_info->driver_version = driver_version; |
| 330 return true; | 333 return true; |
| 331 } | 334 } |
| 332 | 335 |
| 333 } // namespace gpu_info_collector | 336 } // namespace gpu_info_collector |
| OLD | NEW |