mirror of
https://github.com/ilya-zlobintsev/LACT.git
synced 2025-02-25 18:55:26 -06:00
vram fix
This commit is contained in:
@@ -9,6 +9,7 @@ use std::time::Duration;
|
||||
|
||||
use crate::client::DaemonClient;
|
||||
use apply_revealer::ApplyRevealer;
|
||||
use glib::clone;
|
||||
use gtk::prelude::*;
|
||||
use gtk::*;
|
||||
use header::Header;
|
||||
@@ -249,12 +250,11 @@ impl App {
|
||||
|
||||
// The loop that gets stats
|
||||
let (sender, receiver) = glib::MainContext::channel(glib::PRIORITY_DEFAULT);
|
||||
{
|
||||
let daemon_connection = self.daemon_client.clone();
|
||||
|
||||
thread::spawn(move || loop {
|
||||
thread::spawn(
|
||||
clone!(@strong self.daemon_client as daemon_client => move || loop {
|
||||
let gpu_id = current_gpu_id.read().unwrap();
|
||||
match daemon_connection
|
||||
match daemon_client
|
||||
.get_device_stats(&gpu_id)
|
||||
.and_then(|stats| stats.inner())
|
||||
{
|
||||
@@ -266,19 +266,19 @@ impl App {
|
||||
}
|
||||
}
|
||||
thread::sleep(Duration::from_millis(500));
|
||||
});
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
// Receiving stats into the gui event loop
|
||||
{
|
||||
let thermals_page = self.root_stack.thermals_page.clone();
|
||||
// let oc_page = self.root_stack.oc_page.clone();
|
||||
|
||||
receiver.attach(None, move |msg| {
|
||||
receiver.attach(
|
||||
None,
|
||||
clone!(@strong self.root_stack as root_stack, => move |msg| {
|
||||
match msg {
|
||||
GuiUpdateMsg::GpuStats(stats) => {
|
||||
trace!("New stats received, updating {stats:?}");
|
||||
thermals_page.set_stats(&stats);
|
||||
root_stack.info_page.set_stats(&stats);
|
||||
root_stack.thermals_page.set_stats(&stats);
|
||||
// oc_page.set_stats(&stats);
|
||||
} /*GuiUpdateMsg::FanControlInfo(fan_control_info) => {
|
||||
thermals_page.set_ventilation_info(fan_control_info)
|
||||
@@ -286,8 +286,8 @@ impl App {
|
||||
}
|
||||
|
||||
glib::Continue(true)
|
||||
});
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ mod vulkan_info;
|
||||
|
||||
use gtk::prelude::*;
|
||||
use gtk::*;
|
||||
use lact_schema::DeviceInfo;
|
||||
use lact_schema::{DeviceInfo, DeviceStats};
|
||||
use vulkan_info::VulkanInfoFrame;
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -184,13 +184,6 @@ impl InformationPage {
|
||||
self.driver_label
|
||||
.set_markup(&format!("<b>{}</b>", gpu_info.driver));
|
||||
|
||||
// TODO
|
||||
// let vram_size = gpu_info
|
||||
// .vram_size
|
||||
// .map_or_else(|| "unknown".to_owned(), |size| size.to_string());
|
||||
// self.vram_size_label
|
||||
// .set_markup(&format!("<b>{vram_size}</b>"));
|
||||
|
||||
let link_speed = gpu_info
|
||||
.link_info
|
||||
.current_speed
|
||||
@@ -210,4 +203,13 @@ impl InformationPage {
|
||||
|
||||
self.container.show_all();
|
||||
}
|
||||
|
||||
pub fn set_stats(&self, stats: &DeviceStats) {
|
||||
let vram_size = stats.total_vram.map_or_else(
|
||||
|| "unknown".to_owned(),
|
||||
|size| (size / 1024 / 1024).to_string(),
|
||||
);
|
||||
self.vram_size_label
|
||||
.set_markup(&format!("<b>{vram_size}MiB</b>"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,22 +76,22 @@ impl VulkanInfoFrame {
|
||||
|
||||
vbox.pack_start(&grid, false, true, 5);
|
||||
|
||||
let features_expander = Expander::new(Some("Feature support"));
|
||||
|
||||
vbox.pack_start(&features_expander, false, true, 5);
|
||||
let features_expander = Expander::builder().label("Feature support").build();
|
||||
|
||||
let features_scrolled_window = ScrolledWindow::builder().build();
|
||||
|
||||
features_scrolled_window.set_vexpand(true);
|
||||
|
||||
let features_box = Box::new(Orientation::Vertical, 5);
|
||||
|
||||
features_box.set_halign(Align::Center);
|
||||
features_box.set_valign(Align::Fill);
|
||||
|
||||
features_scrolled_window.add(&features_box);
|
||||
|
||||
features_expander.add(&features_scrolled_window);
|
||||
|
||||
vbox.pack_start(&features_expander, false, true, 5);
|
||||
|
||||
let extensions_box = Box::builder()
|
||||
.orientation(Orientation::Vertical)
|
||||
.spacing(5)
|
||||
|
||||
Reference in New Issue
Block a user