Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: gpu/config/gpu_info_collector_wayland.cc

Issue 17265006: wayland patch for inspection Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/content_browser.gypi ('k') | gpu/gpu_config.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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>
8 #include <vector> 7 #include <vector>
9 8
10 #include "base/command_line.h" 9 #include "base/command_line.h"
11 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
12 #include "base/file_util.h" 11 #include "base/file_util.h"
13 #include "base/logging.h" 12 #include "base/logging.h"
14 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/string_util.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"
20 #include "library_loaders/libpci.h" 19 #include "library_loaders/libpci.h"
21 #include "third_party/libXNVCtrl/NVCtrl.h"
22 #include "third_party/libXNVCtrl/NVCtrlLib.h"
23 #include "ui/gl/gl_bindings.h" 20 #include "ui/gl/gl_bindings.h"
24 #include "ui/gl/gl_context.h" 21 #include "ui/gl/gl_context.h"
25 #include "ui/gl/gl_implementation.h" 22 #include "ui/gl/gl_implementation.h"
26 #include "ui/gl/gl_surface.h" 23 #include "ui/gl/gl_surface.h"
27 #include "ui/gl/gl_switches.h" 24 #include "ui/gl/gl_switches.h"
28 25
29 namespace gpu { 26 namespace gpu {
30 27
31 namespace { 28 namespace {
32 29
(...skipping 27 matching lines...) Expand all
60 if (end == std::string::npos) 57 if (end == std::string::npos)
61 return line.substr(begin); 58 return line.substr(begin);
62 else 59 else
63 return line.substr(begin, end - begin); 60 return line.substr(begin, end - begin);
64 } 61 }
65 } 62 }
66 } 63 }
67 return std::string(); 64 return std::string();
68 } 65 }
69 66
70 // Use NVCtrl extention to query NV driver version. 67 // XXX
71 // Return empty string on failing.
72 std::string CollectDriverVersionNVidia() { 68 std::string CollectDriverVersionNVidia() {
73 Display* display = base::MessagePumpForUI::GetDefaultXDisplay();
74 if (!display) {
75 LOG(ERROR) << "XOpenDisplay failed.";
76 return std::string(); 69 return std::string();
77 }
78 int event_base = 0, error_base = 0;
79 if (!XNVCTRLQueryExtension(display, &event_base, &error_base)) {
80 LOG(INFO) << "NVCtrl extension does not exist.";
81 return std::string();
82 }
83 int screen_count = ScreenCount(display);
84 for (int screen = 0; screen < screen_count; ++screen) {
85 char* buffer = NULL;
86 if (XNVCTRLIsNvScreen(display, screen) &&
87 XNVCTRLQueryStringAttribute(display, screen, 0,
88 NV_CTRL_STRING_NVIDIA_DRIVER_VERSION,
89 &buffer)) {
90 std::string driver_version(buffer);
91 XFree(buffer);
92 return driver_version;
93 }
94 }
95 return std::string();
96 } 70 }
97 71
98 const uint32 kVendorIDIntel = 0x8086; 72 const uint32 kVendorIDIntel = 0x8086;
99 const uint32 kVendorIDNVidia = 0x10de; 73 const uint32 kVendorIDNVidia = 0x10de;
100 const uint32 kVendorIDAMD = 0x1002; 74 const uint32 kVendorIDAMD = 0x1002;
101 75
102 bool CollectPCIVideoCardInfo(GPUInfo* gpu_info) { 76 bool CollectPCIVideoCardInfo(GPUInfo* gpu_info) {
103 DCHECK(gpu_info); 77 DCHECK(gpu_info);
104 78
105 if (IsPciSupported() == false) { 79 if (IsPciSupported() == false) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 gpu_info->driver_version = driver_version; 239 gpu_info->driver_version = driver_version;
266 return true; 240 return true;
267 } 241 }
268 242
269 void MergeGPUInfo(GPUInfo* basic_gpu_info, 243 void MergeGPUInfo(GPUInfo* basic_gpu_info,
270 const GPUInfo& context_gpu_info) { 244 const GPUInfo& context_gpu_info) {
271 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); 245 MergeGPUInfoGL(basic_gpu_info, context_gpu_info);
272 } 246 }
273 247
274 } // namespace gpu 248 } // namespace gpu
OLDNEW
« no previous file with comments | « content/content_browser.gypi ('k') | gpu/gpu_config.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698