libdrmtap
Safe Rust wrapper for libdrmtap — DRM/KMS screen capture for Linux.
Capture the screen at the kernel level: login screens, Wayland, headless — no user prompts.
⚠️ Testing Status
Verified on
virtio_gpu(QEMU/Parallels VMs), Intel Meteor Lake (i915, dual 4K, EGL CCS detiling), and NVIDIA Jetson Orin Nano (nvidia-drm, Wayland).The AMD (
amdgpu) backend is implemented but not yet validated on real hardware. If you test it, please report results.
Installation
[]
= "0.3"
This pulls in libdrmtap-sys 0.4.3, which embeds and statically compiles the C
sources (and the privilege helper) — no system libdrmtap install needed.
Example
use DrmTap;
Features
DrmTap::open()— auto-detect GPU and displaygrab()— zero-copy DMA-BUF fd (for hardware encoders)grab_mapped()— mmap'd pixel data (for software access)get_cursor()— cursor position + ARGB imagelist_displays()— enumerate connected monitorsdisplays_changed()— hotplug detection
Requirements
- Linux with DRM/KMS (kernel 4.20+ for the tiled/modifier path; linear/VM framebuffers work on older kernels)
- A C compiler —
libdrmtap-syscompiles its embedded C sources statically, so there is no systemlibdrmtapinstall required - For unprivileged capture:
drmtap-helperwithcap_sys_admin+ep(the helper binary is built bylibdrmtap-sys)
License
MIT