summaryrefslogtreecommitdiffstats
path: root/tools/guest-diag/gzdoom_pbuf_run.sh
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-11-12 20:01:04 -0500
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-11-12 20:01:04 -0500
commit725898e44666b4def396f7f3c5e50712fd37aa33 (patch)
tree261bba910db49036624cc2cf89baac6554a6f58d /tools/guest-diag/gzdoom_pbuf_run.sh
parent800c108f9d2463066a221a0e4ff56867304551a6 (diff)
downloadopen-iov-725898e44666b4def396f7f3c5e50712fd37aa33.tar.gz
open-iov-725898e44666b4def396f7f3c5e50712fd37aa33.zip
vgsp: stop fabricating 0xFFFF into the nvPush error notifier; add r1780 GL ops tooling
The uncommitted keep-alive change wrote 0xFFFF into slot 0's status field (u16 at notifier+0x0e) on the X DDX / GLX kick-idle channel families. Ground truth (570.144 reference sources + stock nvidia_drv.so disassembly): slot 0 of an nvPush notifier block is the ERROR notifier; nvPushCheckChannelError reads that status and 0xFFFF aborts every nvPushWaitForNotifier/idle wait as a channel error. There is no pb_kickIfIdle in 570.144 - the DDX DMA-idle test reads the progress-tracker semaphore word, not this slot. Leave slot 0 untouched; keep the 0x8000->0 completion ack for the remaining slots and the r864 0xFFFF/0x8000 completion on the RC-watchdog/beef families. Correct the CONT.408/409 comments accordingly. New host/guest tooling: gpa.py (QMP gva2gpa), tick_gen.py (guest-RM timer BO tick), guest_mode.sh (shared nvClip modeNum reader), gl_verify.sh (X/GLX bring-up with ScreenInit-lottery retries), push_gl_tools.sh, the gzdoom_pbuf_run.sh guest recipe and the test_tri SDL2 harness validation program; ignore tools/guest-diag/build/.
Diffstat (limited to 'tools/guest-diag/gzdoom_pbuf_run.sh')
-rwxr-xr-xtools/guest-diag/gzdoom_pbuf_run.sh94
1 files changed, 94 insertions, 0 deletions
diff --git a/tools/guest-diag/gzdoom_pbuf_run.sh b/tools/guest-diag/gzdoom_pbuf_run.sh
new file mode 100755
index 0000000..b152bdf
--- /dev/null
+++ b/tools/guest-diag/gzdoom_pbuf_run.sh
@@ -0,0 +1,94 @@
+#!/bin/bash
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2026 Open-IOV contributors
+# gzdoom_pbuf_run.sh - in-guest GZDoom run recipe for the offscreen SDL2
+# GLX-pbuffer harness. Run this inside the guest after push_gl_tools.sh has
+# placed the shims in /tmp. It prints the exact command line, runs GZDoom
+# under timeout, and leaves the output in $GZLOG.
+#
+# Environment (all overridable):
+# GZDOOM_BIN default /opt/gzdoom/gzdoom
+# WAD default /usr/share/games/doom/freedoom2.wad
+# GZCAP default /tmp/gzframes.bin (sdl_cap.so capture file)
+# GZPBUF_W/H default 640/480 (gz_pbuf.so pbuffer size)
+# GZLOG default /tmp/gzdoom-pbuf.log
+# TIMEOUT default 300 seconds
+# GZ_ARGS extra GZDoom args appended after the base set
+# GZ_DETACH default 0; set 1 to setsid/nohup the run and return
+# DISPLAY default :0
+#
+# The base args are windowed GL: +set vid_fullscreen 0, 640x480, OpenGL
+# backend 0, +vid_rendermode 4 (GL mode), MAP01. The preload order matters:
+# sdl_cap.so first (captures SDL_GL_SwapWindow), gz_pbuf.so second (turns the
+# SDL GL context into a GLX pbuffer and the swap into glFinish).
+set -u
+
+GZDOOM_BIN="${GZDOOM_BIN:-/opt/gzdoom/gzdoom}"
+WAD="${WAD:-/usr/share/games/doom/freedoom2.wad}"
+GZCAP="${GZCAP:-/tmp/gzframes.bin}"
+GZPBUF_W="${GZPBUF_W:-640}"
+GZPBUF_H="${GZPBUF_H:-480}"
+GZLOG="${GZLOG:-/tmp/gzdoom-pbuf.log}"
+TIMEOUT="${TIMEOUT:-300}"
+GZ_ARGS="${GZ_ARGS:-}"
+GZ_DETACH="${GZ_DETACH:-0}"
+DISPLAY="${DISPLAY:-:0}"
+SDL_VIDEODRIVER="${SDL_VIDEODRIVER:-offscreen}"
+LD_PRELOAD="${LD_PRELOAD:-/tmp/sdl_cap.so /tmp/gz_pbuf.so}"
+
+export DISPLAY SDL_VIDEODRIVER LD_PRELOAD GZCAP GZPBUF_W GZPBUF_H
+
+if [ ! -x "$GZDOOM_BIN" ]; then
+ echo "gzdoom_pbuf_run: GZDOOM_BIN not executable: $GZDOOM_BIN" >&2
+ exit 2
+fi
+if [ ! -f "$WAD" ]; then
+ echo "gzdoom_pbuf_run: WAD not found: $WAD" >&2
+ exit 2
+fi
+for so in /tmp/sdl_cap.so /tmp/gz_pbuf.so; do
+ if [ ! -f "$so" ]; then
+ echo "gzdoom_pbuf_run: shim missing: $so" >&2
+ exit 2
+ fi
+done
+
+CMD=(
+ "$GZDOOM_BIN"
+ -iwad "$WAD"
+ +set vid_fullscreen 0
+ +set vid_defwidth "$GZPBUF_W"
+ +set vid_defheight "$GZPBUF_H"
+ +set vid_preferbackend 0
+ +vid_rendermode 4
+ -nosound
+ -nomusic
+ +vid_activeinbackground 1
+ +vid_maxfps 60
+ +map MAP01
+)
+if [ -n "$GZ_ARGS" ]; then
+ read -r -a GZ_EXTRA <<< "$GZ_ARGS"
+ CMD+=("${GZ_EXTRA[@]}")
+fi
+
+echo "gzdoom_pbuf_run: DISPLAY=$DISPLAY SDL_VIDEODRIVER=$SDL_VIDEODRIVER"
+echo "gzdoom_pbuf_run: LD_PRELOAD=$LD_PRELOAD"
+echo "gzdoom_pbuf_run: GZCAP=$GZCAP GZPBUF_W=$GZPBUF_W GZPBUF_H=$GZPBUF_H"
+echo "gzdoom_pbuf_run: LOG=$GZLOG TIMEOUT=$TIMEOUT DETACH=$GZ_DETACH"
+printf 'CMD:'
+printf ' %q' "${CMD[@]}"
+echo
+
+if [ "$GZ_DETACH" = "1" ]; then
+ setsid nohup timeout "$TIMEOUT" "${CMD[@]}" > "$GZLOG" 2>&1 < /dev/null &
+ echo "PID=$!"
+ echo "LOG=$GZLOG"
+ exit 0
+fi
+
+timeout "$TIMEOUT" "${CMD[@]}" > "$GZLOG" 2>&1
+rc=$?
+echo "RC=$rc"
+echo "LOG=$GZLOG"
+exit "$rc"