Show amdgpu voltage from hwmon

Added config parameter 'gpu_voltage'
pull/1077/head
andrefsagh@gmail.com 9 months ago committed by flightlessmango
parent 602ba78ea3
commit 5054f6ceff

@ -364,6 +364,7 @@ Parameters that are enabled by default have to be explicitly disabled. These (cu
| `gpu_load_color` | Set the colors for the gpu load change low,medium and high. e.g `gpu_load_color=0000FF,00FFFF,FF00FF` |
| `gpu_load_value` | Set the values for medium and high load e.g `gpu_load_value=50,90` |
| `gpu_name` | Display GPU name from pci.ids |
| `gpu_voltage` | Display GPU voltage (only works on AMD GPUs) |
| `hide_fsr_sharpness` | Hides the sharpness info for the `fsr` option (only available in gamescope) |
| `histogram` | Change FPS graph to histogram |
| `horizontal` | Display Mangohud in a horizontal position |

@ -87,6 +87,7 @@ gpu_stats
# gpu_load_color=39F900,FDFD09,B22222
## GPU fan in rpm (only works on AMD GPUs)
# gpu_fan
# gpu_voltage (only works on AMD GPUs)
### Display the current CPU information
cpu_stats

@ -182,5 +182,13 @@ void getAmdGpuInfo(){
value = 0;
gpu_info.gtt_used = float(value) / (1024 * 1024 * 1024);
}
if (amdgpu.gpu_voltage_soc) {
rewind(amdgpu.gpu_voltage_soc);
fflush(amdgpu.gpu_voltage_soc);
if (fscanf(amdgpu.gpu_voltage_soc, "%" PRId64, &value) != 1)
value = 0;
gpu_info.voltage = value;
}
#endif
}

@ -20,6 +20,7 @@ struct amdgpu_files
FILE *power_usage;
FILE *gtt_used;
FILE *fan;
FILE *gpu_voltage_soc;
};
extern amdgpu_files amdgpu;
@ -42,6 +43,7 @@ struct gpuInfo{
bool is_other_throttled;
float gtt_used;
int fan_speed;
int voltage;
};
extern struct gpuInfo gpu_info;

@ -261,6 +261,15 @@ void HudElements::gpu_stats(){
HUDElements.TextColored(HUDElements.colors.text, "W");
ImGui::PopFont();
}
if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_gpu_voltage]) {
ImguiNextColumnOrNewRow();
right_aligned_text(text_color, HUDElements.ralign_width, "%i", gpu_info.voltage);
ImGui::SameLine(0, 1.0f);
ImGui::PushFont(HUDElements.sw_stats->font1);
HUDElements.TextColored(HUDElements.colors.text, "mV");
ImGui::PopFont();
}
}
}

@ -886,6 +886,8 @@ void init_gpu_stats(uint32_t& vendorID, uint32_t reported_deviceID, overlay_para
amdgpu.memory_temp = fopen((hwmon_path + dir + "/temp3_input").c_str(), "r");
if (!amdgpu.core_clock)
amdgpu.core_clock = fopen((hwmon_path + dir + "/freq1_input").c_str(), "r");
if (!amdgpu.gpu_voltage_soc)
amdgpu.gpu_voltage_soc = fopen((hwmon_path + dir + "/in0_input").c_str(), "r");
}
if (!metrics_path.empty())

@ -607,6 +607,7 @@ static void set_param_defaults(struct overlay_params *params){
params->enabled[OVERLAY_PARAM_ENABLED_gpu_load_change] = false;
params->enabled[OVERLAY_PARAM_ENABLED_cpu_load_change] = false;
params->enabled[OVERLAY_PARAM_ENABLED_core_load_change] = false;
params->enabled[OVERLAY_PARAM_ENABLED_gpu_voltage] = false;
params->enabled[OVERLAY_PARAM_ENABLED_legacy_layout] = true;
params->enabled[OVERLAY_PARAM_ENABLED_frametime] = true;
params->enabled[OVERLAY_PARAM_ENABLED_fps_only] = false;

@ -98,6 +98,7 @@ typedef unsigned long KeySym;
OVERLAY_PARAM_BOOL(bicubic) \
OVERLAY_PARAM_BOOL(retro) \
OVERLAY_PARAM_BOOL(gpu_fan) \
OVERLAY_PARAM_BOOL(gpu_voltage) \
OVERLAY_PARAM_BOOL(engine_short_names) \
OVERLAY_PARAM_BOOL(text_outline) \
OVERLAY_PARAM_BOOL(temp_fahrenheit) \

Loading…
Cancel
Save