Skip to content

Commit

Permalink
Merge pull request #110 from mariux64/nvidiactl-fallback-nouveau
Browse files Browse the repository at this point in the history
nvidiactl: fallback to nouveau
  • Loading branch information
pmenzel authored Dec 16, 2019
2 parents 46309d7 + cf4cd8b commit 75a094d
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions nvidiactl/nvidiactl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ set_generic_mxgfx_link () {
ln -sf /usr/share/mxgfx-generic /node/usr_share_mxgfx
}

use_nouveau () {
set_generic_mxgfx_link
test -e /lib/modules/${kver}/kernel/drivers/gpu/drm/nouveau/nouveau.ko && \
echo >&2 "NOTE: using nouveau.." && \
modprobe nouveau && \
exit 0

echo >&2 "ERROR: nouveau module not available."
exit 1
}

if [ -d /sys/module/nouveau ] ; then
echo >&2 "NOTE: nouveau driver loaded already, using 'mxgfx-generic'."
Expand All @@ -30,22 +40,16 @@ pciids="${PCIIDHINT_DIR}/${kver}-${nvver} ${PCIIDHINT_DIR}/${nvver}"

for leglvlhint in ${pciids} ; do
if [ -h "${leglvlhint}" ] ; then
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
echo >&2 "NOTE: legacy nvidia card found.."
use_nouveau
fi
done

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

if [ ! -h ${nvlink} ] ; then
echo >&2 "WARNING: ${nvlink} is not a link (to nvversion) .."
exit 1
echo >&2 "WARNING: NVIDIA driver not installed for kernel version ${kver}.."
use_nouveau
fi

nvver=$(readlink ${nvlink})
Expand Down

0 comments on commit 75a094d

Please sign in to comment.