From 148bf71a940223bbcb66c1c343365bd5ca907218 Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 5 Jul 2022 03:24:15 +0800 Subject: [PATCH] modify the fb pop routine so it doesn't overwrite the status bar this eliminates a small glitch in the time display/security infos whenever transitioning between foreground/background contexts --- RELEASE-v0.9.md | 7 +++---- services/gam/src/main.rs | 1 + services/graphics-server/src/backend/betrusted.rs | 4 +++- services/graphics-server/src/backend/minifb.rs | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/RELEASE-v0.9.md b/RELEASE-v0.9.md index 70d4d9f15..c82cd2ca7 100644 --- a/RELEASE-v0.9.md +++ b/RELEASE-v0.9.md @@ -179,10 +179,9 @@ perform the Xous firmware upgrade. This requires running manual update commands, - fuzzer added to push many more corner cases than before -- disk is filled to ~75% capacity with dozens of Bases, triggering roughly 4 FSCB ops, and then all Bases and keys are verified to be correct. - Optimize GAM performance - - context switches that revert to a prior app screen are restored from a stashed bitmap instead of a full redraw. this can cause - a slight glitch on the status bar where the wrong time/status is displayed for up to a second after the context swap reverts, but - it is a minor trade-off for the main purpose, which is to prevent old menus, contexts, and defacements from "piling up" when an - app is blocked due to an exceptional condition being raised (such as the PDDB requesting a full basis unlock to generate the FSCB) + - context switches that revert to a prior app screen are restored from a stashed bitmap instead of a full redraw. This + prevents old menus, contexts, and defacements from "piling up" when an app is blocked due to an exceptional condition + being raised (such as the PDDB requesting a full basis unlock to generate the FSCB) ## Roadmap to 1.0 diff --git a/services/gam/src/main.rs b/services/gam/src/main.rs index a887c027c..20ebf1d64 100644 --- a/services/gam/src/main.rs +++ b/services/gam/src/main.rs @@ -75,6 +75,7 @@ fn wrapped_main() -> ! { let status_canvas = Canvas::new( Rectangle::new_coords( 0, 0, screensize.x, + // note: if this gets modified, the "pop" routine in gfx/backend/betrusted.rs also needs to be updated gfx.glyph_height_hint(GlyphStyle::Cjk).expect("couldn't get glyph height") as i16 * 2), 255, &trng, None, crate::api::CanvasType::Status ).expect("couldn't create status canvas"); diff --git a/services/graphics-server/src/backend/betrusted.rs b/services/graphics-server/src/backend/betrusted.rs index 0382bdcf2..fe0125510 100644 --- a/services/graphics-server/src/backend/betrusted.rs +++ b/services/graphics-server/src/backend/betrusted.rs @@ -114,7 +114,9 @@ impl XousDisplay { } pub fn pop(&mut self) { let fb: &mut [u32] = self.fb.as_slice_mut(); - fb[..FB_SIZE].copy_from_slice(&self.srfb); + // skip copying the status bar, so that the status info is not overwritten by the pop. + // this is "fixed" at 32 pixels high (2 * Cjk glyph height hint) per line 79 in gam/src/main.rs + fb[FB_WIDTH_WORDS * 32..FB_SIZE].copy_from_slice(&self.srfb[FB_WIDTH_WORDS * 32..FB_SIZE]); self.redraw(); } diff --git a/services/graphics-server/src/backend/minifb.rs b/services/graphics-server/src/backend/minifb.rs index 3b90d37b5..86e42fbe1 100644 --- a/services/graphics-server/src/backend/minifb.rs +++ b/services/graphics-server/src/backend/minifb.rs @@ -88,7 +88,7 @@ impl XousDisplay { self.srfb.copy_from_slice(&self.emulated_buffer); } pub fn pop(&mut self) { - self.emulated_buffer.copy_from_slice(&self.srfb); + self.emulated_buffer[FB_WIDTH_WORDS*32..].copy_from_slice(&self.srfb[FB_WIDTH_WORDS*32..]); self.redraw(); self.update(); }