diff options
| author | salmonik <salmonik@tuta.io> | 2026-07-31 18:08:45 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-07-31 18:08:45 +0200 |
| commit | 075c87d52a4d90c0f00f8ba7ba849677771a9be3 (patch) | |
| tree | 2d89bc491a3ac1d2d018f1f22c48274e77bd7a08 /rsnix/src/tty.rs | |
| parent | gop: RAM backbuffer — scrolling never reads the framebuffer (diff) | |
| download | rs-dos-075c87d52a4d90c0f00f8ba7ba849677771a9be3.tar.gz rs-dos-075c87d52a4d90c0f00f8ba7ba849677771a9be3.zip | |
vt: defer scrolls and batch framebuffer pushes
Streaming output scrolled one framebuffer push per line (each a
~3-8 MB write-only copy). The vt now scrolls the logical grid
instantly in RAM and defers the display shift: N pending scrolls are
pushed together as one shift_up_n — one push regardless of batch size.
- vt: PENDING_SCROLLS counter; scroll_up shifts CELLS only; flush
renders nothing while pending (the diff would otherwise re-rasterise
the whole screen per line); sync_scroll() does one gop::shift_up_n +
RENDERED mirror + normal diff flush (which re-blits just the newly
exposed rows and the cursor).
- Sync triggers: batch of 16 rows, ~40 ms of stream pause (100 Hz
TICKS), any CSI sequence (full-screen apps like the editor render
immediately), clear_all/set_cursor_visible, interactive input
(tty read_line/read_byte), and the shell before each prompt.
- gop: shift_up → shift_up_n(n) (one shadow memcpy + one push).
Verified in QEMU: mmap/hexdump streaming renders in coherent batches
with the prompt syncing at the end; clear wipes clean; the editor
scrolls and redraws immediately (45-line file, gutter + status bar
intact, cursor correct); save/exit/cat round-trip unchanged. Release
and dev builds pass.
Diffstat (limited to 'rsnix/src/tty.rs')
| -rw-r--r-- | rsnix/src/tty.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/rsnix/src/tty.rs b/rsnix/src/tty.rs index 8d745b3..b6b6cc8 100644 --- a/rsnix/src/tty.rs +++ b/rsnix/src/tty.rs | |||
| @@ -37,6 +37,9 @@ static mut RAW_LEN: usize = 0; | |||
| 37 | /// Read one line in canonical mode: echo every key, ^C cancels the line, | 37 | /// Read one line in canonical mode: echo every key, ^C cancels the line, |
| 38 | /// ^D on an empty line is EOF. Echo goes to the terminal (GOP) and serial. | 38 | /// ^D on an empty line is EOF. Echo goes to the terminal (GOP) and serial. |
| 39 | pub fn read_line() -> LineInput { | 39 | pub fn read_line() -> LineInput { |
| 40 | // Interactive input: make sure deferred scrolls are pushed first so | ||
| 41 | // the screen shows the current state (no-op when nothing is pending). | ||
| 42 | crate::vt::sync_scroll(); | ||
| 40 | let mut buf = strbuf::String::<LINE_BUF_SIZE>::new(); | 43 | let mut buf = strbuf::String::<LINE_BUF_SIZE>::new(); |
| 41 | loop { | 44 | loop { |
| 42 | match ps2::poll_key() { | 45 | match ps2::poll_key() { |
| @@ -112,6 +115,9 @@ pub fn interrupt_pressed() -> bool { | |||
| 112 | /// Blocking read of the next raw-mode byte. Keys arrive translated to the | 115 | /// Blocking read of the next raw-mode byte. Keys arrive translated to the |
| 113 | /// terminal byte protocol; multi-byte sequences are delivered in order. | 116 | /// terminal byte protocol; multi-byte sequences are delivered in order. |
| 114 | pub fn read_byte() -> u8 { | 117 | pub fn read_byte() -> u8 { |
| 118 | // Interactive (raw) input: push deferred scrolls so the full-screen | ||
| 119 | // app draws over a current framebuffer. | ||
| 120 | crate::vt::sync_scroll(); | ||
| 115 | loop { | 121 | loop { |
| 116 | if let Some(b) = pop_raw() { | 122 | if let Some(b) = pop_raw() { |
| 117 | return b; | 123 | return b; |
