summaryrefslogtreecommitdiffstats
path: root/tools/guest-diag/push_gl_tools.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/guest-diag/push_gl_tools.sh')
-rwxr-xr-xtools/guest-diag/push_gl_tools.sh32
1 files changed, 32 insertions, 0 deletions
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"