mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
gfx: Remove option for vfio/compute save
This commit is contained in:
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Changed
|
### Changed
|
||||||
- Add GX550L led modes
|
- Add GX550L led modes
|
||||||
|
- Don't save compute/vfio modes. Option in config for this is removed.
|
||||||
|
|
||||||
# [3.5.2] - 2021-05-15
|
# [3.5.2] - 2021-05-15
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ pub struct Config {
|
|||||||
pub gfx_last_mode: GfxVendors,
|
pub gfx_last_mode: GfxVendors,
|
||||||
pub gfx_managed: bool,
|
pub gfx_managed: bool,
|
||||||
pub gfx_vfio_enable: bool,
|
pub gfx_vfio_enable: bool,
|
||||||
pub gfx_save_compute_vfio: bool,
|
|
||||||
pub active_profile: String,
|
pub active_profile: String,
|
||||||
pub toggle_profiles: Vec<String>,
|
pub toggle_profiles: Vec<String>,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
@@ -38,7 +37,6 @@ impl Default for Config {
|
|||||||
gfx_last_mode: GfxVendors::Hybrid,
|
gfx_last_mode: GfxVendors::Hybrid,
|
||||||
gfx_managed: true,
|
gfx_managed: true,
|
||||||
gfx_vfio_enable: false,
|
gfx_vfio_enable: false,
|
||||||
gfx_save_compute_vfio: true,
|
|
||||||
active_profile: "normal".into(),
|
active_profile: "normal".into(),
|
||||||
toggle_profiles: vec!["normal".into(), "boost".into(), "silent".into()],
|
toggle_profiles: vec!["normal".into(), "boost".into(), "silent".into()],
|
||||||
curr_fan_mode: 0,
|
curr_fan_mode: 0,
|
||||||
@@ -69,6 +67,11 @@ impl Config {
|
|||||||
} else {
|
} else {
|
||||||
if let Ok(data) = serde_json::from_str(&buf) {
|
if let Ok(data) = serde_json::from_str(&buf) {
|
||||||
return data;
|
return data;
|
||||||
|
} else if let Ok(data) = serde_json::from_str::<ConfigV352>(&buf) {
|
||||||
|
let config = data.into_current();
|
||||||
|
config.write();
|
||||||
|
info!("Updated config version to: {}", VERSION);
|
||||||
|
return config;
|
||||||
} else if let Ok(data) = serde_json::from_str::<ConfigV341>(&buf) {
|
} else if let Ok(data) = serde_json::from_str::<ConfigV341>(&buf) {
|
||||||
let config = data.into_current();
|
let config = data.into_current();
|
||||||
config.write();
|
config.write();
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ impl ConfigV317 {
|
|||||||
gfx_last_mode: GfxVendors::Hybrid,
|
gfx_last_mode: GfxVendors::Hybrid,
|
||||||
gfx_managed: self.gfx_managed,
|
gfx_managed: self.gfx_managed,
|
||||||
gfx_vfio_enable: false,
|
gfx_vfio_enable: false,
|
||||||
gfx_save_compute_vfio: false,
|
|
||||||
active_profile: self.active_profile,
|
active_profile: self.active_profile,
|
||||||
toggle_profiles: self.toggle_profiles,
|
toggle_profiles: self.toggle_profiles,
|
||||||
curr_fan_mode: self.curr_fan_mode,
|
curr_fan_mode: self.curr_fan_mode,
|
||||||
@@ -57,7 +56,6 @@ impl ConfigV324 {
|
|||||||
gfx_last_mode: GfxVendors::Hybrid,
|
gfx_last_mode: GfxVendors::Hybrid,
|
||||||
gfx_managed: self.gfx_managed,
|
gfx_managed: self.gfx_managed,
|
||||||
gfx_vfio_enable: false,
|
gfx_vfio_enable: false,
|
||||||
gfx_save_compute_vfio: false,
|
|
||||||
active_profile: self.active_profile,
|
active_profile: self.active_profile,
|
||||||
toggle_profiles: self.toggle_profiles,
|
toggle_profiles: self.toggle_profiles,
|
||||||
curr_fan_mode: self.curr_fan_mode,
|
curr_fan_mode: self.curr_fan_mode,
|
||||||
@@ -87,7 +85,6 @@ impl ConfigV341 {
|
|||||||
gfx_last_mode: GfxVendors::Hybrid,
|
gfx_last_mode: GfxVendors::Hybrid,
|
||||||
gfx_managed: self.gfx_managed,
|
gfx_managed: self.gfx_managed,
|
||||||
gfx_vfio_enable: false,
|
gfx_vfio_enable: false,
|
||||||
gfx_save_compute_vfio: false,
|
|
||||||
active_profile: self.active_profile,
|
active_profile: self.active_profile,
|
||||||
toggle_profiles: self.toggle_profiles,
|
toggle_profiles: self.toggle_profiles,
|
||||||
curr_fan_mode: self.curr_fan_mode,
|
curr_fan_mode: self.curr_fan_mode,
|
||||||
@@ -96,3 +93,35 @@ impl ConfigV341 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Deserialize, Serialize)]
|
||||||
|
pub struct ConfigV352 {
|
||||||
|
pub gfx_mode: GfxVendors,
|
||||||
|
pub gfx_last_mode: GfxVendors,
|
||||||
|
pub gfx_managed: bool,
|
||||||
|
pub gfx_vfio_enable: bool,
|
||||||
|
pub gfx_save_compute_vfio: bool,
|
||||||
|
pub active_profile: String,
|
||||||
|
pub toggle_profiles: Vec<String>,
|
||||||
|
#[serde(skip)]
|
||||||
|
pub curr_fan_mode: u8,
|
||||||
|
pub bat_charge_limit: u8,
|
||||||
|
pub power_profiles: BTreeMap<String, Profile>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ConfigV352 {
|
||||||
|
pub(crate) fn into_current(self) -> Config {
|
||||||
|
Config {
|
||||||
|
gfx_mode: GfxVendors::Hybrid,
|
||||||
|
gfx_last_mode: GfxVendors::Hybrid,
|
||||||
|
gfx_managed: self.gfx_managed,
|
||||||
|
gfx_vfio_enable: false,
|
||||||
|
active_profile: self.active_profile,
|
||||||
|
toggle_profiles: self.toggle_profiles,
|
||||||
|
curr_fan_mode: self.curr_fan_mode,
|
||||||
|
bat_charge_limit: self.bat_charge_limit,
|
||||||
|
power_profiles: self.power_profiles,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -607,16 +607,6 @@ impl CtrlGraphics {
|
|||||||
let bus = self.bus.clone();
|
let bus = self.bus.clone();
|
||||||
Self::do_vendor_tasks(vendor, vfio_enable, &devices, &bus)?;
|
Self::do_vendor_tasks(vendor, vfio_enable, &devices, &bus)?;
|
||||||
info!("GFX: Graphics mode changed to {}", <&str>::from(vendor));
|
info!("GFX: Graphics mode changed to {}", <&str>::from(vendor));
|
||||||
if matches!(vendor, GfxVendors::Compute | GfxVendors::Vfio) {
|
|
||||||
loop {
|
|
||||||
if let Ok(config) = self.config.try_lock() {
|
|
||||||
if config.gfx_save_compute_vfio {
|
|
||||||
Self::save_gfx_mode(vendor, self.config.clone());
|
|
||||||
}
|
|
||||||
return Ok(action_required);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// TODO: undo if failed? Save last mode, catch errors...
|
// TODO: undo if failed? Save last mode, catch errors...
|
||||||
Ok(action_required)
|
Ok(action_required)
|
||||||
|
|||||||
Reference in New Issue
Block a user