Skip to content

Commit

Permalink
refactor the hardware boot screen
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
bunnie committed Nov 5, 2022
1 parent 7eecf2b commit e240ca6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
3 changes: 3 additions & 0 deletions services/graphics-server/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ pub(crate) enum Opcode {
/// SuspendResume callback
SuspendResume,

/// draw the boot logo (for continuity as apps initialize)
DrawBootLogo,

Quit,
}

Expand Down
3 changes: 2 additions & 1 deletion services/graphics-server/src/backend/betrusted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ impl XousDisplay {
display
.susres
.push(RegOrField::Field(utra::memlcd::PRESCALER_PRESCALER), None);
display.sync_clear();

/*
use log::{error, info};
Expand Down Expand Up @@ -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 {
Expand All @@ -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
Expand Down
8 changes: 8 additions & 0 deletions services/graphics-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 6 additions & 2 deletions services/graphics-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e240ca6

Please sign in to comment.