From 8deeffcdad76675cf38721cc8a9de0fad31040d0 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sun, 6 Jun 2021 21:33:31 +1200 Subject: [PATCH] Minor fix to compute/vfio switch --- daemon/src/ctrl_gfx/controller.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/daemon/src/ctrl_gfx/controller.rs b/daemon/src/ctrl_gfx/controller.rs index c316b7f9..8e76951c 100644 --- a/daemon/src/ctrl_gfx/controller.rs +++ b/daemon/src/ctrl_gfx/controller.rs @@ -552,7 +552,7 @@ impl CtrlGraphics { { 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 + sleep(Duration::from_millis(1500)); // Allow some time for the desktop to start Self::do_vendor_tasks(vendor, vfio_enable, &devices, &bus)?; config.gfx_tmp_mode = Some(vendor); mode_to_save = GfxVendors::Integrated; @@ -650,10 +650,12 @@ 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 matches!(vendor, GfxVendors::Vfio | GfxVendors::Compute) { - if let Ok(mut config) = self.config.try_lock() { + if let Ok(mut config) = self.config.try_lock() { + if matches!(vendor, GfxVendors::Vfio | GfxVendors::Compute) { config.gfx_tmp_mode = Some(vendor); - }; + } else { + config.gfx_tmp_mode = None; + } } } // TODO: undo if failed? Save last mode, catch errors...