#!/bin/bash # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2026 Open-IOV contributors # mission-gz.sh - run INSIDE the guest: bring X up (retry), probe the GPU GL # path (gl_frames), then run GZDoom offscreen with the GLX-pbuffer shim and the # swap-capture shim. Everything logs to /tmp/mission-*.log; completion is # signalled by /tmp/mission-done (content = result line). # # Env knobs: GZ_SECS (default 240) GLF_FRAMES (default 5) GLF_W/GLF_H set -u export DISPLAY=:0 echo "mission start $(date +%T)" rm -f /tmp/mission-done /tmp/gzframes.bin mkdir -p /tmp/gzshots # 1. X up (the DDX ScreenInit is a per-start lottery) XOK=0 for t in 1 2 3 4; do pkill -x Xorg; sleep 1 systemctl reset-failed xorg0 2>/dev/null systemd-run --unit=xorg0 --collect --setenv=HOME=/root \ /usr/bin/Xorg :0 -config /etc/X11/xorg.conf >/dev/null 2>&1 sleep 7 if timeout 12 xdpyinfo >/dev/null 2>&1; then XOK=$t; break; fi echo "x try $t: dead" done echo "XOK try=$XOK $(date +%T)" if [ "$XOK" = 0 ]; then echo "X-FAIL" > /tmp/mission-done; exit 1; fi bash /tmp/guest_mode.sh 2>/dev/null || true # 2. GPU GL probe: direct pbuffer frames (non-black px0 = path live) GLF_FRAMES="${GLF_FRAMES:-5}" ( timeout 90 /tmp/gl_frames "$GLF_FRAMES" "${GLF_W:-320}" "${GLF_H:-240}" 5 \ > /tmp/mission-gl.log 2>&1 echo "glf rc=$? $(date +%T)" >> /tmp/mission-gl.log ) & GLFPID=$! sleep 20 echo "x alive after glf start: $(pgrep -c Xorg)" wait $GLFPID 2>/dev/null grep -E "^FRAME seq" /tmp/mission-gl.log | tail -3 # 3. GZDoom offscreen + pbuffer shim + swap capture (tested recipe wrapper) GZ_SECS="${GZ_SECS:-240}" TIMEOUT="$GZ_SECS" GZLOG=/tmp/mission-gz.log GZCAP=/tmp/gzframes.bin \ GZPBUF_W="${GZPBUF_W:-640}" GZPBUF_H="${GZPBUF_H:-480}" \ bash /tmp/gzdoom_pbuf_run.sh GZRC=$? echo "gz rc=$GZRC $(date +%T)" >> /tmp/mission-gz.log ls -la /tmp/gzframes.bin /tmp/gzshots 2>&1 | tail -5 echo "XORG-ALIVE=$(pgrep -c Xorg)" | tee -a /tmp/mission-gz.log echo "DONE x=$XOK gzrc=$GZRC $(date +%T)" > /tmp/mission-done echo "mission end $(date +%T)"