Friday, January 30, 2015

Setting up Optimus on an ASUS NV56VJ with Linux


  • This laptop has an NVIDIA GeForce GT 635M card installed alongside the built-in Intel graphics controller.  This configuration is referred to by NVIDIA as an Optimus configuration
  • [root@localhost ~]# lspci |grep VGA
    00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
    01:00.0 VGA compatible controller: NVIDIA Corporation GF108M [GeForce GT 635M] (rev a1)
    
  • We can see here that the Intel controller is installed at PCI:0:2:0 and the NVIDIA controller at PCI:1:0:0.
  • Following the ArchWiki instructions, I came up with the following /etc/X11/xorg.conf file (which includes a later update to fix a font rendering issue (i.e. the DPI setting)):
    Section "ServerLayout"
        Identifier "layout"
        Screen "nvidia" 0 0 
        Inactive "intel"
    EndSection
    
    Section "Device"
        Identifier "nvidia"
        Driver "nvidia"
        Option "DPI" "96 x 96"
        BusID "PCI:1:0:0"
    EndSection
    
    Section "Screen"
        Identifier "nvidia"
        Device "nvidia"
        Option "AllowEmptyInitialConfiguration"
    EndSection
     
    Section "Device"
        Identifier "intel"
        Driver "modesetting"
        BusID "PCI:0:2:0"
    EndSection
     
    Section "Screen"
        Identifier "intel"
        Device "intel"
    EndSection
    
  • And since I am using KDE, I followed the additional instructions to append the following lines to the end of my /etc/kde/kdm/Xsetup file (which is hard linked to /usr/share/config/kdm/Xsetup):
    xrandr --setprovideroutputsource modesetting NVIDIA-0
    xrandr --auto
    
  • If you're using Gnome instead of KDE, you would add those lines to the bottom of the /etc/gdm/Init/Default file, just before the "exit 0" line (at least on Fedora that's how it is).
  • If this is a brand new install of Fedora, the packages you'd want to install are at least:
    kernel-devel akmod-nvidia vdpauinfo.
    
Some strangeness that I noticed with the new configuration (on Fedora 19 w/KDE, but not on Fedora 21 w/Gnome):
  • The font rendering is smaller (or the fonts are just different) than my previous Intel setup
  • The KDM login screen is now tiled instead of stretched and centered.

Other than that strangeness, everything seems fine. The glxinfo and vdpauinfo commands return what you want to see:
    [martin@localhost ~]$ glxinfo |head -5
    name of display: :0
    display: :0  screen: 0
    direct rendering: Yes
    server glx vendor string: NVIDIA Corporation
    server glx version string: 1.4

    [martin@localhost ~]$ vdpauinfo |head -3
    display: :0   screen: 0
    API version: 1
    Information string: NVIDIA VDPAU Driver Shared Library  340.29  Thu Jul 31 19:59:48 PDT 2014
For reference, here are the NVIDIA packages I have installed:
    [martin@localhost ~]$ rpm -qa|grep -i nvidia|sort
    akmod-nvidia-340.29-2.fc20.x86_64
    kmod-nvidia-3.14.27-100.fc19.x86_64-340.29-2.fc19.x86_64
    xorg-x11-drv-nvidia-340.29-2.fc20.x86_64
    xorg-x11-drv-nvidia-cuda-340.29-2.fc20.i686
    xorg-x11-drv-nvidia-cuda-340.29-2.fc20.x86_64
    xorg-x11-drv-nvidia-devel-340.29-2.fc20.i686
    xorg-x11-drv-nvidia-devel-340.29-2.fc20.x86_64
    xorg-x11-drv-nvidia-libs-340.29-2.fc20.i686
    xorg-x11-drv-nvidia-libs-340.29-2.fc20.x86_64
And here are all the xorg-x11-drv packages I have installed:
    [martin@localhost ~]$ rpm -qa|grep -i xorg-x11-drv |sort
    xorg-x11-drv-ati-7.1.0-5.20130408git6e74aacc5.fc19.x86_64
    xorg-x11-drv-evdev-2.8.1-2.fc19.x86_64
    xorg-x11-drv-fbdev-0.4.3-9.fc19.x86_64
    xorg-x11-drv-intel-2.21.12-2.fc19.x86_64
    xorg-x11-drv-mga-1.6.2-7.fc19.x86_64
    xorg-x11-drv-modesetting-0.8.0-3.fc19.x86_64
    xorg-x11-drv-nouveau-1.0.9-1.fc19.x86_64
    xorg-x11-drv-nvidia-340.29-2.fc20.x86_64
    xorg-x11-drv-nvidia-cuda-340.29-2.fc20.i686
    xorg-x11-drv-nvidia-cuda-340.29-2.fc20.x86_64
    xorg-x11-drv-nvidia-devel-340.29-2.fc20.i686
    xorg-x11-drv-nvidia-devel-340.29-2.fc20.x86_64
    xorg-x11-drv-nvidia-libs-340.29-2.fc20.i686
    xorg-x11-drv-nvidia-libs-340.29-2.fc20.x86_64
    xorg-x11-drv-openchrome-0.3.3-1.fc19.x86_64
    xorg-x11-drv-qxl-0.1.1-3.fc19.x86_64
    xorg-x11-drv-synaptics-1.7.1-6.fc19.x86_64
    xorg-x11-drv-vesa-2.3.2-9.fc19.x86_64
    xorg-x11-drv-vmmouse-13.0.0-5.fc19.x86_64
    xorg-x11-drv-vmware-13.0.1-1.fc19.x86_64
    xorg-x11-drv-wacom-0.23.0-5.fc19.x86_64