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" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 namespace gpu { | 29 namespace gpu { |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
33 // This checks if a system supports PCI bus. | 33 // This checks if a system supports PCI bus. |
34 // We check the existence of /sys/bus/pci or /sys/bug/pci_express. | 34 // We check the existence of /sys/bus/pci or /sys/bug/pci_express. |
35 bool IsPciSupported() { | 35 bool IsPciSupported() { |
36 const base::FilePath pci_path("/sys/bus/pci/"); | 36 const base::FilePath pci_path("/sys/bus/pci/"); |
37 const base::FilePath pcie_path("/sys/bus/pci_express/"); | 37 const base::FilePath pcie_path("/sys/bus/pci_express/"); |
38 return (file_util::PathExists(pci_path) || | 38 return (base::PathExists(pci_path) || |
39 file_util::PathExists(pcie_path)); | 39 base::PathExists(pcie_path)); |
40 } | 40 } |
41 | 41 |
42 // Scan /etc/ati/amdpcsdb.default for "ReleaseVersion". | 42 // Scan /etc/ati/amdpcsdb.default for "ReleaseVersion". |
43 // Return empty string on failing. | 43 // Return empty string on failing. |
44 std::string CollectDriverVersionATI() { | 44 std::string CollectDriverVersionATI() { |
45 const base::FilePath::CharType kATIFileName[] = | 45 const base::FilePath::CharType kATIFileName[] = |
46 FILE_PATH_LITERAL("/etc/ati/amdpcsdb.default"); | 46 FILE_PATH_LITERAL("/etc/ati/amdpcsdb.default"); |
47 base::FilePath ati_file_path(kATIFileName); | 47 base::FilePath ati_file_path(kATIFileName); |
48 if (!file_util::PathExists(ati_file_path)) | 48 if (!base::PathExists(ati_file_path)) |
49 return std::string(); | 49 return std::string(); |
50 std::string contents; | 50 std::string contents; |
51 if (!file_util::ReadFileToString(ati_file_path, &contents)) | 51 if (!file_util::ReadFileToString(ati_file_path, &contents)) |
52 return std::string(); | 52 return std::string(); |
53 base::StringTokenizer t(contents, "\r\n"); | 53 base::StringTokenizer t(contents, "\r\n"); |
54 while (t.GetNext()) { | 54 while (t.GetNext()) { |
55 std::string line = t.token(); | 55 std::string line = t.token(); |
56 if (StartsWithASCII(line, "ReleaseVersion=", true)) { | 56 if (StartsWithASCII(line, "ReleaseVersion=", true)) { |
57 size_t begin = line.find_first_of("0123456789"); | 57 size_t begin = line.find_first_of("0123456789"); |
58 if (begin != std::string::npos) { | 58 if (begin != std::string::npos) { |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 gpu_info->driver_version = driver_version; | 265 gpu_info->driver_version = driver_version; |
266 return true; | 266 return true; |
267 } | 267 } |
268 | 268 |
269 void MergeGPUInfo(GPUInfo* basic_gpu_info, | 269 void MergeGPUInfo(GPUInfo* basic_gpu_info, |
270 const GPUInfo& context_gpu_info) { | 270 const GPUInfo& context_gpu_info) { |
271 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 271 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
272 } | 272 } |
273 | 273 |
274 } // namespace gpu | 274 } // namespace gpu |
OLD | NEW |