perf: fast display (row runs, bulk fills, pixel scroll), terminal draws changed cells only + scrolls pixels, print! batched (was IPC per fmt fragment), snake sleeps on timer
This commit is contained in:
@@ -15,7 +15,7 @@ use libkos::input::{InputEvent, Key};
|
||||
use libkos::syscall;
|
||||
use types::badge::Badge;
|
||||
use types::bounded::CapSlot;
|
||||
use types::display::{Color, ScreenCoord};
|
||||
use types::display::{Color, Dimension, ScreenCoord};
|
||||
use types::terminal::{KEYS_BIT, TIMER_BIT};
|
||||
|
||||
/// Where init put them (its manifest: own endpoint, then `uses`).
|
||||
@@ -33,6 +33,8 @@ struct Screen {
|
||||
/// `KEYS_BIT`, the flush timer with `TIMER_BIT`.
|
||||
notify: CapSlot,
|
||||
timer: CapSlot,
|
||||
/// The screen's height, all of which scrolls.
|
||||
height: Dimension,
|
||||
}
|
||||
|
||||
/// A key as the line editor wants it, if it is one.
|
||||
@@ -65,6 +67,11 @@ impl server::Console for Screen {
|
||||
display::flush(DISPLAY);
|
||||
}
|
||||
|
||||
fn scroll(&mut self, rows: usize) {
|
||||
let by = Dimension::new(u16::try_from(rows * CELL_HEIGHT).unwrap_or(u16::MAX));
|
||||
display::scroll(DISPLAY, ScreenCoord::new(0), self.height, by, BG);
|
||||
}
|
||||
|
||||
fn flush_later(&mut self) {
|
||||
let at = syscall::get_time().raw() + FLUSH_DELAY;
|
||||
let _ = syscall::set_timer(self.timer, types::time::Ticks::from_raw(at));
|
||||
@@ -116,6 +123,6 @@ pub fn run() -> ! {
|
||||
display::clear(DISPLAY, BG);
|
||||
let cols = w.raw() as usize / CELL_WIDTH;
|
||||
let rows = h.raw() as usize / CELL_HEIGHT;
|
||||
let mut srv = server::TerminalServer::new(Screen { notify, timer }, cols, rows);
|
||||
let mut srv = server::TerminalServer::new(Screen { notify, timer, height: h }, cols, rows);
|
||||
server_framework::serve(&mut srv, EP)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user