mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
gfx: asusd config option to not save compute/vfio mode switch
This commit is contained in:
@@ -17,6 +17,7 @@ pub struct Config {
|
||||
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)]
|
||||
@@ -37,6 +38,7 @@ impl Default for Config {
|
||||
gfx_last_mode: GfxVendors::Hybrid,
|
||||
gfx_managed: true,
|
||||
gfx_vfio_enable: false,
|
||||
gfx_save_compute_vfio: true,
|
||||
active_profile: "normal".into(),
|
||||
toggle_profiles: vec!["normal".into(), "boost".into(), "silent".into()],
|
||||
curr_fan_mode: 0,
|
||||
|
||||
@@ -28,6 +28,7 @@ impl ConfigV317 {
|
||||
gfx_last_mode: GfxVendors::Hybrid,
|
||||
gfx_managed: self.gfx_managed,
|
||||
gfx_vfio_enable: false,
|
||||
gfx_save_compute_vfio: false,
|
||||
active_profile: self.active_profile,
|
||||
toggle_profiles: self.toggle_profiles,
|
||||
curr_fan_mode: self.curr_fan_mode,
|
||||
@@ -56,6 +57,7 @@ impl ConfigV324 {
|
||||
gfx_last_mode: GfxVendors::Hybrid,
|
||||
gfx_managed: self.gfx_managed,
|
||||
gfx_vfio_enable: false,
|
||||
gfx_save_compute_vfio: false,
|
||||
active_profile: self.active_profile,
|
||||
toggle_profiles: self.toggle_profiles,
|
||||
curr_fan_mode: self.curr_fan_mode,
|
||||
@@ -85,6 +87,7 @@ impl ConfigV341 {
|
||||
gfx_last_mode: GfxVendors::Hybrid,
|
||||
gfx_managed: self.gfx_managed,
|
||||
gfx_vfio_enable: false,
|
||||
gfx_save_compute_vfio: false,
|
||||
active_profile: self.active_profile,
|
||||
toggle_profiles: self.toggle_profiles,
|
||||
curr_fan_mode: self.curr_fan_mode,
|
||||
|
||||
@@ -286,7 +286,7 @@ impl CtrlGraphics {
|
||||
let mut base = MODPROBE_BASE.to_vec();
|
||||
base.append(&mut MODPROBE_DRM_MODESET.to_vec());
|
||||
base
|
||||
},
|
||||
}
|
||||
GfxVendors::Vfio => Self::get_vfio_conf(devices),
|
||||
GfxVendors::Integrated => MODPROBE_INTEGRATED.to_vec(),
|
||||
GfxVendors::Compute => MODPROBE_BASE.to_vec(),
|
||||
@@ -423,9 +423,13 @@ impl CtrlGraphics {
|
||||
fn logout_required(&self, vendor: GfxVendors) -> GfxRequiredUserAction {
|
||||
if let Ok(config) = self.config.lock() {
|
||||
let current = config.gfx_mode;
|
||||
if matches!(current, GfxVendors::Integrated | GfxVendors::Vfio | GfxVendors::Compute)
|
||||
&& matches!(vendor, GfxVendors::Integrated | GfxVendors::Vfio | GfxVendors::Compute)
|
||||
{
|
||||
if matches!(
|
||||
current,
|
||||
GfxVendors::Integrated | GfxVendors::Vfio | GfxVendors::Compute
|
||||
) && matches!(
|
||||
vendor,
|
||||
GfxVendors::Integrated | GfxVendors::Vfio | GfxVendors::Compute
|
||||
) {
|
||||
return GfxRequiredUserAction::None;
|
||||
}
|
||||
}
|
||||
@@ -660,6 +664,13 @@ impl CtrlGraphics {
|
||||
let bus = self.bus.clone();
|
||||
Self::do_vendor_tasks(vendor, vfio_enable, &devices, &bus)?;
|
||||
info!("GFX: Graphics mode changed to {}", <&str>::from(vendor));
|
||||
if let Ok(config) = self.config.lock() {
|
||||
if matches!(vendor, GfxVendors::Compute | GfxVendors::Vfio)
|
||||
&& config.gfx_save_compute_vfio
|
||||
{
|
||||
Self::save_gfx_mode(vendor, self.config.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: undo if failed? Save last mode, catch errors...
|
||||
Ok(action_required)
|
||||
|
||||
Reference in New Issue
Block a user