Merge pull request #47 from ilyazzz/vulkan

Update to new vulkano and bump buffer size
This commit is contained in:
ilyazzz 2021-10-05 18:18:30 +03:00 committed by GitHub
commit ade275d228
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 9 deletions

View File

@ -10,7 +10,7 @@ edition = "2018"
bincode = "1.3"
serde = { version = "1.0", features = ["derive", "rc"] }
serde_json = "1.0"
vulkano = "0.22"
vulkano = "0.26"
log = "0.4"
env_logger = "0.9"
rand = "0.8"

View File

@ -9,7 +9,8 @@ use std::collections::{BTreeMap, HashMap};
use std::fs;
use std::num::ParseIntError;
use std::path::PathBuf;
use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice};
use vulkano::device::physical::PhysicalDevice;
use vulkano::instance::{Instance, InstanceExtensions};
#[derive(Serialize, Deserialize, Debug)]
pub enum GpuControllerError {
@ -901,12 +902,21 @@ impl GpuController {
let mut api_version = String::new();
let mut features = HashMap::new();
match Instance::new(None, &InstanceExtensions::none(), None) {
let pci_id = u32::from_str_radix(pci_id, 16).expect("Invalid device ID");
match Instance::new(
None,
vulkano::Version::V1_5,
&InstanceExtensions::none(),
None,
) {
Ok(instance) => {
for physical in PhysicalDevice::enumerate(&instance) {
if format!("{:x}", physical.pci_device_id()) == pci_id.to_lowercase() {
let properties = physical.properties();
if properties.device_id == pci_id {
api_version = physical.api_version().to_string();
device_name = physical.name().to_string();
device_name = properties.device_name.clone();
let features_string = format!("{:?}", physical.supported_features());
let features_string = features_string

View File

@ -236,7 +236,7 @@ impl HWMon {
while s.fan_control.load(Ordering::SeqCst) {
let temps = s.get_temps();
log::trace!("Temps: {:?}", temps);
// Use junction temp when available, otherwise fall back to edge
let temps = match temps.get("junction") {
Some(temp) => temp,
@ -257,8 +257,8 @@ impl HWMon {
match curve.range(t_low..).nth(1) {
Some((t_high, s_high)) => {
if (t_low..t_high).contains(&&temps.current) {
let speed_ratio =
(temps.current - t_low) as f64 / (t_high - t_low) as f64; //The ratio of which speed to choose within the range of current lower and upper speeds
let speed_ratio = (temps.current - t_low) as f64
/ (t_high - t_low) as f64; //The ratio of which speed to choose within the range of current lower and upper speeds
let speed_percent =
s_low + ((s_high - s_low) * speed_ratio);
let pwm = (255f64 * (speed_percent / 100f64)) as i64;

View File

@ -19,7 +19,7 @@ use crate::gpu_controller::GpuController;
// Abstract socket allows anyone to connect without worrying about permissions
// https://unix.stackexchange.com/questions/579612/unix-domain-sockets-for-non-root-user
pub const SOCK_PATH: &str = "amdgpu-configurator.sock";
pub const BUFFER_SIZE: usize = 4096;
pub const BUFFER_SIZE: usize = 16384;
pub struct Daemon {
gpu_controllers: HashMap<u32, GpuController>,