summaryrefslogtreecommitdiffstats
path: root/tools/guest-diag/sdl_cap.c
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-11-12 18:28:16 -0500
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-11-12 18:28:16 -0500
commit800c108f9d2463066a221a0e4ff56867304551a6 (patch)
treef9fec57a2402c5022f19f4a0be164e58f96b7fe5 /tools/guest-diag/sdl_cap.c
parent8dce7e59027e8d07ccdf4aa6ac3da02b6e9e9fd9 (diff)
downloadopen-iov-800c108f9d2463066a221a0e4ff56867304551a6.tar.gz
open-iov-800c108f9d2463066a221a0e4ff56867304551a6.zip
tools: fix r1780 cycle prerequisites and add SDL GLX-pbuffer shim
- cycle-r1780.sh: load vfio modules one per modprobe (the multi-module form was silently treating the extra names as parameters and never loading mdev); auto-detect the vgpu mdev type and prefer the 2 GiB type used by the campaign. - sdl_cap.c: gate capture-file creation to processes that can actually read GL pixels (a child was truncating the capture), and log the capture pid/pointers. - gz_pbuf.c: LD_PRELOAD shim that gives an SDL2 GL client a GLX pbuffer context on the guest's NVIDIA X server (the proven gl_frames path), with SDL_GL_GetDrawableSize/SwapWindow interception.
Diffstat (limited to 'tools/guest-diag/sdl_cap.c')
-rw-r--r--tools/guest-diag/sdl_cap.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/guest-diag/sdl_cap.c b/tools/guest-diag/sdl_cap.c
index 23c83ab..5b9c096 100644
--- a/tools/guest-diag/sdl_cap.c
+++ b/tools/guest-diag/sdl_cap.c
@@ -87,10 +87,12 @@ __attribute__((constructor)) static void cap_init(void)
if (h)
real_glReadPixels = dlsym(h, "glReadPixels");
}
- fprintf(stderr, "[gzcap] init path=%s present=%p updwin=%p swap=%p read=%p gros=%p\n",
- p, (void *)real_RenderPresent, (void *)real_UpdateWindowSurface,
+ fprintf(stderr, "[gzcap] init pid=%d path=%s present=%p updwin=%p swap=%p read=%p gros=%p\n",
+ (int)getpid(), p, (void *)real_RenderPresent, (void *)real_UpdateWindowSurface,
(void *)real_GL_SwapWindow, (void *)real_RenderReadPixels,
(void *)real_GetRendererOutputSize, (void *)real_glReadPixels);
+ if (!real_glReadPixels && !real_RenderReadPixels)
+ return;
cap_fp = fopen(p, "wb");
if (!cap_fp)
return;
@@ -192,7 +194,9 @@ void SDL_GL_SwapWindow(SDL_Window *win)
static size_t gbufsz;
if (!hit++)
- fprintf(stderr, "[gzcap] hook GLSwapWindow\n");
+ fprintf(stderr, "[gzcap] hook GLSwapWindow pid=%d fp=%p read=%p gros=%p\n",
+ (int)getpid(), (void *)cap_fp, (void *)real_glReadPixels,
+ (void *)real_GL_GetDrawableSize);
if (cap_fp && !cap_stop && real_glReadPixels && real_GL_GetDrawableSize) {
int w = 0, h = 0;