summaryrefslogtreecommitdiffstats
path: root/pts-core/functions/pts-init.php
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-10-18 07:34:05 -0400
committerMichael Larabel <michael@phx-laptop.(none)>2008-10-18 07:34:05 -0400
commite6f3af4323ac02ae6d107b0ac15f0c50b748c8f8 (patch)
treed3049b32d1894cc35ed0ebdf957b05c151b7de5e /pts-core/functions/pts-init.php
parent6da1484765fc24879965b5cfacf2e9708d12e8d4 (diff)
downloadphoronix-test-suite-upstream-e6f3af4323ac02ae6d107b0ac15f0c50b748c8f8.tar.gz
phoronix-test-suite-upstream-e6f3af4323ac02ae6d107b0ac15f0c50b748c8f8.tar.xz
phoronix-test-suite-upstream-e6f3af4323ac02ae6d107b0ac15f0c50b748c8f8.zip
pts-core: Clean-up IS_*_GRAPHICS define setup
Diffstat (limited to 'pts-core/functions/pts-init.php')
-rw-r--r--pts-core/functions/pts-init.php56
1 files changed, 26 insertions, 30 deletions
diff --git a/pts-core/functions/pts-init.php b/pts-core/functions/pts-init.php
index 8cd68e7..88e9026 100644
--- a/pts-core/functions/pts-init.php
+++ b/pts-core/functions/pts-init.php
@@ -155,42 +155,38 @@ function pts_extended_init()
}
// OpenGL / graphics detection
+ $graphics_detection = array("NVIDIA", array("ATI", "fglrx"), "Mesa");
$opengl_driver = opengl_version();
+ $found_gpu_match = false;
- if(strpos($opengl_driver, "NVIDIA") !== false)
+ foreach($graphics_detection as $gpu_check)
{
- define("IS_NVIDIA_GRAPHICS", true);
- }
- else if(strpos($opengl_driver, "fglrx") !== false)
- {
- define("IS_ATI_GRAPHICS", true);
- }
- else if(strpos($opengl_driver, "Mesa") !== false)
- {
- define("IS_MESA_GRAPHICS", true);
- }
- else
- {
- define("IS_UNKNOWN_GRAPHICS", true);
- }
+ if(!is_array($gpu_check))
+ {
+ $gpu_check = array($gpu_check);
+ }
- if(!defined("IS_NVIDIA_GRAPHICS"))
- {
- define("IS_NVIDIA_GRAPHICS", false);
- }
- if(!defined("IS_ATI_GRAPHICS"))
- {
- define("IS_ATI_GRAPHICS", false);
- }
- if(!defined("IS_MESA_GRAPHICS"))
- {
- define("IS_MESA_GRAPHICS", false);
- }
- if(!defined("IS_UNKNOWN_GRAPHICS"))
- {
- define("IS_UNKNOWN_GRAPHICS", false);
+ $is_this = false;
+ $gpu_title = $gpu_check[0];
+
+ for($i = 0; $i < count($gpu_check) && !$is_this; $i++)
+ {
+ if(stripos($opengl_driver, $gpu_check[$i]) !== false) // Check for GPU
+ {
+ define("IS_" . strtoupper($gpu_title) . "_GRAPHICS", true);
+ $is_this = true;
+ $found_gpu_match = true;
+ }
+ }
+
+ if(!$is_this)
+ {
+ define("IS_" . strtoupper($gpu_title) . "_GRAPHICS", false);
+ }
}
+ define("IS_UNKNOWN_GRAPHICS", ($found_gpu_match == false));
+
// Check for batch mode
if(getenv("PTS_BATCH_MODE") != false)
{