Skip to content
Open

Tui #942

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ hashes are given where a change is easiest to understand by reading the commit.

### Front ends

- `iris --tui` builds a configuration in the terminal: open, convert and save `iris.toml` files, pick the machine,
add and edit devices at its slots, then run it straight into the monitor console. All machines.

- A native Windows front end, `iris-win32`, over the same controllers as the
Mac and Linux apps: menu bar, library, machine page, guest display with
mouse capture, settings, the New Machine wizard, the disk browser and the
Expand Down
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ tlbvmap = []
# or when stdin is not a terminal, the console reads plain lines. On by default;
# `--no-default-features` drops the dependency.
lineedit = ["dep:rustyline"]
# `iris --tui`: the configuration builder in the terminal.
tui = ["dep:ratatui"]
# CD-ROM media served over HTTP(S) with Range requests (src/http_disk.rs): a
# CD-ROM path or changer disc may be an http:// or https:// URL. On by default;
# without it such a URL is refused when the disc is opened, and the build
Expand Down Expand Up @@ -180,7 +182,7 @@ cache-ecc = []
# Always built now; this flag does nothing and is kept so command lines that
# still pass `--features decode-cache` keep working.
decode-cache = []
default = ["tlbvmap", "rexdiag", "lineedit", "embedded-proms", "http-media"]
default = ["tlbvmap", "rexdiag", "lineedit", "tui", "embedded-proms", "http-media"]
# The SGI PROMs iris carries (data/proms), each a deflate file inflated when its machine
# starts. Off, nothing is built in and every machine needs a `prom` file.
embedded-proms = []
Expand Down Expand Up @@ -360,6 +362,8 @@ iris-hostgl = { path = "iris-hostgl", optional = true }
junit-report = "0.9"
# `lineedit`'s editor: no file history, hints or derive macros.
rustyline = { version = "19", optional = true, default-features = false }
# `tui`'s terminal UI; crossterm comes with it (ratatui::crossterm).
ratatui = { version = "0.30", optional = true }
# `http-media`'s client: ring-backed rustls with the bundled Mozilla roots, no gzip.
ureq = { version = "3.5", optional = true, default-features = false, features = ["rustls"] }
[target.'cfg(target_os = "macos")'.dependencies]
Expand Down
7 changes: 5 additions & 2 deletions FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ are below the inventory.

### iris (core and standalone CLI)

Source: [Cargo.toml](Cargo.toml). Default features are `tlbvmap,rexdiag,lineedit,embedded-proms,http-media`.
Source: [Cargo.toml](Cargo.toml). Default features are `tlbvmap,rexdiag,lineedit,tui,embedded-proms,http-media`.
Select with `cargo build --release --features <comma-separated-list>`; add
`--no-default-features` to drop the core default bundle.

Expand Down Expand Up @@ -39,7 +39,7 @@ Select with `cargo build --release --features <comma-separated-list>`; add
| `decode-cache` | Compatibility flag; decoded-instruction caching for the shadow model is unconditional. | — |
| `tcache_verify` | Assert transparent-cache/RAM coherence on accesses; very slow. | `tcache` |
| `embedded-proms` | The SGI PROMs built into the binary, each inflated when its machine starts. Without it a machine needs a `prom` file. | — |
| `default` | Default bundle: `tlbvmap`, `rexdiag`, `lineedit`, `embedded-proms` and `http-media`. | `tlbvmap`, `rexdiag`, `lineedit`, `embedded-proms`, `http-media` |
| `default` | Default bundle: `tlbvmap`, `rexdiag`, `lineedit`, `tui`, `embedded-proms` and `http-media`. | `tlbvmap`, `rexdiag`, `lineedit`, `tui`, `embedded-proms`, `http-media` |
| `rex-dirty-upload` | Track conservative Newport framebuffer damage and copy/upload only dirty regions. Opt-in; the default retains the original REX3 and presentation paths. | — |
| `rex-jit` | Cranelift compiler for Newport draw shaders; complements precompiled shaders. | `cranelift-codegen`, `cranelift-frontend`, `cranelift-jit`, `cranelift-module`, `cranelift-native` |
| `wgpu` | Host-GPU rasterisation through the common wgpu layer (VPro, IMPACT and experimental GPU-authoritative Newport), plus wgpu window composition. Newport production activation is initially validated on Vulkan and D3D12 and fails closed without CPU fallback. Work in progress; see `clanker/plans/GPUTodo.md`. | `dep:bytemuck`, `dep:pollster`, `dep:wgpu`, `dep:ash` |
Expand All @@ -55,6 +55,7 @@ Select with `cargo build --release --features <comma-separated-list>`; add
| `hostcall` | Private user-mode guest syscall services 3000–3009; IRIX handles other calls. | `dep:iris-hostcall` |
| `hostgl` | Guest replacement-libGL command replay; macOS (CGL) and Linux (EGL) backends. | `hostcall`, `dep:iris-hostgl` |
| `lineedit` | Terminal console line editing (history, Ctrl-R, cursor keys, Tab completion of command names) when stdin is a terminal. Default on; `--no-default-features` drops rustyline. | `dep:rustyline` |
| `tui` | `iris --tui`, the configuration builder in the terminal (ratatui). Default on; a build without it refuses `--tui`. | `dep:ratatui` |
| `http-media` | CD-ROM images given as `http://` or `https://` URLs, read with HTTP `Range` requests (see [STORAGE.md](STORAGE.md#cd-rom-images-over-http)). Default on; without it such a URL is refused when the disc is opened and the build has no HTTP or TLS code. | `dep:ureq` |

Cargo also exposes these **implicit optional-dependency features**:
Expand Down Expand Up @@ -664,6 +665,7 @@ iris-gui does not parse this standalone option set; use its named-machine UI.
| `--list-slots` | Print the machine's slots as a tree, their aliases, what is in each and what it takes, then exit. |
| `--config-show` | Print the effective config as an iris.toml with only what differs from the machine's defaults, each device at its resolved slot, then exit. |
| `--config-dump FILE` | Write that file to `FILE`, which must not exist, then exit. |
| `--tui` | Build the configuration in a terminal UI, then run it (see [HELP.md](HELP.md#building-a-configuration-in-the-terminal)). Opens `--config FILE` when given (a new file when it does not exist); the other options change the first file it opens. Needs a terminal and the `tui` feature. |
| `--2x` | 2× window scaling for HiDPI/4K monitors |
| `--headless` | Suppress the standalone window (platform-specific graphics/console behavior, as `headless`; audio unaffected) |
| `--noaudio` | Disable host audio output, as `no_audio`; graphics is unaffected |
Expand Down Expand Up @@ -813,6 +815,7 @@ mistaken for GUI settings.
| `IRIS_QOS` | HostGL QoS: default/off disables promotion; quiet suppresses logging. | [iris-hostgl/src/qos.rs](iris-hostgl/src/qos.rs) |
| `IRIS_REX3_GPU_STATS` | Set (any value) to add the costlier Newport GPU-raster telemetry to `rex status`: command generation time per GO and which state-slot words change from one primitive to the next. Read when the GPU raster starts. | [src/dev/ng1/wgpu/resident.rs](src/dev/ng1/wgpu/resident.rs) |
| `IRIS_REX_JIT_PROFILE` | Where the REX3 shader JIT keeps its profile of draw modes between runs, instead of `~/.iris/rex-jit-profile.bin` (`rex-jit` builds). | [src/dev/ng1/rex3_profile.rs](src/dev/ng1/rex3_profile.rs) |
| `IRIS_SIMD` | `sse4.2` caps the host SIMD level on an x86 host with AVX2: the VPro SIMD kernels run at SSE4.2, and every JIT (MIPS, REX3, IMPACT, GR2) compiles without AVX, FMA or BMI, as on a CPU without AVX2. Only lowers the level; a build for `target-cpu=native` on an AVX2 host keeps AVX2. Unset: the level the CPU has, detected once. | [src/host_simd.rs](src/host_simd.rs) |
| `IRIS_SNAPSHOT_SKIP_CHECK` | 1 bypasses selected snapshot compatibility checks; diagnostic escape hatch. | [src/machine.rs](src/machine.rs) |
| `IRIS_SOCKET` | iris-ci default socket override (Unix path or TCP address). | [src/iris_ci_main.rs](src/iris_ci_main.rs) |
| `IRIS_VNC_PASSWORD` | The VNC password itself (first 8 bytes), used when neither `[vnc] password_file` nor `IRIS_VNC_PASSWORD_FILE` is set. Standalone `iris` only. | [src/vnc/auth.rs](src/vnc/auth.rs) |
Expand Down
2 changes: 1 addition & 1 deletion HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ Every device that has real work to do runs on its own thread:
| `IOC3-NVRAM` | the DS1685 NVRAM file writer (IOC3's other deadlines are `hptimer` one-shots) |
| `bcm5701-rx`, `bcm5701-net` | Tezro BCM5701 receive pump and network backend |
| `ioc3-eth-rx`, `ioc3-eth-net` | IOC3 ethernet receive pump (every machine with an IOC3); the network backend |
| `odyssey-work`, `odyssey-raster`, `odyssey-pool-N` | VPro: the front end decodes the queued command-FIFO stores (the processor's stores only queue); the raster unit sets each draw up and walks its primitives into 2x2 quads; a pool of workers (`[graphics] threads`, default 2) walks, shades and stores filled triangles and stores every other fragment, one screen tile at a time; and the display composes each whole frame from board memory (64-bit words, as main memory is: a field is a bit range of its word, read by shift and mask with no byte order, `vram.rs`) as the scan-out registers describe it, counts the retrace and presents the window at 60 Hz. No board-wide lock: the front end owns its state, an access that needs the drawing is answered busy until it is done, the display FIFO (PB&J's register file) has its own lock and never waits for the drawing (`display_fifo.rs`), and the display reads board memory while it is drawn, as the board's own scan-out does; nobody tracks which rows changed. The raster thread sets primitives up and writes each as one command in a ring of 64-byte slots (`pipe/ring.rs`): a triangle's record and bounding box, a quad it shaded itself (lines, points), or a clear's rectangle; the slot's index goes on the queue of every screen tile (`[graphics] tile`, default 32 pixels) it touches. A worker takes a ready tile and owns it until its queue is empty, walking each triangle within the tile and shading and storing quad by quad, so every pixel sees its fragments in command order with no other ordering, and the depth pre-test reads depth its own tile stored. A slot is retired once all its tiles have run it. The raster thread drains the ring before any other work on board memory (a texture upload waits for the shader alone). A completion (a fence's token, a query's words) does not drain: it rides the ring and runs once the ring retires past the quads queued before it. A quad's four pixels are lanes: the walk's depth, the texture unit's positions and the colour weights run on the host's SIMD unit (`fearless_simd`, `pipe/lanes.rs`, the level detected at start-up), bit for bit the scalar arithmetic. When its queue runs dry the raster thread does not drain: it keeps one count of the raster unit's pending jobs for the quads still in flight, and a front-end wait or a refused processor read asks it to store them. `IRIS_ODSY_SHADER=inline` makes the raster thread shade every quad itself, and `IRIS_ODSY_BACKEND=inline` stores on the raster thread with no pool. The texture registers a draw reads live in an array of draw state slots (`pipe/slot.rs`): the front end writes the current slot, a draw latches it and holds it until its job is given back, and a write while a queued draw holds the current slot first copies it to a free one, so the stages read their draw's registers with no lock |
| `odyssey-work`, `odyssey-raster`, `odyssey-pool-N` | VPro: the front end decodes the queued command-FIFO stores (the processor's stores only queue); the raster unit sets each draw up and walks its primitives into 2x2 quads; a pool of workers (`[graphics] threads`, default 2) walks, shades and stores filled triangles and stores every other fragment, one screen tile at a time; and the display composes each whole frame from board memory (64-bit words, as main memory is: a field is a bit range of its word, read by shift and mask with no byte order, `vram.rs`) as the scan-out registers describe it, counts the retrace and presents the window at 60 Hz. No board-wide lock: the front end owns its state, an access that needs the drawing is answered busy until it is done, the display FIFO (PB&J's register file) has its own lock and never waits for the drawing (`display_fifo.rs`), and the display reads board memory while it is drawn, as the board's own scan-out does; nobody tracks which rows changed. The raster thread sets primitives up and writes each as one command in a ring of 64-byte slots (`pipe/ring.rs`): a triangle's record and bounding box, a quad it shaded itself (lines, points), or a clear's rectangle; the slot's index goes on the queue of every screen tile (`[graphics] tile`, default 32 pixels) it touches. A worker takes a ready tile and owns it until its queue is empty, walking each triangle within the tile and shading and storing quad by quad, so every pixel sees its fragments in command order with no other ordering, and the depth pre-test reads depth its own tile stored. A slot is retired once all its tiles have run it. The raster thread drains the ring before any other work on board memory (a texture upload waits for the shader alone). A completion (a fence's token, a query's words) does not drain: it rides the ring and runs once the ring retires past the quads queued before it. A quad's four pixels are lanes: the walk's depth, the texture unit's positions and the colour weights run on the host's SIMD unit (`fearless_simd`, `pipe/lanes.rs`, at the level `host_simd.rs` detects once, which the JITs' targets also follow), bit for bit the scalar arithmetic. When its queue runs dry the raster thread does not drain: it keeps one count of the raster unit's pending jobs for the quads still in flight, and a front-end wait or a refused processor read asks it to store them. `IRIS_ODSY_SHADER=inline` makes the raster thread shade every quad itself, and `IRIS_ODSY_BACKEND=inline` stores on the raster thread with no pool. The texture registers a draw reads live in an array of draw state slots (`pipe/slot.rs`): the front end writes the current slot, a draw latches it and holds it until its job is given back, and a write while a queued draw holds the current slot first copies it to a free one, so the stages read their draw's registers with no lock |
| `kona-hip`, `kona-tile-N` | InfiniteReality (KONA): the processor's stores to the pipe only queue in a ring (`src/dev/kona/mod.rs`); `kona-hip` takes them in order under the pipe lock, frames the commands and runs the back end inline, so the front end's state needs no lock of its own. A draw is set up on `kona-hip` and its job goes on the index queue of every screen tile it touches (`[graphics] tile`); `kona-tile-N` workers (`[graphics] threads`; none means `kona-hip` runs the tiles itself) each take a ready tile and own it until its queue is empty, so every pixel sees its work in command order. `kona-hip` drains the tiles before any other use of the pixel store. The display refresh thread (`Display-Refresh`, section 7) runs the board at 60 Hz and, at each retrace, completes the retrace requests made since the last one (through the display handle, not the pipe lock); it composes the whole frame from the store and the display tables when drawing finished since the last frame, a screenshot or frame is wanted, or six frames have passed |

With VPro's wgpu raster selected, GPU memory is authoritative. CPU geometry,
Expand Down
26 changes: 26 additions & 0 deletions HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,32 @@ replaced). The file holds only what differs from the machine's defaults, with ea
slot it took. It is not validated, so run `--validate` on the result. Example: `iris --machine octane_ip30 --device hostserial@serial1,path=/dev/ttyUSB0 --config-dump octane.toml`.
In the monitor, `config show` and `config dump PATH` do the same for the running machine.

### Building a configuration in the terminal

`iris --tui` opens a configuration builder in the terminal. It starts in a file browser over the `.toml` files of
the current directory; `iris --tui --config FILE` opens `FILE` straight away, or starts a new one there when it does
not exist.

- **Files.** Enter opens a file or a directory, Backspace goes up, `n` makes a new file after asking which machine it
is for. A file written in older spellings is converted as it is read, and the builder lists the keys it converted.
A file iris cannot read shows iris's reason; `e` opens its text in your editor to fix it.
- **Slots.** The machine's slots as a tree, with what is in each: the file's own entries in yellow, the machine's
defaults dimmed, and what an empty slot takes. Enter on an empty slot offers the device types that fit it; Enter on a
device edits its entry (a default becomes an entry of the file). `d` removes an entry, or leaves a default's slot
empty. An entry that finds no slot, after a change of machine for instance, is listed in red at the end.
- **Entries.** A form with the type's keys. A value is TOML when it reads as TOML, else a string, so a path needs no
quotes; ←/→ steps through the values of a key that has few, and `b` picks a file for the value. An entry iris
could not place is refused with the reason.
- **Checks.** Under the tree, what a run would stop at (missing disk images, ports in use) and its warnings, kept up to
date as you edit.
- `m` changes the machine, `e` edits the whole file as text in `$VISUAL` or `$EDITOR`.
- `s` saves, `S` saves under another name. A save writes the current spellings and only what differs from the
machine's defaults; comments are not kept, so the first save over a file keeps the original as `FILE.bak`.
- `r` runs. Paths in a configuration are relative to the directory iris runs from, so choose it: the current
directory, the file's directory or the iris checkout above them. The builder offers to save first and shows what
the run would stop at, then closes; the machine starts as it would from the file, and the terminal becomes the
monitor console.

```toml
# ── Top-level scalars (must come before any [section]) ───────────────────────

Expand Down
33 changes: 30 additions & 3 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3999,6 +3999,11 @@ pub struct Cli {
#[arg(long = "config-dump", value_name = "FILE")]
pub config_dump: Option<String>,

/// Build the configuration in a terminal UI (open, convert, edit and save iris.toml files), then run it; the other
/// options change the first file it opens
#[arg(long, default_value_t = false)]
pub tui: bool,

/// Additional ISO images for CD-ROM ID 4 (can be specified multiple times)
#[arg(long = "cdrom4-extra", value_name = "ISO")]
pub cdrom4_extra: Vec<String>,
Expand Down Expand Up @@ -4383,7 +4388,7 @@ pub fn load_config() -> (MachineConfig, u32) {
// against the wrong cwd, and silently booting a default machine instead
// (different disks, no DaynaPort, whatever they configured) wastes a run
// before anyone notices.
if cli.config != DEFAULT_CONFIG && !std::path::Path::new(&cli.config).exists() {
if !cli.tui && cli.config != DEFAULT_CONFIG && !std::path::Path::new(&cli.config).exists() {
eprintln!("Configuration error: --config {} does not exist", cli.config);
std::process::exit(1);
}
Expand All @@ -4407,8 +4412,11 @@ pub fn load_config() -> (MachineConfig, u32) {
std::process::exit(crate::validate_config::report(&cli.config, &cfg));
}

let toml_cfg = MachineConfig::load_toml(&cli.config);
let mut cfg = cli.apply(toml_cfg);
let mut cfg = match cli.tui {
// The builder applies the command line to the file it opens; a quit ends the process here.
true => tui_config(&cli),
false => cli.apply(MachineConfig::load_toml(&cli.config)),
};
if let Err(e) = cfg.resolve_slots() {
eprintln!("Configuration error: {e}");
std::process::exit(1);
Expand Down Expand Up @@ -4438,6 +4446,25 @@ pub fn load_config() -> (MachineConfig, u32) {
(cfg, scale)
}

/// The config `iris --tui` builds, or the process ends: on a quit, or when the build has no builder.
fn tui_config(cli: &Cli) -> MachineConfig {
#[cfg(feature = "tui")]
match crate::tui::run(cli) {
Ok(Some(cfg)) => return cfg,
Ok(None) => std::process::exit(0),
Err(e) => {
eprintln!("iris: --tui: {e}");
std::process::exit(1);
}
}
#[cfg(not(feature = "tui"))]
{
let _ = cli;
eprintln!("iris: --tui needs a build with the tui feature");
std::process::exit(1);
}
}

/// Parse a CIDR string like "192.168.5.0/24" and return
/// `(gateway_ip, client_ip, netmask)` where gateway=host .1, client=host .2.
///
Expand Down
Loading
Loading