From 52e5d21e6ff686352c0a45fe7c98cc6a3e067b9a Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 10 May 2024 00:33:59 +0800 Subject: [PATCH] work around white screen issue on Windows 11 (#538) This is the work-around suggested at https://github.com/emoon/rust_minifb/issues/351 until a new release is tagged. --- services/graphics-server/Cargo.toml | 2 +- services/graphics-server/src/backend/minifb.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/graphics-server/Cargo.toml b/services/graphics-server/Cargo.toml index eeeacad23..25fc23e83 100644 --- a/services/graphics-server/Cargo.toml +++ b/services/graphics-server/Cargo.toml @@ -33,7 +33,7 @@ cramium-hal = { path = "../../libs/cramium-hal", optional = true, features = [ ] } [target.'cfg(any(windows,unix))'.dependencies] -minifb = "0.23.0" +minifb = { git = "https://github.com/emoon/rust_minifb.git", rev = "633e6cd4f8f55fd9cbedc461976dde0f408bea35" } [features] cramium-soc = [ diff --git a/services/graphics-server/src/backend/minifb.rs b/services/graphics-server/src/backend/minifb.rs index e30f7e07f..a472eca1d 100644 --- a/services/graphics-server/src/backend/minifb.rs +++ b/services/graphics-server/src/backend/minifb.rs @@ -16,7 +16,7 @@ pub const FB_WIDTH_PIXELS: usize = WIDTH as usize; pub const FB_LINES: usize = HEIGHT as usize; pub const FB_SIZE: usize = WIDTH_WORDS * HEIGHT as usize; // 44 bytes by 536 lines -const MAX_FPS: u64 = 60; +const MAX_FPS: usize = 60; const DARK_COLOUR: u32 = 0xB5B5AD; const LIGHT_COLOUR: u32 = 0x1B1B19; @@ -166,7 +166,7 @@ impl MinifbThread { }); // Limit the maximum update rate - window.limit_update_rate(Some(std::time::Duration::from_micros(1000 * 1000 / MAX_FPS))); + window.set_target_fps(MAX_FPS); let xns = xous_names::XousNames::new().unwrap(); let kbd = keyboard::Keyboard::new(&xns).expect("GFX|hosted can't connect to KBD for emulation");