Force change to integrated if in nvidia or hybrid mode

Force change to integrated if in nvidia or hybrid mode and user tries
to switch to vfio or compute
This commit is contained in:
Luke D. Jones
2021-06-06 12:24:15 +12:00
parent ffa74d52e5
commit 439b006342
3 changed files with 18 additions and 3 deletions

View File

@@ -548,8 +548,21 @@ impl CtrlGraphics {
false
};
Self::do_vendor_tasks(vendor, vfio_enable, &devices, &bus)?;
Self::do_display_manager_action("restart")?;
// Need to change to integrated before we can change to vfio or compute
if let Ok(config) = config.try_lock() {
if matches!(vendor, GfxVendors::Compute | GfxVendors::Vfio)
&& matches!(config.gfx_mode, GfxVendors::Nvidia | GfxVendors::Hybrid)
{
Self::do_vendor_tasks(GfxVendors::Integrated, vfio_enable, &devices, &bus)?;
Self::do_display_manager_action("restart")?;
sleep(Duration::from_millis(1000)); // Allow some time for the desktop to start
Self::do_vendor_tasks(vendor, vfio_enable, &devices, &bus)?;
}
} else {
Self::do_vendor_tasks(vendor, vfio_enable, &devices, &bus)?;
Self::do_display_manager_action("restart")?;
}
// Save selected mode in case of reboot
Self::save_gfx_mode(vendor, config);
info!("GFX thread: display-manager started");

View File

@@ -17,7 +17,7 @@ use rog_aura::{
AuraEffect, LedBrightness, LED_MSG_LEN,
};
use rog_types::supported::LedSupportedFunctions;
use std::{fs::OpenOptions, thread::{self, spawn}, time::Duration};
use std::{fs::OpenOptions, thread::spawn};
use std::io::{Read, Write};
use std::path::Path;
use std::sync::Arc;