update
This commit is contained in:
@@ -55,6 +55,9 @@ cleanup() {
|
|||||||
if [ -n "$VIEWER_PID" ] && kill -0 "$VIEWER_PID" 2>/dev/null; then
|
if [ -n "$VIEWER_PID" ] && kill -0 "$VIEWER_PID" 2>/dev/null; then
|
||||||
kill "$VIEWER_PID" 2>/dev/null || true
|
kill "$VIEWER_PID" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$XORG_PID" ] && kill -0 "$XORG_PID" 2>/dev/null; then
|
||||||
|
kill "$XORG_PID" 2>/dev/null || true
|
||||||
|
fi
|
||||||
if [ -f "$PID_FILE" ]; then
|
if [ -f "$PID_FILE" ]; then
|
||||||
PID=$(cat "$PID_FILE")
|
PID=$(cat "$PID_FILE")
|
||||||
if kill -0 "$PID" 2>/dev/null; then
|
if kill -0 "$PID" 2>/dev/null; then
|
||||||
@@ -129,13 +132,44 @@ if [ -z "$WAYLAND_DISPLAY" ] && [ -z "$DISPLAY" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Launch remote-viewer - use Xvfb if no display available
|
# Launch remote-viewer - use dummy X server with 3 monitors if no display available
|
||||||
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
|
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
|
||||||
echo "No display found, using Xvfb for headless SPICE client..."
|
echo "No display found, starting headless X server with 3 virtual monitors..."
|
||||||
# Use Xvfb with large virtual screen to support 3 monitors (5760x1080 = 3x1920x1080)
|
|
||||||
xvfb-run -a -s "-screen 0 5760x1080x24" remote-viewer spice://localhost:5930 &
|
# Find an available display number
|
||||||
|
XDISPLAY=99
|
||||||
|
while [ -S "/tmp/.X11-unix/X$XDISPLAY" ]; do
|
||||||
|
XDISPLAY=$((XDISPLAY + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
# Start Xorg with dummy driver config for 3 monitors
|
||||||
|
XORG_CONFIG="$SCRIPT_DIR/xorg-dummy.conf"
|
||||||
|
Xorg :$XDISPLAY -config "$XORG_CONFIG" -noreset +extension GLX +extension RANDR +extension RENDER &
|
||||||
|
XORG_PID=$!
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
export DISPLAY=:$XDISPLAY
|
||||||
|
|
||||||
|
# Configure 3 virtual monitors using xrandr
|
||||||
|
# Add mode to disconnected DUMMY outputs and position them
|
||||||
|
xrandr --newmode "1920x1080" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync 2>/dev/null || true
|
||||||
|
|
||||||
|
# Add mode to DUMMY1 and DUMMY2, then enable them
|
||||||
|
xrandr --addmode DUMMY1 "1920x1080" 2>/dev/null || true
|
||||||
|
xrandr --addmode DUMMY2 "1920x1080" 2>/dev/null || true
|
||||||
|
|
||||||
|
# Position the outputs side by side
|
||||||
|
xrandr --output DUMMY0 --mode 1920x1080 --pos 0x0 --primary
|
||||||
|
xrandr --output DUMMY1 --mode 1920x1080 --pos 1920x0 2>/dev/null || true
|
||||||
|
xrandr --output DUMMY2 --mode 1920x1080 --pos 3840x0 2>/dev/null || true
|
||||||
|
|
||||||
|
echo "Headless X server started on :$XDISPLAY with 3 RandR monitors"
|
||||||
|
xrandr --listmonitors
|
||||||
|
|
||||||
|
# Launch remote-viewer in fullscreen to use all monitors
|
||||||
|
remote-viewer --full-screen spice://localhost:5930 &
|
||||||
VIEWER_PID=$!
|
VIEWER_PID=$!
|
||||||
echo "remote-viewer running headlessly under Xvfb (PID: $VIEWER_PID)"
|
echo "remote-viewer running headlessly (PID: $VIEWER_PID)"
|
||||||
else
|
else
|
||||||
echo "Launching remote-viewer (DISPLAY=$DISPLAY, WAYLAND_DISPLAY=$WAYLAND_DISPLAY)..."
|
echo "Launching remote-viewer (DISPLAY=$DISPLAY, WAYLAND_DISPLAY=$WAYLAND_DISPLAY)..."
|
||||||
remote-viewer spice://localhost:5930 &
|
remote-viewer spice://localhost:5930 &
|
||||||
|
|||||||
41
isotest/xorg-dummy.conf
Normal file
41
isotest/xorg-dummy.conf
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# Xorg configuration for 3 virtual monitors using dummy driver with RandR
|
||||||
|
# Used for headless multi-display testing with SPICE/remote-viewer
|
||||||
|
|
||||||
|
Section "ServerFlags"
|
||||||
|
Option "DontVTSwitch" "true"
|
||||||
|
Option "AllowMouseOpenFail" "true"
|
||||||
|
Option "PciForceNone" "true"
|
||||||
|
Option "AutoEnableDevices" "false"
|
||||||
|
Option "AutoAddDevices" "false"
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "Device"
|
||||||
|
Identifier "dummy"
|
||||||
|
Driver "dummy"
|
||||||
|
VideoRam 768000
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "Monitor"
|
||||||
|
Identifier "Monitor0"
|
||||||
|
HorizSync 28.0-80.0
|
||||||
|
VertRefresh 48.0-75.0
|
||||||
|
# 1920x1080 @ 60Hz (CVT) modeline
|
||||||
|
Modeline "1920x1080" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "Screen"
|
||||||
|
Identifier "Screen0"
|
||||||
|
Device "dummy"
|
||||||
|
Monitor "Monitor0"
|
||||||
|
DefaultDepth 24
|
||||||
|
SubSection "Display"
|
||||||
|
Depth 24
|
||||||
|
Modes "1920x1080"
|
||||||
|
Virtual 5760 1080
|
||||||
|
EndSubSection
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "ServerLayout"
|
||||||
|
Identifier "Layout0"
|
||||||
|
Screen 0 "Screen0" 0 0
|
||||||
|
EndSection
|
||||||
Reference in New Issue
Block a user