michaelmelanson / michaelmelanson/panda-os
GPU-accelerated composition (virtio-gpu 3D / virgl)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Summary
Add virtio-gpu 3D (virgl) support to offload window composition to the host GPU. Currently the compositor does CPU-side pixel-by-pixel alpha blending, which is slow for overlapping windows with transparency.
See plans/virtio-gpu-3d-composition.md for the full design.
Current state
- Virtio GPU 2D is working: surface blit, fill, flush operations
- Window composition (alpha blending, z-ordering) is done in software on the CPU
- Each frame redraws all visible pixels, even for static content
- No 3D context or virgl support
Desired behaviour
- Initialize a virtio-gpu 3D context with virgl
- Each window surface becomes a virgl texture
- Composition uses GPU shaders: textured quads with alpha blending
- Only re-compose when window content or layout changes (damage tracking)
- Significant reduction in CPU time spent on composition
Key components
- Virgl context creation: Negotiate 3D capabilities with virtio-gpu, create a virgl rendering context
- Texture management: Upload window surfaces as virgl textures, update on damage
- Composition shader: Simple fragment shader that samples window textures and blends with alpha
- Damage tracking: Only re-compose regions that changed (dirty rectangles)
- Scanout: Present the composed framebuffer to the display
Key files
panda-kernel/src/drivers/virtio_gpu/— extend with 3D/virgl support- Compositor code (wherever window composition happens)
plans/virtio-gpu-3d-composition.md— detailed design document
Implementation notes
- Virtio-gpu 3D uses the
VIRTIO_GPU_CMD_CTX_*andVIRTIO_GPU_CMD_SUBMIT_3Dcommands - Virgl encodes OpenGL commands into a command stream sent to the host
- The host uses the virgl renderer library to execute GL commands
- QEMU must be started with
virtio-gpu-gldevice (not justvirtio-gpu) - Need to handle fallback to 2D composition if 3D is not available
Testing
- Test 3D context creation and capability negotiation
- Visual test: compose overlapping windows with transparency, compare screenshot
- Performance test: measure frame time for composition with and without GPU acceleration
- Fallback test: verify 2D composition still works when 3D is unavailable
- Run existing window/surface tests to verify no regressions
Documentation
- Document the virgl command stream format
- Document the composition pipeline (texture upload → shader → scanout)
- Document QEMU configuration for 3D support
- Update any GPU driver documentation
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading plans/virtio-gpu-3d-composition.md and inspecting panda-kernel/src/drivers/virtio_gpu/. Locate the compositor code and existing window/surface tests, then use the design and listed 3D, visual, performance, and fallback tests to define completion. Done means virgl composition works when available and 2D composition remains functional otherwise.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics, operating-systems, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100