| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include <X11/Xlib.h> | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "gpu/config/gpu_info_collector_linux.h" | |
| 9 #include "third_party/libXNVCtrl/NVCtrl.h" | |
| 10 #include "third_party/libXNVCtrl/NVCtrlLib.h" | |
| 11 #include "ui/gfx/x/x11_types.h" | |
| 12 | |
| 13 namespace gpu { | |
| 14 | |
| 15 // Use NVCtrl extention to query NV driver version. | |
| 16 // Return empty string on failing. | |
| 17 std::string CollectDriverVersionNVidia() { | |
| 18 Display* display = gfx::GetXDisplay(); | |
| 19 if (!display) { | |
| 20 LOG(ERROR) << "XOpenDisplay failed."; | |
| 21 return std::string(); | |
| 22 } | |
| 23 int event_base = 0, error_base = 0; | |
| 24 if (!XNVCTRLQueryExtension(display, &event_base, &error_base)) { | |
| 25 VLOG(1) << "NVCtrl extension does not exist."; | |
| 26 return std::string(); | |
| 27 } | |
| 28 int screen_count = ScreenCount(display); | |
| 29 for (int screen = 0; screen < screen_count; ++screen) { | |
| 30 char* buffer = NULL; | |
| 31 if (XNVCTRLIsNvScreen(display, screen) && | |
| 32 XNVCTRLQueryStringAttribute(display, screen, 0, | |
| 33 NV_CTRL_STRING_NVIDIA_DRIVER_VERSION, | |
| 34 &buffer)) { | |
| 35 std::string driver_version(buffer); | |
| 36 XFree(buffer); | |
| 37 return driver_version; | |
| 38 } | |
| 39 } | |
| 40 return std::string(); | |
| 41 } | |
| 42 | |
| 43 } // namespace gpu | |
| OLD | NEW |