Files
punktfunk/crates/lumen-host
enricobuehler e3876c0d8a feat: M2 zero-copy — PipeWire dmabuf negotiation + EGL device-platform import (WIP)
Wire the capture side of zero-copy (LUMEN_ZEROCOPY=1):

- EGL importer now opens the headless EGLDisplay on the NVIDIA EGL device
  (EGL_PLATFORM_DEVICE_EXT) and queries its importable DRM modifiers
  (eglQueryDmaBufModifiersEXT).
- The PipeWire stream advertises a BGRx dmabuf format with those modifiers as a
  mandatory enum Choice + a dmabuf-only Buffers param; the compositor fixates an
  importable tiled modifier. param_changed reads the negotiated modifier; the
  process callback imports the dmabuf (eglCreateImage with explicit LO/HI
  modifier) and would copy it into a CUDA buffer for the encoder.

Validated against headless KWin (Plasma 6.4): negotiation succeeds (13 NVIDIA
modifiers advertised, KWin fixates one, stream reaches Streaming with a real
tiled dmabuf) and `eglCreateImage` succeeds. The remaining blocker is
`cuGraphicsEGLRegisterImage` returning CUDA_ERROR_INVALID_VALUE on the
dmabuf-imported EGLImage — the likely fix is to bind the EGLImage to a GL
texture (glEGLImageTargetTexture2DOES) and register that via
cuGraphicsGLRegisterImage (OBS/Sunshine's path), which needs a GL context.

The CPU-copy path stays the default and is unaffected (regression-checked: real
KWin capture → HEVC). LUMEN_ZEROCOPY is opt-in/experimental until the CUDA
registration lands.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 15:41:31 +00:00
..