Skip to content

Conversation

@ryanbreen
Copy link
Owner

Summary

  • 2D Graphics Primitives (Phase 3): Add core drawing primitives module with Canvas trait abstraction
  • xtask QEMU Isolation: Fix multi-worktree support by replacing global pkill with per-worktree PID tracking

Graphics Primitives

Added kernel/src/graphics/primitives.rs with:

  • Core types: Color, Point, Rect
  • Canvas trait for drawing surface abstraction
  • Drawing functions: draw_line, draw_hline, draw_vline, draw_rect, fill_rect, draw_circle, fill_circle
  • Optimized Bresenham's line algorithm and midpoint circle algorithm
  • Bounds checking and clip-to-canvas utilities
  • Canvas implementation for ShellFrameBuffer
  • 4 unit tests with comprehensive edge case coverage

xtask QEMU Isolation

Replaced all 6 instances of pkill -9 qemu-system-x86_64 with worktree-specific PID file tracking:

  • PID files stored at /tmp/breenix-qemu-<worktree-hash>.pid
  • Hash derived from current working directory for uniqueness
  • Allows multiple worktrees to run boot-stages simultaneously
  • Each worktree only kills its own QEMU process

Test plan

  • All 226 boot stages pass
  • xtask builds with zero warnings
  • Graphics primitives compile and link correctly
  • Canvas trait implementation works with ShellFrameBuffer

🤖 Generated with Claude Code

ryanbreen and others added 2 commits January 16, 2026 08:45
Implements Phase 3 of the graphics stack with 2D drawing primitives:

Core types:
- Color struct with RGB support and BGR/RGB pixel format conversion
- Point and Rect structs for geometry
- Canvas trait for abstracted drawing surface

Drawing functions:
- draw_hline/draw_vline: Optimized horizontal/vertical lines
- draw_line: General line drawing using Bresenham's algorithm
- draw_rect: Rectangle outline
- fill_rect: Filled rectangle with row optimization
- draw_circle/fill_circle: Circle using midpoint algorithm

Integration:
- ShellFrameBuffer implements Canvas trait
- draw_test_pattern() demo function for testing

All drawing functions handle bounds checking and clipping automatically.
Coordinates use i32 to allow negative values (clipped at canvas boundary).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace all instances of `pkill -9 qemu-system-x86_64` with worktree-specific
PID file tracking. This allows multiple worktrees to run boot-stages tests
simultaneously without killing each other's QEMU processes.

Changes:
- Add get_qemu_pid_file() to generate unique PID file path per worktree
- Add signal_worktree_qemu() to send signals to specific QEMU process
- Add kill_worktree_qemu() and term_worktree_qemu() helpers
- Add save_qemu_pid() to track QEMU PID on startup
- Replace all 6 pkill calls with worktree-specific PID-based killing

PID files are stored at /tmp/breenix-qemu-<worktree-hash>.pid using
a hash of the current working directory for uniqueness.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ryanbreen ryanbreen merged commit db6d3c6 into main Jan 16, 2026
1 check passed
@ryanbreen ryanbreen deleted the feature/graphics-phase-3 branch January 16, 2026 16:12
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.

2 participants