Probe the GPUs/kernel and select an appropriate accel method, fix #3
Only use vDRM on supported drivers, introduce Venus for others, and fall back to software on kernels older than 6.13 due to missing PFNMAP support.
This commit is contained in:
parent
9256257abe
commit
de0c868428
2 changed files with 33 additions and 1 deletions
32
munix
32
munix
|
|
@ -56,8 +56,40 @@ if [ "$GPU" -eq 1 ]; then
|
||||||
"--dev-bind" "/dev/dri" "/dev/dri"
|
"--dev-bind" "/dev/dri" "/dev/dri"
|
||||||
"--ro-bind" "$HOST_OPENGL_DRIVER" "/run/opengl-driver"
|
"--ro-bind" "$HOST_OPENGL_DRIVER" "/run/opengl-driver"
|
||||||
)
|
)
|
||||||
|
GPU_MODE=venus
|
||||||
|
kernel_ver="$(uname -r)"
|
||||||
|
kernel_ver_arr=(${kernel_ver//./ })
|
||||||
|
kernel_major="${kernel_ver_arr:-0}"
|
||||||
|
kernel_ver_arr=("${kernel_ver_arr[@]:1}")
|
||||||
|
kernel_minor="${kernel_ver_arr:-0}"
|
||||||
|
if [[ "$kernel_major" -gt 6 || ("$kernel_major" -eq 6 && "$kernel_minor" -gt 12) ]]; then
|
||||||
|
for card in /dev/dri/card*; do
|
||||||
|
driver_link="/sys/class/drm/${card##*/}/device/driver"
|
||||||
|
if [ -L "$driver_link" ]; then
|
||||||
|
driver_mod="$(readlink "$driver_link")"
|
||||||
|
driver_name="${driver_mod##*/}"
|
||||||
|
case "$driver_name" in
|
||||||
|
amdgpu|msm) # TODO: i915
|
||||||
|
echo "munix: ${card##*/} gpu driver is '$driver_name', using vdrm" >&2;
|
||||||
|
GPU_MODE=drm
|
||||||
|
break;;
|
||||||
|
*) echo "munix: ${card##*/} gpu driver is '$driver_name', using venus unless more gpus are found" >&2;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo "munix: ${card##*/} has no gpu driver" >&2;
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "munix: kernel version '$kernel_ver' is older than 6.13, not using gpu due to missing support" >&2;
|
||||||
|
GPU_MODE=software
|
||||||
|
fi
|
||||||
|
MUVM_ARGS+=("--gpu-mode=$GPU_MODE")
|
||||||
|
if [ "$GPU_MODE" = "venus" ]; then
|
||||||
|
MUVM_ARGS+=("-e" "MESA_LOADER_DRIVER_OVERRIDE=zink")
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
BWRAP_ARGS+=("--dir" "/dev/dri")
|
BWRAP_ARGS+=("--dir" "/dev/dri")
|
||||||
|
MUVM_ARGS+=("--gpu-mode=software")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$WAYLAND" -eq 1 ]; then
|
if [ "$WAYLAND" -eq 1 ]; then
|
||||||
|
|
|
||||||
2
muvm
2
muvm
|
|
@ -1 +1 @@
|
||||||
Subproject commit 70badbc44d421c49f82130321e35b949f8b4ed14
|
Subproject commit 53d416fb3f96b04a5bd3dd40f94fa4d8fbf1d7f1
|
||||||
Loading…
Add table
Add a link
Reference in a new issue