diff --git a/apps/ball/src/ball.rs b/apps/ball/src/ball.rs index 039fbadf8..ae4f40895 100644 --- a/apps/ball/src/ball.rs +++ b/apps/ball/src/ball.rs @@ -142,6 +142,7 @@ impl Ball { self.ball.style = DrawStyle::new(PixelColor::Dark, PixelColor::Dark, 1); draw_list.push(GamObjectType::Circ(self.ball)).unwrap(); self.gam.draw_list(draw_list).expect("couldn't execute draw list"); + log::trace!("ball app redraw##"); self.gam.redraw().unwrap(); } pub(crate) fn focus(&mut self) { diff --git a/apps/repl/src/repl.rs b/apps/repl/src/repl.rs index a1ca7ce7c..9de6aa887 100644 --- a/apps/repl/src/repl.rs +++ b/apps/repl/src/repl.rs @@ -208,6 +208,7 @@ impl Repl{ break; // we get None on the bounds computed if the text view fell off the top of the screen } } + log::trace!("repl app redraw##"); self.gam.redraw().expect("couldn't redraw screen"); Ok(()) } diff --git a/services/com/src/main.rs b/services/com/src/main.rs index 916e47cb7..5ae4a7b98 100644 --- a/services/com/src/main.rs +++ b/services/com/src/main.rs @@ -341,6 +341,10 @@ fn xmain() -> ! { info!("my PID is {}", xous::process::id()); let xns = xous_names::XousNames::new().unwrap(); + // reset the EC so we're in sync at boot on state + let llio = llio::Llio::new(&xns); + llio.ec_reset().unwrap(); + // unlimited connections allowed -- any server is currently allowed to talk to COM. This might need to be revisited. let com_sid = xns.register_name(api::SERVER_NAME_COM, None).expect("can't register server"); trace!("registered with NS -- {:?}", com_sid); @@ -349,24 +353,22 @@ fn xmain() -> ! { let mut com = XousCom::new(); let ticktimer = ticktimer_server::Ticktimer::new().unwrap(); - // reset the EC so we're in sync at boot on state - let llio = llio::Llio::new(&xns); - llio.ec_reset().unwrap(); - ticktimer.sleep_ms(250).unwrap(); #[cfg(not(any(windows, unix)))] // avoid errors in hosted mode { + ticktimer.sleep_ms(100).unwrap(); // give the EC a moment to de-chatter let mut attempts = 0; let ping_value = 0xaeedu16; // for various reasons, this is a string that is "unlikely" to happen randomly loop { com.txrx(ComState::LINK_PING.verb); com.txrx(ping_value); - let pong = com.wait_txrx(ComState::LINK_READ.verb, Some(5000)); // this should "stall" until the EC comes out of reset - let phase = com.wait_txrx(ComState::LINK_READ.verb, Some(500)); + let pong = com.wait_txrx(ComState::LINK_READ.verb, Some(150)); // this should "stall" until the EC comes out of reset + let phase = com.wait_txrx(ComState::LINK_READ.verb, Some(150)); if pong == !ping_value && phase == 0x600d { // 0x600d is a hard-coded constant. It's included to confirm that we aren't "wedged" just sending one value back at us + log::info!("EC rebooting: link established"); break; } else { - log::warn!("Wf200 reset: establishing link sync, attempt {} [{:04x}/{:04x}]", attempts, pong, phase); + log::info!("EC rebooting: establishing link sync, attempt {} [{:04x}/{:04x}]", attempts, pong, phase); com.txrx(ComState::LINK_SYNC.verb); ticktimer.sleep_ms(200).unwrap(); attempts += 1; diff --git a/services/gam/src/canvas.rs b/services/gam/src/canvas.rs index 135db60a0..e05298bda 100644 --- a/services/gam/src/canvas.rs +++ b/services/gam/src/canvas.rs @@ -292,7 +292,7 @@ fn remap_rand(end_range: i32, rand: i16, source_range: i32) -> i16 { } // we use the "screen" parameter to determine when we can turn off drawing to canvases that are off-screen -pub fn recompute_canvases(canvases: &HashMap, screen: Rectangle) -> HashMap { +pub(crate) fn recompute_canvases(canvases: &HashMap, screen: Rectangle) -> HashMap { let debug = false; // keep this around, it's really convenient for turning off just this specific subset of debug messages // first, sort canvases by trust_level. Canvas implements ord/eq based on the trust_level attribute // so jush pushing it into a max binary heap does the trick. diff --git a/services/gam/src/contexts.rs b/services/gam/src/contexts.rs index 21548fe2e..f2cd02cad 100644 --- a/services/gam/src/contexts.rs +++ b/services/gam/src/contexts.rs @@ -435,9 +435,10 @@ impl ContextManager { self.last_context = self.focused_context; self.focused_context = Some(last_token); } - log::trace!("defacing old canvases prior to redraw"); // run the defacement before we redraw all the canvases - deface(gfx, &self.trng, canvases); + if deface(gfx, &self.trng, canvases) { + log::info!("activate triggered a defacement"); + } log::trace!("activate redraw"); self.redraw().expect("couldn't redraw the currently focused app"); } diff --git a/services/gam/src/main.rs b/services/gam/src/main.rs index fc89b9439..671feb70a 100644 --- a/services/gam/src/main.rs +++ b/services/gam/src/main.rs @@ -281,8 +281,9 @@ fn xmain() -> ! { // recompute the canvas orders based on the new layout let recomp_canvases = recompute_canvases(&canvases, Rectangle::new(Point::new(0, 0), screensize)); canvases = recomp_canvases; - log::trace!("canvas bounds redraw"); - context_mgr.redraw().expect("can't redraw after new canvas bounds"); + // this set of redraw commands is not needed because every context will call redraw after it has finished fitting its bounds + // log::info!("canvas bounds redraw"); + // context_mgr.redraw().expect("can't redraw after new canvas bounds"); } cb.granted = granted; let ret = api::Return::SetCanvasBoundsReturn(cb); diff --git a/services/gam/src/menu.rs b/services/gam/src/menu.rs index 7aa43d26f..727ed5770 100644 --- a/services/gam/src/menu.rs +++ b/services/gam/src/menu.rs @@ -267,6 +267,7 @@ impl<'a> Menu<'a> { self.draw_divider(cur_index as _); } } + log::trace!("menu redraw##"); self.gam.redraw().unwrap(); } fn num_items(&self) -> usize { @@ -297,6 +298,7 @@ impl<'a> Menu<'a> { } } self.index = 0; // reset the index to 0 + log::trace!("menu redraw## select key"); self.gam.redraw().unwrap(); break; // drop any characters that happened to trail the select key, it's probably a fat-finger error. }, @@ -310,10 +312,12 @@ impl<'a> Menu<'a> { } '↑' => { self.prev_item(); + log::trace!("menu redraw## up key"); self.gam.redraw().unwrap(); } '↓' => { self.next_item(); + log::trace!("menu redraw## down key"); self.gam.redraw().unwrap(); } _ => {} diff --git a/services/gam/src/modal.rs b/services/gam/src/modal.rs index 08db12dee..3fd11220f 100644 --- a/services/gam/src/modal.rs +++ b/services/gam/src/modal.rs @@ -440,6 +440,7 @@ impl<'a> Modal<'a> { self.bot_dirty = false; } log::trace!("total height: {}", cur_height); + log::trace!("modal redraw##"); self.gam.redraw().unwrap(); } diff --git a/services/graphics-server/src/backend/betrusted.rs b/services/graphics-server/src/backend/betrusted.rs index 8502d08b1..dc3aa2943 100644 --- a/services/graphics-server/src/backend/betrusted.rs +++ b/services/graphics-server/src/backend/betrusted.rs @@ -134,7 +134,6 @@ impl XousDisplay { } pub fn redraw(&mut self) { - log::info!("**update**"); let mut busy_count = 0; let mut dirty_count = 0; while self.busy() { diff --git a/services/graphics-server/src/main.rs b/services/graphics-server/src/main.rs index 5b4f426f2..6bff0d287 100644 --- a/services/graphics-server/src/main.rs +++ b/services/graphics-server/src/main.rs @@ -350,6 +350,7 @@ fn xmain() -> ! { buffer.replace(tv).unwrap(); } Some(Opcode::Flush) => { + log::trace!("***gfx flush*** redraw##"); display.update(); display.redraw(); } diff --git a/services/ime-frontend/src/main.rs b/services/ime-frontend/src/main.rs index 36b15f789..f204a9bf3 100644 --- a/services/ime-frontend/src/main.rs +++ b/services/ime-frontend/src/main.rs @@ -600,6 +600,7 @@ impl InputTracker { } } + log::trace!("imef: redraw##"); self.gam.redraw().expect("couldn't redraw screen"); Ok(retstring) diff --git a/services/pddb/src/main.rs b/services/pddb/src/main.rs index 9b0f5166a..2d03bef15 100644 --- a/services/pddb/src/main.rs +++ b/services/pddb/src/main.rs @@ -460,28 +460,25 @@ fn xmain() -> ! { } }); // our menu handler + let my_cid = xous::connect(pddb_sid).unwrap(); let _ = thread::spawn({ - let my_cid = xous::connect(pddb_sid).unwrap(); + let my_cid = my_cid.clone(); move || { pddb_menu(my_cid); } }); - // try to mount the PDDB automatically before starting the server - #[cfg(not(any(windows, unix)))] // avoid errors in hosted mode - let tt = ticktimer_server::Ticktimer::new().unwrap(); - #[cfg(not(any(windows, unix)))] // skip this step if running in hosted mode, for now... - if pddb_os.rootkeys_initialized() { - tt.sleep_ms(6000).unwrap(); // wait after boot before attempting to mount, to let the boot screen finish redrawing (cosmetic issue). - match ensure_password(&modals, &mut pddb_os) { - PasswordState::Correct => { - try_mount_or_format(&modals, &mut pddb_os, &mut basis_cache, PasswordState::Correct); - }, - PasswordState::Uninit => { - try_mount_or_format(&modals, &mut pddb_os, &mut basis_cache, PasswordState::Uninit); - }, - _ => (), // continue without mounting if the user opts out + // spawn a delayed mount command, shortly after boot. There's too much going on at boot, and it blocks other things from coming up. + #[cfg(not(any(windows, unix)))] // skip this step if running in hosted mode + let _ = thread::spawn({ + let my_cid = my_cid.clone(); + move || { + let tt = ticktimer_server::Ticktimer::new().unwrap(); + tt.sleep_ms(5000).unwrap(); // wait after boot before attempting to mount, to let the boot screen finish redrawing + send_message(my_cid, + Message::new_blocking_scalar(Opcode::TryMount.to_usize().unwrap(), 0, 0, 0, 0) + ).expect("couldn't send mount request"); } - } + }); // main server loop let mut key_list = Vec::::new(); // storage for key lists let mut key_token: Option<[u32; 4]> = None; @@ -489,9 +486,8 @@ fn xmain() -> ! { let mut dict_token: Option<[u32; 4]> = None; // register a suspend/resume listener - let sr_cid = xous::connect(pddb_sid).expect("couldn't create suspend callback connection"); let mut susres = susres::Susres::new(Some(susres::SuspendOrder::Early), &xns, - Opcode::SuspendResume as u32, sr_cid).expect("couldn't create suspend/resume object"); + Opcode::SuspendResume as u32, my_cid).expect("couldn't create suspend/resume object"); loop { let mut msg = xous::receive_message(pddb_sid).unwrap(); match FromPrimitive::from_usize(msg.body.id()) { @@ -514,14 +510,23 @@ fn xmain() -> ! { // can't mount if we have no root keys xous::return_scalar(msg.sender, 0).expect("could't return scalar"); } else { - if ensure_password(&modals, &mut pddb_os) == PasswordState::Correct { - if try_mount_or_format(&modals, &mut pddb_os, &mut basis_cache, PasswordState::Correct) { - xous::return_scalar(msg.sender, 1).expect("couldn't return scalar"); - } else { - xous::return_scalar(msg.sender, 0).expect("couldn't return scalar"); - } - } else { - xous::return_scalar(msg.sender, 0).expect("couldn't return scalar"); + match ensure_password(&modals, &mut pddb_os) { + PasswordState::Correct => { + if try_mount_or_format(&modals, &mut pddb_os, &mut basis_cache, PasswordState::Correct) { + xous::return_scalar(msg.sender, 1).expect("couldn't return scalar"); + } else { + xous::return_scalar(msg.sender, 0).expect("couldn't return scalar"); + } + }, + PasswordState::Uninit => { + if try_mount_or_format(&modals, &mut pddb_os, &mut basis_cache, PasswordState::Uninit) { + xous::return_scalar(msg.sender, 1).expect("couldn't return scalar"); + } else { + xous::return_scalar(msg.sender, 0).expect("couldn't return scalar"); + } + }, + // user aborted procedure + _ => xous::return_scalar(msg.sender, 0).expect("couldn't return scalar"), } } } diff --git a/services/shellchat/src/main.rs b/services/shellchat/src/main.rs index 4591c1fb5..a0279cca4 100644 --- a/services/shellchat/src/main.rs +++ b/services/shellchat/src/main.rs @@ -260,6 +260,7 @@ impl Repl{ break; // we get None on the bounds computed if the text view fell off the top of the screen } } + log::trace!("shellchat redraw##"); self.gam.redraw().expect("couldn't redraw screen"); // self.gam.request_ime_redraw().expect("couldn't redraw the IME area"); Ok(()) diff --git a/services/status/src/main.rs b/services/status/src/main.rs index 4c420c0e8..69ae6af25 100644 --- a/services/status/src/main.rs +++ b/services/status/src/main.rs @@ -116,7 +116,7 @@ pub fn pump_thread(conn: usize, pump_run: Arc) { #[xous::xous_main] fn xmain() -> ! { log_server::init_wait().unwrap(); - log::set_max_level(log::LevelFilter::Debug); + log::set_max_level(log::LevelFilter::Info); log::info!("my PID is {}", xous::process::id()); let xns = xous_names::XousNames::new().unwrap(); @@ -259,6 +259,7 @@ fn xmain() -> ! { gam.draw_line(status_gid, Line::new_with_style( Point::new(0, screensize.y), screensize, DrawStyle::new(PixelColor::Light, PixelColor::Light, 1))).unwrap(); + log::trace!("status redraw## initial"); gam.redraw().unwrap(); // initial boot redraw let sec_notes = Arc::new(Mutex::new(HashMap::new())); @@ -575,6 +576,7 @@ fn xmain() -> ! { gam.post_textview(&mut uptime_tv) .expect("|status: can't draw uptime"); } + log::trace!("status redraw## update"); gam.redraw().expect("|status: couldn't redraw"); stats_phase = stats_phase.wrapping_add(1);