| 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 <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // Use NVCtrl extention to query NV driver version. | 172 // Use NVCtrl extention to query NV driver version. |
| 173 // Return empty string on failing. | 173 // Return empty string on failing. |
| 174 std::string CollectDriverVersionNVidia() { | 174 std::string CollectDriverVersionNVidia() { |
| 175 Display* display = base::MessagePumpForUI::GetDefaultXDisplay(); | 175 Display* display = base::MessagePumpForUI::GetDefaultXDisplay(); |
| 176 if (!display) { | 176 if (!display) { |
| 177 LOG(ERROR) << "XOpenDisplay failed."; | 177 LOG(ERROR) << "XOpenDisplay failed."; |
| 178 return std::string(); | 178 return std::string(); |
| 179 } | 179 } |
| 180 int event_base = 0, error_base = 0; | 180 int event_base = 0, error_base = 0; |
| 181 if (!XNVCTRLQueryExtension(display, &event_base, &error_base)) { | 181 if (!XNVCTRLQueryExtension(display, &event_base, &error_base)) { |
| 182 LOG(INFO) << "NVCtrl extension does not exits."; | 182 LOG(INFO) << "NVCtrl extension does not exist."; |
| 183 return std::string(); | 183 return std::string(); |
| 184 } | 184 } |
| 185 int screen_count = ScreenCount(display); | 185 int screen_count = ScreenCount(display); |
| 186 for (int screen = 0; screen < screen_count; ++screen) { | 186 for (int screen = 0; screen < screen_count; ++screen) { |
| 187 char* buffer = NULL; | 187 char* buffer = NULL; |
| 188 if (XNVCTRLIsNvScreen(display, screen) && | 188 if (XNVCTRLIsNvScreen(display, screen) && |
| 189 XNVCTRLQueryStringAttribute(display, screen, 0, | 189 XNVCTRLQueryStringAttribute(display, screen, 0, |
| 190 NV_CTRL_STRING_NVIDIA_DRIVER_VERSION, | 190 NV_CTRL_STRING_NVIDIA_DRIVER_VERSION, |
| 191 &buffer)) { | 191 &buffer)) { |
| 192 std::string driver_version(buffer); | 192 std::string driver_version(buffer); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 return false; | 375 return false; |
| 376 if (pos != std::string::npos) | 376 if (pos != std::string::npos) |
| 377 driver_version = driver_version.substr(0, pos); | 377 driver_version = driver_version.substr(0, pos); |
| 378 | 378 |
| 379 gpu_info->driver_vendor = pieces[1]; | 379 gpu_info->driver_vendor = pieces[1]; |
| 380 gpu_info->driver_version = driver_version; | 380 gpu_info->driver_version = driver_version; |
| 381 return true; | 381 return true; |
| 382 } | 382 } |
| 383 | 383 |
| 384 } // namespace gpu_info_collector | 384 } // namespace gpu_info_collector |
| OLD | NEW |