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

Side by Side Diff: content/gpu/gpu_info_collector_linux.cc

Issue 6713014: Change LOG to VLOG to avoid a lot of messages in the bots output. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 9 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 | « no previous file | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "app/gfx/gl/gl_bindings.h" 10 #include "app/gfx/gl/gl_bindings.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 return (file_util::PathExists(pci_path) || 86 return (file_util::PathExists(pci_path) ||
87 file_util::PathExists(pcie_path)); 87 file_util::PathExists(pcie_path));
88 } 88 }
89 89
90 // This dynamically opens libpci and get function pointers we need. Return 90 // This dynamically opens libpci and get function pointers we need. Return
91 // NULL if library fails to open or any functions can not be located. 91 // NULL if library fails to open or any functions can not be located.
92 // Returned interface (if not NULL) should be deleted in FinalizeLibPci. 92 // Returned interface (if not NULL) should be deleted in FinalizeLibPci.
93 PciInterface* InitializeLibPci(const char* lib_name) { 93 PciInterface* InitializeLibPci(const char* lib_name) {
94 void* handle = dlopen(lib_name, RTLD_LAZY); 94 void* handle = dlopen(lib_name, RTLD_LAZY);
95 if (handle == NULL) { 95 if (handle == NULL) {
96 LOG(INFO) << "Failed to dlopen " << lib_name; 96 VLOG(1) << "Failed to dlopen " << lib_name;
97 return NULL; 97 return NULL;
98 } 98 }
99 PciInterface* interface = new struct PciInterface; 99 PciInterface* interface = new struct PciInterface;
100 interface->lib_handle = handle; 100 interface->lib_handle = handle;
101 interface->pci_alloc = reinterpret_cast<FT_pci_alloc>( 101 interface->pci_alloc = reinterpret_cast<FT_pci_alloc>(
102 dlsym(handle, "pci_alloc")); 102 dlsym(handle, "pci_alloc"));
103 interface->pci_init = reinterpret_cast<FT_pci_init>( 103 interface->pci_init = reinterpret_cast<FT_pci_init>(
104 dlsym(handle, "pci_init")); 104 dlsym(handle, "pci_init"));
105 interface->pci_cleanup = reinterpret_cast<FT_pci_cleanup>( 105 interface->pci_cleanup = reinterpret_cast<FT_pci_cleanup>(
106 dlsym(handle, "pci_cleanup")); 106 dlsym(handle, "pci_cleanup"));
107 interface->pci_scan_bus = reinterpret_cast<FT_pci_scan_bus>( 107 interface->pci_scan_bus = reinterpret_cast<FT_pci_scan_bus>(
108 dlsym(handle, "pci_scan_bus")); 108 dlsym(handle, "pci_scan_bus"));
109 interface->pci_fill_info = reinterpret_cast<FT_pci_fill_info>( 109 interface->pci_fill_info = reinterpret_cast<FT_pci_fill_info>(
110 dlsym(handle, "pci_fill_info")); 110 dlsym(handle, "pci_fill_info"));
111 interface->pci_lookup_name = reinterpret_cast<FT_pci_lookup_name>( 111 interface->pci_lookup_name = reinterpret_cast<FT_pci_lookup_name>(
112 dlsym(handle, "pci_lookup_name")); 112 dlsym(handle, "pci_lookup_name"));
113 if (interface->pci_alloc == NULL || 113 if (interface->pci_alloc == NULL ||
114 interface->pci_init == NULL || 114 interface->pci_init == NULL ||
115 interface->pci_cleanup == NULL || 115 interface->pci_cleanup == NULL ||
116 interface->pci_scan_bus == NULL || 116 interface->pci_scan_bus == NULL ||
117 interface->pci_fill_info == NULL || 117 interface->pci_fill_info == NULL ||
118 interface->pci_lookup_name == NULL) { 118 interface->pci_lookup_name == NULL) {
119 LOG(ERROR) << "Missing required function(s) from " << lib_name; 119 VLOG(1) << "Missing required function(s) from " << lib_name;
120 dlclose(handle); 120 dlclose(handle);
121 delete interface; 121 delete interface;
122 return NULL; 122 return NULL;
123 } 123 }
124 return interface; 124 return interface;
125 } 125 }
126 126
127 // This close the dynamically opened libpci and delete the interface. 127 // This close the dynamically opened libpci and delete the interface.
128 void FinalizeLibPci(PciInterface** interface) { 128 void FinalizeLibPci(PciInterface** interface) {
129 DCHECK(interface && *interface && (*interface)->lib_handle); 129 DCHECK(interface && *interface && (*interface)->lib_handle);
(...skipping 27 matching lines...) Expand all
157 // TODO(zmo): if vendor is ATI, consider passing /etc/ati/amdpcsdb.default 157 // TODO(zmo): if vendor is ATI, consider passing /etc/ati/amdpcsdb.default
158 // for driver information. 158 // for driver information.
159 159
160 return rt; 160 return rt;
161 } 161 }
162 162
163 bool CollectVideoCardInfo(GPUInfo* gpu_info) { 163 bool CollectVideoCardInfo(GPUInfo* gpu_info) {
164 DCHECK(gpu_info); 164 DCHECK(gpu_info);
165 165
166 if (IsPciSupported() == false) { 166 if (IsPciSupported() == false) {
167 LOG(INFO) << "PCI bus scanning is not supported"; 167 VLOG(1) << "PCI bus scanning is not supported";
168 return false; 168 return false;
169 } 169 }
170 170
171 // TODO(zmo): be more flexible about library name. 171 // TODO(zmo): be more flexible about library name.
172 PciInterface* interface = InitializeLibPci("libpci.so.3"); 172 PciInterface* interface = InitializeLibPci("libpci.so.3");
173 if (interface == NULL) 173 if (interface == NULL)
174 interface = InitializeLibPci("libpci.so"); 174 interface = InitializeLibPci("libpci.so");
175 if (interface == NULL) { 175 if (interface == NULL) {
176 LOG(ERROR) << "Failed to locate libpci"; 176 VLOG(1) << "Failed to locate libpci";
177 return false; 177 return false;
178 } 178 }
179 179
180 PciAccess* access = (interface->pci_alloc)(); 180 PciAccess* access = (interface->pci_alloc)();
181 DCHECK(access != NULL); 181 DCHECK(access != NULL);
182 (interface->pci_init)(access); 182 (interface->pci_init)(access);
183 (interface->pci_scan_bus)(access); 183 (interface->pci_scan_bus)(access);
184 std::vector<PciDevice*> gpu_list; 184 std::vector<PciDevice*> gpu_list;
185 PciDevice* gpu_active = NULL; 185 PciDevice* gpu_active = NULL;
186 for (PciDevice* device = access->device_list; 186 for (PciDevice* device = access->device_list;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 return false; 268 return false;
269 if (pos != std::string::npos) 269 if (pos != std::string::npos)
270 driver_version = driver_version.substr(0, pos); 270 driver_version = driver_version.substr(0, pos);
271 271
272 gpu_info->driver_vendor = pieces[1]; 272 gpu_info->driver_vendor = pieces[1];
273 gpu_info->driver_version = driver_version; 273 gpu_info->driver_version = driver_version;
274 return true; 274 return true;
275 } 275 }
276 276
277 } // namespace gpu_info_collector 277 } // namespace gpu_info_collector
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698