emu: pin windowed mode to the integrated GPU
The discrete card now runs continuous AI inference, so the emulator must not claim GL/Vulkan contexts on it. In windowed mode the emulator uses the host GL/Vulkan stack, and the default GLVND selection picks the discrete card on this machine. The script now discovers the first display device whose driver is not nvidia and pins the emulator process to it (Mesa GLX/EGL + DRI_PRIME + the Intel Vulkan ICD). Headless (the default) needs no change: it always ran on swiftshader, strictly software, and never touched any GPU. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
e9cb32b173
commit
730bda0b40
1 changed files with 35 additions and 0 deletions
|
|
@ -76,6 +76,41 @@ if [ -e /dev/kvm ]; then
|
||||||
echo "/dev/kvm found — hardware acceleration on"
|
echo "/dev/kvm found — hardware acceleration on"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Pin the emulator process to the integrated GPU so the discrete card stays free
|
||||||
|
# for AI inference (windowed mode uses the host GL/Vulkan stack; headless runs on
|
||||||
|
# swiftshader — pure software — and never touches any GPU at all). Discovered
|
||||||
|
# from the PCI tree: first display device NOT driven by the nvidia driver.
|
||||||
|
IGPU=""
|
||||||
|
for dev in /sys/bus/pci/devices/*; do
|
||||||
|
class=$(cat "$dev/class" 2>/dev/null) || continue
|
||||||
|
case "$class" in
|
||||||
|
0x0300*|0x0380*) ;; # VGA / display controller
|
||||||
|
*) continue ;;
|
||||||
|
esac
|
||||||
|
if [ "$(basename "$(readlink "$dev/driver" 2>/dev/null)")" = nvidia ]; then continue; fi
|
||||||
|
IGPU=$(basename "$dev")
|
||||||
|
break
|
||||||
|
done
|
||||||
|
if [ -n "$IGPU" ]; then
|
||||||
|
# Mesa GL/GLES: force the Mesa vendors, then the Intel render device.
|
||||||
|
export __GLX_VENDOR_LIBRARY_NAME=mesa
|
||||||
|
export __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json
|
||||||
|
export DRI_PRIME="pci-${IGPU//./_}"
|
||||||
|
# Vulkan: restrict the loader to the iGPU's ICD (both var names — loader
|
||||||
|
# version differences).
|
||||||
|
for icd in /usr/share/vulkan/icd.d/intel_icd.x86_64.json \
|
||||||
|
/usr/share/vulkan/icd.d/Intel_icd.x86_64.json; do
|
||||||
|
if [ -f "$icd" ]; then
|
||||||
|
export VK_ICD_FILENAMES="$icd"
|
||||||
|
export VK_DRIVER_FILES="$icd"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "GPU pinned to iGPU $IGPU (Mesa/Intel env) — dGPU untouched"
|
||||||
|
else
|
||||||
|
echo "no iGPU found — leaving GPU selection to the driver (dGPU may be used)"
|
||||||
|
fi
|
||||||
|
|
||||||
# --- build combined adb vendor-keys file ------------------------------------
|
# --- build combined adb vendor-keys file ------------------------------------
|
||||||
# The TV system image is a user build: adb push to /data/misc/adb/adb_keys is
|
# The TV system image is a user build: adb push to /data/misc/adb/adb_keys is
|
||||||
# blocked, so remote keys are trusted via ADB_VENDOR_KEYS at launch instead.
|
# blocked, so remote keys are trusted via ADB_VENDOR_KEYS at launch instead.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue