mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 05:46:03 +00:00
feat(vkbridge): Phase 1 integration - Setup toggle, server process, session wiring, builds
- Setup: 'Mali bridge' switch on the GPU row (non-Adreno only); the non-Adreno gate relaxes when on - VkBridgeComponent starts libvkbridge_server.so before the guest and waits for its socket - session script points the loader at the bridge ICD and logs the self-test + vulkaninfo - Flatpak sandboxes get the bridge ICD and socket; the compositor uses the system driver without KGSL - Gradle builds the server with the NDK; CI/build_local cross-build the ICD + smoke test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KZqR8XUE8czvGzEpgSCVQR
This commit is contained in:
1 parent
d82c42d818
commit
4050270511
17 files changed
+280
-5
No files matched your search
@@ -101,6 +101,7 @@ docker run --rm --platform linux/amd64 \
|
||||
-o "$d/libssbs.so" tools/linuxfs/ssbs/ssbs_adapter.c -ldl
|
||||
aarch64-linux-gnu-strip --strip-unneeded "$d/libssbs.so"
|
||||
mkdir -p "$d/usr/local/bin"
|
||||
tools/vkbridge/build-client-linux.sh "$d" aarch64-linux-gnu-gcc
|
||||
aarch64-linux-gnu-gcc -O2 -Wall -Wextra -o "$d/usr/local/bin/droiddeck-clipboard" tools/linuxfs/clipboard/clipboard.c -ldl
|
||||
aarch64-linux-gnu-strip --strip-unneeded "$d/usr/local/bin/droiddeck-clipboard"
|
||||
for script in tools/linuxfs/overlay/usr/local/bin/droiddeck-* tools/linuxfs/overlay/usr/local/bin/steam-compatibility; do
|
||||
|
||||
@@ -107,6 +107,31 @@ if [ -n "${BL_VK_DRIVER:-}" ]; then
|
||||
fi
|
||||
unset bl_icd_lib
|
||||
fi
|
||||
# The Mali bridge (Setup's experimental switch on a non-Adreno GPU; tools/vkbridge): the app runs a
|
||||
# server on the phone's own Vulkan driver and this session draws through its ICD, which replaces
|
||||
# every other driver here. Checked from inside like an imported driver, and on the first pass only
|
||||
# the bridge's self-test and the driver's summary go into the log, so a black screen comes with the
|
||||
# reason in the same file.
|
||||
if [ "${BL_VKBRIDGE:-0}" = 1 ]; then
|
||||
bl_vkb_icd=/usr/local/share/vkbridge/droidbridge_icd.json
|
||||
if [ -r "$bl_vkb_icd" ] && [ -r /usr/local/lib/vkbridge/libvulkan_droidbridge.so ] && [ -S "${VKBRIDGE_SOCKET:-}" ]; then
|
||||
export VK_DRIVER_FILES=$bl_vkb_icd VK_ICD_FILENAMES=$bl_vkb_icd
|
||||
export VKBRIDGE_SOCKET VKBRIDGE_CLIENT_LOG
|
||||
# Turnip's switches mean nothing to the bridge.
|
||||
unset TU_DEBUG
|
||||
if [ -z "${BL_INSIDE:-}" ]; then
|
||||
step "vkbridge self-test"
|
||||
timeout 60 /usr/local/bin/droiddeck-vkbridge-smoke 2>&1 | sed 's/^/== vkbridge: /'
|
||||
if command -v vulkaninfo >/dev/null 2>&1; then
|
||||
timeout 30 vulkaninfo --summary 2>&1 | sed -n '/^Devices:/,$p' | head -40 | sed 's/^/== vulkaninfo: /'
|
||||
fi
|
||||
fi
|
||||
echo "== vulkan driver: Mali bridge ($bl_vkb_icd, server at $VKBRIDGE_SOCKET)"
|
||||
else
|
||||
echo "== vulkan driver: Mali bridge requested but NOT usable (icd $bl_vkb_icd, socket ${VKBRIDGE_SOCKET:-unset}); this GPU will show a black screen"
|
||||
fi
|
||||
unset bl_vkb_icd
|
||||
fi
|
||||
# The app's gamescope build (tools/gamescope) asks for realtime-priority Vulkan queues on this
|
||||
# switch instead of on CAP_SYS_NICE, which proot never has; it falls back to normal priority
|
||||
# where the driver refuses, and the runtime's own build ignores it. On KGSL Turnip (Mesa 26.2) it
|
||||
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
# Builds the Linux side of the bridge for the runtime (glibc, aarch64):
|
||||
# tools/vkbridge/build-client-linux.sh <linuxfs-asset-dir> [cc]
|
||||
# Produces, under the asset dir (staged into the runtime by SessionFiles):
|
||||
# usr/local/lib/vkbridge/libvulkan_droidbridge.so the Vulkan ICD
|
||||
# usr/local/share/vkbridge/droidbridge_icd.json its manifest
|
||||
# usr/local/bin/droiddeck-vkbridge-smoke the session-start self-test
|
||||
set -euo pipefail
|
||||
d=$1
|
||||
cc=${2:-aarch64-linux-gnu-gcc}
|
||||
strip=${STRIP:-${cc%gcc}strip}
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
inc="-I$here/third_party/Vulkan-Headers-1.3.247/include -I$here/common -I$here/common/gen"
|
||||
mkdir -p "$d/usr/local/lib/vkbridge" "$d/usr/local/share/vkbridge" "$d/usr/local/bin"
|
||||
"$cc" -O2 -fPIC -shared -fvisibility=hidden -DVKB_CLIENT -Wall -Wno-unused-parameter -Wno-missing-field-initializers \
|
||||
$inc -I"$here/client" -I"$here/client/compat" -pthread \
|
||||
-Wl,--no-undefined -Wl,-soname,libvulkan_droidbridge.so \
|
||||
-o "$d/usr/local/lib/vkbridge/libvulkan_droidbridge.so" \
|
||||
"$here"/client/*.c "$here/common/vkb_wire.c" "$here/common/gen/vkb_gen_structs.c" "$here/common/gen/vkb_gen_client.c" -ldl
|
||||
"$strip" --strip-unneeded "$d/usr/local/lib/vkbridge/libvulkan_droidbridge.so"
|
||||
"$cc" -O2 -Wall $inc -I"$here/tests" -o "$d/usr/local/bin/droiddeck-vkbridge-smoke" "$here/tests/smoke.c" -ldl
|
||||
"$strip" --strip-unneeded "$d/usr/local/bin/droiddeck-vkbridge-smoke"
|
||||
cat > "$d/usr/local/share/vkbridge/droidbridge_icd.json" <<JSON
|
||||
{"file_format_version": "1.0.0", "ICD": {"library_path": "/usr/local/lib/vkbridge/libvulkan_droidbridge.so", "api_version": "1.3.247"}}
|
||||
JSON
|
||||
echo "built the vkbridge client into $d"
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
# Builds the bridge server for the device (bionic, arm64-v8a, API 26) with the NDK's clang:
|
||||
# tools/vkbridge/build-server-android.sh <ndk-dir> <jniLibs-out-dir>
|
||||
# The output is an executable named like a library (libvkbridge_server.so) so that Android
|
||||
# extracts it into the native library directory, the one place an app may exec from.
|
||||
set -euo pipefail
|
||||
ndk=$1
|
||||
out=$2/arm64-v8a
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
srv=$(cd "$here/../../app/src/main/cpp/vkbridge" && pwd)
|
||||
cc=$(ls -d "$ndk"/toolchains/llvm/prebuilt/*/bin/aarch64-linux-android26-clang | head -1)
|
||||
[ -x "$cc" ] || { echo "no NDK clang under $ndk" >&2; exit 1; }
|
||||
mkdir -p "$out"
|
||||
"$cc" -O2 -g0 -fPIE -pie -Wall -Wno-unused-parameter -Wno-missing-field-initializers \
|
||||
-I"$here/third_party/Vulkan-Headers-1.3.247/include" -I"$here/common" -I"$here/common/gen" -I"$srv" \
|
||||
-Wl,-z,max-page-size=16384 -Wl,--build-id=none \
|
||||
-o "$out/libvkbridge_server.so" \
|
||||
"$srv"/*.c "$here/common/vkb_wire.c" "$here/common/gen/vkb_gen_structs.c" "$here/common/gen/vkb_gen_server.c" \
|
||||
-ldl -llog -lm
|
||||
"$(dirname "$cc")/llvm-strip" --strip-unneeded "$out/libvkbridge_server.so"
|
||||
echo "built $out/libvkbridge_server.so"
|
||||
Reference in new issue
Block a user