From e240ca64992ab0e805ae53f391ae37f558271ca3 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 6 Nov 2022 03:10:00 +0800 Subject: [PATCH] refactor the hardware boot screen - remove a blanking operation. this makes the transision from loader to runtime almost imperceptably smoother - add the ability to summon the logo screen earlier in the process Note that only GAM can call GFX, so, it's alright to expose that API, since GAM should gate-keep and prevent abuse of that function. --- services/graphics-server/src/api.rs | 3 +++ services/graphics-server/src/backend/betrusted.rs | 3 ++- services/graphics-server/src/lib.rs | 8 ++++++++ services/graphics-server/src/main.rs | 8 ++++++-- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/services/graphics-server/src/api.rs b/services/graphics-server/src/api.rs index b83abe479..9fc8232c5 100644 --- a/services/graphics-server/src/api.rs +++ b/services/graphics-server/src/api.rs @@ -119,6 +119,9 @@ pub(crate) enum Opcode { /// SuspendResume callback SuspendResume, + /// draw the boot logo (for continuity as apps initialize) + DrawBootLogo, + Quit, } diff --git a/services/graphics-server/src/backend/betrusted.rs b/services/graphics-server/src/backend/betrusted.rs index fe0125510..120c87571 100644 --- a/services/graphics-server/src/backend/betrusted.rs +++ b/services/graphics-server/src/backend/betrusted.rs @@ -68,7 +68,6 @@ impl XousDisplay { display .susres .push(RegOrField::Field(utra::memlcd::PRESCALER_PRESCALER), None); - display.sync_clear(); /* use log::{error, info}; @@ -255,6 +254,7 @@ impl XousDisplay { /// "synchronous clear" -- must be called on init, so that the state of the LCD /// internal memory is consistent with the state of the frame buffer + /* fn sync_clear(&mut self) { let framebuffer = self.fb.as_mut_ptr() as *mut u32; for words in 0..FB_SIZE { @@ -267,6 +267,7 @@ impl XousDisplay { self.update_all(); // because we force an all update here while self.busy() {} } + */ fn busy(&self) -> bool { self.csr.rf(utra::memlcd::BUSY_BUSY) == 1 diff --git a/services/graphics-server/src/lib.rs b/services/graphics-server/src/lib.rs index f895b230c..e98db6bbc 100644 --- a/services/graphics-server/src/lib.rs +++ b/services/graphics-server/src/lib.rs @@ -108,6 +108,14 @@ impl Gfx { .map(|_| ()) } + pub fn draw_boot_logo(&self) -> Result<(), xous::Error> { + send_message( + self.conn, + Message::new_scalar(Opcode::DrawBootLogo.to_usize().unwrap(), 0, 0, 0, 0), + ) + .map(|_| ()) + } + pub fn screen_size(&self) -> Result { let response = send_message( self.conn, diff --git a/services/graphics-server/src/main.rs b/services/graphics-server/src/main.rs index 00029f6cc..a0bb3181f 100644 --- a/services/graphics-server/src/main.rs +++ b/services/graphics-server/src/main.rs @@ -112,6 +112,7 @@ fn wrapped_main() -> ! { log::info!("my PID is {}", xous::process::id()); let mut display = XousDisplay::new(); + draw_boot_logo(&mut display); // bring this up as soon as possible let fontregion = map_fonts(); // install the graphical panic handler. It won't catch really early panics, or panics in this crate, @@ -139,8 +140,6 @@ fn wrapped_main() -> ! { .register_name(api::SERVER_NAME_GFX, Some(1)) .expect("can't register server"); - draw_boot_logo(&mut display); - let screen_clip = Rectangle::new(Point::new(0, 0), display.screen_size()); display.redraw(); @@ -459,6 +458,11 @@ fn wrapped_main() -> ! { display.update(); display.redraw(); }), + Some(Opcode::DrawBootLogo) => msg_scalar_unpack!(msg, _, _, _, _, { + display.blit_screen(&poweron::LOGO_MAP); + display.update(); + display.redraw(); + }), Some(Opcode::Devboot) => msg_scalar_unpack!(msg, ena, _, _, _, { if ena != 0 { display.set_devboot(true);