Files
chandra/docs/x11.md
Claude e184e29600
CI / test (push) Failing after 2m3s
X11 backend: ignore a stale _NET_SUPPORTING_WM_CHECK; tested on NVIDIA Xorg
A window manager that was killed leaves the property on the root window,
so Chandra opened a 1280x720 window instead of taking the screen (seen on
a Vast.ai NVIDIA rig after pkill -9 openbox). Check that the window it
names exists and points at itself, as EWMH says. docs/x11.md records the
NVIDIA test (GTX 1650, driver 595.91.07).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hhLFs4VtHV26G1iyeo
2026-11-26 01:59:17 +00:00

5.5 KiB

Running Chandra on Xorg (NVIDIA)

--x11 runs Chandra on an X server instead of on DRM/KMS. It exists for machines where the display is NVIDIA's proprietary driver on Xorg: the driver draws the screen, Chandra is one X client on it, and Wayland apps connect to Chandra as usual.

build/wasmhost build/compositor.wasm --socket "$XDG_RUNTIME_DIR/wayland-moon-0" --x11
just run-x11                      # the same, from the checkout

Modes

Where What --x11 does
An X desktop with a window manager (GNOME on Xorg, KDE X11, Openbox...) A normal, resizable window (--size WxH, default 1280x720). --fullscreen asks the window manager for a fullscreen window.
An X server with no window manager (startx, xinit, the "Chandra (X11)" login entry, a headless NVIDIA Xorg in a container) Chandra covers the whole screen, takes the keyboard, and follows the screen when it is resized (xrandr, as Selkies does when the browser window changes size).

Chandra decides by looking for an EWMH window manager on the root window (_NET_SUPPORTING_WM_CHECK).

As your login session

just install also installs /usr/share/xsessions/chandra-x11.desktop. Pick Chandra (X11) on the login screen (GDM, SDDM, LightDM): the display manager starts Xorg with the NVIDIA driver and runs chandra-session --x11, which starts the compositor with --x11 --login-session (power actions, the polkit password dialog and apps' dark/light preference, as in the DRM session).

Without a display manager, put this in ~/.xinitrc and run startx from a text console:

exec /usr/local/bin/chandra-session --x11

The log is ~/.local/state/chandra/session.log, as for the DRM session.

How it works

compositor/x11/x11.mbt speaks the X11 wire protocol itself over /tmp/.X11-unix/X<n>, like the nested backend speaks Wayland: no libX11 or libxcb, and the same code runs in the wasm compositor (either host) and in the native build.

  • Authentication: the MIT-MAGIC-COOKIE-1 for the display from $XAUTHORITY (or ~/.Xauthority); this host's entry first, then a wildcard or any other local entry.
  • Frames: MIT-SHM 1.2 with fd passing (ShmAttachFd + ShmPutImage). The host's framebuffer memfd goes straight to the X server, so no pixels pass through the compositor, and the next frame waits for the server's completion event. Needs a 24-bit TrueColor visual (any NVIDIA setup at the default DefaultDepth 24). Without MIT-SHM it falls back to core PutImage in strips, which is slow on the wasm hosts (about 2 frames a second at 1280x800, because the pixels cross the component boundary); CHANDRA_X11_NO_SHM=1 forces that path for debugging and CHANDRA_X11_DEBUG=1 logs its frame times.
  • Keyboard: Xorg's keycodes are evdev codes + 8, the same as libinput's. The keymap sent to Wayland clients is the X server's own (xkbcomp -xkb $DISPLAY -), so the layout and options are whatever Xorg was configured with; after setxkbmap new apps get the new one. X's auto-repeat is dropped (Wayland apps repeat keys themselves). Modifier and lock state come from X's modifier map.
  • Pointer: motion, buttons (left, middle, right, back, forward), wheel (buttons 4-7). The cursor comes from the X cursor font, picked by the shape Chandra wants.
  • Input injection (XTest, xdotool, Selkies, VNC servers) works, since it arrives as ordinary X events.

Tested on NVIDIA

2026-11-26 on a Vast.ai rig (GeForce GTX 1650, driver 595.91.07, the gamerig-tiny image's headless NVIDIA Xorg on :0, depth 24, MIT-SHM): under Openbox with --fullscreen, on the whole screen with no window manager (also after the window manager was killed and left a stale _NET_SUPPORTING_WM_CHECK), following xrandr --output DVI-D-0 --mode 1024x768, and typing into foot through XTest (xdotool, the way Selkies injects input). Not yet tried: a physical NVIDIA desktop through a display manager.

Limits

  • Apps don't get the NVIDIA GPU through Chandra. Chandra composes on the CPU and its Wayland clients share buffers with wl_shm; there is no zwp_linux_dmabuf_v1 yet, so GPU-drawing apps (games, Zed, Chrome with GPU raster) fall back to software rendering (llvmpipe/lavapipe) or fail, exactly as on the DRM backend. Running on Xorg makes Chandra start on NVIDIA; it does not give its apps hardware acceleration. See docs/kiosk-gamerig.md (G4).
  • X11-only apps run on the X server, not in Chandra. DISPLAY stays set, so an app that only speaks X11 (Steam, xterm) opens on Xorg directly: under a window manager it is a window beside Chandra's; in whole-screen mode it maps on top of Chandra with no window manager to move it. Chandra has no Xwayland.
  • Only local displays (:0, unix:0): no TCP displays or ssh -X.
  • Keyboard layout groups: the group is always reported as 0, so layout switching through XKB groups (two layouts with a toggle key) shows the first layout's symbols in Wayland apps.
  • One screen: Chandra covers the X screen it opened (multi-monitor setups are one big X screen under NVIDIA's TwinView/xrandr, so Chandra spans all monitors).

Isn't there a KMS path on NVIDIA now?

With the NVIDIA driver 545 or newer and nvidia-drm.modeset=1 (the default from 560 on), NVIDIA does offer KMS and dumb buffers, which is all --drm uses (no GBM, no EGL). So on a recent driver the regular Chandra session may work too: try just run-drm from a text console. --x11 is for older drivers, modeset=0 setups, and anywhere Xorg must stay the display server (a streaming rig whose grabber reads the X screen).