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; }
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; } } } } } }
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 gpu_aa_level() { // Determine AA level if over-rode $aa_level = false; if (phodevi::is_nvidia_graphics()) { $nvidia_fsaa = phodevi_parser::read_nvidia_extension('FSAA'); switch ($nvidia_fsaa) { case 1: $aa_level = '2x Bilinear'; break; case 5: $aa_level = '4x Bilinear'; break; case 7: $aa_level = '8x'; break; case 8: $aa_level = '16x'; break; case 10: $aa_level = '8xQ'; break; case 12: $aa_level = '16xQ'; break; } } else { if (phodevi::is_ati_graphics() && phodevi::is_linux()) { $ati_fsaa = phodevi_linux_parser::read_amd_pcsdb('OpenGL,AntiAliasSamples'); $ati_fsaa_filter = phodevi_linux_parser::read_amd_pcsdb('OpenGL,AAF'); if (!empty($ati_fsaa)) { if ($ati_fsaa_filter == '0x00000000') { // Filter: Box switch ($ati_fsaa) { case '0x00000002': $aa_level = '2x Box'; break; case '0x00000004': $aa_level = '4x Box'; break; case '0x00000008': $aa_level = '8x Box'; break; } } else { if ($ati_fsaa_filter == '0x00000001') { // Filter: Narrow-tent switch ($ati_fsaa) { case '0x00000002': $aa_level = '4x Narrow-tent'; break; case '0x00000004': $aa_level = '8x Narrow-tent'; break; case '0x00000008': $aa_level = '12x Narrow-tent'; break; } } else { if ($ati_fsaa_filter == '0x00000002') { // Filter: Wide-tent switch ($ati_fsaa) { case '0x00000002': $aa_level = '6x Wide-tent'; break; case '0x00000004': $aa_level = '8x Wide-tent'; break; case '0x00000008': $aa_level = '16x Wide-tent'; break; } } else { if ($ati_fsaa_filter == '0x00000003') { // Filter: Edge-detect switch ($ati_fsaa) { case '0x00000004': $aa_level = '12x Edge-detect'; break; case '0x00000008': $aa_level = '24x Edge-detect'; break; } } } } } } } else { if (phodevi::is_mesa_graphics()) { $gallium_msaa = getenv('GALLIUM_MSAA'); if (is_numeric($gallium_msaa) && $gallium_msaa > 0) { // Simple test to try to figure out if the GALLIUM_MSAA anti-aliasing value was forced $aa_level = $gallium_msaa . 'x MSAA'; } } else { if (getenv('__GL_FSAA_MODE')) { $gl_msaa = getenv('__GL_FSAA_MODE'); if (is_numeric($gl_msaa) && $gl_msaa > 0) { $aa_level = '__GL_FSAA_MODE=' . $gallium_msaa; } } } } } return $aa_level; }