Ejemplo n.º 1
0
 public function read_sensor()
 {
     // Report graphics processor fan speed as a percent
     $fan_speed = -1;
     if (phodevi::is_nvidia_graphics()) {
         // NVIDIA fan speed reading support in NVIDIA 190.xx and newer
         // TODO: support for multiple fans, also for reading GPUFanTarget to get appropriate fan
         // nvidia-settings --describe GPUFanTarget
         $fan_speed = phodevi_parser::read_nvidia_extension('[fan:0]/GPUCurrentFanSpeed');
     } else {
         if (phodevi::is_ati_graphics() && phodevi::is_linux()) {
             $fan_speed = phodevi_linux_parser::read_ati_overdrive('FanSpeed');
         }
     }
     return $fan_speed;
 }
Ejemplo n.º 2
0
 public static function read_sensor()
 {
     // Report graphics processor temperature
     $temp_c = -1;
     if (phodevi::is_nvidia_graphics()) {
         $temp_c = phodevi_parser::read_nvidia_extension('GPUCoreTemp');
     } else {
         if (phodevi::is_ati_graphics() && phodevi::is_linux()) {
             $temp_c = phodevi_linux_parser::read_ati_overdrive('Temperature');
         } else {
             foreach (array_merge(array('/sys/class/drm/card0/device/temp1_input'), pts_file_io::glob('/sys/class/drm/card0/device/hwmon/hwmon*/temp1_input')) as $temp_input) {
                 // This works for at least Nouveau driver with Linux 2.6.37 era DRM
                 if (is_readable($temp_input) == false) {
                     continue;
                 }
                 $temp_input = pts_file_io::file_get_contents($temp_input);
                 if (is_numeric($temp_input)) {
                     if ($temp_input > 1000) {
                         $temp_input /= 1000;
                     }
                     $temp_c = $temp_input;
                     break;
                 }
             }
             if ($temp_c == -1 && is_readable('/sys/kernel/debug/dri/0/i915_emon_status')) {
                 // Intel thermal
                 $i915_emon_status = file_get_contents('/sys/kernel/debug/dri/0/i915_emon_status');
                 $temp = strpos($i915_emon_status, 'GMCH temp: ');
                 if ($temp !== false) {
                     $temp = substr($i915_emon_status, $temp + 11);
                     $temp = substr($temp, 0, strpos($temp, PHP_EOL));
                     if (is_numeric($temp) && $temp > 0) {
                         $temp_c = $temp;
                     }
                 }
             }
         }
     }
     if ($temp_c > 1000 || $temp_c < 9) {
         // Invalid data
         return -1;
     }
     return $temp_c;
 }
Ejemplo n.º 3
0
 private function set_probe_mode()
 {
     if (phodevi::is_ati_graphics() && phodevi::is_linux()) {
         $this->probe_ati_overdrive = true;
     } else {
         if (phodevi::is_mesa_graphics() && pts_client::executable_in_path('radeontop')) {
             $this->probe_radeontop = true;
         } else {
             if (phodevi::is_nvidia_graphics()) {
                 $util = $this->read_nvidia_settings_gpu_utilization();
                 if ($util !== false) {
                     $this->probe_nvidia_settings = true;
                 } else {
                     if (pts_client::executable_in_path('nvidia-smi')) {
                         $this->probe_nvidia_smi = true;
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
 public static function support_check()
 {
     if (phodevi::is_ati_graphics() && phodevi::is_linux()) {
         $gpu_usage = self::ati_overdrive_core_usage();
         if (is_numeric($gpu_usage)) {
             self::$probe_ati_overdrive = true;
             return true;
         }
     } else {
         if (phodevi::is_mesa_graphics()) {
             if (pts_client::executable_in_path('radeontop')) {
                 $test = self::radeontop_gpu_usage();
                 if (is_numeric($test) && $test >= 0) {
                     self::$probe_radeontop = true;
                     return true;
                 }
             } else {
                 if (is_readable('/sys/kernel/debug/dri/0/radeon_fence_info')) {
                     $fence_speed = self::radeon_fence_speed();
                     if (is_numeric($fence_speed) && $fence_speed >= 0) {
                         self::$probe_radeon_fences = true;
                         return true;
                     }
                 } else {
                     if (is_readable('/sys/kernel/debug/dri/0/i915_gem_seqno')) {
                         $commands = self::intel_command_speed();
                         if (is_numeric($commands) && $commands > 0) {
                             self::$probe_intel_commands = true;
                             return true;
                         }
                     }
                 }
             }
         } else {
             if (phodevi::is_nvidia_graphics()) {
                 $util = self::read_nvidia_settings_gpu_utilization();
                 if ($util !== false) {
                     self::$probe_nvidia_settings = true;
                     return true;
                 } else {
                     if (pts_client::executable_in_path('nvidia-smi')) {
                         $usage = self::nvidia_core_usage();
                         if (is_numeric($usage) && $usage >= 0 && $usage <= 100) {
                             self::$probe_nvidia_smi = true;
                             return true;
                         }
                     }
                 }
             }
         }
     }
     return false;
 }
 public static function sw_display_driver($with_version = true)
 {
     if (phodevi::is_windows()) {
         return null;
     }
     $display_driver = phodevi::read_property('system', 'dri-display-driver');
     if (empty($display_driver)) {
         if (phodevi::is_ati_graphics() && phodevi::is_linux()) {
             $display_driver = 'fglrx';
         } else {
             if (phodevi::is_nvidia_graphics() || is_file('/proc/driver/nvidia/version')) {
                 $display_driver = 'nvidia';
             } else {
                 if ((phodevi::is_mesa_graphics() || phodevi::is_bsd()) && stripos(phodevi::read_property('gpu', 'model'), 'NVIDIA') !== false) {
                     if (is_file('/sys/class/drm/version')) {
                         // If there's DRM loaded and NVIDIA, it should be Nouveau
                         $display_driver = 'nouveau';
                     } else {
                         // The dead xf86-video-nv doesn't use any DRM
                         $display_driver = 'nv';
                     }
                 } else {
                     // Fallback to hopefully detect the module, takes the first word off the GPU string and sees if it is the module
                     // This works in at least the case of the Cirrus driver
                     $display_driver = strtolower(pts_strings::first_in_string(phodevi::read_property('gpu', 'model')));
                 }
             }
         }
     }
     if (!empty($display_driver)) {
         $driver_version = phodevi_parser::read_xorg_module_version($display_driver . '_drv');
         if ($driver_version == false || $driver_version == '1.0.0') {
             switch ($display_driver) {
                 case 'amd':
                     // See if it's radeon driver
                     $driver_version = phodevi_parser::read_xorg_module_version('radeon_drv');
                     if ($driver_version != false) {
                         $display_driver = 'radeon';
                     }
                     break;
                 case 'vmwgfx':
                     // See if it's VMware driver
                     $driver_version = phodevi_parser::read_xorg_module_version('vmware_drv');
                     if ($driver_version != false) {
                         $display_driver = 'vmware';
                     }
                     break;
                 case 'radeon':
                     // RadeonHD driver also reports DRI driver as 'radeon', so try reading that instead
                     $driver_version = phodevi_parser::read_xorg_module_version('radeonhd_drv');
                     if ($driver_version != false) {
                         $display_driver = 'radeonhd';
                     }
                     break;
                 case 'nvidia':
                 case 'NVIDIA':
                 case 'nouveau':
                     // NVIDIA's binary driver usually ends up reporting 1.0.0
                     if ($nvs_value = phodevi_parser::read_nvidia_extension('NvidiaDriverVersion')) {
                         $display_driver = 'NVIDIA';
                         $driver_version = $nvs_value;
                     } else {
                         // NVIDIA's binary driver appends their driver version on the end of the OpenGL version string
                         $glxinfo = phodevi_parser::software_glxinfo_version();
                         if (($pos = strpos($glxinfo, 'NVIDIA ')) != false) {
                             $display_driver = 'NVIDIA';
                             $driver_version = substr($glxinfo, $pos + 7);
                         }
                     }
                     break;
                 default:
                     if (is_readable('/sys/class/graphics/fb0/name')) {
                         // This path works for at least finding NVIDIA Tegra 2 DDX (via tegra_fb)
                         $display_driver = file_get_contents('/sys/class/graphics/fb0/name');
                         $display_driver = str_replace(array('drm', '_fb'), null, $display_driver);
                         $driver_version = phodevi_parser::read_xorg_module_version($display_driver . '_drv');
                     }
                     break;
             }
         }
         if ($driver_version == false) {
             // If the version is empty, chances are the DDX driver string is incorrect
             $display_driver = null;
             // See if the VESA or fbdev driver is in use
             foreach (array('modesetting', 'fbdev', 'vesa') as $drv) {
                 $drv_version = phodevi_parser::read_xorg_module_version($drv . '_drv');
                 if ($drv_version) {
                     $display_driver = $drv;
                     $driver_version = $drv_version;
                     break;
                 }
             }
         }
         if (!empty($driver_version) && $with_version && $driver_version != '0.0.0') {
             $display_driver .= ' ' . $driver_version;
             // XXX: The below check is disabled since the Catalyst Version no longer seems reliably reported (circa Catalyst 13.x)
             if (false && phodevi::is_ati_graphics() && strpos($display_driver, 'fglrx') !== false) {
                 $catalyst_version = phodevi_linux_parser::read_amd_pcsdb('AMDPCSROOT/SYSTEM/LDC,Catalyst_Version');
                 if ($catalyst_version != null && $catalyst_version > 10.1 && $catalyst_version != 10.5 && $catalyst_version != 11.8) {
                     // This option was introduced around Catalyst 10.5 but seems to not be updated properly until Catalyst 10.11/10.12
                     $display_driver .= ' Catalyst ' . $catalyst_version . '';
                 }
             }
         }
     }
     return $display_driver;
 }
 public static function __post_option_process()
 {
     if (self::$error_count > 0) {
         $error_breakdown = PHP_EOL;
         foreach (self::$error_analysis as $test => $error_count) {
             $error_breakdown .= PHP_EOL . $test . ': ' . $error_count;
         }
         echo PHP_EOL . 'GPU Errors: ' . $error_count . $error_breakdown . PHP_EOL;
     }
     if (self::$driver_forced_vsync && phodevi::is_nvidia_graphics()) {
         shell_exec('nvidia-settings -a SyncToVBlank=1 2>&1');
     }
 }
Ejemplo n.º 7
0
 public function read_sensor()
 {
     // Graphics processor real/current frequency
     $show_memory = false;
     $core_freq = 0;
     $mem_freq = 0;
     if (phodevi::is_nvidia_graphics()) {
         $nv_freq = phodevi_parser::read_nvidia_extension('GPUCurrentClockFreqs');
         $nv_freq = pts_strings::comma_explode($nv_freq);
         $core_freq = isset($nv_freq[0]) ? $nv_freq[0] : 0;
         $mem_freq = isset($nv_freq[1]) ? $nv_freq[1] : 0;
     } else {
         if (phodevi::is_ati_graphics() && phodevi::is_linux()) {
             $od_clocks = phodevi_linux_parser::read_ati_overdrive('CurrentClocks');
             if (is_array($od_clocks) && count($od_clocks) >= 2) {
                 $core_freq = array_shift($od_clocks);
                 $mem_freq = array_pop($od_clocks);
             }
         } else {
             if (phodevi::is_linux()) {
                 if (isset(phodevi::$vfs->radeon_pm_info)) {
                     // radeon_pm_info should be present with Linux 2.6.34+
                     foreach (pts_strings::trim_explode("\n", phodevi::$vfs->radeon_pm_info) as $pm_line) {
                         $pm_line = pts_strings::colon_explode($pm_line);
                         if (isset($pm_line[1])) {
                             list($descriptor, $value) = $pm_line;
                         } else {
                             continue;
                         }
                         switch ($descriptor) {
                             case 'current engine clock':
                                 $core_freq = pts_arrays::first_element(explode(' ', $value)) / 1000;
                                 break;
                             case 'current memory clock':
                                 $mem_freq = pts_arrays::first_element(explode(' ', $value)) / 1000;
                                 break;
                         }
                     }
                     if ($core_freq == null && ($x = strpos(phodevi::$vfs->radeon_pm_info, 'sclk: '))) {
                         $x = substr(phodevi::$vfs->radeon_pm_info, $x + strlen('sclk: '));
                         $x = substr($x, 0, strpos($x, ' '));
                         if (is_numeric($x)) {
                             if ($x > 1000) {
                                 $x = $x / 100;
                             }
                             $core_freq = $x;
                         }
                     }
                     if ($mem_freq == null && ($x = strpos(phodevi::$vfs->radeon_pm_info, 'mclk: '))) {
                         $x = substr(phodevi::$vfs->radeon_pm_info, $x + strlen('mclk: '));
                         $x = substr($x, 0, strpos($x, ' '));
                         if (is_numeric($x)) {
                             if ($x > 1000) {
                                 $x = $x / 100;
                             }
                             $mem_freq = $x;
                         }
                     }
                 } else {
                     if (is_file('/sys/class/drm/card0/gt_cur_freq_mhz')) {
                         $gt_cur_freq_mhz = pts_file_io::file_get_contents('/sys/class/drm/card0/gt_cur_freq_mhz');
                         if ($gt_cur_freq_mhz > 2) {
                             $core_freq = $gt_cur_freq_mhz;
                         }
                     } else {
                         if (is_file('/sys/class/drm/card0/device/performance_level')) {
                             $performance_level = pts_file_io::file_get_contents('/sys/class/drm/card0/device/performance_level');
                             $performance_level = explode(' ', $performance_level);
                             $core_string = array_search('core', $performance_level);
                             if ($core_string !== false && isset($performance_level[$core_string + 1])) {
                                 $core_string = str_ireplace('MHz', null, $performance_level[$core_string + 1]);
                                 if (is_numeric($core_string) && $core_string > $core_freq) {
                                     $core_freq = $core_string;
                                 }
                             }
                             $mem_string = array_search('memory', $performance_level);
                             if ($mem_string !== false && isset($performance_level[$mem_string + 1])) {
                                 $mem_string = str_ireplace('MHz', null, $performance_level[$mem_string + 1]);
                                 if (is_numeric($mem_string) && $mem_string > $mem_freq) {
                                     $mem_freq = $mem_string;
                                 }
                             }
                         } else {
                             if (isset(phodevi::$vfs->i915_cur_delayinfo)) {
                                 $i915_cur_delayinfo = phodevi::$vfs->i915_cur_delayinfo;
                                 $cagf = strpos($i915_cur_delayinfo, 'CAGF: ');
                                 if ($cagf !== false) {
                                     $cagf_mhz = substr($i915_cur_delayinfo, $cagf + 6);
                                     $cagf_mhz = substr($cagf_mhz, 0, strpos($cagf_mhz, 'MHz'));
                                     if (is_numeric($cagf_mhz)) {
                                         $core_freq = $cagf_mhz;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!is_numeric($core_freq)) {
         $core_freq = 0;
     }
     if (!is_numeric($mem_freq)) {
         $mem_freq = 0;
     }
     if ($core_freq == 0 && $mem_freq == 0) {
         $show_memory = false;
         $core_freq = -1;
     }
     return $show_memory ? array($core_freq, $mem_freq) : $core_freq;
 }
 public static function monitor_count()
 {
     // Report number of connected/enabled monitors
     $monitor_count = 0;
     // First try reading number of monitors from xdpyinfo
     $monitor_count = count(phodevi_parser::read_xdpy_monitor_info());
     if ($monitor_count == 0) {
         // Fallback support for ATI and NVIDIA if phodevi_parser::read_xdpy_monitor_info() fails
         if (phodevi::is_nvidia_graphics()) {
             $enabled_displays = phodevi_parser::read_nvidia_extension('EnabledDisplays');
             switch ($enabled_displays) {
                 case '0x00010000':
                     $monitor_count = 1;
                     break;
                 case '0x00010001':
                     $monitor_count = 2;
                     break;
                 default:
                     $monitor_count = 1;
                     break;
             }
         } else {
             if (phodevi::is_ati_graphics() && phodevi::is_linux()) {
                 $amdpcsdb_enabled_monitors = phodevi_linux_parser::read_amd_pcsdb('SYSTEM/BUSID-*/DDX,EnableMonitor');
                 $amdpcsdb_enabled_monitors = pts_arrays::to_array($amdpcsdb_enabled_monitors);
                 foreach ($amdpcsdb_enabled_monitors as $enabled_monitor) {
                     foreach (pts_strings::comma_explode($enabled_monitor) as $monitor_connection) {
                         $monitor_count++;
                     }
                 }
             } else {
                 $monitor_count = 1;
             }
         }
     }
     return $monitor_count;
 }
Ejemplo n.º 9
0
 public static function gpu_model()
 {
     // Report graphics processor string
     $info = phodevi_parser::read_glx_renderer();
     $video_ram = phodevi::read_property('gpu', 'memory-capacity');
     if (phodevi::is_ati_graphics() && phodevi::is_linux()) {
         $crossfire_status = phodevi_linux_parser::read_amd_pcsdb('SYSTEM/Crossfire/chain/*,Enable');
         $crossfire_status = pts_arrays::to_array($crossfire_status);
         $crossfire_card_count = 0;
         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 = phodevi_linux_parser::read_amd_graphics_adapters();
         if (count($adapters) > 0) {
             $video_ram = $video_ram > 64 ? ' ' . $video_ram . 'MB' : null;
             // assume more than 64MB of vRAM
             if ($crossfire_card_count > 1 && $crossfire_card_count <= count($adapters)) {
                 $unique_adapters = array_unique($adapters);
                 if (count($unique_adapters) == 1) {
                     if (strpos($adapters[0], 'X2') > 0 && $crossfire_card_count > 1) {
                         $crossfire_card_count -= 1;
                     }
                     $info = $crossfire_card_count . ' x ' . $adapters[0] . $video_ram . ' CrossFire';
                 } else {
                     $info = implode(', ', $unique_adapters) . ' CrossFire';
                 }
             } else {
                 $info = $adapters[0] . $video_ram;
             }
         }
     } else {
         if (phodevi::is_macosx()) {
             $system_profiler_info = implode(' + ', phodevi_osx_parser::read_osx_system_profiler('SPDisplaysDataType', 'ChipsetModel', true));
             if (!empty($system_profiler_info)) {
                 $info = $system_profiler_info;
             }
         } else {
             if (phodevi::is_nvidia_graphics()) {
                 if ($info == null) {
                     if (pts_client::executable_in_path('nvidia-settings')) {
                         $nv_gpus = shell_exec('nvidia-settings -q gpus 2>&1');
                         // TODO: search for more than one GPU
                         $nv_gpus = substr($nv_gpus, strpos($nv_gpus, '[0]'));
                         $nv_gpus = substr($nv_gpus, strpos($nv_gpus, '(') + 1);
                         $nv_gpus = substr($nv_gpus, 0, strpos($nv_gpus, ')'));
                         if (stripos($nv_gpus, 'GeForce') !== false || stripos($nv_gpus, 'Quadro') !== false) {
                             $info = $nv_gpus;
                         }
                     }
                 }
                 $sli_mode = phodevi_parser::read_nvidia_extension('SLIMode');
                 if (!empty($sli_mode) && $sli_mode != 'Off') {
                     $info .= ' SLI';
                 }
             } else {
                 if (phodevi::is_solaris()) {
                     if (($cut = strpos($info, 'DRI ')) !== false) {
                         $info = substr($info, $cut + 4);
                     }
                     if (($cut = strpos($info, ' Chipset')) !== false) {
                         $info = substr($info, 0, $cut);
                     }
                     if ($info == false && isset(phodevi::$vfs->xorg_log)) {
                         $xorg_log = phodevi::$vfs->xorg_log;
                         if (($x = strpos($xorg_log, '(0): Chipset: ')) !== false) {
                             $xorg_log = substr($xorg_log, $x + 14);
                             $xorg_log = str_replace(array('(R)', '"'), null, substr($xorg_log, 0, strpos($xorg_log, PHP_EOL)));
                             if (($c = strpos($xorg_log, '[')) || ($c = strpos($xorg_log, '('))) {
                                 $xorg_log = substr($xorg_log, 0, $c);
                             }
                             if (phodevi::is_product_string($xorg_log)) {
                                 $info = $xorg_log;
                             }
                         }
                     }
                 } else {
                     if (phodevi::is_bsd()) {
                         $drm_info = phodevi_bsd_parser::read_sysctl('dev.drm.0.%desc');
                         if (!$drm_info) {
                             $drm_info = phodevi_bsd_parser::read_sysctl('dev.nvidia.0.%desc');
                         }
                         if (!$drm_info) {
                             $agp_info = phodevi_bsd_parser::read_sysctl('dev.agp.0.%desc');
                             if ($agp_info != false) {
                                 $info = $agp_info;
                             }
                         } else {
                             $info = $drm_info;
                         }
                         if ($info == null && isset(phodevi::$vfs->xorg_log)) {
                             $xorg_log = phodevi::$vfs->xorg_log;
                             if (($e = strpos($xorg_log, ' at 01@00:00:0')) !== false) {
                                 $xorg_log = substr($xorg_log, 0, $e);
                                 $info = substr($xorg_log, strrpos($xorg_log, 'Found ') + 6);
                             }
                         }
                     } else {
                         if (phodevi::is_windows()) {
                             $info = phodevi_windows_parser::read_cpuz('Display Adapters', 'Name');
                         }
                     }
                 }
             }
         }
     }
     if (empty($info) || strpos($info, 'Mesa ') !== false || strpos($info, 'Gallium ') !== false) {
         if (phodevi::is_windows() == false) {
             $info_pci = phodevi_linux_parser::read_pci('VGA compatible controller', false);
             if (!empty($info_pci)) {
                 $info = $info_pci;
                 if (strpos($info, 'Intel 2nd Generation Core Family') !== false || strpos($info, 'Gen Core') !== false) {
                     // Try to come up with a better non-generic string
                     $was_reset = false;
                     if (isset(phodevi::$vfs->xorg_log)) {
                         /*
                         $ cat /var/log/Xorg.0.log | grep -i Chipset
                         [     8.421] (II) intel: Driver for Intel Integrated Graphics Chipsets: i810,
                         [     8.421] (II) VESA: driver for VESA chipsets: vesa
                         [     8.423] (II) intel(0): Integrated Graphics Chipset: Intel(R) Sandybridge Mobile (GT2+)
                         [     8.423] (--) intel(0): Chipset: "Sandybridge Mobile (GT2+)"
                         */
                         $xorg_log = phodevi::$vfs->xorg_log;
                         if (($x = strpos($xorg_log, 'Integrated Graphics Chipset: ')) !== false) {
                             $xorg_log = substr($xorg_log, $x + 29);
                             $xorg_log = str_replace(array('(R)', '"'), null, substr($xorg_log, 0, strpos($xorg_log, PHP_EOL)));
                             if (stripos($xorg_log, 'Intel') === false) {
                                 $xorg_log = 'Intel ' . $xorg_log;
                             }
                             // if string is too long, likely not product
                             if (!isset($xorg_log[45])) {
                                 $info = $xorg_log;
                                 $was_reset = true;
                             }
                         } else {
                             if (($x = strpos($xorg_log, '(0): Chipset: ')) !== false) {
                                 $xorg_log = substr($xorg_log, $x + 14);
                                 $xorg_log = str_replace(array('(R)', '"'), null, substr($xorg_log, 0, strpos($xorg_log, PHP_EOL)));
                                 if (stripos($xorg_log, 'Intel') === false) {
                                     $xorg_log = 'Intel ' . $xorg_log;
                                 }
                                 // if string is too long, likely not product
                                 if (!isset($xorg_log[45])) {
                                     $info = $xorg_log;
                                     $was_reset = true;
                                 }
                             }
                         }
                     }
                     if ($was_reset == false && isset(phodevi::$vfs->i915_capabilities)) {
                         $i915_caps = phodevi::$vfs->i915_capabilities;
                         if (($x = strpos($i915_caps, 'gen: ')) !== false) {
                             $gen = substr($i915_caps, $x + 5);
                             $gen = substr($gen, 0, strpos($gen, PHP_EOL));
                             if (is_numeric($gen)) {
                                 $info = 'Intel Gen' . $gen;
                                 if (strpos($i915_caps, 'is_mobile: yes') !== false) {
                                     $info .= ' Mobile';
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if (($start_pos = strpos($info, ' DRI ')) > 0) {
             $info = substr($info, $start_pos + 5);
         }
         if (empty($info) && isset(phodevi::$vfs->xorg_log)) {
             $log_parse = phodevi::$vfs->xorg_log;
             $log_parse = substr($log_parse, strpos($log_parse, 'Chipset') + 8);
             $log_parse = substr($log_parse, 0, strpos($log_parse, 'found'));
             if (strpos($log_parse, '(--)') === false && strlen(str_ireplace(array('ATI', 'NVIDIA', 'VIA', 'Intel'), '', $log_parse)) != strlen($log_parse)) {
                 $info = $log_parse;
             }
         }
         if (empty($info) && is_readable('/sys/class/graphics/fb0/name')) {
             switch (pts_file_io::file_get_contents('/sys/class/graphics/fb0/name')) {
                 case 'omapdrm':
                     $info = 'Texas Instruments OMAP';
                     // The OMAP DRM driver currently is for OMAP2/3/4 hardware
                     break;
                 case 'exynos':
                     $info = 'Samsung EXYNOS';
                     // The Exynos DRM driver
                     break;
                 case 'tegra_fb':
                     $info = 'NVIDIA TEGRA';
                     // The Exynos DRM driver
                     break;
                 default:
                     if (is_file('/dev/mali')) {
                         $info = 'ARM Mali';
                         // One of the ARM Mali models
                     }
                     break;
             }
         }
         if (substr($info, -1) == ')' && ($open_p = strrpos($info, '(')) != false) {
             $end_check = strpos($info, ' ', $open_p);
             $to_check = substr($info, $open_p + 1, $end_check - $open_p - 1);
             // Don't report card revision from PCI info
             if ($to_check == 'rev') {
                 $info = substr($info, 0, $open_p - 1);
             }
         }
     }
     if (($bracket_open = strpos($info, '[')) !== false) {
         // Report only the information inside the brackets if it's more relevant...
         // Mainly with Linux systems where the PCI information is reported like 'nVidia GF104 [GeForce GTX 460]'
         if (($bracket_close = strpos($info, ']', $bracket_open + 1)) !== false) {
             $inside_bracket = substr($info, $bracket_open + 1, $bracket_close - $bracket_open - 1);
             if (stripos($inside_bracket, 'Quadro') !== false || stripos($inside_bracket, 'GeForce') !== false) {
                 $info = $inside_bracket . ' ' . substr($info, $bracket_close + 1);
             } else {
                 if (stripos($inside_bracket, 'Radeon') !== false || stripos($inside_bracket, 'Fire') !== false || stripos($inside_bracket, 'Fusion') !== false) {
                     $info = $inside_bracket . ' ' . substr($info, $bracket_close + 1);
                 }
             }
         }
     }
     if (stripos($info, 'NVIDIA') === false && (stripos($info, 'Quadro') !== false || stripos($info, 'GeForce') !== false)) {
         $info = 'NVIDIA' . ' ' . $info;
     } else {
         if (stripos($info, 'ATI') === false && stripos($info, 'AMD') === false && (stripos($info, 'Radeon') !== false || stripos($info, 'Fire') !== false || stripos($info, 'Fusion') !== false)) {
             // Fire would be for FireGL or FirePro hardware
             $info = 'AMD ' . $info;
         }
     }
     if (phodevi::is_linux() && ($vendor = phodevi_linux_parser::read_pci_subsystem_value('VGA compatible controller')) != null && stripos($info, $vendor) === false && (stripos($info, 'AMD') !== false || stripos($info, 'NVIDIA') !== false)) {
         $info = $vendor . ' ' . $info;
     }
     if ($video_ram > 64 && strpos($info, $video_ram) == false) {
         $info .= ' ' . $video_ram . 'MB';
     }
     $clean_phrases = array('OpenGL Engine');
     $info = str_replace($clean_phrases, null, $info);
     return $info;
 }
 public static function __post_option_process()
 {
     if (phodevi::is_nvidia_graphics()) {
         if (self::$preset_aa !== FALSE) {
             self::set_nvidia_extension("FSAA", self::$preset_aa);
             self::set_nvidia_extension("FSAAAppControlled", self::$preset_aa_control);
         }
         if (self::$preset_af !== FALSE) {
             self::set_nvidia_extension("LogAniso", self::$preset_af);
             self::set_nvidia_extension("LogAnisoAppControlled", self::$preset_af_control);
         }
     } else {
         if (phodevi::is_ati_graphics()) {
             if (self::$preset_aa !== FALSE) {
                 self::set_amd_pcsdb("OpenGL,AntiAliasSamples", self::$preset_aa);
                 self::set_amd_pcsdb("OpenGL,AAF", self::$preset_aa_control);
             }
             if (self::$preset_af !== FALSE) {
                 self::set_amd_pcsdb("OpenGL,AnisoDegree", self::$preset_af);
             }
         }
     }
 }