Skip to content

feat: BWM split-screen, fart synth, and input fixes#212

Merged
ryanbreen merged 4 commits intomainfrom
feat/btop
Feb 14, 2026
Merged

feat: BWM split-screen, fart synth, and input fixes#212
ryanbreen merged 4 commits intomainfrom
feat/btop

Conversation

@ryanbreen
Copy link
Owner

Summary

  • BWM split-screen rendering: Right half for window manager (tabs, shell, btop), left half preserved for graphics demos (bounce). Per-process display ownership prevents demo crashes.
  • PTY input fix: TCSETS now updates the line discipline, so raw mode actually works — shell input and echo functional in BWM.
  • F-key routing: F1-F10 converted to VT100 escape sequences when BWM owns display (both ARM64 and x86_64).
  • Mouse click tab switching: New mouse_state() syscall exposes button state; BWM polls for clicks and switches tabs on hit.
  • fart: New FM audio synthesis program and libbreenix::synth module.
  • Font/layout: Terminal font scale 1 (~80-col), tab bar scale 2, kernel-matching colors and separator.

Test plan

  • ./run.sh — verify BWM renders on right half, bounce demo works on left
  • Type in BWM shell — verify keystroke echo and command execution
  • F1/F2/F3 — verify tab switching between Shell, Logs, Btop
  • Click tab headers — verify mouse click tab switching
  • Run bounce from BWM shell — verify left-pane graphics demo doesn't crash
  • ./docker/qemu/run-aarch64-boot-test-native.sh — verify boot tests pass

🤖 Generated with Claude Code

ryanbreen and others added 4 commits February 13, 2026 16:00
Add real CPU time tracking to the scheduler:
- Thread struct gains cpu_ticks_total and owner_pid fields
- Scheduler charges elapsed ticks to outgoing thread at context switch
- get_process_cpu_ticks() accessor returns per-PID CPU time including
  in-flight ticks for currently-running threads
- All thread creation paths (create_main_thread, fork, clone) set owner_pid

Update btop monitor tab to show real CPU%:
- Queries scheduler for per-process CPU ticks each refresh cycle
- Computes delta-based CPU% with one decimal place (e.g., "1.5%")
- Includes heap_size in per-process memory display (code+heap+stack)

Update /proc/[pid]/status CpuTicks to read from scheduler instead of
the stale process.cpu_ticks field.

Add BWM handoff document (docs/planning/BWM_HANDOFF.md) describing
architecture for replacing kernel terminal manager with userspace
window manager.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add give_back_display syscall (432) that reactivates the kernel terminal
manager after userspace releases the display. This enables crash recovery:
when BWM dies, init calls give_back_display before respawning.

Update sys_fbmmap to return full-screen mapping when userspace has taken
over the display via take_over_display, and left-pane-only otherwise.

Update init to spawn BWM as primary UI with crash recovery:
- Spawns /bin/bwm instead of /bin/bsh directly
- Falls back to /bin/bsh after MAX_RAPID_FAILURES BWM crashes
- Calls give_back_display on BWM exit to restore kernel terminal

Add libbreenix::graphics::give_back_display() wrapper.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… switch

Adds tracing hooks to ARM64 code paths so SYSCALL_TOTAL, TIMER_TICK_TOTAL,
and CTX_SWITCH_TOTAL counters show real values on ARM64 (previously always 0).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
BWM Window Manager:
- Render BWM on right half only (per-process display ownership via
  has_display_ownership flag on Process struct)
- Left pane reserved for graphics demos (bounce), right pane for BWM
- Flush copies offset by x_offset for correct framebuffer positioning
- Match kernel terminal_manager colors and tab layout exactly
- Font scale 1 for terminal content (compact ~80-col), scale 2 for tabs
- Add separator line, padding, and proper terminal area calculation
- Fix stair-stepping newlines (LF now implies CR)
- Add TIOCSWINSZ to inform PTY children of terminal dimensions
- Add mouse click tab switching (poll mouse_state syscall)
- Add hit_test_tab_bar for click-to-tab-switch support

Kernel fixes:
- PTY TCSETS now updates line discipline (was only updating pair.termios,
  so raw mode never took effect for input processing)
- F-keys routed to userspace as VT100 escape sequences when display is
  inactive (both ARM64 keycode_to_escape_seq and x86_64
  scancode_to_fkey_escape)
- sys_get_mouse_pos extended to return button state ([x, y, buttons])
- sys_take_over_display sets per-process has_display_ownership flag

New programs:
- fart: FM audio synthesis tool for Breenix audio subsystem
- synth module in libbreenix for audio waveform generation

Co-Authored-By: Ryan Breen <rbreen@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ryanbreen ryanbreen merged commit 99a5796 into main Feb 14, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant