diff options
author | Michael Larabel <michael@phx-laptop.(none)> | 2008-08-09 17:34:32 -0400 |
---|---|---|
committer | Michael Larabel <michael@phx-laptop.(none)> | 2008-08-09 17:34:32 -0400 |
commit | 8e32927b6bb6f16a8349ead26ca143f999d0ea5f (patch) | |
tree | b916c71847a1ec6bd37b7faaadb84ac52a9508a3 /pts-core/functions | |
parent | deb39910c970f404f1d6b02192bd905fbbe74922 (diff) | |
download | phoronix-test-suite-upstream-8e32927b6bb6f16a8349ead26ca143f999d0ea5f.tar.gz phoronix-test-suite-upstream-8e32927b6bb6f16a8349ead26ca143f999d0ea5f.tar.xz phoronix-test-suite-upstream-8e32927b6bb6f16a8349ead26ca143f999d0ea5f.zip |
pts-core: Add ATI multi-GPU detection support
Diffstat (limited to 'pts-core/functions')
-rw-r--r-- | pts-core/functions/pts-functions_system_graphics.php | 30 | ||||
-rw-r--r-- | pts-core/functions/pts-functions_system_parsing.php | 11 |
2 files changed, 41 insertions, 0 deletions
diff --git a/pts-core/functions/pts-functions_system_graphics.php b/pts-core/functions/pts-functions_system_graphics.php index dddc2f4..51377be 100644 --- a/pts-core/functions/pts-functions_system_graphics.php +++ b/pts-core/functions/pts-functions_system_graphics.php @@ -475,6 +475,36 @@ function graphics_processor_string() else $info = ""; + if(IS_ATI_GRAPHICS) + { + $crossfire_status = amd_pcsdb_parser("SYSTEM/Crossfire/chain/*,Enable"); + $crossfire_card_count = 0; + + if(!is_array($crossfire_status)) + $crossfire_status = array($crossfire_status); + + for($i = 0; $i < count($crossfire_status); $i++) + if($crossfire_status[$i] == "0x00000001") + $crossfire_card_count += 2; // For now assume each chain is 2 cards, but proper way would be NumSlaves + 1 + + $adapters = read_amd_graphics_adapters(); + + if(count($adapters) > 1) + { + if($crossfire_card_count > 1 && $crossfire_card_count <= count($adapters)) + { + $unique_adapters = array_unique($adapters); + + if(count($unique_adapters) == 1) + $info = $crossfire_card_count . " x " . $adapters[0] . " CrossFire"; + else + $info = implode(", ", $unique_adapters) . " CrossFire"; + } + else + $info = $adapters[0]; + } + } + if(empty($info) || strpos($info, "Mesa ") !== FALSE) { $info_pci = read_pci("VGA compatible controller:"); diff --git a/pts-core/functions/pts-functions_system_parsing.php b/pts-core/functions/pts-functions_system_parsing.php index 8902f12..32c85b5 100644 --- a/pts-core/functions/pts-functions_system_parsing.php +++ b/pts-core/functions/pts-functions_system_parsing.php @@ -210,6 +210,17 @@ function read_xdpy_monitor_info() return $monitor_info; } +function read_amd_graphics_adapters() +{ + $info = trim(shell_exec("aticonfig --list-adapters 2>&1")); + $adapters = array(); + + foreach(explode("\n", $info) as $line) + if(($last_point = strrpos($line, ".")) > 0) + array_push($adapters, substr($line, $last_point + 3)); + + return $adapters; +} function read_amd_pcsdb($attribute) { $info = shell_exec("aticonfig --get-pcs-key=" . $attribute . " 2>&1"); |