diff options
| author | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-11-16 09:50:31 -0500 |
|---|---|---|
| committer | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-11-16 09:50:31 -0500 |
| commit | ed8a9c6b8e061fe772fc0050ab83c2dec2db8d1e (patch) | |
| tree | 458d2ea063d8a8a6996cd15891e3242cfe93ece5 /tools/guest-diag/mission-gz.sh | |
| parent | f2c73f4e52d24188a9edb0e8190c50f87f19181f (diff) | |
| download | open-iov-ed8a9c6b8e061fe772fc0050ab83c2dec2db8d1e.tar.gz open-iov-ed8a9c6b8e061fe772fc0050ab83c2dec2db8d1e.zip | |
vgsp: eng89 - live-derived GS map, draw-move anchor, raster enables, async capture
Kernel (deterministic fixes, each with an A/B knob):
- sema_gl_sph_gs_maps=6: derive the whole 216-bit GS IMAP/OMAP blocks
from the bound VTG image's OMAP and the PS image's IMAP at authoring
time (SPH-GS-MAP receipt; SPH-GS-SKIP names ps-invalid/gs-invalid/
vtg-overlap/vtg-short). maps=4 stays as the fallback.
- DS-MAP census line: dump stage-4/5 w5/w10/w13/w17 next to DS-IMAGE so
the fetched maps are visible without a new probe.
- MME pack carrier: reject maxa > 4096 (the IR pack array) instead of
64K, with MME-PACK-REJECT reason=bound.
- MME-DRAW-MOVE: anchor the slot-34 move after a 0x3810 VERTEX_STREAM
run. c848 moved CALL(34) to 0x204, ahead of the prepended stream bind,
so the 8x3 fetch used stale stream state.
- sema_gl_raster_enable=1: emit SET_RASTER_ENABLE=1 and
SET_GLOBAL_RENDER_ENABLE MODE_TRUE in the raster prelude (fresh replay
contexts may carry 0 for both, discarding every fragment).
Guest tooling (unblocks the render loop and capture):
- sdl_cap.c: asynchronous PBO+fence capture with a 5 s abandonment
bound; no glFinish/blocking readback (c899 wedged gzdoom in an
uninterruptible nv ioctl); clean sentinel from a destructor.
- gz_pbuf.c: request depth 24/stencil 8, log GL_DEPTH_BITS, and swap
with glFlush only.
- mission-gz.sh: gl_frames probe off by default; GZDoom launched
detached with a bounded wait, per-attempt X restart and retry;
capture in /dev/shm with GZCAP_MAXF.
- gzdoom_pbuf_run.sh: gl_pipeline_depth=2, gl_finishbeforeswap=0,
GZCAP_MAXF default, rc-file support for the detached run.
- run_cycles_long.sh: durable multi-cycle runner (the previous one lived
in /tmp and was lost on reboot); pushes tools, runs the mission, grabs
dmesg + guest logs + capture per cycle, stops on pixels.
Test matrix: params-r1624-maps{4,6}.txt.
Diffstat (limited to 'tools/guest-diag/mission-gz.sh')
| -rw-r--r-- | tools/guest-diag/mission-gz.sh | 122 |
1 files changed, 86 insertions, 36 deletions
diff --git a/tools/guest-diag/mission-gz.sh b/tools/guest-diag/mission-gz.sh index cf58f02..c4665d2 100644 --- a/tools/guest-diag/mission-gz.sh +++ b/tools/guest-diag/mission-gz.sh @@ -1,55 +1,105 @@ #!/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). +# mission-gz.sh - run INSIDE the guest: bring X up (retry), optionally 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 +# Env knobs: GZ_SECS (default 240) GLF_FRAMES (default 0 = skip probe) +# GLF_W/GLF_H GZCAP GZCAP_MAXF GZ_ATTEMPTS (default 2) +# +# 2026-11-16 (post-reboot c895-c898): the gl_frames probe is now OFF by default +# (GLF_FRAMES=0). It is a diagnostic, not a render source, and in the batch it +# cost 30-40 s/frame and preceded X/GLX failures that made GZDoom abort with +# "Could not create OpenGL window" (rc=255). GZDoom is the mission; probe only +# when explicitly requested. set -u export DISPLAY=:0 +GZCAP="${GZCAP:-/dev/shm/gzframes.bin}" +GZCAP_MAXF="${GZCAP_MAXF:-1800}" +GZ_ATTEMPTS="${GZ_ATTEMPTS:-2}" + +x_up() { + local t r + 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 echo "$t"; return 0; fi + echo "x try $t: dead" + done + return 1 +} + echo "mission start $(date +%T)" -rm -f /tmp/mission-done /tmp/gzframes.bin +rm -f /tmp/mission-done /tmp/gzframes.bin "$GZCAP" 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)" +XTRY=$(x_up) && XOK=1 +echo "XOK try=$XTRY $(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 -k 5 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 +# 2. Optional GPU GL probe (diagnostic only; off by default) +GLF_FRAMES="${GLF_FRAMES:-0}" +if [ "$GLF_FRAMES" != 0 ]; then + ( + timeout -k 5 120 /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 10 + echo "x alive after glf start: $(pgrep -c Xorg)" + wait $GLFPID 2>/dev/null + grep -E "^FRAME seq" /tmp/mission-gl.log | tail -3 +else + : > /tmp/mission-gl.log + echo "glf skipped (GLF_FRAMES=0)" +fi -# 3. GZDoom offscreen + pbuffer shim + swap capture (tested recipe wrapper) +# 3. GZDoom offscreen + pbuffer shim + swap capture. The run is DETACHED and +# bounded by GZ_SECS: a GPU wait must never wedge this shell (c899: glFinish +# on non-retiring work put gzdoom in an uninterruptible nv ioctl and even +# SIGKILL could not reap it, so the mission never wrote mission-done). 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 +export GZ_RCFILE=/tmp/gz-rc +GZRC=255 +attempt=1 +while [ "$attempt" -le "$GZ_ATTEMPTS" ]; do + if ! pgrep -x Xorg >/dev/null; then + echo "X dead before GZDoom attempt $attempt - restarting" >> /tmp/mission-gz.log + x_up >/dev/null 2>&1 || { echo "X restart failed" >> /tmp/mission-gz.log; break; } + fi + rm -f "$GZ_RCFILE" + GZ_DETACH=1 TIMEOUT="$GZ_SECS" GZLOG=/tmp/mission-gz.log GZCAP="$GZCAP" \ + GZCAP_MAXF="$GZCAP_MAXF" \ + GZPBUF_W="${GZPBUF_W:-640}" GZPBUF_H="${GZPBUF_H:-480}" \ + bash /tmp/gzdoom_pbuf_run.sh + GZRC="hung" + for i in $(seq 1 $((GZ_SECS + 30))); do + if [ -f "$GZ_RCFILE" ]; then GZRC=$(cat "$GZ_RCFILE"); break; fi + sleep 1 + done + echo "gz attempt=$attempt rc=$GZRC $(date +%T)" >> /tmp/mission-gz.log + # Stop the renderer before fetching/next attempt. A D-state process + # survives SIGKILL; that is fine, the capture file is append-only and the + # cycle teardown removes it. + pkill -x gzdoom 2>/dev/null + sleep 1 + pkill -9 -x gzdoom 2>/dev/null + [ "$GZRC" != 255 ] && break + attempt=$((attempt + 1)) + sleep 2 +done + +ls -la "$GZCAP" /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)" +echo "mission end $(date +%T)"
\ No newline at end of file |
