amdgpu: use gtt_used for APUs

pull/758/head
FlightlessMango 2 years ago
parent 19fbd9bf9b
commit 17d4c1dd4a

@ -137,4 +137,12 @@ void getAmdGpuInfo(){
value = 0;
gpu_info.temp = value / 1000;
}
if (amdgpu.gtt_used) {
rewind(amdgpu.gtt_used);
fflush(amdgpu.gtt_used);
if (fscanf(amdgpu.gtt_used, "%" PRId64, &value) != 1)
value = 0;
gpu_info.gtt_used = float(value) / (1024 * 1024 * 1024);
}
}

@ -16,6 +16,7 @@ struct amdgpu_files
FILE *core_clock;
FILE *memory_clock;
FILE *power_usage;
FILE *gtt_used;
};
extern amdgpu_files amdgpu;
@ -34,6 +35,7 @@ struct gpuInfo{
bool is_current_throttled;
bool is_temp_throttled;
bool is_other_throttled;
float gtt_used;
};
extern struct gpuInfo gpu_info;

@ -343,7 +343,11 @@ void HudElements::vram(){
ImGui::TableNextRow(); ImGui::TableNextColumn();
ImGui::TextColored(HUDElements.colors.vram, "VRAM");
ImGui::TableNextColumn();
right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%.1f", gpu_info.memoryUsed);
// Add gtt_used to vram usage for APUs
if (cpuStats.cpu_type == "APU")
right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%.1f", gpu_info.memoryUsed + gpu_info.gtt_used);
else
right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%.1f", gpu_info.memoryUsed);
ImGui::SameLine(0,1.0f);
ImGui::PushFont(HUDElements.sw_stats->font1);
ImGui::Text("GiB");

@ -676,6 +676,8 @@ void init_gpu_stats(uint32_t& vendorID, uint32_t reported_deviceID, overlay_para
amdgpu.vram_total = fopen((path + "/mem_info_vram_total").c_str(), "r");
if (!amdgpu.vram_used)
amdgpu.vram_used = fopen((path + "/mem_info_vram_used").c_str(), "r");
if (!amdgpu.gtt_used)
amdgpu.gtt_used = fopen((path + "/mem_info_gtt_used").c_str(), "r");
path += "/hwmon/";
auto dirs = ls(path.c_str(), "hwmon", LS_DIRS);

Loading…
Cancel
Save