Use dummy driver in headless Xorg

This commit is contained in:
Héctor Molinero Fernández
2025-06-21 13:49:26 +02:00
parent 558f1ec368
commit 4a45adaa58
2 changed files with 39 additions and 31 deletions

View File

@@ -1,20 +1,15 @@
#!/bin/sh
if [ -z "${VGL_DISPLAY-}" ]; then
# Use the dummy X server if it is enabled
if [ "${SERVICE_XORG_HEADLESS_ENABLED:?}" = 'true' ]; then
export VGL_DISPLAY=:0.0
else
# Otherwise try to use the EGL backend
for card in /dev/dri/card*; do
if /opt/VirtualGL/bin/eglinfo -B "${card:?}" 2>/dev/null; then
export VGL_DISPLAY="${card:?}"
break
fi
done
# And fallback to DISPLAY if the EGL backend is not available
if [ -z "${VGL_DISPLAY-}" ] && [ -n "${DISPLAY-}" ]; then
export VGL_DISPLAY="${DISPLAY:?}"
# Try to use the EGL backend
for card in /dev/dri/card*; do
if /opt/VirtualGL/bin/eglinfo -B "${card:?}" 2>/dev/null; then
export VGL_DISPLAY="${card:?}"
break
fi
done
# And fallback to DISPLAY if the EGL backend is not available
if [ -z "${VGL_DISPLAY-}" ] && [ -n "${DISPLAY-}" ]; then
export VGL_DISPLAY="${DISPLAY:?}"
fi
fi