Add gpu_fan param and hwmon fan reading

Co-authored-by: Andreas Rachev <andreasratchev@gmail.com>
pull/841/head^2
FlightlessMango 1 year ago
parent 26a9f2e663
commit 4b69f23fb5

@ -110,6 +110,14 @@ void getAmdGpuInfo(){
gpu_info.powerUsage = value / 1000000;
}
if (amdgpu.fan) {
rewind(amdgpu.fan);
fflush(amdgpu.fan);
if (fscanf(amdgpu.fan, "%d" PRId64, &value) != 1)
value = 0;
gpu_info.fan_speed = value;
}
}
if (amdgpu.vram_total) {

@ -17,6 +17,7 @@ struct amdgpu_files
FILE *memory_clock;
FILE *power_usage;
FILE *gtt_used;
FILE *fan;
};
extern amdgpu_files amdgpu;
@ -36,6 +37,7 @@ struct gpuInfo{
bool is_temp_throttled;
bool is_other_throttled;
float gtt_used;
int fan_speed;
};
extern struct gpuInfo gpu_info;

@ -181,6 +181,13 @@ void HudElements::gpu_stats(){
else
ImGui::Text("°C");
}
if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_gpu_fan]){
right_aligned_text(text_color, HUDElements.ralign_width, "%i", gpu_info.fan_speed);
ImGui::SameLine(0, 1.0f);
ImGui::PushFont(HUDElements.sw_stats->font1);
ImGui::Text("RPM");
ImGui::PopFont();
}
if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_gpu_core_clock]){
ImguiNextColumnOrNewRow();
right_aligned_text(text_color, HUDElements.ralign_width, "%i", gpu_info.CoreClock);

@ -794,6 +794,8 @@ void init_gpu_stats(uint32_t& vendorID, uint32_t reported_deviceID, overlay_para
amdgpu.memory_clock = fopen((hwmon_path + dir + "/freq2_input").c_str(), "r");
if (!amdgpu.power_usage)
amdgpu.power_usage = fopen((hwmon_path + dir + "/power1_average").c_str(), "r");
if (!amdgpu.fan)
amdgpu.fan = fopen((hwmon_path + dir + "/fan1_input").c_str(), "r");
}
break;
}

@ -94,6 +94,7 @@ typedef unsigned long KeySym;
OVERLAY_PARAM_BOOL(trilinear) \
OVERLAY_PARAM_BOOL(bicubic) \
OVERLAY_PARAM_BOOL(retro) \
OVERLAY_PARAM_BOOL(gpu_fan) \
OVERLAY_PARAM_CUSTOM(fps_sampling_period) \
OVERLAY_PARAM_CUSTOM(output_folder) \
OVERLAY_PARAM_CUSTOM(output_file) \

Loading…
Cancel
Save