A high-performance GPU renderer that directly outputs to DRM framebuffer for maximum efficiency. This project demonstrates optimized rendering from GPU to display using wgpu and Linux DRM APIs with double-buffering and hardware page flipping.
- Direct GPU to DRM framebuffer rendering
- Double-buffered presentation with hardware page flipping
- High-performance optimized rendering pipeline
- Real-time FPS monitoring with instantaneous and average metrics
- Frame time analysis with min/max tracking
- Zero-copy memory operations where possible
- Vulkan backend for maximum performance
- Clean, production-ready codebase
- Linux system with DRM support
- Vulkan-capable GPU and drivers
- Root access or proper DRM device permissions
- Rust 1.70+ with Cargo
-
Build the project:
./build.sh
Or manually:
cargo build --release
-
Check DRM permissions:
./check_permissions.sh
-
Run the renderer:
sudo ./target/release/wgpu-drm
The renderer provides detailed performance metrics:
Frame 120: Instant FPS: 142.7, Average FPS: 145.2, Frame time: 7.01ms (min: 6.89ms, max: 8.45ms)
- Instant FPS: Real-time performance based on recent frame times
- Average FPS: Overall performance since startup
- Frame Time: Current frame rendering duration
- Min/Max: Performance variance analysis
The renderer typically achieves high frame rates on modern hardware, with performance depending on GPU capabilities and display resolution. The optimized pipeline runs without artificial frame rate limiting for maximum throughput.
main.rs- Clean entry point with production-ready initializationdrm_surface.rs- DRM device management, buffer allocation, and page flippingrenderer.rs- WGPU rendering pipeline with advanced FPS trackingtexture.rs- Texture loading utilitiesshaders.wgsl- Vertex and fragment shaders
The renderer implements:
- Double-buffered DRM surface with mapped memory
- Hardware page flipping for smooth presentation
- Efficient GPU texture-to-buffer copying
- Advanced FPS calculation with sliding window analysis
- Minimal memory allocations in the render loop
- Optimized command buffer submission
- Real-time performance monitoring
Permission Issues:
- Run with
sudoor add user tovideogroup - Check
/dev/dri/card*device permissions
No Display Output:
- Verify GPU supports Vulkan
- Check DRM device availability
- Ensure display is connected and active
Build Issues:
- Update Rust:
rustup update - Check Vulkan drivers are installed
MIT