Hermes-KMS
Hermes-KMS is a Linux DRM/KMS virtual display driver.
It is an EVDI alternative: a virtual display backend that exports the compositor's scanout as a DMA-BUF without driver-side CPU readback. End-to-end zero-copy depends on the consumer's GPU import path; NVIDIA currently uses a CPU-copy fallback in Hermes. Hermes is the reference consumer, but the driver is not tied to it — any program that speaks its DRM ioctl UAPI can consume frames (see Using it in other projects).
Current state
This documentation describes v0.4.1, released on 2026-11-02, with unchanged UAPI v14. See the changelog and the 0.4.1 release notes for fixes, package installation, and validation limits. CI builds passed, but not all GPU/HDR, reboot and multi-session runtime tests have been completed against the release artifacts.
| Area | Implemented behavior and validation limits |
|---|---|
| Capture | Session-authorized DMA-BUF and producer-fence export; end-to-end VAAPI zero-copy validated for linear XRGB8888. Other format/modifier/backend combinations need their own validation. |
| HDR | ACQUIRE_FRAME2 carries frame-associated colour and static HDR10 metadata. Driver/VM tests cover the contract; GPU, encoder and client/display validation remains a separate integration requirement. |
| Runtime displays | Configfs creates cards with per-card modes, identity, HDR and access policy, including a devices=0 runtime-only setup. |
| Concurrent sessions | Multi-output, independent cards and host-compatible session pools are implemented with VM regressions. Real concurrent streaming and input isolation still need product-level validation. |
| Access and brokers | Capture opens use O_RDONLY; private seatd services run with SEATD_VTBOUND=0 so they do not take over the host VT. |
| NVIDIA | Current Hermes uses a CPU scanout copy with hardware conversion/encoding. The separate experimental/nvidia-zero-copy branch contains diagnostic experiments, not a validated replacement path. |
Documentation: driver design, configfs attributes and examples, HDR capture contract, roadmap, and upstream references.
What this is
- A Linux kernel DRM/KMS driver (
hermes_kms.ko). - An EVDI alternative for low-latency screen capture, used by Hermes today.
- A virtual display that exposes independently controlled outputs
(
HERMES-1,HERMES-2, ... for static cards; configurable for runtime cards) which a desktop compositor (KWin/GNOME) drives like a normal monitor. - A zero-copy DMA-BUF source for VAAPI/other hardware encoders.
What this is not
- It is not an EVDI manager or a userspace wrapper around EVDI.
- It is not a render GPU: it exports the compositor's framebuffer; the encode still runs on a real GPU, using direct import or the consumer's copy fallback.
How it works
The compositor owns the card and the capture consumer only reads frames:
- The driver exposes a primary KMS node for the compositor and a render node
(
DRIVER_RENDER) for control/capture without taking DRM master. It provides no hardware rendering engine; compositor adoption depends on its backend. - A userspace owner opens the render node (never the primary node, which would steal DRM master and EBUSY-block the compositor), claims an output, and obtains an opaque session capability.
- The compositor (KWin/GNOME) takes DRM master on the primary node, enables
the now-connected
HERMES-1output, and scans out the desktop into its framebuffer. - The owner hands the capability to a capture fd over an application-defined
trusted channel. The bound fd pulls the current scanout as DMA-BUFs via
ACQUIRE_FRAME2(or legacyACQUIRE_FRAME); the kernel never checks an application or process name. - The consumer imports those DMA-BUFs into a real GPU for conversion/encoding when supported. A fallback may copy the pixels; the kernel export alone does not prove that the complete pipeline is zero-copy.
An earlier KWin/720p measurement was ~8 us/frame for ACQUIRE_FRAME versus
~180 us/frame for EVDI's CPU copy. This measures acquisition overhead, not
end-to-end streaming latency or every GPU/resolution combination.
Using it in other projects
The driver is not Hermes-specific. "Hermes" here is the reference consumer, not a requirement: there is no hard-coded process gating, no exported Hermes-only symbol, and the capture path is a plain DRM ioctl UAPI over the render node. Any userspace consumer — another streaming host such as Apollo/Sunshine, a recorder, or your own tool — can use it by talking the same UAPI, with no fork required:
- Open a candidate render node read-only (
O_RDONLY | O_CLOEXEC) and identify it with the DRM coreDRM_IOCTL_VERSIONioctl (or libdrm'sdrmGetVersion()); require the exact driver namehermes-kmsbefore issuing any Hermes-KMS private ioctl. Private DRM command numbers are driver-local and are not safe device probes. Then useGET_VERSION/GET_CAPS. The current interface is UAPI v14; requireHERMES_KMS_CAP_SESSION_TOKENbefore using the protected capture path, andHERMES_KMS_CAP_SESSION_LIFECYCLEbefore relying on token rotation or binding revocation. - For UAPI v8 multi-output discovery/control, select an available output on
the prospective owner fd with
SELECT_OUTPUT; use one owner fd per simultaneous virtual display. An unselected fd is scoped to the first output, but still needs UAPI v11 authorization for protected operations. - For UAPI v9 independent sessions, discover every Hermes DRM card through
GET_IDENTITY.device_index/device_countand give each compositor a different primary node. Each card is a separate DRM-master domain. With UAPI v10, prefer cards whose identity role isSESSION; theirsession_indexmaps directly to the packagedhermes-kms-Nseat and broker. Session-role primary nodes are root-only and are opened through that broker; theHOSTcard remains available to the normal desktop. - On an owner fd, call
SET_OUTPUTto claim and configure an available output (this does not take DRM master, so the compositor keeps it), then useSESSION_ACCESS(GET_TOKEN)to retrieve its opaque token and session ID. - Transfer the token through a trusted channel defined by your project. On
each separate capture fd, call
SESSION_ACCESS(BIND)with the output index, token and session ID.BINDselects the active output and authorizes the fd atomically; do not callSELECT_OUTPUTfirst on that capture fd. - A primary-frame-only consumer runs
WAIT_FRAME→ACQUIRE_FRAME2whenHERMES_KMS_CAP_FRAME_COLORis present. The extended acquire associates colour state with the buffer, sequence and fence. LegacyACQUIRE_FRAMEremains available, but cannot safely identify HDR samples. - A consumer that needs the hardware cursor requires
HERMES_KMS_CAP_CURSOR_CAPTURE, waits on both streams withWAIT_UPDATE, acquires the primary frame withACQUIRE_FRAME2(legacyACQUIRE_FRAMEwhen needed) and the cursor withACQUIRE_CURSOR, then waits on their producer fences and composites the cursor in the correct colour space.GET_STATUSandGET_METRICSuse the same binding. - To cut off access without ending the stream, the owner calls
SESSION_ACCESS(ROTATE_TOKEN)— which retires the token while every bound consumer keeps running — orSESSION_ACCESS(REVOKE_BINDINGS), which also drops every binding at once; both needHERMES_KMS_CAP_SESSION_LIFECYCLE. Disabling the output or closing the owner fd still revokes everything and ends the session.
The capability is deliberately generic: the driver neither knows nor accepts an executable name, Steam application ID, UID, TGID, or Hermes-specific credential. This also lets a broker hand capture access to a sandboxed worker without baking that broker's policy into the kernel ABI. Treat the 128-bit token as a secret and do not put it in logs or command lines.
tools/hermes-kmsctl and tools/hermes-kms-import-check are small, self-contained reference consumers you can read or copy. The UAPI is documented in include/uapi/drm/hermes_kms_drm.h and in Userspace communication below.
Runtime cards default to VIRTUAL- output names and a VRT / Virtual KMS
EDID identity. Configfs can change output_prefix, manufacturer,
monitor_name and serial_base without a fork. Static cards retain the
HERMES- prefix; the DRM driver name (hermes-kms) and public HERMES_KMS_
symbols remain the protocol identity regardless of display branding.
The established zero-copy validation is VAAPI with linear XRGB8888.
NVIDIA DMA-BUF import has known correctness issues on the tested configuration;
NVENC through Hermes's CPU-copy path is a different integration. AMF direct
import and NV12/P010 scanout are not validated. HDR advertisement and per-frame
colour metadata are implemented; a consumer must support the
HDR capture contract and validate its conversion, encoder
and client. See the roadmap for remaining work.
The kernel module is GPL-2.0, while the installed UAPI has the Linux syscall-note exception and the optional userspace session helper is MIT-licensed. This keeps an independently developed consumer separate from the Hermes application; see License.
Features
- out-of-tree kernel module:
hermes_kms.ko; - explicit CRTC/encoder/plane modeset with a software vblank timer, so the compositor composes the virtual output at its full refresh (60/120/144 Hz);
- cursor plane so the compositor offloads pointer motion, plus a separately sequenced cursor-capture stream for consumers that composite it themselves;
- damage tracking (
FB_DAMAGE_CLIPS) forwarded to the capture consumer viaACQUIRE_FRAME; - render node for masterless, zero-copy frame consumption;
- synthetic EDID 1.4 so compositors treat
HERMES-1as a normal continuous-frequency monitor, with range limits derived from the configured mode envelope; - 1–8 independent outputs on one DRM card (
outputs=, default 1 for compatibility), with separate KMS pipelines, sessions, frame channels, and EDID serials; - runtime card creation through configfs
(
mkdir /sys/kernel/config/hermes-kms/<name>), so a host adds and removes virtual displays on demand instead of drawing from a pool fixed at module load. Role and session index are settable before the card exists, so a dynamic card lands on the same seat and broker a pool card would, and thecard/render_nodeattributes report the nodes it received. Runtime cards also support per-card display profiles and generic/custom EDID identity; - per-card render-node ACLs (
access_uid), so several mutually untrusted consumers can each hold their own card instead of sharing the one uid the packaged pool grants every Hermes node; - 0–8 static DRM cards (
devices=, default 1; 0 for configfs-only use), each with its own DRM-master domain so separate compositors can back separate graphical sessions. The legacydevices=N outputs=1layout remains available; - UAPI v10 automatic session pools (
session_devices=1..8). A pool adds one host card that remains on seat0 plus the requested private cards, so the existing host-desktop path and isolated sessions can coexist without reloading the module. The core package defaults to no private cards; the optional setup helper defaults to four inert session cards. Scanout buffers are allocated only while a client owns a card; - role-aware udev rules map only private cards to stable
hermes-kms-1..8seats and ask systemd to start the matching private seat broker automatically; - exact requested mode synthesized from CVT timings and re-probed on
SET_OUTPUT, preserving non-eight-aligned visible widths such as 854 pixels while keeping the framebuffer pitch independently aligned for DMA-BUF; - eight- and ten-bit scanout formats (
XRGB8888/ARGB8888and the2101010variants), with the advertised EDID depth selected bycolor_depth=; - optional HDR advertisement (
hdr_enable=1, default off), which adds a CTA-861 EDID extension (HDR Static Metadata + BT2020 Colorimetry data blocks) and theHDR_OUTPUT_METADATAandColorspaceconnector properties as one unit, plus UAPI v14ACQUIRE_FRAME2for atomic frame/colour snapshots; see HDR advertisement and the HDR capture contract; - scanout modifier pass-through: any tiled or compressed layout the compositor's
render GPU produces is accepted, and
scanout_modifiers=publishes the extra layouts anIN_FORMATS-driven compositor can negotiate; - DMA-BUF export of the tracked scanout framebuffer, cached per buffer object;
- real
dma_resvwrite fence exported as a sync_file; - UAPI v11 generic, opaque session-capability handoff between an output owner and one or more capture fds, with no application/process-name coupling;
- token rotation and one-shot revocation of every binding, so an owner can cut off a consumer without tearing down its stream, plus live binding counts and bind/reject/revoke metrics;
- fixed-layout DRM ioctls for frame acquisition, damage, synchronization and metrics, including vblank and late-vblank counters;
- debugfs telemetry at
/sys/kernel/debug/dri/<n>/hermes_kms_stats; - debug/control tool:
tools/hermes-kmsctl/hermes-kmsctl, whoseholdaccepts--control PATHto rotate or revoke the session capability while it runs; - configurable mode envelope, 640x480 through 7680x4320 at up to 240 Hz by
default with 1920x1080 preferred, reported through
GET_CAPSand reflected in the synthetic EDID's range limits; - optional reported physical panel size, so a compositor can derive a scale.
Build
Install matching kernel headers first. The default target builds only the kernel module and therefore does not require the optional diagnostic-tool libraries:
On CachyOS/Arch-like systems:
make
To build the module and every diagnostic userspace tool, install the libdrm, VAAPI, GBM, EGL and OpenGL development packages, then run:
make full
Clean:
make clean
The userspace regression checks run without loading the driver — no kernel build, no root and no hardware — and are what CI runs on every push:
make check
make check-hdr-build
That covers check-uapi (public struct sizes, alignment-sensitive offsets and
encoded ioctl values, so a newly compiled 32-bit client sees the same ABI as a
64-bit one), check-session (the file-backed CLI credential transport),
check-edid (the generated EDID bytes, both block checksums and the published
EDID length) and check-edid-conformity (the same bytes through a real
parser). Each can also be run on its own. check-uapi and check-session need
libdrm's pkg-config metadata, and both SKIP their 32-bit half when no multilib
compiler is available; check-edid-conformity SKIPs cleanly when edid-decode
(v4l-utils) is not installed.
check-hdr-build compiles the DRM/HDR integration tests without running them.
CI also builds the optional tools, checks staged installation and packaged
configuration, and compiles the module against Arch rolling, Ubuntu LTS and
Fedora headers. These build checks do not exercise a loaded driver, compositor
or hardware encoder. The runtime scripts below belong in a disposable VM or
explicitly prepared test host.
Install
The Arch/CachyOS build produces a DKMS package with the host access policy and
an optional seatd package for private session cards:
makepkg -s
sudo pacman -U ./hermes-kms-dkms-git-*.pkg.tar.zst
The default load creates one seat0 host card. Its render node remains owned by
root and gets a read-only logind uaccess ACL for the active local desktop
user. Hermes-KMS control and capture ioctls work through an O_RDONLY fd. The
restricted open mode is intentional: Chromium/Electron probe candidate GPUs
with O_RDWR, so they skip this capture-only render node instead of selecting
it as the system's renderer. Upgrade capture consumers with this policy (older
clients that still open Hermes-KMS with O_RDWR receive EACCES). For a
private pool, install the optional broker package and configure the intended
consumer. The setup helper stores that UID and grants it only the private
read-only render-node ACLs, without udev's deprecated non-system OWNER
assignment:
sudo pacman -U ./hermes-kms-seatd-git-*.pkg.tar.zst
sudo /usr/lib/hermes-kms/hermes-kms-setup configure --user auto
The split packages are hermes-kms-dkms-git (module, core runtime policy and
public headers) and hermes-kms-seatd-git (private brokers and setup helper).
The -git PKGBUILD fetches the default branch; it does not pin a release tag.
Build optional diagnostic tools separately with make tools; the packages do
not install the hermes-kmsctl executable. If the helper is missing, check
pacman -Q hermes-kms-seatd-git and install the broker package above.
Native Fedora and Ubuntu packages (0.4.1+)
The release also builds native Fedora RPM and Ubuntu/Debian DEB
packages. Each distribution has a DKMS core package
(hermes-kms-dkms) and an optional private-session broker
(hermes-kms-seatd). Package versions and UAPI match the Arch release;
neither host Hermes nor libvirtualhid is a dependency of the driver package.
On Ubuntu/Debian, install the attached .deb files using apt:
sudo apt install ./hermes-kms-dkms_0.4.1-1_all.deb
# Optional isolated session brokers:
sudo apt install ./hermes-kms-seatd_0.4.1-1_all.deb
On mutable Fedora Workstation, use the RPMs matching your Fedora release:
sudo dnf install ./hermes-kms-dkms-0.4.1-1.fc44.noarch.rpm
# Optional isolated session brokers:
sudo dnf install ./hermes-kms-seatd-0.4.1-1.fc44.noarch.rpm
Install kernel headers/devel files matching the target kernel before the
DKMS build. Confirm dkms status -m hermes-kms reports the module installed
for that kernel and reboot after upgrading an already loaded driver. Missing
headers, module signing under Secure Boot and package installation are separate
checks. On Bazzite/bootc or other immutable images, use the image-based method
below rather than a normal RPM/DKMS install.
The package inventory, checksums, versioning, install gates and intended
integration contract for a Hermes ecosystem installer are documented in
docs/installer-contract.md. make tools builds
optional diagnostics; the native DKMS packages do not bundle hermes-kmsctl.
For a source installation, sudo make dkms-install installs the core policy.
Use sudo make INSTALL_BROKER=1 dkms-install to install the optional private-seat
helper. If an older module topology is already loaded, the helper saves the new
configuration and asks for one reboot instead of forcibly unloading a card a
compositor may hold.
If you installed the temporary 99-hermes-kms-uaccess.rules workaround from
issue #6, remove it; it matches private render nodes too and would override
their restricted access policy.
Image-based systems (Bazzite and compatible bootc/ostree images)
The repository provides a build-time image integration instead of a runtime
DKMS workflow for a read-only /usr. Distribution-specific mechanisms such as
akmods are separate integrations; the Containerfile is a Bazzite/Fedora example,
not a universal Silverblue or SteamOS installer.
packaging/bazzite/Containerfile does that: it compiles hermes_kms.ko against
the image's kernel and installs it to /usr/lib/modules/<kver>/extra, which is
where akmods and the ublue-os kmod images put theirs.
podman build -t localhost/bazzite-hermes:latest -f packaging/bazzite/Containerfile .
sudo bootc switch --transport containers-storage localhost/bazzite-hermes:latest
Build from the image the machine already runs: rpm-ostree status names it, for
example ghcr.io/ublue-os/bazzite:stable. The Containerfile defaults to
ghcr.io/ublue-os/bazzite:latest; pass --build-arg BASE_TAG=…, and
--build-arg BASE_IMAGE=… for another variant such as
ghcr.io/ublue-os/bazzite-gnome, to match it.
Run the build and switch with access to the same Podman image store (for example,
use sudo podman build if sudo bootc cannot see a rootless build). Reboot into
the new image and the module autoloads. Rebuild and redeploy the derived image
for kernel updates; publishing it once does not automatically track base-image
changes. See the bootc references.
Packages layered with rpm-ostree install do not carry over. bootc switch
deploys the image exactly as built, so a Hermes installed that way is gone after
the reboot, without a warning. Layer it again on the new image and reboot once
more:
rpm-ostree install ./hermes-*.rpm
Hermes opens the driver's render node through the udev uaccess rule, which
grants it to the user logged in at the machine. Until someone logs in to the
desktop, Hermes reports Hermes-KMS as unavailable; a machine meant to stream
from boot needs automatic login.
The Containerfile defaults to WITH_SEAT_BROKER=1; pass
--build-arg WITH_SEAT_BROKER=0 for core-only installation. After a broker-enabled
installation, run the same setup helper to configure the private pool.
Secure Boot. If the target enforces trusted module signatures, an unsigned module will not load. Enroll a signing certificate through the distribution's supported workflow, then pass its matching key and certificate to the build:
podman build \
--no-cache \
--secret id=module_sign_key,src=/path/to/MOK.priv \
--secret id=module_sign_cert,src=/path/to/MOK.der \
-t localhost/bazzite-hermes:latest -f packaging/bazzite/Containerfile .
Both secrets are required together. They are mounted only in the discarded build stage and are never copied into the build context or final image.
Alternatively, disable Secure Boot in firmware. Signing alone does not enroll the certificate; see the kernel module-signing reference.
The two Makefile targets behind it work for any image build, not only Bazzite:
make modules KERNELRELEASE=<kver> KDIR=/usr/lib/modules/<kver>/build
make modules-install install-configs KERNELRELEASE=<kver> DESTDIR=/
modules-install places the module and runs depmod; install-configs adds the
module options, the autoload entry, the session-seat udev rule and the seatd
helper under /usr, so they survive on a read-only root. On a staging DESTDIR
with no full module tree depmod is skipped with a note rather than failing —
run depmod -a <kver> on the target in that case.
Local test commands
Loading an unsigned experimental kernel module can destabilize the session. Use
this only on a test machine. Two ways to drive the output are described below:
compositor-driven (real streaming) and isolated modetest (driver validation).
Inspect the driver with the control tool while it is loaded:
sudo insmod kernel/hermes-kms/hermes_kms.ko initial_enabled=0 outputs=2
sleep 1
tools/hermes-kmsctl/hermes-kmsctl version
tools/hermes-kmsctl/hermes-kmsctl outputs
tools/hermes-kmsctl/hermes-kmsctl identity
tools/hermes-kmsctl/hermes-kmsctl --output 2 identity
tools/hermes-kmsctl/hermes-kmsctl caps
tools/hermes-kmsctl/hermes-kmsctl status
tools/hermes-kmsctl/hermes-kmsctl --verbose status
ls -l /dev/dri/
modetest -c
drm_info
journalctl -k -g hermes-kms
sudo scripts/hermes-kms-unload
A desktop compositor or Xwayland may keep the DRM card open after Hermes exits,
even when its connector is disconnected. hermes-kms-unload first unbinds the
cards (which sends a device-removal event), waits briefly, and then removes the
module. If a process keeps an old descriptor open, the script leaves the cards
detached and reports the earlier openers; close that process and rerun it. Use
sudo hermes-kms-rebind to restore detached cards without rebooting. Configfs
cards must be removed by their creator before unloading.
Active output state and capture are capability-protected. For command-line diagnostics, keep an owner running in one terminal and publish its credential to a same-UID, mode-0600 file under the user's runtime directory:
session_file="${XDG_RUNTIME_DIR:?}/hermes-kms-session"
tools/hermes-kmsctl/hermes-kmsctl --output 1 \
--session-file "$session_file" hold 1920x1080@60
While that command holds the owner fd open, use the file from another terminal:
session_file="${XDG_RUNTIME_DIR:?}/hermes-kms-session"
tools/hermes-kmsctl/hermes-kmsctl --session-file "$session_file" status
tools/hermes-kmsctl/hermes-kmsctl --session-file "$session_file" metrics
tools/hermes-kmsctl/hermes-kmsctl --session-file "$session_file" wait 0 1000
tools/hermes-kmsctl/hermes-kmsctl --session-file "$session_file" \
frame --require-dmabuf --sync-file
hermes-kmsctl removes its diagnostic credential file when the owner exits.
Production consumers should normally transfer the token in memory over their
own trusted IPC rather than writing it to disk.
Optional initial mode/state parameters:
sudo insmod kernel/hermes-kms/hermes_kms.ko initial_width=1920 initial_height=1080 initial_refresh_hz=60
sudo insmod kernel/hermes-kms/hermes_kms.ko initial_enabled=1
sudo insmod kernel/hermes-kms/hermes_kms.ko initial_enabled=0 outputs=2
sudo insmod kernel/hermes-kms/hermes_kms.ko initial_enabled=0 devices=2 outputs=1
sudo insmod kernel/hermes-kms/hermes_kms.ko initial_enabled=0 session_devices=4 outputs=1
HDR advertisement
hdr_enable=1 (default off, load-time only) makes the output advertise HDR. It
gates every mechanism together, so the output never advertises a subset: the
CTA-861 HDR Static Metadata and BT2020 Colorimetry data blocks in the EDID, and
the HDR_OUTPUT_METADATA and Colorspace connector properties. All of them are
needed because compositors gate HDR behind a chain rather than a single signal;
docs/driver-design.md walks through the KWin integration
used when implementing that chain and why each mechanism is load-bearing.
sudo modprobe hermes_kms hdr_enable=1
To apply it at every module load, drop a file in /etc/modprobe.d:
# /etc/modprobe.d/hermes-kms-hdr.conf
options hermes_kms hdr_enable=1
For a ten-bit HDR10 setup, use hdr_enable=1 color_depth=10 together and keep
the normal initial_enabled=0 owner-controlled lifecycle. Store the HDR options
in a separate /etc/modprobe.d/hermes-kms-hdr.conf and reboot if the module is
already loaded. Configfs cards can set the same options before card creation.
UAPI v14 implements the capture side: HERMES_KMS_CAP_FRAME_COLOR advertises
ACQUIRE_FRAME2, which returns the frame and its committed colour/HDR metadata
as one snapshot. Colour-only changes advance the frame sequence and invalidate
damage. The old ACQUIRE_FRAME deliberately remains colour-blind and
binary-compatible; querying current connector properties separately is not a
safe replacement for frame-associated metadata.
Advertisement still does not activate HDR: the compositor chooses PQ/BT.2020. Ten-bit storage alone is not HDR. The driver preserves RGB pixels and static HDR10 metadata; it performs no RGB-to-P010 conversion, tone mapping or encoding. A compatible consumer must do those steps and signal its client correctly. See docs/hdr-capture.md for flags, units, cursor constraints, tests and end-to-end release gates, and Hermes's integration guide for that consumer's setup and GPU paths.
Private session brokers
Independent compositors use the packaged
72-hermes-kms-session-seats.rules and one private seat broker per session
device. The udev rule starts those instances as cards appear; users no longer
enable N units or join the seat group manually. hermes-kms-setup records
the Hermes service uid, removes persistent broker enablement left by older
prototype instructions, stops instances outside the configured pool, and
restarts the required brokers with sockets owned by that user.
The sockets are exposed as
/run/hermes-kms-seatd/1/seatd.sock,
/run/hermes-kms-seatd/2/seatd.sock, and so on. Each service runs the stock
seatd daemon inside its own mount namespace because the daemon has a
compile-time socket path and only permits one active compositor per daemon.
The packaged service sets SEATD_VTBOUND=0: private sessions have no host VT,
and allowing seatd to bind one can switch a startx desktop to text mode.
Keep the packaged setting when overriding or copying the service. The launcher
creates a private mount namespace even when invoked directly; that alone does
not set the service's VT environment for a hand-written launch command.
The pool's host-role card stays on seat0, so existing KWin/GNOME use is
unchanged. These private brokers are experimental session plumbing, not a
security boundary between mutually untrusted local users.
There are two ways to drive the output, for two different purposes.
Compositor-driven (real streaming)
This is the normal owner-controlled path. Load the module disconnected, then hold an output from the render node and let the desktop adopt its hotplug:
sudo modprobe hermes_kms initial_enabled=0
session_file="${XDG_RUNTIME_DIR:?}/hermes-kms-session"
tools/hermes-kmsctl/hermes-kmsctl --session-file "$session_file" hold 1920x1080@60
For an uninstalled source build, use sudo insmod kernel/hermes-kms/hermes_kms.ko initial_enabled=0 instead of modprobe.
The card must stay on the active logind seat so the compositor opens it; do
not install the dev seat-ignore rule for this. The compositor commits a
framebuffer, and the authorized consumer captures it through the render node.
hold calls SET_OUTPUT and keeps the owner fd alive without taking DRM master.
initial_enabled=1 remains available for standalone modeset tests, but it does
not establish the capture owner's authorization.
Isolated modetest (driver validation, no compositor)
To exercise the driver without a compositor, load it connected but silent so
modetest can take DRM master itself:
sudo insmod kernel/hermes-kms/hermes_kms.ko initial_enabled=1 hotplug_events=0
For this path the card must be kept off the compositor's seat, otherwise KWin/Xwayland grab DRM master first. Install the development udev rule, which is isolated-testing only — it removes the seat assignment, which also stops the compositor from adopting the output:
sudo make install-dev-udev # then log out/in once if KWin already opened the card
scripts/test-driver-zero-copy.sh automates this: it reloads an isolated
module, drives a modetest producer, and verifies the DMA-BUF/sync_file path.
Other validation scripts (run as root, in the virtme-ng VM or on the host):
scripts/vm-access-unload-test.sh— checks host/private render-node access, a DRM descriptor held after client exit, safe detach, rebind, and unload;scripts/vm-session-lifecycle-test.sh— checks token rotation, one-shot binding revocation, binding accounting, and that a blockedWAIT_FRAMEon a revoked descriptor is woken withEACCESrather than left to time out;scripts/vm-configfs-test.sh— creates and removes cards at runtime through configfs alongside a static card, and verifies role/seat metadata, unique output naming, rejected writes on a live card, refused unload, and clean teardown;scripts/vm-multi-device-test.sh— creates two independent DRM cards, gives each one a simultaneous DRM master, and verifies distinct owner/frame/DMA-BUF channels, exact 854x480 visible geometry with an aligned pitch, and clean teardown;scripts/vm-multi-compositor-test.sh— starts two private seat brokers and two Weston DRM compositors concurrently, one on each card, then verifies independent scanout modes;scripts/vm-multi-output-test.sh— drives two outputs concurrently at different modes and verifies distinct owners, framebuffers, DMA-BUFs, independent disconnect, and clean unload;scripts/vm-session-pool-test.sh— validates one seat0 host card, private role/index identities, automatic seat assignments, and systemd broker wants for a two-card session pool;scripts/vm-setup-helper-test.sh— validates one-click user/topology persistence, exact broker restarts, and the safe reboot-required upgrade path;scripts/vm-systemd-broker-test.sh— boots a systemd guest and validates the packaged unit's hardening plus configured-user socket ownership;scripts/vm-uapi-v7-compat-test.sh— verifies an unmodified v0.1.2 control client remains confined to the first output under the current UAPI;scripts/vm-hdr-test.sh— loads withhdr_enable=0,hdr_enable=1andhdr_enable=1 color_depth=10, and verifies the published EDID length (128 vs 256 bytes), the CTA extension's HDR Static Metadata and BT2020 Colorimetry blocks, and thatHDR_OUTPUT_METADATAandColorspaceappear on the connector only when enabled, then verifies committed colour metadata throughACQUIRE_FRAME2. Needs no GPU or compositor;scripts/vm-hdr-capture-test.sh— exercises ten-bit SDR/HDR capture, metadata-only and nonblocking commits, invalid state, old ABI access, producer fences and session revocation;scripts/vm-wlroots-test.sh— exercises labwc's wlroots DRM backend on a private card with the pixman renderer; this is not a GPU-rendering or Hyprland/Aquamarine compatibility test;scripts/vm-cursor-gnome-test.sh— starts a GNOME/Mutter session against a Hermes card, moves the pointer, and records whether Mutter uses the cursor plane and whether the independent cursor DMA-BUF stream reports coherent metadata and visible pixel content;scripts/vm-pacing-test.sh— asserts the vblank timer fires at exactly 60/120/144 Hz with no missed vblanks (useshermes-vblank-meter.c);scripts/vm-export-stress.sh— hammersACQUIRE_FRAMEfrom many threads while the scanout buffer churns, to catch dma-buf/fence lifetime bugs (run underslub_debug=FZPU);scripts/host-vblank-isolated.sh— isolated vblank-rate check on real hardware;scripts/host-restore-display.shre-enables a caller-selected physical monitor and can stop caller-selected streaming processes gracefully.
For example, from SSH or a TTY:
scripts/host-restore-display.sh --physical HDMI-A-1 --virtual Virtual-1 \
--stop my-stream-server
Remove the rule to return to the compositor-driven path:
sudo make uninstall-dev-udev
The seat exclusion cannot live inside the kernel driver: seat,
master-of-seat, ID_SEAT, and ID_AUTOSEAT are udev/logind userspace
policy. The dev udev rule adjusts primary-node seat/permissions for isolated test
controllers. Render nodes retain the packaged read-only ACL policy; inspect
udev/99-hermes-kms-ignore-seat.rules before using it on a test host.
Userspace communication
Hermes-KMS exposes a small DRM ioctl UAPI in include/uapi/drm/hermes_kms_drm.h. External projects can install the public UAPI and the application-neutral MIT session helper without installing any Hermes application code:
sudo make install-uapi
#include <drm/hermes_kms_drm.h>
#include <hermes-kms/hermes_session.h> /* optional header-only helper */
Both paths honor DESTDIR, PREFIX, UAPI_INCLUDE_DIR, and
HERMES_INCLUDE_DIR; sudo make uninstall-uapi removes only those two managed
headers. Consumers using the helper also need the normal libdrm and Linux UAPI
headers available at compile time.
The kernel/module sources remain GPL-2.0, and the public UAPI carries the Linux syscall-note exception. The standalone session helper and its userspace-only tests are MIT-licensed under LICENSES/MIT.txt, so another project can reuse that helper without inheriting application-specific code.
Before calling any ioctl listed below, identify the fd with the DRM core
DRM_IOCTL_VERSION ioctl (or drmGetVersion()) and require the exact driver
name hermes-kms. Do not use a private ioctl as the initial probe: private DRM
command numbers have meaning only after the core driver identity is known and
can overlap with another driver's commands.
The current interface is UAPI v14. Its ioctls are:
DRM_IOCTL_HERMES_KMS_GET_VERSIONDRM_IOCTL_HERMES_KMS_GET_IDENTITYDRM_IOCTL_HERMES_KMS_GET_CAPSDRM_IOCTL_HERMES_KMS_GET_STATUSDRM_IOCTL_HERMES_KMS_SET_OUTPUTDRM_IOCTL_HERMES_KMS_ACQUIRE_FRAMEDRM_IOCTL_HERMES_KMS_ACQUIRE_FRAME2(UAPI v14, frame-associated colour)DRM_IOCTL_HERMES_KMS_WAIT_FRAMEDRM_IOCTL_HERMES_KMS_GET_METRICSDRM_IOCTL_HERMES_KMS_SELECT_OUTPUT(UAPI v8)DRM_IOCTL_HERMES_KMS_SESSION_ACCESS(UAPI v11)DRM_IOCTL_HERMES_KMS_ACQUIRE_CURSOR(UAPI v11)DRM_IOCTL_HERMES_KMS_WAIT_UPDATE(UAPI v11)
GET_CAPS.output_count reports the number of independent outputs.
SELECT_OUTPUT binds all output-scoped ioctls on that fd to a 0-based output;
new fds default to output 0 for compatibility. GET_IDENTITY then exposes the
selected driver-facing name (HERMES-* on static cards, configurable on runtime
cards), while the DRM core may expose connector objects as Virtual-*.
UAPI v9 also exposes GET_IDENTITY.device_index and device_count. UAPI v10
adds device_role, session_index, and session_device_count in words that
were previously reserved. Consumers must check
HERMES_KMS_CAP_SESSION_DEVICE_POOL before interpreting them.
GET_IDENTITY.cursor_plane_id identifies the cursor plane when
HERMES_KMS_CAP_CURSOR_CAPTURE is advertised.
HERMES_KMS_CAP_MULTI_DEVICE means the module can create multiple independent
DRM devices with devices=N; every device has its own DRM-master ownership
domain and contains output_count selectable outputs.
HERMES_KMS_CAP_DYNAMIC_DEVICES (UAPI v12) means cards can also be created and
removed at runtime through configfs, so a consumer should enumerate cards rather
than assume the set fixed at module load.
HERMES_KMS_CAP_SESSION_LIFECYCLE (UAPI v13) means the owner can rotate the
session token and revoke bindings without ending the session.
HERMES_KMS_CAP_FRAME_COLOR (UAPI v14) advertises ACQUIRE_FRAME2. Zero the
whole drm_hermes_kms_acquire_frame2 and set only frame.flags on input;
frame and color describe one captured state. Check colour validity flags
before interpreting the HDR blob. See the HDR contract.
UAPI v11 advertises HERMES_KMS_CAP_SESSION_TOKEN and protects active output
state, frame capture, waits and metrics with a generic session capability.
GET_STATUS remains public while an output is completely idle so a controller
can discover and claim it. The fd that successfully calls SET_OUTPUT is the
owner and can call
SESSION_ACCESS(GET_TOKEN) with only the operation field set and every other
request field zero; the response returns its output index, 128-bit token,
session ID and RESULT_TOKEN_VALID. A second fd calls
SESSION_ACCESS(BIND) with those three values. BIND selects the active output
and authorizes the fd in one operation, returning RESULT_BOUND with the token
fields cleared; a preceding SELECT_OUTPUT is neither needed nor valid for
another session's active output. UNBIND removes access from that fd. Disabling
the output or closing the owner fd invalidates every binding for the old
session.
UAPI v13 adds HERMES_KMS_CAP_SESSION_LIFECYCLE and two owner-only operations
that make that authorization manageable rather than all-or-nothing.
SESSION_ACCESS(ROTATE_TOKEN) replaces the token while the session and every
existing binding stay intact, so a token that may have leaked stops granting new
binds without interrupting the consumers already running.
SESSION_ACCESS(REVOKE_BINDINGS) additionally drops every binding at once:
bound descriptors fail their next protected ioctl with EACCES, blocked waits
are woken to the same error, and ownership, the session ID and the scanout all
survive. It rotates the token as part of the same operation, because leaving the
old token usable would let the same holder simply bind again. Both return the
new token, and an owner blocked in its own WAIT_FRAME on another thread sees
that wait fail with EACCES across a revocation and should reissue it. Without
these, the only way to cut off a consumer was to disable the output, which ends
the stream.
GET_STATUS.bound_fd_count reports how many descriptors are bound to the live
session, excluding the owner; GET_METRICS adds bind_count,
bind_reject_count, unbind_count and binding_revoke_count. A broker that
handed its capability to one worker and sees two is looking at a leak.
Token transport and policy belong to userspace. The kernel does not key access to Hermes, Steam, an executable name, UID or process relationship; any project can pass the opaque token through its own trusted IPC channel. Tokens are credentials: keep them out of logs, arguments and world-readable files.
For short-lived migration of old diagnostic clients, root can load the module
with insecure_legacy_unbound_access=1. This restores unbound pre-v11 access
and therefore permits any process that can open the node to inspect/capture an
active session; it is intentionally off by default and is unsafe for normal use.
GET_STATUS now reports scanout/frame metadata:
- frame sequence counter;
- active session ID and owner pid when a control fd owns the output;
- last update/enable/disable timestamps;
- framebuffer ID;
- framebuffer width/height;
- DRM fourcc format;
- modifier;
- per-plane pitch/offset.
SET_OUTPUT is an IOWR ioctl. On enable or disable it returns the applied
mode, result flags, and the session ID owned by that fd. The controller should
keep the same fd open for the whole stream; if it closes, the driver revokes the
token, disconnects the output, clears the tracked frame, and emits hotplug.
Real state changes are rate-limited to a burst of ten per output per second;
EAGAIN means no mutation occurred and may be retried with bounded backoff.
Exact repeats and an already-idle disable are not charged.
ACQUIRE_FRAME supports metadata-only acquisition by default. If userspace sets
HERMES_KMS_FRAME_REQUEST_DMABUF, the driver exports DMA-BUF fds for the
currently tracked scanout framebuffer and sets
HERMES_KMS_FRAME_DMABUF_VALID on success.
If userspace sets HERMES_KMS_FRAME_REQUEST_SYNC_FILE, ACQUIRE_FRAME
returns a sync_file fd carrying the framebuffer's implicit write fence (from the
buffer's dma_resv), or an already-signalled fence when the buffer is idle. The
consumer waits on it before sampling, so a frame the compositor flipped while its
GPU was still rendering is read only after that render completes.
When the compositor supplies damage (FB_DAMAGE_CLIPS), ACQUIRE_FRAME can
return the merged half-open dirty rectangle (damage_x1..y2, flagged by
HERMES_KMS_FRAME_DAMAGE_VALID). A consecutive new sequence can use that
rectangle; acquiring the same sequence again returns a valid empty rectangle,
meaning no additional primary-plane change. On the fd's first acquire, after a
skipped sequence, or when the compositor supplies no damage, the flag is clear
and the consumer must treat the whole frame as dirty. A cursor-only commit does
not advance the primary-frame sequence.
WAIT_FRAME lets a capture consumer block until frame_sequence advances past
a known sequence, with a caller-provided timeout. This is the intended
low-latency primary-only capture loop; cursor-only commits deliberately do not
wake it:
WAIT_FRAME(after_sequence, timeout_ms)
ACQUIRE_FRAME2 with frame.flags = REQUEST_DMABUF | REQUEST_SYNC_FILE
(legacy ACQUIRE_FRAME only when FRAME_COLOR is unavailable)
wait on the returned producer fence
import DMA-BUF into encoder
after_sequence = returned sequence
Separate cursor capture
When HERMES_KMS_CAP_CURSOR_CAPTURE is present, the hardware cursor is exposed
as a latest-state stream separate from the primary framebuffer. This matters
because a compositor can move its cursor plane without redrawing the primary
plane; such pixels are not present in the DMA-BUF returned by ACQUIRE_FRAME.
WAIT_UPDATE accepts the last consumed primary frame_sequence and cursor
cursor_sequence, then wakes when either advances. Its response sets
HERMES_KMS_WAIT_UPDATE_FRAME_READY,
HERMES_KMS_WAIT_UPDATE_CURSOR_READY, or both and samples the current
sequences, timestamps, and output status coherently under the same state lock.
With no pending update, a zero timeout returns EAGAIN and a nonzero timeout
expires with ETIMEDOUT; session revocation takes precedence as EACCES.
The two sequence spaces are independent. Coherent values in one WAIT_UPDATE
response do not mean that its frame and cursor sequence numbers identify one
atomic compositor transaction, and an acquire made afterward can observe an
even newer latest state. Consumers should treat each READY bit relative to the
corresponding sequence they supplied, retain the latest complete state of each
stream, and tolerate skipped values rather than treating the two counters as a
paired frame ID.
ACQUIRE_CURSOR returns cursor metadata by default and can export its DMA-BUF
and write-fence sync_file when the corresponding request flags are set. The
cursor plane uses DRM_FORMAT_ARGB8888; its RGB components follow the standard
DRM premultiplied-alpha convention and the plane opacity is full, so a software
consumer must not interpret the pixels as straight alpha or multiply RGB by
alpha a second time. Wait for the returned sync_file before reading or importing
the buffer.
position_x/y is the nominal, unclipped top-left of the full cursor image in
CRTC coordinates. When HOTSPOT_VALID is set, hotspot_x/y is relative to
that full image, so the logical pointer hotspot is
(position_x + hotspot_x, position_y + hotspot_y). Hermes exposes a universal
cursor plane rather than requiring the para-virtualized DRM hotspot extension;
ordinary compositors therefore pre-adjust the plane position and the hotspot
validity bit remains clear.
crtc_x/y/w/h is the clipped integer destination rectangle, while
src_x/y/w/h is the matching clipped source rectangle in DRM 16.16 fixed-point
pixels. Use those clipped rectangles when the cursor crosses an output edge;
do not crop by changing the meaning of the hotspot. The validity flags say
which metadata groups may be consumed. VISIBLE is intentionally independent
of BUFFER_VALID, allowing an off-screen or hidden cursor to retain a reusable
image.
cursor_sequence advances for position, visibility, or image-state updates.
image_sequence advances conservatively whenever a committed cursor buffer may
need to be sampled again, including in-place pixel updates. Refresh cached pixels
when it changes. If a primary or cursor buffer is replaced while an fd export is
being prepared, ACQUIRE_FRAME or ACQUIRE_CURSOR can return ESTALE; discard
that attempt and retry the latest-state acquire with a small bounded loop. This
prevents a consumer from receiving an fd paired with stale metadata.
A combined loop therefore uses WAIT_UPDATE, refreshes whichever primary or
cursor state advanced, waits for requested fences, and composites the clipped
premultiplied cursor over the primary image. If the compositor uses a software
cursor instead of the KMS cursor plane, no separate visible cursor buffer is
reported because those pixels are already part of the primary framebuffer.
ACQUIRE_FRAME2 uses the same buffer, fence, damage, session and ESTALE
contracts, adding colour metadata for that exact primary state. Prefer it when
HERMES_KMS_CAP_FRAME_COLOR is present. An HDR consumer must also resolve
cursor colour semantics; see the HDR contract.
This hands userspace a shared buffer with no driver-side CPU readback. The reference consumer validates end-to-end zero-copy on VAAPI (XRGB8888, linear). NVIDIA currently uses a CPU-copy fallback; direct NVENC/AMF import needs its own format/modifier/content validation. Successful import alone does not prove correct full-frame sampling or encoding.
GET_METRICS reports counters and timestamps for frame updates, frame waits,
acquires, DMA-BUF exports, sync_file exports, hotplug events, output lifecycle,
and owner-fd cleanup. UAPI v11 also names the previously reserved
vblank_count and vblank_overrun_count words without changing the struct's
size. The overrun counter measures timer intervals missed when a vblank
callback runs late; it is not a count of rejected frame acquires.
The driver deliberately does not advertise writeback_connector yet. That
needs real DRM writeback connector plumbing, not placeholder flags.
Diagnostic command:
tools/hermes-kmsctl/hermes-kmsctl --session-file "$session_file" frame
tools/hermes-kmsctl/hermes-kmsctl --session-file "$session_file" \
frame --require-dmabuf --sync-file
tools/hermes-kmsctl/hermes-kmsctl --session-file "$session_file" wait 0 1000
tools/hermes-kmsctl/hermes-kmsctl --session-file "$session_file" metrics
tools/hermes-kms-import-check/hermes-kms-import-check \
--session-file "$session_file" --wait-ms 1000
hermes-kms-import-check acquires the latest Hermes-KMS DMA-BUF frame and tries
to import it into VAAPI through VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2. This
is an encoder-path preflight: success means the VA driver accepted the exported
buffer as a VASurface; failure means a consumer may need a different scanout
format, modifier, GPU placement, or a conversion path before true encoder
zero-copy is possible.
The zero-copy test script can run the same preflight while its modetest
producer is still active:
./scripts/test-driver-zero-copy.sh --keep-loaded --check-vaapi-import
./scripts/test-driver-zero-copy.sh --keep-loaded --check-vaapi-import --va-device /dev/dri/renderD128
Roadmap
See docs/roadmap.md and docs/driver-design.md.
License
The kernel module and kernel-side sources are licensed under the GNU General
Public License, version 2 (GPL-2.0), the license required for this out-of-tree
DRM/KMS module. See LICENSE; those sources carry
SPDX-License-Identifier: GPL-2.0. GPL-2.0 terms apply when distributing a fork
or derivative of that kernel/module code, including the corresponding-source
obligations.
The installed public UAPI header instead carries
GPL-2.0 WITH Linux-syscall-note, matching the normal Linux userspace boundary.
The optional header-only session helper and its userspace-only tests carry the
MIT license in LICENSES/MIT.txt. An independently developed
userspace project therefore does not have to become the Hermes application or
adopt its application license merely because it issues the documented ioctls,
includes the syscall-note UAPI, or reuses the MIT helper.
Source: Hermes-KMS at ba9aeb854d2b · GPL-2.0 license.