Tuesday, May 29, 2012

NVidia Optimus and Fedora 17

I bought a new laptop

It has the ubercool sounding Nvidia Optimus GT650M graphics (it is a chaos 1212 from mythlogic).   Now I have been doing Linux/RedHat/Fedora Core/Fedora on laptops and desktops for a while (back before there was a Fedora).    Some time ago, it was a really good idea to do some exploration in the linux world in the pre-buy time to make sure that what you want to buy has good linux support.    

In my humble experience, in that last 2 or so years of Fedora, it pretty much handles just about any hardware.   Or there exists some simple procedure to add the needed driver or other hardware support.    So recently I have been pretty lax on the "check before you buy" rule for linux.

I am not sure having more knowledge about using NVIDIA Optimus technologies under linux would change my purchase decision; but it does reinforce the "check before you buy" rule.    So here is how I disabled nVidia Optimus under Fedora 17.      Maybe I will discuss why I am doing this (you can get the Optimus stuff to 'work' under linux), but for the short term here is some NowTo steps (as root):
  • add a file to /etc/modprobe.d (blacklist-nvidia.conf perhaps) with the following lines:
blacklist nouveau
blacklist nvidia ##don't really have this driver, but oh well
  • cd /boot
  • backup up your initramfs if you want:  mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img
  • rebuild your initramfs:  dracut --force /boot/initramfs-$(uname -r).img $(uname -r)
  • reboot 
  • now nouveau (and/or nvidia) shouldn't load.   In my case the VESA: Intel® Sandybridge/Ivybridge Graphics driver is doing the work.   lsmod to check that nouveau/nvidia isn't loaded.
But wait, there is more!   The Optimus graphics stuff is still kinda 'on'.   There are a few ways to turn it off assuming your bios doesn't have a discrete graphics disable  (if so you probably don't need to do the above).  I chose 'bbswitch'  which is part of the Bumblebee work.   Here is what I did:

  • goto BBSWITCH at github 
  • read the readme file, it is short and covers what you need to know and do
  • grab zip of the source
  • make sure you got all the developer stuffs installed 
  • yum install dkms  #if not already there
  • fix dkms as per this link 
  • unzip the zip & cd into the created directory
  • make -f Makefile.dkms 
  • add a load driver conf file to modules-load.d directory.  Do the equivalent of:  echo "bbswitch " >/etc/modules-load.d/bbswitch.conf 
  • add an conf file to modprobe.d to start machine with discrete graphics 'off'.  Do the equivalent of:     echo "options bbswitch load_state=0 " >/etc/modprobe.d/bbswitch.conf
  • reboot
Now lsmod should reveal a loaded bbswitch driver, and cat /proc/acpi/bbswitch  should display something like:

No comments:

Post a Comment