tools/power/turbostat: Relocate graphics probing code

Introduce probe_graphics(), and move all graphics probing related code
into it.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Reviewed-by: Len Brown <len.brown@intel.com>
This commit is contained in:
Zhang Rui 2023-08-31 16:01:12 +08:00
parent 6cb13609a0
commit 2538d1673d

View File

@ -4424,6 +4424,20 @@ static void probe_intel_uncore_frequency(void)
}
}
static void probe_graphics(void)
{
if (!access("/sys/class/drm/card0/power/rc6_residency_ms", R_OK))
BIC_PRESENT(BIC_GFX_rc6);
if (!access("/sys/class/drm/card0/gt_cur_freq_mhz", R_OK) ||
!access("/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz", R_OK))
BIC_PRESENT(BIC_GFXMHz);
if (!access("/sys/class/drm/card0/gt_act_freq_mhz", R_OK) ||
!access("/sys/class/graphics/fb0/device/drm/card0/gt_act_freq_mhz", R_OK))
BIC_PRESENT(BIC_GFXACTMHz);
}
static void dump_sysfs_cstate_config(void)
{
char path[64];
@ -5558,22 +5572,13 @@ void process_cpuid()
probe_intel_uncore_frequency();
probe_graphics();
probe_rapl();
if (platform->has_nhm_msrs)
BIC_PRESENT(BIC_SMI);
if (!access("/sys/class/drm/card0/power/rc6_residency_ms", R_OK))
BIC_PRESENT(BIC_GFX_rc6);
if (!access("/sys/class/drm/card0/gt_cur_freq_mhz", R_OK) ||
!access("/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz", R_OK))
BIC_PRESENT(BIC_GFXMHz);
if (!access("/sys/class/drm/card0/gt_act_freq_mhz", R_OK) ||
!access("/sys/class/graphics/fb0/device/drm/card0/gt_act_freq_mhz", R_OK))
BIC_PRESENT(BIC_GFXACTMHz);
if (!access("/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us", R_OK))
BIC_PRESENT(BIC_CPU_LPI);
else