From 0003921eb18bb72206515489df4f1f36092ff419 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 26 Oct 2025 13:37:31 +0800 Subject: [PATCH] disable preemption during video capture the camirq is a perfectly good source of preemption, and xous will run other threads when the handler is finished. having both natural timer preemption and camera preemption running at the sime time seems unnecessary and hurts performance. --- services/bao-video/src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/bao-video/src/main.rs b/services/bao-video/src/main.rs index 88dcb0b76..1b5d85bfb 100644 --- a/services/bao-video/src/main.rs +++ b/services/bao-video/src/main.rs @@ -3,6 +3,7 @@ // Including a resolver to a given character map also pulls the font data into the // bao-video binary, increasing its size. +use bao1x_hal_service::Hal; use ux_api::minigfx::*; mod gfx; @@ -169,6 +170,7 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! { let iox = IoxHal::new(); let udma_global = UdmaGlobal::new(); let mut i2c = I2c::new(); + let hal = Hal::new(); let mut display = Oled128x128::new(main_thread_token, bao1x_api::PERCLK, &iox, &udma_global); display.init(); @@ -314,8 +316,10 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! { { log::info!("initiating auto test"); cam.capture_async(); + // cam_irq serves as a preemption timer source, every time it fires a different + // task can run after cam_irq is handled. + hal.set_preemption(false); } - #[cfg(feature = "no-gam")] let modals = modals::Modals::new(&xns).unwrap(); let mut modal_queue = VecDeque::::new();