diff options
| author | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-11-16 23:45:08 -0500 |
|---|---|---|
| committer | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-11-16 23:45:08 -0500 |
| commit | 10e03cd7571e905c17092e234a74eed217f1c83d (patch) | |
| tree | 4ebe8848dbcfa7332f5b55a643cbd771db1824bf | |
| parent | 9386fe4b948e0aba2f3455671a77e18452ddc924 (diff) | |
| download | open-iov-10e03cd7571e905c17092e234a74eed217f1c83d.tar.gz open-iov-10e03cd7571e905c17092e234a74eed217f1c83d.zip | |
vgsp: eng89s - admit the real CALL(0) 0x3800 draw; GZ_EGL harness
The real 570.144 direct-GL draw window (12068 B @ push 0x402f9d8) carries
no 0x3910/0x3914 write. Its draw is an op=4 IMMD to method 0x3800
(imm=0xd48=3400) plus CALL slots 44/57/58 (0x3960/0x39c8/0x39d0), and the
window has no colour-target bind of its own, so RT-gated admission sent it
down the compute-QMD lane. Recognize and admit the real marker: the walker,
chunk check and window marker accept 0x3800/0x3960/0x39c8/0x39d0 (0x3910/
0x3914 kept); the call-0 admission predicate scans the admitted window
(a pre-window run header can swallow the window head); the draw chunk is
forced first (draw_slice=1, order 0) and the window replayed verbatim.
The booter's DRAW_IAB window predicate accepts the op=4 CALL(0) and the
secondaries, the census names slot 0 (MME-CALL-ARGS slot=0 data=), and the
final emitted window gets MME-EXEC-CALL slot=0 (the physical GR front-end
executes the CALL; the kernel has no CALL interpreter, the 0x114 prelude
uploads precede the window in the same launch).
Guest harness: add tools/guest-diag/gz_es.c and an on-demand build in
push_gl_tools.sh; GZ_EGL=1 switches gzdoom_pbuf_run.sh/mission-gz.sh to
SDL offscreen + real NVIDIA EGL/GLES (default unchanged); push_gl_tools.sh
creates the NVIDIA EGL vendor ICD only when missing.
Receipts: c1025 GL-FLUSH admitted=1, DRAW-WRITE m=0x3800 op=4 data=0xd48,
3D mark admitted (CALL(0) 0x3800 draw marker), 3D stream chunked, 3D chunk
launch draw=1, MME-CALL-ARGS slot=0 data=0xd48, MME-EXEC-CALL slot=0
op=4 imm=0xd48. Exact 0x402f9d8 post-fix replay still unverified (run
wedged on an earlier draw window); stores/px remain open.
| -rw-r--r-- | kernel/gsp_phys_booter.c | 84 | ||||
| -rw-r--r-- | kernel/gsp_sema_service.c | 110 | ||||
| -rw-r--r-- | tools/guest-diag/10_nvidia.json | 6 | ||||
| -rw-r--r-- | tools/guest-diag/gz_es.c | 106 | ||||
| -rwxr-xr-x | tools/guest-diag/gzdoom_pbuf_run.sh | 24 | ||||
| -rw-r--r-- | tools/guest-diag/mission-gz.sh | 22 | ||||
| -rwxr-xr-x | tools/guest-diag/push_gl_tools.sh | 32 | ||||
| -rw-r--r-- | wiki/Graphics-Execution.md | 27 |
8 files changed, 392 insertions, 19 deletions
diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c index 2be4a60..5f1b99f 100644 --- a/kernel/gsp_phys_booter.c +++ b/kernel/gsp_phys_booter.c @@ -19164,7 +19164,19 @@ MODULE_PARM_DESC(sema_gl_mme_release_chain, * carry 1+cnt words; only op 1/3 walk past the header method), so a * CALL_MME_DATA(34) port write (0x3914) or another slot's call never * selects the record. + * + * eng89s: the real 570.144 direct-GL draw is CALL_MME_MACRO(0) - an IMMD + * (op 4) write to 0x3800 whose immediate is the macro program length + * (c1022: hdr 0x8d480e00 imm=0xd48=3400) - with 0x3960/0x39c8/0x39d0 + * (slots 44/57/58) as secondaries. Accept it as a DRAW_IAB-bearing + * window so the saved-window release prefers the real draw chunk. */ +static bool gsp_phys_gr_mme_draw_method(u32 m) +{ + return m == 0x3800u || m == 0x3910u || m == 0x3914u || + m == 0x3960u || m == 0x39c8u || m == 0x39d0u; +} + static bool gsp_phys_gr_mme_window_has_draw_ia(const u32 *win, u32 n) { u32 r = 0; @@ -19185,14 +19197,19 @@ static bool gsp_phys_gr_mme_window_has_draw_ia(const u32 *win, u32 n) * k=(0x3910-0x804)/4 with the macro data/address in the * following word. Only count it when that data word exists * (k + 1 < span), so a bare method mention is not a CALL. + * eng89s: an op=4 CALL(0) carries its argument as the header + * immediate, so it needs no following data word. */ for (k = 0; k < span; k++) { u32 m = ((h & 0xfffu) << 2) + 4u * k; if (k && op != 1u && op != 3u) break; - if (m == 0x3800u + 34u * 8u && - k + 1u < span && r + k + 1u < n) + if (!gsp_phys_gr_mme_draw_method(m)) + continue; + if (m == 0x3800u && op == 4u && cnt) + return true; + if (k + 1u < span && r + k + 1u < n) return true; } r += span; @@ -19503,6 +19520,28 @@ static void gsp_phys_gr_mme_call_census(const struct gsp_phys_gr_submit *req, (have_gold ? gent : 0u), win_n, held); } + /* + * eng89s: the real draw's CALL_MME_MACRO(0) target. + * An IMMD carries its argument in the header immediate; + * an interior INC/ONEINC run carries it in the following + * data word. + */ + if (j == 0u) { + u32 data = 0; + + if (op == 4u) + data = (h >> 16) & 0x1fffu; + else if (k + 1u < span) + data = req->stream[r + k + 1u]; + pr_info("vgsp-gr: MME-CALL-ARGS slot=0 data=0x%x at=%u\n", + data, r + k); + pr_info("vgsp-gr: MME-CALL-TARGET slot=0 method=0x%x client=0x%x golden=0x%x used=0x%x win=%u held=%u\n", + m, have_cli ? sa_ent[0] : 0u, + have_gold ? gent : 0u, + have_cli ? sa_ent[0] : + (have_gold ? gent : 0u), + win_n, held); + } } r += span; } @@ -26014,6 +26053,47 @@ if (gsp_phys_gr_slot_kept(j, sa_mask, } } /* + * eng89s: op=4 CALL_MME_MACRO(0) execution receipt. There is + * no kernel-side CALL interpreter: the FINAL emitted window is + * walked by the physical GR front-end, and CALL(0) resolves to + * the START-ADDRESS RAM entry the prelude pack uploaded. A + * call that survived the hold/elision passes above is in the + * emitted bytes, so name its resolved target; a held call has + * no receipt (MME-CALL-HOLD names the hold instead). + */ + if ((u32)(p - pb) > win_emit_off) { + static u32 mme_exec_log; + u32 ew = win_emit_off, en = (u32)(p - pb); + + while (ew < en && mme_exec_log < 32u) { + u32 h = pb[ew]; + u32 op = (h >> 29) & 7u; + u32 cnt = (h >> 16) & 0x1fffu; + u32 span = 1u; + u32 m0 = (h & 0xfffu) << 2; + + if ((op <= 3u || op == 5u) && cnt && + ew + 1u + cnt <= en) + span = 1u + cnt; + if (m0 == 0x3800u && + (op == 4u || op == 0u || op == 1u || + op == 3u || op == 5u)) { + u32 sa_ent[64] = { 0 }; + u64 sa_mask = gsp_sema_mme_sa_get( + sa_ent, 64); + u32 addr = (sa_mask & 1ull) ? + sa_ent[0] : 0u; + + mme_exec_log++; + pr_info("vgsp-gr: MME-EXEC-CALL slot=0 addr=0x%x h=0x%x push=0x%llx rel=%u op=%u imm=0x%x\n", + addr, req->h_object, + req->push_va, req->stream_rel, + op, op == 4u ? cnt : 0u); + } + ew += span; + } + } + /* * eng39: neutralize the client's own notify/report-semaphore * targets in the FINAL emitted window (after the CALL/pair * elisions above, before the ladder's own release tail below diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c index ad99397..7eb67ae 100644 --- a/kernel/gsp_sema_service.c +++ b/kernel/gsp_sema_service.c @@ -11953,6 +11953,20 @@ static bool svc_gl_mismatch_new_push(u64 push_va) return true; } +/* + * eng89s: the real direct-GL draw markers. The 570.144 client encodes the + * draw as CALL_MME_MACRO(0): an IMMD (op 4) write to method 0x3800 whose + * immediate is the macro program length (c1022: hdr 0x8d480e00, m=0x3800, + * imm=0xd48=3400), followed by CALL slots 44/57/58 as ONE_INC runs to + * 0x3960 / 0x39c8 / 0x39d0. The older DRAW_IAB slots 34 (0x3910 macro / + * 0x3914 data) stay accepted for the lanes that use them. + */ +static bool svc_gl_draw_method(u32 m) +{ + return m == 0x3800u || m == 0x3910u || m == 0x3914u || + m == 0x3960u || m == 0x39c8u || m == 0x39d0u; +} + static u32 svc_gl_draw_walk(const u32 *win, u32 n, u32 base_word, u32 *at, u32 *span_out, u32 *runs_out, bool log_it, struct svc_channel *ch, u64 push_va) @@ -11988,7 +12002,7 @@ static u32 svc_gl_draw_walk(const u32 *win, u32 n, u32 base_word, if (k && !incr) break; m = m0 + 4u * k; - if (m != 0x3910u && m != 0x3914u) + if (!svc_gl_draw_method(m)) continue; if (!found) { *at = r; @@ -12001,6 +12015,23 @@ static u32 svc_gl_draw_walk(const u32 *win, u32 n, u32 base_word, ch->h_object, push_va, base_word + r, m, op, cnt, span); } + /* + * eng89s: the CALL(0) marker is an IMMD: its argument is + * the header's immediate, not a following data word. + */ + if (m == 0x3800u) { + if (log_it && svc_gl_draw_write_log < 16u) { + u32 data = op == 4u ? cnt : + (k + 1u < span ? + win[r + k + 1u] : 0u); + + svc_gl_draw_write_log++; + pr_info("sema-gl: DRAW-WRITE h=0x%x push=0x%llx m=0x3800 op=%u data=0x%x at=%u run=%u\n", + ch->h_object, push_va, op, data, + r + k, r); + } + continue; + } /* eng89r: the write word and its data word, bounded * 16 per push. `at`/`run` are window words. */ if (log_it && svc_gl_draw_write_log < 16u && @@ -12364,12 +12395,13 @@ static bool svc_gl_chunk_has_draw_ia(const u32 *win, u32 n) if ((op <= 3u || op == 5u) && cnt && r + 1u + cnt <= n) span = 1u + cnt; - /* eng89r: interior methods again (see svc_gl_draw_walk). */ + /* eng89r: interior methods again (see svc_gl_draw_walk). + * eng89s: the real draw is CALL(0) (0x3800, op 4 IMMD) with + * 0x3960/0x39c8/0x39d0 as the slot 44/57/58 secondaries. */ for (k = 0; k < span; k++) { if (k && !incr) break; - if (m0 + 4u * k == 0x3910u || - m0 + 4u * k == 0x3914u) + if (svc_gl_draw_method(m0 + 4u * k)) return true; } r += span; @@ -12744,6 +12776,11 @@ static bool svc_gl_win_has_draw_legacy(const u8 *buf, u32 len) * r + (0x3910 - 0x804)/4). Walk every method the run reaches * (m0 + 4*k, k<span), exactly the pre-eng89p admission that admitted the * real windows; eng89p's header-only gate rejected all of them. + * + * eng89s: the real 570.144 direct-GL draw is CALL_MME_MACRO(0) - an IMMD + * (op 4) write to 0x3800 whose immediate is the macro program length + * (c1022: 0x8d480e00 imm=0xd48=3400) - with CALL slots 44/57/58 + * (0x3960/0x39c8/0x39d0) as secondaries. The old DRAW_IAB slots stay. */ static bool svc_gl_win_has_draw(const u8 *buf, u32 len) { @@ -12766,8 +12803,7 @@ static bool svc_gl_win_has_draw(const u8 *buf, u32 len) for (k = 0; k < span; k++) { if (k && !incr) break; - if (m0 + 4u * k == 0x3910u || - m0 + 4u * k == 0x3914u) + if (svc_gl_draw_method(m0 + 4u * k)) return true; } r += span; @@ -12775,6 +12811,47 @@ static bool svc_gl_win_has_draw(const u8 *buf, u32 len) return false; } +/* + * eng89s: admission predicate for the real draw. The real direct-GL draw + * window carries the CALL(0) IMMD but no colour-target bind of its own + * (c1022: no 0x800/0x804/0x808/0x80c write in the 2617-word window, and + * no persisted bind on the channel), so every RT clause can miss. Accept + * the CALL(0) marker only when its immediate is a plausible macro program + * length, so a data word that happens to decode as op=4/0x3800 cannot + * admit a blob. + * + * Scan the ADMITTED WINDOW, not the whole push: the push's pre-window data + * can contain a run header whose span covers the window head (c1023 push + * 0x402f9d8: word 316 decodes op=0 cnt=1059 and swallows words 400..1459, + * hiding the real CALL(0) at word 655 from a from-zero walk). + */ +static bool svc_gl_win_has_draw_call0(const u8 *buf, u32 len, u32 start_off, + u32 at_off) +{ + const u32 *win = (const u32 *)buf; + u32 n, r, end; + + if (!buf || start_off >= at_off || at_off > len) + return false; + r = start_off / 4u; + end = at_off / 4u; + n = len / 4u; + while (r < end && r < n) { + u32 h = win[r]; + u32 op = (h >> 29) & 7u; + u32 cnt = (h >> 16) & 0x1fffu; + u32 span = 1u; + u32 m0 = (h & 0xfffu) << 2; + + if ((op <= 3u || op == 5u) && cnt && r + 1u + cnt <= end) + span = 1u + cnt; + if (op == 4u && m0 == 0x3800u && cnt >= 0x100u) + return true; + r += span; + } + return false; +} + static void svc_gl_rt_note(const u8 *buf, u32 len, u64 h, u64 push) { u32 A[4] = { 0 }, B[4] = { 0 }, W[4] = { 0 }, H[4] = { 0 }; @@ -12893,6 +12970,27 @@ static bool svc_gl_window_drawwin_ok(const u8 *buf, u32 len, u32 start_off, return true; } /* + * eng89s: the real draw window carries the CALL(0) marker but no + * colour-target bind of its own (c1022: RT-SCAN found no 0x800..0x80c + * write and no bind was persisted on the channel), so every clause + * above misses and the window fell to the compute-QMD lane. The + * op=4 CALL(0) with a plausible macro-program length is the primary + * draw marker of this lane; admit on it. The caller still enforces + * the raw/geometry gates before streaming. + */ + if (svc_gl_win_has_draw_call0(buf, len, start_off, at_off)) { + static u32 call0_adm_log; + + if (call0_adm_log < 16u) { + call0_adm_log++; + pr_info("sema-gl: 3D mark admitted (CALL(0) 0x3800 draw marker) start=0x%x at=0x%x win=%u words\n", + start_off, at_off, + at_off > start_off ? + (at_off - start_off) / 4u : 0u); + } + return true; + } + /* * eng89: the draw window usually carries no bind of its own (the * target was bound by an earlier state push). Admit on the * persisted bind when one is known; the replay context's RT state diff --git a/tools/guest-diag/10_nvidia.json b/tools/guest-diag/10_nvidia.json new file mode 100644 index 0000000..2bfcca0 --- /dev/null +++ b/tools/guest-diag/10_nvidia.json @@ -0,0 +1,6 @@ +{ + "file_format_version" : "1.0.0", + "ICD" : { + "library_path" : "libEGL_nvidia.so.0" + } +} diff --git a/tools/guest-diag/gz_es.c b/tools/guest-diag/gz_es.c new file mode 100644 index 0000000..b371e4f --- /dev/null +++ b/tools/guest-diag/gz_es.c @@ -0,0 +1,106 @@ +// gz_es.c - give SDL2's offscreen driver a real NVIDIA EGL/GLES context. +// no X, no GLX, no llvmpipe. build: gcc -shared -fPIC -O2 -o gz_es.so gz_es.c -lEGL -lGLESv2 -ldl +#define _GNU_SOURCE +#include <dlfcn.h> +#include <stdio.h> +#include <EGL/egl.h> +#include <EGL/eglext.h> +#include <GLES2/gl2.h> + +static EGLDisplay dpy; +static EGLContext ctx; +static int (*real_make)(void *, void *); + +void *SDL_GL_CreateContext(void *win) +{ + PFNEGLGETPLATFORMDISPLAYEXTPROC gp = + (PFNEGLGETPLATFORMDISPLAYEXTPROC)eglGetProcAddress( + "eglGetPlatformDisplayEXT"); + PFNEGLQUERYDEVICESEXTPROC qd = + (PFNEGLQUERYDEVICESEXTPROC)eglGetProcAddress( + "eglQueryDevicesEXT"); + EGLint maj, min, nc = 0; + EGLConfig cfg; + EGLint ca[] = { EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, + EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_NONE }; + EGLint at[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; + void (*load)(const char *) = dlsym(RTLD_NEXT, "SDL_GL_LoadLibrary"); + + if (load) + load(NULL); + if (!gp || !qd) { + fprintf(stderr, "[gzes] no EGL platform ext\n"); + return NULL; + } + { + EGLDeviceEXT devs[8]; + EGLint n = 0; + + if (qd(8, devs, &n) && n > 0) + dpy = gp(EGL_PLATFORM_DEVICE_EXT, devs[0], NULL); + } + if (dpy == EGL_NO_DISPLAY) + dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); + if (!eglInitialize(dpy, &maj, &min)) { + fprintf(stderr, "[gzes] eglInitialize 0x%x\n", eglGetError()); + return NULL; + } + if (!eglChooseConfig(dpy, ca, &cfg, 1, &nc) || nc < 1) { + fprintf(stderr, "[gzes] choose 0x%x\n", eglGetError()); + return NULL; + } + ctx = eglCreateContext(dpy, cfg, EGL_NO_CONTEXT, at); + if (ctx == EGL_NO_CONTEXT) { + fprintf(stderr, "[gzes] ctx 0x%x\n", eglGetError()); + return NULL; + } + if (!eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, ctx)) { + fprintf(stderr, "[gzes] current 0x%x\n", eglGetError()); + return NULL; + } + fprintf(stderr, "[gzes] OK %s | %s ctx=%p\n", + glGetString(GL_RENDERER), glGetString(GL_VERSION), (void *)ctx); + return (void *)ctx; +} + +int SDL_GL_MakeCurrent(void *win, void *c) +{ + if (!real_make) + real_make = dlsym(RTLD_NEXT, "SDL_GL_MakeCurrent"); + if (!dpy || !c) + return real_make ? real_make(win, c) : -1; + return eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, + (EGLContext)c) ? 0 : -1; +} + +void SDL_GL_SwapWindow(void *win) +{ + (void)win; + glFlush(); +} + +void SDL_GL_GetDrawableSize(void *win, int *w, int *h) +{ + (void)win; + if (w) + *w = 640; + if (h) + *h = 480; +} + +void SDL_GL_GetWindowSize(void *win, int *w, int *h) +{ + SDL_GL_GetDrawableSize(win, w, h); +} + +void *SDL_GL_GetCurrentContext(void) +{ + return (void *)ctx; +} + +void SDL_GL_DeleteContext(void *c) +{ + (void)c; +} diff --git a/tools/guest-diag/gzdoom_pbuf_run.sh b/tools/guest-diag/gzdoom_pbuf_run.sh index 49c5c96..6d9e8b7 100755 --- a/tools/guest-diag/gzdoom_pbuf_run.sh +++ b/tools/guest-diag/gzdoom_pbuf_run.sh @@ -16,6 +16,9 @@ # 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 +# GZ_EGL default 0; set 1 to use SDL's offscreen driver with a real +# NVIDIA EGL/GLES context via gz_es.so (no X, no GLX; the +# c1020/c1021 real-GL path). The pbuffer shims are not used. # # The base args are windowed GL: +set vid_fullscreen 0, 640x480, OpenGL # backend 0, +vid_rendermode 4 (GL mode), MAP01. The preload order matters: @@ -35,10 +38,21 @@ GZ_ARGS="${GZ_ARGS:-}" GZ_DETACH="${GZ_DETACH:-0}" GZ_RCFILE="${GZ_RCFILE:-/tmp/gz-rc}" DISPLAY="${DISPLAY:-:0}" +GZ_EGL="${GZ_EGL:-0}" SDL_VIDEODRIVER="${SDL_VIDEODRIVER:-offscreen}" -LD_PRELOAD="${LD_PRELOAD:-/tmp/sdl_cap.so /tmp/gz_pbuf.so}" +if [ "$GZ_EGL" = "1" ]; then + SDL_VIDEO_EGL_DRIVER="${SDL_VIDEO_EGL_DRIVER:-/usr/lib/x86_64-linux-gnu/libEGL.so.1}" + LD_PRELOAD="${LD_PRELOAD:-/tmp/gz_es.so}" + GZ_BACKEND="${GZ_BACKEND:-2}" + SHIMS="/tmp/gz_es.so" +else + SDL_VIDEO_EGL_DRIVER="${SDL_VIDEO_EGL_DRIVER:-}" + LD_PRELOAD="${LD_PRELOAD:-/tmp/sdl_cap.so /tmp/gz_pbuf.so}" + GZ_BACKEND="${GZ_BACKEND:-0}" + SHIMS="/tmp/sdl_cap.so /tmp/gz_pbuf.so" +fi -export DISPLAY SDL_VIDEODRIVER LD_PRELOAD GZCAP GZCAP_MAXF GZPBUF_W GZPBUF_H GZ_RCFILE +export DISPLAY SDL_VIDEODRIVER SDL_VIDEO_EGL_DRIVER LD_PRELOAD GZCAP GZCAP_MAXF GZPBUF_W GZPBUF_H GZ_RCFILE GZ_EGL if [ ! -x "$GZDOOM_BIN" ]; then echo "gzdoom_pbuf_run: GZDOOM_BIN not executable: $GZDOOM_BIN" >&2 @@ -48,7 +62,7 @@ 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 +for so in $SHIMS; do if [ ! -f "$so" ]; then echo "gzdoom_pbuf_run: shim missing: $so" >&2 exit 2 @@ -61,7 +75,7 @@ CMD=( +set vid_fullscreen 0 +set vid_defwidth "$GZPBUF_W" +set vid_defheight "$GZPBUF_H" - +set vid_preferbackend 0 + +set vid_preferbackend "$GZ_BACKEND" +vid_rendermode 4 -nosound -nomusic @@ -76,7 +90,7 @@ if [ -n "$GZ_ARGS" ]; then CMD+=("${GZ_EXTRA[@]}") fi -echo "gzdoom_pbuf_run: DISPLAY=$DISPLAY SDL_VIDEODRIVER=$SDL_VIDEODRIVER" +echo "gzdoom_pbuf_run: DISPLAY=$DISPLAY SDL_VIDEODRIVER=$SDL_VIDEODRIVER GZ_EGL=$GZ_EGL" echo "gzdoom_pbuf_run: LD_PRELOAD=$LD_PRELOAD" echo "gzdoom_pbuf_run: GZCAP=$GZCAP GZCAP_MAXF=$GZCAP_MAXF GZPBUF_W=$GZPBUF_W GZPBUF_H=$GZPBUF_H" echo "gzdoom_pbuf_run: LOG=$GZLOG TIMEOUT=$TIMEOUT DETACH=$GZ_DETACH" diff --git a/tools/guest-diag/mission-gz.sh b/tools/guest-diag/mission-gz.sh index c4665d2..cb27503 100644 --- a/tools/guest-diag/mission-gz.sh +++ b/tools/guest-diag/mission-gz.sh @@ -8,6 +8,8 @@ # # Env knobs: GZ_SECS (default 240) GLF_FRAMES (default 0 = skip probe) # GLF_W/GLF_H GZCAP GZCAP_MAXF GZ_ATTEMPTS (default 2) +# GZ_EGL (default 0; 1 = SDL offscreen + real NVIDIA EGL via +# gz_es.so, no X - the c1020/c1021 real-GL path) # # 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 @@ -20,6 +22,8 @@ export DISPLAY=:0 GZCAP="${GZCAP:-/dev/shm/gzframes.bin}" GZCAP_MAXF="${GZCAP_MAXF:-1800}" GZ_ATTEMPTS="${GZ_ATTEMPTS:-2}" +GZ_EGL="${GZ_EGL:-0}" +export GZ_EGL x_up() { local t r @@ -39,11 +43,17 @@ echo "mission start $(date +%T)" rm -f /tmp/mission-done /tmp/gzframes.bin "$GZCAP" mkdir -p /tmp/gzshots -# 1. X up (the DDX ScreenInit is a per-start lottery) +# 1. X up (the DDX ScreenInit is a per-start lottery). The GZ_EGL path is +# offscreen EGL and does not need X at all. XOK=0 -XTRY=$(x_up) && XOK=1 -echo "XOK try=$XTRY $(date +%T)" -if [ "$XOK" = 0 ]; then echo "X-FAIL" > /tmp/mission-done; exit 1; fi +if [ "$GZ_EGL" = "1" ]; then + XOK=1 + echo "X skipped (GZ_EGL=1 offscreen EGL) $(date +%T)" +else + XTRY=$(x_up) && XOK=1 + echo "XOK try=$XTRY $(date +%T)" + if [ "$XOK" = 0 ]; then echo "X-FAIL" > /tmp/mission-done; exit 1; fi +fi bash /tmp/guest_mode.sh 2>/dev/null || true # 2. Optional GPU GL probe (diagnostic only; off by default) @@ -73,12 +83,12 @@ export GZ_RCFILE=/tmp/gz-rc GZRC=255 attempt=1 while [ "$attempt" -le "$GZ_ATTEMPTS" ]; do - if ! pgrep -x Xorg >/dev/null; then + if [ "$GZ_EGL" != "1" ] && ! 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" \ + GZ_EGL="$GZ_EGL" 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 diff --git a/tools/guest-diag/push_gl_tools.sh b/tools/guest-diag/push_gl_tools.sh index 986d2d6..4ea5665 100755 --- a/tools/guest-diag/push_gl_tools.sh +++ b/tools/guest-diag/push_gl_tools.sh @@ -25,15 +25,30 @@ if [ "${1:-}" = "--dry-run" ]; then shift fi +# gz_es.so is small and its source is tracked; build it on demand (host gcc, +# same libc family as the guest) so the GZ_EGL=1 path works from a fresh +# checkout. The other shims stay prebuilt in build/. +if [ ! -f "$BUILD/gz_es.so" ] && [ "$DRY_RUN" != "1" ]; then + mkdir -p "$BUILD" + if gcc -shared -fPIC -O2 -o "$BUILD/gz_es.so" "$HERE/gz_es.c" \ + -lEGL -lGLESv2 -ldl; then + echo "BUILD $BUILD/gz_es.so" + else + echo "BUILD-FAIL gz_es.so (EGL/GLESv2 dev headers needed)" >&2 + fi +fi + FIXED=( "$BUILD/gl_frames" "$BUILD/gz_pbuf.so" + "$BUILD/gz_es.so" "$BUILD/sdl_cap.so" "$BUILD/test_tri" "$HERE/guest_mode.sh" "$HERE/gzf2_video.py" "$HERE/gzdoom_pbuf_run.sh" "$HERE/mission-gz.sh" + "$HERE/10_nvidia.json" ) if [ "$#" -gt 0 ]; then @@ -72,4 +87,21 @@ for f in "${FILES[@]}"; do fi push_b64 "$f" "$DEST_DIR/$(basename "$f")" || rc=1 done + +# The EGL offscreen path (GZ_EGL=1) needs the NVIDIA EGL vendor ICD; some +# guest images lack it. Create it only when missing (never overwrite the +# driver's own file). +EGL_JSON=/usr/share/glvnd/egl_vendor.d/10_nvidia.json +if [ "$DRY_RUN" = "1" ]; then + echo "PUSH-DRY $EGL_JSON (if missing)" +elif sudo "$VMEXEC" exec --timeout 30 "test -f $EGL_JSON" >/dev/null 2>&1; then + echo "PUSH-SKIP existing $EGL_JSON" +elif sudo "$VMEXEC" exec --timeout 30 \ + "mkdir -p /usr/share/glvnd/egl_vendor.d && cp '$DEST_DIR/10_nvidia.json' '$EGL_JSON'" \ + >/dev/null 2>&1; then + echo "PUSHED $EGL_JSON" +else + echo "PUSH-FAIL $EGL_JSON" >&2 + rc=1 +fi exit "$rc" diff --git a/wiki/Graphics-Execution.md b/wiki/Graphics-Execution.md index 4d879df..6cadc98 100644 --- a/wiki/Graphics-Execution.md +++ b/wiki/Graphics-Execution.md @@ -174,6 +174,33 @@ fidelity: miss (`wrote=0`, `0/1025` pages, `px0=0`); the window/screen present is still the frontier (ยง6), and the pack-completion and X-start lotteries remain the throughput limiters. + **The real client draw uses `CALL_MME_MACRO(0)`.** The real-NVIDIA-GL + capture (c1021/c1022) shows the 12068-byte draw window at push + `0x402f9d8` carries no `0x3910/0x3914` write. Its draw is an IMMD (op 4) + write to method `0x3800` (`hdr=8d480e00`, `imm=0xd48` = 3400), followed + by CALL slots 44/57/58 (`0x3960`, `0x39c8`, `0x39d0`). That window also + carries no colour-target bind of its own and no persisted bind was live, + so the RT-gated admission refused it and it retired through the + compute-QMD lane (`stream_3d=false`). Recognition now covers the real + marker: `0x3800` (op 4; `imm>=0x100` as the admission floor) plus + `0x3960/0x39c8/0x39d0`, with `0x3910/0x3914` kept; the call-0 predicate + scans the admitted window (`start_off..at_off`) because a pre-window run + header can swallow the window head (word 316's op=0 count=1059 covers + words 400..1459 and hides the CALL at word 655 from a from-zero walk). + Admission is on the real marker even without a bind, the chunk carrying + the CALL is forced first (`draw_slice=1`, order 0), and every chunk is + replayed verbatim. The CALL is not interpreted in software: the emitted + window is walked by the physical GR front-end (the `0x114` prelude + uploads precede the window in the same launch), and + `MME-EXEC-CALL slot=0 ... op=4 imm=...` records the call reaching the + emitted stream. c1025 receipts: `GL-FLUSH ... admitted=1`, + `DRAW-WRITE ... m=0x3800 op=4 data=0xd48`, `3D mark admitted (CALL(0) + 0x3800 draw marker)`, `3D stream chunked`, `3D chunk launch ... draw=1`, + `MME-CALL-ARGS slot=0 data=0xd48`, `MME-EXEC-CALL slot=0 ... imm=0xd48`. + The captured SA[0] is still unresolved (`addr=0x0`), the exact + 12068-byte window's post-fix admission was not re-captured (the run + wedged on an earlier draw window first), and stores / `DRAW_IAB + mac=0x22` remain the open frontier. ## 4. The channel and object picture * **Every submission lives on a channel**: a GPFIFO ring plus engine objects, |
