Skip to content

Commit

Permalink
nvidiactl: Pass legacy cards to nouveau driver
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas committed Feb 22, 2018
1 parent f309ac4 commit 9c4b957
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions nvidiactl/nvidiactl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ set_generic_mxgfx_link () {
ln -sf /usr/share/mxgfx-generic /node/usr_share_mxgfx
}


if [ -d /sys/module/nouveau ] ; then
echo >&2 "NOTE: nouveau driver loaded already, using 'mxgfx-generic'."
set_generic_mxgfx_link
exit 0
fi

PCIIDHINT_DIR=/usr/share/nvidia/pciidhints

kver=$(uname -r)
Expand All @@ -13,7 +20,6 @@ nvidiacards=( $(lspci -n | grep " 0300: 10de:" | cut -d ' ' -f 3) )

nvver=${nvidiacards[0]}


if [ -z ${nvver} ] ; then
echo >&2 "WARNING: no nvidia card found.."
set_generic_mxgfx_link
Expand All @@ -22,22 +28,20 @@ fi

pciids="${PCIIDHINT_DIR}/${kver}-${nvver} ${PCIIDHINT_DIR}/${nvver}"


leglvl="current"

for leglvlhint in ${pciids} ; do
if [ -h "${leglvlhint}" ] ; then
leglvl=$(readlink ${leglvlhint})
break
set_generic_mxgfx_link
test -e /lib/modules/${kver}/kernel/drivers/gpu/drm/nouveau/nouveau.ko && \
echo >&2 "NOTE: legacy nvidia card found, loading nouveau .." && \
modprobe nouveau && \
exit 0

echo >&2 "ERROR: nouveau module not available, choose a newer kernel!"
exit 1
fi
done

nvlink=/usr/share/nvidia/kernel/${kver}/${leglvl}

if [ ! -h ${nvlink} ] ; then
echo >&2 "WARNING: ${nvlink} is not a link (to nvversion) trying current.."
nvlink=/usr/share/nvidia/kernel/${kver}/current
fi
nvlink=/usr/share/nvidia/kernel/${kver}/current

if [ ! -h ${nvlink} ] ; then
echo >&2 "WARNING: ${nvlink} is not a link (to nvversion) .."
Expand All @@ -46,7 +50,7 @@ fi

nvver=$(readlink ${nvlink})

#echo "kver=${kver} leglvl=${leglvl} nvver=${nvver}"
#echo "kver=${kver} nvver=${nvver}"

# lrwxrwxrwx 1 root system 27 Feb 11 15:39 /node/usr_share_mxgfx -> /usr/share/nvidia/260.19.21

Expand Down

0 comments on commit 9c4b957

Please sign in to comment.