Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: show effective VRAM clockspeed in the GUI on GDDR6 #368

Merged
merged 2 commits into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading