本文整理汇总了PHP中phodevi::is_nvidia_graphics方法的典型用法代码示例。如果您正苦于以下问题:PHP phodevi::is_nvidia_graphics方法的具体用法?PHP phodevi::is_nvidia_graphics怎么用?PHP phodevi::is_nvidia_graphics使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phodevi
的用法示例。
在下文中一共展示了phodevi::is_nvidia_graphics方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: read_sensor
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;
}
示例2: read_sensor
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;
}
示例3: set_probe_mode
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;
}
}
}
}
}
}
示例4: support_check
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;
}
示例5: sw_display_driver
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
//.........这里部分代码省略.........
示例6: __post_option_process
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');
}
}
示例7: read_sensor
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;
}
}
}
}
}
}
}
}
}
//.........这里部分代码省略.........
示例8: monitor_count
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;
}
示例9: gpu_model
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 {
//.........这里部分代码省略.........
示例10: __post_option_process
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);
}
}
}
}