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.
This commit is contained in:
bunnie 2022-11-06 03:10:00 +08:00
parent 7eecf2b1ce
commit e240ca6499
4 changed files with 19 additions and 3 deletions

View file

@ -119,6 +119,9 @@ pub(crate) enum Opcode {
/// SuspendResume callback
SuspendResume,
/// draw the boot logo (for continuity as apps initialize)
DrawBootLogo,
Quit,
}

View file

@ -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

View file

@ -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<Point, xous::Error> {
let response = send_message(
self.conn,

View file

@ -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);