| 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 <X11/Xlib.h> | 7 #include <X11/Xlib.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/debug/trace_event.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "base/strings/string_piece.h" | 16 #include "base/strings/string_piece.h" |
| 17 #include "base/strings/string_split.h" | 17 #include "base/strings/string_split.h" |
| 18 #include "base/strings/string_tokenizer.h" | 18 #include "base/strings/string_tokenizer.h" |
| 19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 20 #include "library_loaders/libpci.h" | 20 #include "library_loaders/libpci.h" |
| 21 #include "third_party/libXNVCtrl/NVCtrl.h" | 21 #include "third_party/libXNVCtrl/NVCtrl.h" |
| 22 #include "third_party/libXNVCtrl/NVCtrlLib.h" | 22 #include "third_party/libXNVCtrl/NVCtrlLib.h" |
| 23 #include "ui/gfx/x/x11_types.h" | |
| 24 #include "ui/gl/gl_bindings.h" | 23 #include "ui/gl/gl_bindings.h" |
| 25 #include "ui/gl/gl_context.h" | 24 #include "ui/gl/gl_context.h" |
| 26 #include "ui/gl/gl_implementation.h" | 25 #include "ui/gl/gl_implementation.h" |
| 27 #include "ui/gl/gl_surface.h" | 26 #include "ui/gl/gl_surface.h" |
| 28 #include "ui/gl/gl_switches.h" | 27 #include "ui/gl/gl_switches.h" |
| 29 | 28 |
| 30 namespace gpu { | 29 namespace gpu { |
| 31 | 30 |
| 32 namespace { | 31 namespace { |
| 33 | 32 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 64 return line.substr(begin, end - begin); | 63 return line.substr(begin, end - begin); |
| 65 } | 64 } |
| 66 } | 65 } |
| 67 } | 66 } |
| 68 return std::string(); | 67 return std::string(); |
| 69 } | 68 } |
| 70 | 69 |
| 71 // Use NVCtrl extention to query NV driver version. | 70 // Use NVCtrl extention to query NV driver version. |
| 72 // Return empty string on failing. | 71 // Return empty string on failing. |
| 73 std::string CollectDriverVersionNVidia() { | 72 std::string CollectDriverVersionNVidia() { |
| 74 Display* display = gfx::GetXDisplay(); | 73 Display* display = base::MessagePumpForUI::GetDefaultXDisplay(); |
| 75 if (!display) { | 74 if (!display) { |
| 76 LOG(ERROR) << "XOpenDisplay failed."; | 75 LOG(ERROR) << "XOpenDisplay failed."; |
| 77 return std::string(); | 76 return std::string(); |
| 78 } | 77 } |
| 79 int event_base = 0, error_base = 0; | 78 int event_base = 0, error_base = 0; |
| 80 if (!XNVCTRLQueryExtension(display, &event_base, &error_base)) { | 79 if (!XNVCTRLQueryExtension(display, &event_base, &error_base)) { |
| 81 VLOG(1) << "NVCtrl extension does not exist."; | 80 VLOG(1) << "NVCtrl extension does not exist."; |
| 82 return std::string(); | 81 return std::string(); |
| 83 } | 82 } |
| 84 int screen_count = ScreenCount(display); | 83 int screen_count = ScreenCount(display); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 gpu_info->driver_version = driver_version; | 264 gpu_info->driver_version = driver_version; |
| 266 return kCollectInfoSuccess; | 265 return kCollectInfoSuccess; |
| 267 } | 266 } |
| 268 | 267 |
| 269 void MergeGPUInfo(GPUInfo* basic_gpu_info, | 268 void MergeGPUInfo(GPUInfo* basic_gpu_info, |
| 270 const GPUInfo& context_gpu_info) { | 269 const GPUInfo& context_gpu_info) { |
| 271 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 270 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
| 272 } | 271 } |
| 273 | 272 |
| 274 } // namespace gpu | 273 } // namespace gpu |
| OLD | NEW |