diff options
-rw-r--r-- | hardinfo/gpu_util.c | 13 | ||||
-rw-r--r-- | includes/gpu_util.h | 1 | ||||
-rw-r--r-- | modules/devices/gpu.c | 14 |
3 files changed, 25 insertions, 3 deletions
diff --git a/hardinfo/gpu_util.c b/hardinfo/gpu_util.c index beb115ae..17c79a73 100644 --- a/hardinfo/gpu_util.c +++ b/hardinfo/gpu_util.c @@ -133,8 +133,10 @@ static void amdgpu_parse_dpmclk(gchar *path, int *min, int *max) { static void amdgpu_fill_freq(gpud *s) { gchar path[256] = ""; - int clk_min = -1, clk_max = -1; + int clk_min = -1, clk_max = -1, mem_clk_min = -1, mem_clk_max = -1; + if (s->sysfs_drm_path) { + /* core */ snprintf(path, 255, "%s/%s/device/pp_dpm_sclk", s->sysfs_drm_path, s->id); amdgpu_parse_dpmclk(path, &clk_min, &clk_max); @@ -142,6 +144,15 @@ static void amdgpu_fill_freq(gpud *s) { s->khz_max = clk_max * 1000; if (clk_min > 0) s->khz_min = clk_min * 1000; + + /* memory */ + snprintf(path, 255, "%s/%s/device/pp_dpm_mclk", s->sysfs_drm_path, s->id); + amdgpu_parse_dpmclk(path, &mem_clk_min, &mem_clk_max); + + if (mem_clk_max > 0) + s->mem_khz_max = mem_clk_max * 1000; + if (mem_clk_min > 0) + s->mem_khz_min = mem_clk_min * 1000; } } diff --git a/includes/gpu_util.h b/includes/gpu_util.h index f053dbc8..cdac6ec4 100644 --- a/includes/gpu_util.h +++ b/includes/gpu_util.h @@ -36,6 +36,7 @@ typedef struct gpud { char *device_str; char *location; uint32_t khz_min, khz_max; /* core */ + uint32_t mem_khz_min, mem_khz_max; /* memory */ char *drm_dev; char *sysfs_drm_path; diff --git a/modules/devices/gpu.c b/modules/devices/gpu.c index 263edb30..0814a62e 100644 --- a/modules/devices/gpu.c +++ b/modules/devices/gpu.c @@ -129,12 +129,20 @@ static void _gpu_pci_dev(gpud* gpu) { gchar *freq = g_strdup(_("(Unknown)")); if (gpu->khz_max > 0) { - if (gpu->khz_min > 0) + if (gpu->khz_min > 0 && gpu->khz_min != gpu->khz_max) freq = g_strdup_printf("%0.2f-%0.2f %s", (double) gpu->khz_min / 1000, (double) gpu->khz_max / 1000, _("MHz")); else freq = g_strdup_printf("%0.2f %s", (double) gpu->khz_max / 1000, _("MHz")); } + gchar *mem_freq = g_strdup(_("(Unknown)")); + if (gpu->mem_khz_max > 0) { + if (gpu->mem_khz_min > 0 && gpu->mem_khz_min != gpu->mem_khz_max) + mem_freq = g_strdup_printf("%0.2f-%0.2f %s", (double) gpu->mem_khz_min / 1000, (double) gpu->mem_khz_max / 1000, _("MHz")); + else + mem_freq = g_strdup_printf("%0.2f %s", (double) gpu->mem_khz_max / 1000, _("MHz")); + } + str = g_strdup_printf("[%s]\n" /* Location */ "%s=%s\n" /* DRM Dev */ "%s=%s\n" @@ -142,7 +150,8 @@ static void _gpu_pci_dev(gpud* gpu) { "%s" /* Revision */ "%s=%02x\n" "[%s]\n" - /* Frequency */ "%s=%s\n" + /* Core freq */ "%s=%s\n" + /* Mem freq */ "%s=%s\n" /* NV */ "%s" /* PCIe */ "%s" "[%s]\n" @@ -156,6 +165,7 @@ static void _gpu_pci_dev(gpud* gpu) { _("Revision"), p->revision, _("Clocks"), _("Core"), freq, + _("Memory"), mem_freq, nv_str, pcie_str, _("Driver"), |