fix(compositor): allow the software renderer when asked, and ask in the VM

QEMU's default virtio-gpu has no 3D acceleration, so Mesa offers only a
software EGL device, which the DRM backend refused; the compositor took
the display but had no renderer for its output. WEFT_ALLOW_SOFTWARE_RENDERING
lets it use that device, and the VM's compositor unit sets it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QS8QcxvhVJwU3X2qhPamUW
This commit is contained in:
Marco Allegretti 2026-10-11 10:01:33 +00:00
parent 538c752d80
commit 4d5590c73e
No known key found for this signature in database
2 changed files with 10 additions and 3 deletions

View file

@ -311,8 +311,10 @@ fn device_added(state: &mut WeftCompositorState, node: DrmNode, path: &Path) ->
let egl_display =
unsafe { EGLDisplay::new(gbm.clone()).context("EGLDisplay::new failed")? };
let egl_device = EGLDevice::device_for_display(&egl_display).context("no EGL device")?;
if egl_device.is_software() {
anyhow::bail!("software renderer");
// A software renderer is refused unless asked for: it is the only
// one a virtual GPU without 3D acceleration offers.
if egl_device.is_software() && std::env::var_os("WEFT_ALLOW_SOFTWARE_RENDERING").is_none() {
anyhow::bail!("software renderer (set WEFT_ALLOW_SOFTWARE_RENDERING to use it)");
}
let rn = egl_device
.try_get_render_node()

View file

@ -119,7 +119,12 @@
# units after it; a restarted compositor must not inherit it, or an
# X11 DISPLAY, or it would pick the nested backend.
UnsetEnvironment = "WAYLAND_DISPLAY DISPLAY";
Environment = "LIBSEAT_BACKEND=seatd";
Environment = [
"LIBSEAT_BACKEND=seatd"
# QEMU's default virtio-gpu has no 3D acceleration; Mesa renders in
# software.
"WEFT_ALLOW_SOFTWARE_RENDERING=1"
];
Restart = "on-failure";
RestartSec = "1";
};