Skip to content

Commit

Permalink
feat: show effective VRAM clockspeed in the GUI on GDDR6 (#368)
Browse files Browse the repository at this point in the history
* feat: refactor clocks frame adjustments into a separate widget

* feat: show effective VRAM clockspeed in the GUI on GDDR6
  • Loading branch information
ilya-zlobintsev authored Sep 7, 2024
1 parent 99f6e9e commit 9dbce2a
Show file tree
Hide file tree
Showing 9 changed files with 362 additions and 192 deletions.
6 changes: 6 additions & 0 deletions lact-daemon/src/server/gpu_controller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ impl GpuController {

#[cfg(feature = "libdrm_amdgpu_sys")]
fn get_drm_info(&self) -> Option<DrmInfo> {
use libdrm_amdgpu_sys::AMDGPU::VRAM_TYPE;

trace!("Reading DRM info");
let drm_handle = self.drm_handle.as_ref();

Expand All @@ -211,6 +213,10 @@ impl GpuController {
chip_class: drm_info.get_chip_class().to_string(),
compute_units: drm_info.cu_active_number,
vram_type: drm_info.get_vram_type().to_string(),
vram_clock_ratio: match drm_info.get_vram_type() {
VRAM_TYPE::GDDR6 => 2.0,
_ => 1.0,
},
vram_bit_width: drm_info.vram_bit_width,
vram_max_bw: drm_info.peak_memory_bw_gb().to_string(),
l1_cache_per_cu: drm_info.get_l1_cache_size(),
Expand Down
14 changes: 10 additions & 4 deletions lact-gui/src/app/graphs_window/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ glib::wrapper! {

impl GraphsWindow {
pub fn new() -> Self {
Object::builder().build()
Object::builder().property("vram_clock_ratio", 1.0).build()
}

pub fn set_stats(&self, stats: &DeviceStats) {
Expand Down Expand Up @@ -79,7 +79,7 @@ impl GraphsWindow {
clockspeed_plot.push_line_series("GPU (Trgt)", point as f64);
}
if let Some(point) = stats.clockspeed.vram_clockspeed {
clockspeed_plot.push_line_series("VRAM", point as f64);
clockspeed_plot.push_line_series("VRAM", point as f64 * self.vram_clock_ratio());
}

if let Some(max_speed) = stats.fan.speed_max {
Expand Down Expand Up @@ -132,16 +132,18 @@ impl Default for GraphsWindow {
mod imp {
use super::plot::Plot;
use gtk::{
glib::{self, subclass::InitializingObject},
glib::{self, subclass::InitializingObject, Properties},
prelude::*,
subclass::{
prelude::*,
widget::{CompositeTemplateClass, WidgetImpl},
},
CompositeTemplate,
};
use std::cell::Cell;

#[derive(CompositeTemplate, Default)]
#[derive(CompositeTemplate, Default, Properties)]
#[properties(wrapper_type = super::GraphsWindow)]
#[template(file = "ui/graphs_window.blp")]
pub struct GraphsWindow {
#[template_child]
Expand All @@ -152,6 +154,9 @@ mod imp {
pub(super) power_plot: TemplateChild<Plot>,
#[template_child]
pub(super) fan_plot: TemplateChild<Plot>,

#[property(get, set)]
pub vram_clock_ratio: Cell<f64>,
}

#[glib::object_subclass]
Expand All @@ -171,6 +176,7 @@ mod imp {
}
}

#[glib::derived_properties]
impl ObjectImpl for GraphsWindow {}

impl WidgetImpl for GraphsWindow {}
Expand Down
8 changes: 8 additions & 0 deletions lact-gui/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,14 @@ impl App {
trace!("setting info {info:?}");

self.root_stack.info_page.set_info(&info);
self.root_stack.oc_page.set_info(&info);

let vram_clock_ratio = info
.drm_info
.as_ref()
.map(|info| info.vram_clock_ratio)
.unwrap_or(1.0);
self.graphs_window.set_vram_clock_ratio(vram_clock_ratio);

self.set_initial(gpu_id);
self.root_stack.thermals_page.set_info(&info);
Expand Down
Loading

0 comments on commit 9dbce2a

Please sign in to comment.