Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion host/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ featclamp envfile unflagged eventstatus query querystuck gsexport dmabufsize dsh
submitfail waitlost apicap ycbcr_swap driverid vidyn eds compilegate sparse a1zink envswitch poolfull heapleak lowmem exitheap xclipse_zink syncfd dmabufsync timeline imageless dabreg dmabufahb
xfb xfb_nofold hotpath wire
poll reqcache syncmirror stale_frames bcn_budget bcn_mixcopy hitch bcauto bcbudget bcupload latency lagprobe framequeue
presentwait present_block compileburst querystuck_burst describe dmaheap"
presentwait present_block compileburst querystuck_burst describe dmaheap instrumentation"
if [ "${1:-}" = --list ]; then
printf '%s\n' $VKB_TEST_NAMES
exit 0
Expand Down Expand Up @@ -689,6 +689,13 @@ run_mode() {
if want server_hup; then
timeout 60 ./server_hup_test.sh >out/t-hup.log 2>&1; result $? "server_hup_test ($(tail -1 out/t-hup.log))"
fi
# The per-frame instrumentation is in the binaries this checkout builds (VKBRIDGE_LATLOG,
# VKBRIDGE_STATS; scripts/check-instrumentation.sh, which the Android build and the asset check
# also run): a build that lost it cannot answer "where did the frame go"
if want instrumentation; then
timeout 60 ../scripts/check-instrumentation.sh --server out/vkbridge-server >out/t-instr.log 2>&1 &&
timeout 60 ../scripts/check-instrumentation.sh out/libvulkan_droidbridge.so >>out/t-instr.log 2>&1; result $? "instrumentation ($(tail -1 out/t-instr.log))"
fi
# A driver crash's line names the client, the bind's image and memory, a draw's bound pipeline
if want crashline; then
timeout 200 ./crashline_test.sh >out/t-crashline.log 2>&1; result $? "crashline_test ($(tail -1 out/t-crashline.log))"
Expand Down
3 changes: 3 additions & 0 deletions scripts/build-server-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@ git=$(git -C "$root" describe --tags --match 'v[0-9]*' --always --dirty 2>/dev/n
"$srv"/*.c "$root/common/vkb_wire.c" "$root/common/vkb_caps.c" "$root/common/gen/vkb_gen_structs.c" "$root/common/gen/vkb_gen_server.c" \
-ldl -llog -lm
"$(dirname "$cc")/llvm-strip" --strip-unneeded "$out/libvkbridge_jni.so"
# The per-frame instrumentation (VKBRIDGE_LATLOG, VKBRIDGE_STATS) is what a "where did the frame go"
# answer is made of; a checkout that lost it must not ship quietly.
"$root/scripts/check-instrumentation.sh" --server "$out/libvkbridge_server.so" "$out/libvkbridge_jni.so"
echo "built $out/libvkbridge_server.so and libvkbridge_jni.so"
8 changes: 7 additions & 1 deletion scripts/check-droiddeck-asset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,10 @@ for f in android/arm64-v8a/libvkbridge_server.so android/arm64-v8a/libvkbridge_j
readelf -h "$f" | grep -q 'Machine:.*AArch64' || fail "$f is not aarch64"
done
readelf -d android/arm64-v8a/libvkbridge_jni.so | grep -q 'SONAME.*libvkbridge_jni.so' || fail "jni soname"
echo "elf ok: ICD GLIBC_$g, self-test GLIBC_$s, 3 vk_icd exports"
# The device's per-frame instrumentation: an asset built from an older checkout shipped the bridge
# without VKBRIDGE_LATLOG / VKBRIDGE_STATS, so the knobs did nothing and no latency log existed.
here=$(cd "$(dirname "$0")" && pwd)
"$here/check-instrumentation.sh" --server android/arm64-v8a/libvkbridge_server.so android/arm64-v8a/libvkbridge_jni.so >/dev/null &&
"$here/check-instrumentation.sh" usr/local/lib/vkbridge/libvulkan_droidbridge.so >/dev/null ||
fail "the asset was built without the latency log / VKBRIDGE_STATS (see check-instrumentation.sh)"
echo "elf ok: ICD GLIBC_$g, self-test GLIBC_$s, 3 vk_icd exports, instrumentation present"
34 changes: 34 additions & 0 deletions scripts/check-instrumentation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
# Checks that a built bridge library still carries the diagnostics that answer "where did the frame go":
# scripts/check-instrumentation.sh [--server] <elf>...
# Every file must carry the VKBRIDGE_LATLOG and VKBRIDGE_STATS switches; with --server it must also
# carry the latency log's own header line, so that what is checked is the log (server_latency.c) and
# not just a table naming the switch.
# Both are compiled in unconditionally, but they only help if the binary that reaches the device has
# them. A build from an older checkout or a package built from the wrong source directory ships without
# them silently: the knobs are set, nothing is logged, and no measurement can be taken (the CMF's
# v0.5.5.3 server, 2026-11-20: fence wait 2.60 ms and render_scene 3.39 ms of a 31.8 ms frame, with no
# per-frame log to say what the rest of the frame was doing).
# Reads the ELF's string tables, so it runs before or after strip: the literals stay either way.
set -euo pipefail

server=0
if [ "${1:-}" = --server ]; then server=1; shift; fi
[ $# -gt 0 ] || { echo "usage: $0 [--server] <elf>..." >&2; exit 2; }

fail=0
for f in "$@"; do
[ -f "$f" ] || { echo "FAIL: $f: no such file" >&2; fail=1; continue; }
readelf -h "$f" >/dev/null 2>&1 || { echo "FAIL: $f: not an ELF file" >&2; fail=1; continue; }
missing=
grep -aq 'VKBRIDGE_LATLOG' "$f" || missing="$missing VKBRIDGE_LATLOG"
grep -aq 'VKBRIDGE_STATS' "$f" || missing="$missing VKBRIDGE_STATS"
[ "$server" = 0 ] || grep -aq 'vkbridge latency log' "$f" || missing="$missing latency-log-writer"
if [ -n "$missing" ]; then
echo "FAIL: $f has no:$missing -- built without the per-frame instrumentation?" >&2
fail=1
else
echo "ok: $f carries$( [ "$server" = 0 ] || echo ' the latency log and') VKBRIDGE_LATLOG VKBRIDGE_STATS"
fi
done
exit $fail