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

Unified Diff: gpu/config/gpu_info_collector_linux.cc

Issue 2263743002: Add logic to detect AMD linux driver version for both Brahma/Catalyst drivers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/config/gpu_info_collector_linux.cc
diff --git a/gpu/config/gpu_info_collector_linux.cc b/gpu/config/gpu_info_collector_linux.cc
index 1f380474f792e134d7f7589418e34ebc9a65e220..7737137b9c2ac8187cd45bb428ab4c193e592277 100644
--- a/gpu/config/gpu_info_collector_linux.cc
+++ b/gpu/config/gpu_info_collector_linux.cc
@@ -46,12 +46,30 @@ bool IsPciSupported() {
}
#endif // defined(USE_LIBPCI)
+// Scan /sys/module/amdgpu/version.
+// Return empty string on failing.
+std::string CollectDriverVersionAMDBrahma() {
+ const base::FilePath ati_file_path("/sys/module/amdgpu/version");
+ if (!base::PathExists(ati_file_path))
+ return std::string();
+ std::string contents;
+ if (!base::ReadFileToString(ati_file_path, &contents))
+ return std::string();
+ size_t begin = contents.find_first_of("0123456789");
+ if (begin != std::string::npos) {
+ size_t end = contents.find_first_not_of("0123456789.", begin);
+ if (end == std::string::npos)
+ return contents.substr(begin);
+ else
+ return contents.substr(begin, end - begin);
+ }
+ return std::string();
+}
+
// Scan /etc/ati/amdpcsdb.default for "ReleaseVersion".
// Return empty string on failing.
-std::string CollectDriverVersionATI() {
- const base::FilePath::CharType kATIFileName[] =
- FILE_PATH_LITERAL("/etc/ati/amdpcsdb.default");
- base::FilePath ati_file_path(kATIFileName);
+std::string CollectDriverVersionAMDCatalyst() {
+ const base::FilePath ati_file_path("/etc/ati/amdpcsdb.default");
if (!base::PathExists(ati_file_path))
return std::string();
std::string contents;
@@ -209,10 +227,16 @@ CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info) {
std::string driver_version;
switch (gpu_info->gpu.vendor_id) {
case kVendorIDAMD:
- driver_version = CollectDriverVersionATI();
+ driver_version = CollectDriverVersionAMDBrahma();
if (!driver_version.empty()) {
- gpu_info->driver_vendor = "ATI / AMD";
+ gpu_info->driver_vendor = "ATI / AMD (Brahma)";
gpu_info->driver_version = driver_version;
+ } else {
+ driver_version = CollectDriverVersionAMDCatalyst();
+ if (!driver_version.empty()) {
+ gpu_info->driver_vendor = "ATI / AMD (Catalyst)";
+ gpu_info->driver_version = driver_version;
+ }
}
break;
case kVendorIDNVidia:
« 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