summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-11-17 08:05:28 -0500
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-11-17 08:05:28 -0500
commit86ee35bd03a51abf115812540dcd6d711d79e9e9 (patch)
tree4fe2787e2019ff3db93d1333253af34ed6fa49f2
parente6d24f0f1c2d1d459bad2ada690c6778fefbe085 (diff)
downloadopen-iov-86ee35bd03a51abf115812540dcd6d711d79e9e9.tar.gz
open-iov-86ee35bd03a51abf115812540dcd6d711d79e9e9.zip
chore: sync work tree before video production runHEADmaster
-rw-r--r--kernel/gsp_sema_service.c36
-rw-r--r--tools/guest-diag/gz_es.c250
-rw-r--r--tools/guest-diag/gz_view.c175
-rw-r--r--tools/guest-diag/params-r1624-maps6-780.txt2
-rwxr-xr-xtools/guest-diag/push_gl_tools.sh11
5 files changed, 448 insertions, 26 deletions
diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c
index 7eb67ae..b80a397 100644
--- a/kernel/gsp_sema_service.c
+++ b/kernel/gsp_sema_service.c
@@ -11853,6 +11853,24 @@ module_param_named(sema_gl_chunk_words, svc_gl_chunk_words_param, uint, 0644);
MODULE_PARM_DESC(sema_gl_chunk_words,
"3D stream chunk size in words for the chunked verbatim replay (0 = built-in 384)");
#define SVC_GL_STREAM_CHUNK_WORDS 384u
+/*
+ * Strict in-order replay (default 0 = historical forced-draw-first).
+ *
+ * The client's method stream is order-dependent: a CALL_MME_MACRO run is
+ * followed by the DATA/argument runs it consumes, and the preceding runs
+ * set the state it reads. Forcing the draw-bearing slice to launch first
+ * (the historical behaviour) executes that CALL before its own argument
+ * runs and before the window's state, which is exactly the class of
+ * poison (MME HWW badf1201 pc=513) seen on the real GZDoom draw stream.
+ * With the candidate ring large enough that a chunk is no longer evicted
+ * (eng89m), the ordering workaround is no longer needed: replay the
+ * admitted window in its original order. Kept as a runner-settable knob
+ * so the old ordering remains available for A/B sessions.
+ */
+static unsigned svc_gl_stream_inorder;
+module_param_named(sema_gl_stream_inorder, svc_gl_stream_inorder, uint, 0644);
+MODULE_PARM_DESC(sema_gl_stream_inorder,
+ "Replay a chunked 3D window strictly in window order (1) instead of draw-slice-first (0, default)");
static u32 svc_gl_chunk_boundary(const u8 *buf, u32 len, u32 start,
u32 at_off, u32 max_words)
@@ -12212,8 +12230,13 @@ static void svc_gl_stream_chunks(struct svc_channel *ch, const u8 *buf,
* slice starts at its header and contains its full op span.
* A chunk that would straddle the draw is cut before it; the
* next iteration starts exactly at the run header.
+ *
+ * sema_gl_stream_inorder: skip both the cut and the forced
+ * first launch; the chunk that happens to contain the draw
+ * is only marked for the receipt, and every slice keeps the
+ * FIFO stamp of its position in the window.
*/
- if (have_draw) {
+ if (!READ_ONCE(svc_gl_stream_inorder) && have_draw) {
if (cur < draw_at && draw_at < end) {
end = draw_at;
} else if (cur == draw_at) {
@@ -12227,6 +12250,8 @@ static void svc_gl_stream_chunks(struct svc_channel *ch, const u8 *buf,
end = dend;
is_draw = true;
}
+ } else if (have_draw && draw_at >= cur && draw_at < end) {
+ is_draw = true;
}
rel = (cur - svc_gl.start_off) / 4u;
nw = (end - cur) / 4u;
@@ -12257,10 +12282,13 @@ static void svc_gl_stream_chunks(struct svc_channel *ch, const u8 *buf,
}
if (have) {
/* eng89o: a re-decode must keep the draw slice's
- * forced-first identity, not just its bytes. */
+ * forced-first identity, not just its bytes.
+ * sema_gl_stream_inorder drops that identity so
+ * the replay stays in window order. */
if (is_draw) {
svc_gr_cand_ring[ri].draw_slice = true;
- svc_gr_cand_ring[ri].order = 0;
+ if (!READ_ONCE(svc_gl_stream_inorder))
+ svc_gr_cand_ring[ri].order = 0;
}
n++;
cur = end;
@@ -12300,7 +12328,7 @@ static void svc_gl_stream_chunks(struct svc_channel *ch, const u8 *buf,
* the window; the receipt then shows draw=1 on that launch.
*/
c->draw_slice = is_draw;
- if (is_draw)
+ if (is_draw && !READ_ONCE(svc_gl_stream_inorder))
c->order = 0;
c->valid = true;
c->offered = false;
diff --git a/tools/guest-diag/gz_es.c b/tools/guest-diag/gz_es.c
index b371e4f..5a56fee 100644
--- a/tools/guest-diag/gz_es.c
+++ b/tools/guest-diag/gz_es.c
@@ -1,17 +1,165 @@
-// 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
+// gz_es.c - give SDL2's offscreen driver a real NVIDIA EGL context and
+// publish every presented frame to /dev/shm for a desktop viewer.
+//
+// The guest's vGPU 3D stream is replayed by vgsp; GZDoom renders through
+// the real NVIDIA EGL/GL driver (GL_RENDERER = NVIDIA GeForce RTX 2080
+// SUPER, 4.6.0 NVIDIA 570.144). This shim creates the context on a
+// pbuffer surface (so the default framebuffer is real), and on each
+// SDL_GL_SwapWindow reads the frame back into /dev/shm/gzframes.bin.
+// gz_view then displays those frames in an X11 window on the guest
+// desktop - a capture surface, not a renderer.
+//
+// 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 <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <time.h>
+#include <stdarg.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES2/gl2.h>
+#ifndef GL_BACK
+#define GL_BACK 0x0405
+#endif
+#ifndef GL_FRONT
+#define GL_FRONT 0x0404
+#endif
+#ifndef GL_RGBA8
+#define GL_RGBA8 0x8058
+#endif
+
+#define GZFRAME_MAGIC 0x31465a47u /* "GZF1" */
+struct gzframe_hdr {
+ unsigned int magic;
+ unsigned int w;
+ unsigned int h;
+ unsigned int seq;
+ unsigned int nonblack;
+ unsigned int pad[3];
+};
+
static EGLDisplay dpy;
static EGLContext ctx;
+static EGLSurface surf;
+static int fw = 640, fh = 480;
static int (*real_make)(void *, void *);
+static struct gzframe_hdr *shm;
+static unsigned char *shm_px;
+static size_t shm_len;
+static unsigned int seq;
+static int readbuf = GL_BACK;
+static int tried_front;
+static int logfd = -1;
-void *SDL_GL_CreateContext(void *win)
+static void gzlog(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
+static void gzlog(const char *fmt, ...)
+{
+ char buf[512];
+ va_list ap;
+ int n;
+
+ va_start(ap, fmt);
+ n = vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
+ if (n < 0)
+ return;
+ if (n > (int)sizeof(buf) - 1)
+ n = sizeof(buf) - 1;
+ if (logfd >= 0)
+ (void)write(logfd, buf, n);
+ (void)write(2, buf, n);
+}
+
+static int env_int(const char *name, int def)
+{
+ const char *v = getenv(name);
+
+ return (v && *v) ? atoi(v) : def;
+}
+
+static void shm_open_frame(void)
+{
+ const char *path = getenv("GZFRAME");
+ int fd;
+ size_t need;
+ void *p;
+
+ if (!path || !*path)
+ path = "/dev/shm/gzframes.bin";
+ fw = env_int("GZFRAME_W", fw);
+ fh = env_int("GZFRAME_H", fh);
+ if (fw <= 0 || fw > 4096 || fh <= 0 || fh > 4096) {
+ fw = 640;
+ fh = 480;
+ }
+ need = sizeof(struct gzframe_hdr) + (size_t)fw * fh * 4;
+ fd = open(path, O_RDWR | O_CREAT | O_TRUNC, 0666);
+ if (fd < 0)
+ return;
+ if (ftruncate(fd, need) != 0) {
+ close(fd);
+ return;
+ }
+ p = mmap(NULL, need, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ close(fd);
+ if (p == MAP_FAILED)
+ return;
+ shm = p;
+ shm_px = (unsigned char *)(shm + 1);
+ shm_len = need;
+ memset(shm, 0, need);
+ shm->magic = GZFRAME_MAGIC;
+ shm->w = fw;
+ shm->h = fh;
+ gzlog("[gzes] frame shm %s w=%d h=%d len=%zu\n", path, fw, fh, need);
+}
+
+static void publish_frame(void)
+{
+ unsigned int i, nb = 0;
+
+ if (!shm || !shm_px)
+ return;
+ glFinish();
+ glReadPixels(0, 0, fw, fh, GL_RGBA, GL_UNSIGNED_BYTE, shm_px);
+ for (i = 0; i < (unsigned int)fw * fh; i++) {
+ const unsigned char *p = shm_px + i * 4;
+
+ if (p[0] || p[1] || p[2])
+ nb++;
+ }
+ /*
+ * A pbuffer's default read buffer can be front (single buffered) or
+ * back. If the first frames are entirely black, retry the other
+ * buffer once; the nonblack count is published either way.
+ */
+ if (!nb && !tried_front && readbuf == GL_BACK) {
+ tried_front = 1;
+ readbuf = GL_FRONT;
+ glReadPixels(0, 0, fw, fh, GL_RGBA, GL_UNSIGNED_BYTE, shm_px);
+ for (i = 0; i < (unsigned int)fw * fh; i++) {
+ const unsigned char *p = shm_px + i * 4;
+
+ if (p[0] || p[1] || p[2])
+ nb++;
+ }
+ gzlog("[gzes] first frame black on GL_BACK; GL_FRONT nonblack=%u\n", nb);
+ }
+ seq += 2;
+ shm->seq = seq;
+ shm->nonblack = nb;
+ __sync_synchronize();
+ shm->seq = seq + 1;
+}
+
+static int create_context(void)
{
PFNEGLGETPLATFORMDISPLAYEXTPROC gp =
(PFNEGLGETPLATFORMDISPLAYEXTPROC)eglGetProcAddress(
@@ -21,18 +169,29 @@ void *SDL_GL_CreateContext(void *win)
"eglQueryDevicesEXT");
EGLint maj, min, nc = 0;
EGLConfig cfg;
- EGLint ca[] = { EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
+ EGLint ca_gl[] = { EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
+ EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8,
+ EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8,
+ EGL_DEPTH_SIZE, 24, EGL_NONE };
+ EGLint ca_es[] = { 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 };
+ EGLint at_gl[] = { EGL_CONTEXT_MAJOR_VERSION, 3,
+ EGL_CONTEXT_MINOR_VERSION, 3,
+ EGL_CONTEXT_OPENGL_PROFILE_MASK,
+ EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT, EGL_NONE };
+ EGLint at_es[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
+ EGLint pb[] = { EGL_WIDTH, fw, EGL_HEIGHT, fh, EGL_NONE };
void (*load)(const char *) = dlsym(RTLD_NEXT, "SDL_GL_LoadLibrary");
+ int desktop = 0;
if (load)
load(NULL);
if (!gp || !qd) {
- fprintf(stderr, "[gzes] no EGL platform ext\n");
- return NULL;
+ gzlog("[gzes] no EGL platform ext\n");
+ return -1;
}
{
EGLDeviceEXT devs[8];
@@ -44,24 +203,68 @@ void *SDL_GL_CreateContext(void *win)
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;
+ gzlog("[gzes] eglInitialize 0x%x\n", eglGetError());
+ return -1;
}
- if (!eglChooseConfig(dpy, ca, &cfg, 1, &nc) || nc < 1) {
- fprintf(stderr, "[gzes] choose 0x%x\n", eglGetError());
- return NULL;
+ if (eglBindAPI(EGL_OPENGL_API) &&
+ eglChooseConfig(dpy, ca_gl, &cfg, 1, &nc) && nc >= 1) {
+ ctx = eglCreateContext(dpy, cfg, EGL_NO_CONTEXT, at_gl);
+ if (ctx != EGL_NO_CONTEXT) {
+ desktop = 1;
+ surf = eglCreatePbufferSurface(dpy, cfg, pb);
+ if (surf == EGL_NO_SURFACE) {
+ gzlog("[gzes] pbuffer 0x%x (desktop)\n",
+ eglGetError());
+ eglDestroyContext(dpy, ctx);
+ ctx = EGL_NO_CONTEXT;
+ }
+ }
}
- ctx = eglCreateContext(dpy, cfg, EGL_NO_CONTEXT, at);
if (ctx == EGL_NO_CONTEXT) {
- fprintf(stderr, "[gzes] ctx 0x%x\n", eglGetError());
- return NULL;
+ EGLint sa = EGL_NONE;
+
+ eglBindAPI(EGL_OPENGL_ES_API);
+ if (!eglChooseConfig(dpy, ca_es, &cfg, 1, &nc) || nc < 1) {
+ gzlog("[gzes] choose 0x%x\n", eglGetError());
+ return -1;
+ }
+ ctx = eglCreateContext(dpy, cfg, EGL_NO_CONTEXT, at_es);
+ if (ctx == EGL_NO_CONTEXT) {
+ gzlog("[gzes] ctx 0x%x\n", eglGetError());
+ return -1;
+ }
+ /* ES2 allows a pbuffer too; keep a surface so readback works. */
+ surf = eglCreatePbufferSurface(dpy, cfg, pb);
+ (void)sa;
+ } else {
+ eglBindAPI(EGL_OPENGL_API);
}
- if (!eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, ctx)) {
- fprintf(stderr, "[gzes] current 0x%x\n", eglGetError());
- return NULL;
+ if (surf == EGL_NO_SURFACE) {
+ if (!eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, ctx)) {
+ gzlog("[gzes] current 0x%x\n", eglGetError());
+ return -1;
+ }
+ } else if (!eglMakeCurrent(dpy, surf, surf, ctx)) {
+ gzlog("[gzes] current(surf) 0x%x\n", eglGetError());
+ return -1;
}
- fprintf(stderr, "[gzes] OK %s | %s ctx=%p\n",
- glGetString(GL_RENDERER), glGetString(GL_VERSION), (void *)ctx);
+ shm_open_frame();
+ gzlog("[gzes] OK api=%s renderer=%s version=%s surf=%d desktop=%d\n",
+ eglQueryString(dpy, EGL_CLIENT_APIS) ?: "?",
+ glGetString(GL_RENDERER) ? (const char *)glGetString(GL_RENDERER) : "?",
+ glGetString(GL_VERSION) ? (const char *)glGetString(GL_VERSION) : "?",
+ surf != EGL_NO_SURFACE, desktop);
+ return 0;
+}
+
+void *SDL_GL_CreateContext(void *win)
+{
+ (void)win;
+ if (!logfd)
+ logfd = open("/dev/shm/gzes.log",
+ O_WRONLY | O_CREAT | O_APPEND, 0666);
+ if (create_context())
+ return NULL;
return (void *)ctx;
}
@@ -71,6 +274,8 @@ int SDL_GL_MakeCurrent(void *win, void *c)
real_make = dlsym(RTLD_NEXT, "SDL_GL_MakeCurrent");
if (!dpy || !c)
return real_make ? real_make(win, c) : -1;
+ if (surf != EGL_NO_SURFACE)
+ return eglMakeCurrent(dpy, surf, surf, (EGLContext)c) ? 0 : -1;
return eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE,
(EGLContext)c) ? 0 : -1;
}
@@ -78,6 +283,7 @@ int SDL_GL_MakeCurrent(void *win, void *c)
void SDL_GL_SwapWindow(void *win)
{
(void)win;
+ publish_frame();
glFlush();
}
@@ -85,9 +291,9 @@ void SDL_GL_GetDrawableSize(void *win, int *w, int *h)
{
(void)win;
if (w)
- *w = 640;
+ *w = fw;
if (h)
- *h = 480;
+ *h = fh;
}
void SDL_GL_GetWindowSize(void *win, int *w, int *h)
diff --git a/tools/guest-diag/gz_view.c b/tools/guest-diag/gz_view.c
new file mode 100644
index 0000000..fe167c1
--- /dev/null
+++ b/tools/guest-diag/gz_view.c
@@ -0,0 +1,175 @@
+// gz_view.c - display GZDoom's real-NVIDIA EGL frames in an X11 window.
+// Reads the /dev/shm ring published by gz_es.so and XPutImage's each new
+// frame, scaled 2x. This window is a CAPTURE SURFACE ONLY: the pixels are
+// produced by GZDoom through the guest's real NVIDIA GL driver (vGPU).
+//
+// build: gcc -O2 -o gz_view gz_view.c -lX11
+// run: DISPLAY=:0 ./gz_view [/dev/shm/gzframes.bin]
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <time.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+#define GZFRAME_MAGIC 0x31465a47u
+struct gzframe_hdr {
+ unsigned int magic;
+ unsigned int w;
+ unsigned int h;
+ unsigned int seq;
+ unsigned int nonblack;
+ unsigned int pad[3];
+};
+
+static unsigned int frame_seq(void *p)
+{
+ struct gzframe_hdr *h = p;
+
+ __sync_synchronize();
+ return h->seq;
+}
+
+int main(int argc, char **argv)
+{
+ const char *path = argc > 1 ? argv[1] : "/dev/shm/gzframes.bin";
+ Display *d;
+ Window w;
+ GC gc;
+ XImage *img;
+ Pixmap pm;
+ int scr, sw, sh, W = 1280, H = 960;
+ int fd, mapw = 0, maph = 0, running = 1;
+ void *p = MAP_FAILED;
+ size_t maplen = 0;
+ unsigned int last = 0;
+ unsigned long frames = 0;
+ long nonblack = -1;
+ time_t t0 = time(NULL);
+ char title[256];
+
+ d = XOpenDisplay(NULL);
+ if (!d) {
+ fprintf(stderr, "gz_view: cannot open display\n");
+ return 1;
+ }
+ scr = DefaultScreen(d);
+ sw = DisplayWidth(d, scr);
+ sh = DisplayHeight(d, scr);
+ if (W > sw)
+ W = sw;
+ if (H > sh)
+ H = sh;
+ w = XCreateSimpleWindow(d, RootWindow(d, scr), 20, 40, W, H, 1,
+ BlackPixel(d, scr), BlackPixel(d, scr));
+ snprintf(title, sizeof(title),
+ "GZDoom -> real NVIDIA EGL (GPU frames) [capture surface]");
+ XStoreName(d, w, title);
+ XSelectInput(d, w, ExposureMask | KeyPressMask | StructureNotifyMask);
+ XMapWindow(d, w);
+ gc = XCreateGC(d, w, 0, NULL);
+ XSetForeground(d, gc, WhitePixel(d, scr));
+ img = XCreateImage(d, DefaultVisual(d, scr), DefaultDepth(d, scr),
+ ZPixmap, 0, NULL, W, H, 32, 0);
+ if (!img) {
+ fprintf(stderr, "gz_view: XCreateImage failed\n");
+ return 1;
+ }
+ pm = XCreatePixmap(d, w, W, H, DefaultDepth(d, scr));
+
+ while (running) {
+ while (XPending(d)) {
+ XEvent e;
+
+ XNextEvent(d, &e);
+ if (e.type == KeyPress) {
+ running = 0;
+ } else if (e.type == ClientMessage) {
+ running = 0;
+ } else if (e.type == DestroyNotify) {
+ running = 0;
+ }
+ }
+ if (p == MAP_FAILED) {
+ struct stat st;
+
+ fd = open(path, O_RDONLY);
+ if (fd >= 0 && fstat(fd, &st) == 0 && st.st_size > 32) {
+ maplen = st.st_size;
+ p = mmap(NULL, maplen, PROT_READ,
+ MAP_SHARED, fd, 0);
+ if (p != MAP_FAILED) {
+ struct gzframe_hdr *h = p;
+
+ mapw = h->w;
+ maph = h->h;
+ }
+ }
+ if (fd >= 0)
+ close(fd);
+ }
+ if (p != MAP_FAILED) {
+ struct gzframe_hdr *h = p;
+ unsigned int s = frame_seq(p);
+
+ if ((s & 1u) == 0 && s != last && h->magic == GZFRAME_MAGIC &&
+ mapw > 0 && maph > 0 &&
+ maplen >= 32 + (size_t)mapw * maph * 4) {
+ unsigned char *px = (unsigned char *)(h + 1);
+ unsigned int x, y, *dst = (unsigned int *)img->data;
+ int stride = img->bytes_per_line / 4;
+
+ for (y = 0; y < (unsigned int)maph; y++) {
+ unsigned int yy0 = y * H / maph;
+ unsigned int yy1 = (y + 1) * H / maph;
+
+ for (x = 0; x < (unsigned int)mapw; x++) {
+ unsigned char *sp = px + ((size_t)y * mapw + x) * 4;
+ unsigned int v = (sp[0] << 16) |
+ (sp[1] << 8) | sp[2];
+ unsigned int xx0 = x * W / mapw;
+ unsigned int xx1 = (x + 1) * W / mapw;
+ unsigned int x2, y2;
+
+ for (y2 = yy0; y2 < yy1 && y2 < (unsigned int)H; y2++)
+ for (x2 = xx0; x2 < xx1 && x2 < (unsigned int)W; x2++)
+ dst[(size_t)y2 * stride + x2] = v;
+ }
+ }
+ XPutImage(d, pm, gc, img, 0, 0, 0, 0, W, H);
+ XCopyArea(d, pm, w, gc, 0, 0, W, H, 0, 0);
+ XSetForeground(d, gc, 0x000000);
+ XFillRectangle(d, w, gc, 0, 0, W, 28);
+ XSetForeground(d, gc, 0x00ff00);
+ XDrawString(d, w, gc, 8, 19,
+ "GZDoom -> real NVIDIA EGL (GPU frames) | this window is a capture surface | /dev/shm/gzframes.bin",
+ strlen("GZDoom -> real NVIDIA EGL (GPU frames) | this window is a capture surface | /dev/shm/gzframes.bin"));
+ last = s;
+ frames++;
+ nonblack = (long)h->nonblack;
+ }
+ if (time(NULL) - t0 >= 2 || frames == 0) {
+ char st[256];
+ int n = snprintf(st, sizeof(st),
+ "frames=%lu nonblack=%ld", frames, nonblack);
+ XSetForeground(d, gc, 0x000000);
+ XFillRectangle(d, w, gc, 0, 28, 420, 22);
+ XSetForeground(d, gc, 0x00ffff);
+ XDrawString(d, w, gc, 8, 45, st, n);
+ t0 = time(NULL);
+ }
+ } else {
+ XSetForeground(d, gc, WhitePixel(d, scr));
+ XDrawString(d, w, gc, 20, 60,
+ "waiting for /dev/shm/gzframes.bin (start GZDoom with GZ_EGL=1)",
+ strlen("waiting for /dev/shm/gzframes.bin (start GZDoom with GZ_EGL=1)"));
+ }
+ XFlush(d);
+ usleep(33000);
+ }
+ return 0;
+}
diff --git a/tools/guest-diag/params-r1624-maps6-780.txt b/tools/guest-diag/params-r1624-maps6-780.txt
index 5c82983..958e831 100644
--- a/tools/guest-diag/params-r1624-maps6-780.txt
+++ b/tools/guest-diag/params-r1624-maps6-780.txt
@@ -11,3 +11,5 @@ sema_gl_mme_pack_carry=1 sema_gl_mme_pack_carry_ms=100 sema_gl_mme_pack_release=
sema_gl_vs_autobind=2
sema_gl_wit_shown=40
sema_gl_surf_alias_pref=1
+
+sema_gl_stream_inorder=1 gsp_phys_gr_dump_push=1
diff --git a/tools/guest-diag/push_gl_tools.sh b/tools/guest-diag/push_gl_tools.sh
index 4ea5665..06f7478 100755
--- a/tools/guest-diag/push_gl_tools.sh
+++ b/tools/guest-diag/push_gl_tools.sh
@@ -37,11 +37,22 @@ if [ ! -f "$BUILD/gz_es.so" ] && [ "$DRY_RUN" != "1" ]; then
echo "BUILD-FAIL gz_es.so (EGL/GLESv2 dev headers needed)" >&2
fi
fi
+# gz_view displays the shim's published frames in an X11 window on the
+# guest desktop (capture surface for the real-NVIDIA GZDoom run).
+if [ ! -f "$BUILD/gz_view" ] && [ "$DRY_RUN" != "1" ]; then
+ mkdir -p "$BUILD"
+ if gcc -O2 -o "$BUILD/gz_view" "$HERE/gz_view.c" -lX11; then
+ echo "BUILD $BUILD/gz_view"
+ else
+ echo "BUILD-FAIL gz_view (X11 dev headers needed)" >&2
+ fi
+fi
FIXED=(
"$BUILD/gl_frames"
"$BUILD/gz_pbuf.so"
"$BUILD/gz_es.so"
+ "$BUILD/gz_view"
"$BUILD/sdl_cap.so"
"$BUILD/test_tri"
"$HERE/guest_mode.sh"