Graphics drivers: choose and import the Linux runtime driver and the display driver

Ported from Bannerlator's driver selection so the standalone stops being pinned
to whatever Turnip the runtime image was built with (Mesa 26.2.2 today, while
Bannerlator already runs 26.3.0 in the same role).

Linux runtime driver: LinuxVulkanDriverManager imports a "-Linux" (glibc)
Turnip zip under files/linux_vulkan_drivers/<id>/ with a generated ICD manifest
whose library_path is absolute, validated by the libc the driver links against
(libc.so.6, never libc.so) and by its ELF header. The choice is per mode, so
Steam and the desktop can differ. SessionService hands the session BL_VK_DRIVER,
and the session script — staged from the apk at every launch, so no runtime
re-host — checks the manifest and its library from inside before exporting
VK_DRIVER_FILES; the runtime's own driver is what anything unreadable falls
back to. That block is Bannerlator's, verbatim.

Display driver: TurnipDriver now also imports AdrenoTools zips beside the two
bundled builds and honours a chosen id ahead of the GPU pick, with the same
refusals as Bannerlator's AdrenotoolsManager — a zip with no libraryName, a
Linux runtime driver, or a glibc library dressed as one is refused with the
list it belongs in, never installed as a black session.

One dialog on the main screen carries both lists; a removed import falls back
at once. Documented in the README.
This commit is contained in:
The412Banner committed 2026-09-21 08:22:03 -04:00
1 parent 54417dd3a7
commit 539fd692ed
10 files changed
+886 -4

No files matched your search

@@ -37,6 +37,33 @@ collect_steam_logs() {
[ -f "$steam_root/steam.pid" ] && cp "$steam_root/steam.pid" "$BL_DEBUG_DIR/" 2>/dev/null
echo "== steam logs copied to $BL_DEBUG_DIR"
}
# The driver everything in this session draws with: gamescope's compositing, the client's UI
# (OpenGL through Zink), every game Proton launches, and in desktop mode every program on it.
# BL_VK_DRIVER names an imported driver's ICD manifest on the Android side, which is bound into the
# session at its own path; unset means the runtime keeps the Turnip it was built with.
# VK_DRIVER_FILES REPLACES the loader's search, so a manifest whose library is unreadable would
# leave the session with no Vulkan at all - check both before setting it, and say so in the log
# rather than fail silently half a minute later.
if [ -n "${BL_VK_DRIVER:-}" ]; then
bl_icd_lib=$(sed -n 's/.*"library_path"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$BL_VK_DRIVER" 2>/dev/null | head -1)
# JSON may escape the separator: org.json writes "\/data\/user\/0\/...". The Vulkan loader
# parses that correctly; this check has to as well, or an absolute path looks relative and gets
# glued onto the manifest's directory - which is exactly what happened the first time.
bl_icd_lib=$(printf '%s' "$bl_icd_lib" | sed 's|\\/|/|g')
case $bl_icd_lib in
/*) ;;
?*) bl_icd_lib="$(dirname "$BL_VK_DRIVER")/$bl_icd_lib" ;;
esac
if [ -r "$BL_VK_DRIVER" ] && [ -n "$bl_icd_lib" ] && [ -r "$bl_icd_lib" ]; then
export VK_DRIVER_FILES="$BL_VK_DRIVER"
# Loaders older than 1.3.207 only know the old name; both are harmless together.
export VK_ICD_FILENAMES="$BL_VK_DRIVER"
echo "== vulkan driver: imported $bl_icd_lib (via $BL_VK_DRIVER)"
else
echo "== vulkan driver: IGNORING $BL_VK_DRIVER (manifest or ${bl_icd_lib:-library} unreadable); using the runtime's own"
fi
unset bl_icd_lib
fi
export XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
export XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache}