Difference between revisions of "Lenovo IdeaPad Y580"

From ArchWiki
Jump to: navigation, search
m (categorize, see Help:Style)
(Using nvidia)
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:Lenovo]]
 
[[Category:Lenovo]]
==DISPLAY==
+
===Intel graphics===
As of the arrival of the 3.7.X series kernel, this machine boots into black screen. You will have to add acpi_backlight=vendor to kernel command line to boot into a visible display. You can alternatively increase the screen brightness during every boot also, since the screen brightness is set to 0 wrongly by the kernel acpi by default.
+
  
As of September 2013, this doesn't seem to be an issue anymore, at least not on kernel 3.10.
+
This machine has two video cards, an Intel HD 4000 integrated chip and a discrete Nvidia GTX 660M.
  
===Intel Card===
+
If you don't wish to use the machine's NVIDIA card, simply install xf86-video-intel and use the Intel driver. This will leave the NVIDIA card disabled, but it will still use power. To completely disable the NVIDIA card, enter the Y580's BIOS and on the "Configuration" tab, change "Graphic Device" from "Switchable Graphic" to "UMA Graphic". If these options are not there, you may need to update the BIOS.
  
This machine has two video cards, explained in detail below
+
===NVIDIA graphics===
{{bc|<nowiki>
+
Since the NVIDIA card must have some form of Optimus to be used, the graphics configuration can be complicated. The current Arch Linux kernel and proprietary NVIDIA driver support Optimus, but configuration is somewhat involved. There are three options:
$ lspci | grep VGA
+
* Use the proprietary NVIDIA driver
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
+
* Use the open-source nouveau driver
01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GTX 660M] (rev a1)
+
* Use Bumblebee, which is designed as a third-party Optimus-like solution
</nowiki>}}
+
Each option has its advantages. Bumblebee allows power-saving methods like graphics-card switching, so if you don't want to constantly be running the NVIDIA card, follow the guides for [[Bumblebee]] on the wiki. The proprietary NVIDIA driver typically has better performance than the open-source driver as of September 2013, but typically has more bugs and compatibility issues. The nouveau driver is reverse-engineered due to Nvidia's lack of hardware documentation, and therefore does not perform as well as the proprietary driver, but is simpler to use and less prone to bugs. More information can be found on the wiki's article on [[NVIDIA Optimus]].
  
In order to get the machine working for basic purposes, simply install xf86-video-intel and use the intel driver. You can leave the nvidia card disabled (and powered down?) just by not installing nvidia-304xx.
+
===Using nouveau===
 +
To use the nouveau drivers, install the {{Pkg|xf86-video-nouveau}} and {{Pkg|xf86-video-intel}} packages. After rebooting, X should automatically detect the drivers and work.
  
===NVIDIA Card===
+
===Using nvidia===
 +
To use the proprietary NVIDIA drivers, install the {{Pkg|xf86-video-modesetting}}, {{Pkg|nvidia}}, and {{Pkg|xorg-xrandr}} packages.
  
The Y580 uses NVIDIA's Optimus technology, which is not officially supported on Linux yet. A possible solution is to install Bumblebee (https://wiki.archlinux.org/index.php/Bumblebee) and to access the card with optirun. However, you can still use CUDA, which is good if you use apps like Blender or if you develop CUDA C programs.
+
The next step is to change {{ic|/etc/X11/xorg.conf}} appropriately. First, you must determine the PCI address of the NVIDIA card. Using {{ic|lspci}}, check the NVIDIA entry:
  
===Nvidia Bumblebee support===
+
{{ic|lspci <nowiki>|</nowiki> grep NVIDIA}}
In Linux currently [https://wiki.archlinux.org/index.php/Bumblebee bumblebee ] is the easiest option for a optimus like solution. For this laptop you will need bbswitch, Bumblebee, nvidia from official Arch repos. After installation of these packages you will need to add your user name to bumblebee group.You have to start the bumblebeed service manually. A short guide given here [https://wiki.archlinux.org/index.php/Bumblebee#Bumblebee:_Optimus_for_Linux bumblebee].
+
  
===Driver===
+
The first number you see, which should be formatted something like {{ic|##:##.#}}, is the PCI address. In {{ic|/etc/X11/xorg.conf}}, however, the format must be modified so each number is one digit separated by colons (i.e. 01:00.0 would be written as 1:0:0).
  
To compile and run CUDA programs, you need a NVIDIA driver and the cuda-toolkit. Any driver with version 295.59 or higher will work.
+
Now edit {{ic|/etc/X11/xorg.conf}}:
{{Note|The only exception being the 302.17}}
+
{{hc|# nano /etc/X11/xorg.conf|
 +
Section "ServerLayout"
 +
        Identifier "layout"
 +
        Screen 0 "nvidia"
 +
        Inactive "intel"
 +
EndSection
  
As of 10/24/2012, the newest driver is 304.60. To install it, you need a modified version of the package nvidia-utils from extra. The easiest way to do this is to install the package nvidia-utils-custom from the AUR: https://aur.archlinux.org/packages.php?ID=60991.
+
Section "Device"
 +
        Identifier "nvidia"
 +
        Driver "nvidia"
 +
        BusID "PCI:''PCI_address''"
 +
EndSection
  
Alternatively, you can use ABS and patch the package yourself. If you are not familiar with the process, read the wiki: https://wiki.archlinux.org/index.php/Arch_Build_System. The exact way to rebuild a package depends on your own preferences, one way is to download the source code (in this case, the driver, obtained here: ftp://download.nvidia.com/XFree86/Linux-x86_64/304.60/NVIDIA-Linux-x86_64-304.60-no-compat32.run), copy it to the build directory, edit the PKGBUILD, and then run makepkg.
+
Section "Screen"
 +
        Identifier "nvidia"
 +
        Device "nvidia"
 +
        Option "UseDisplayDevice" "none"
 +
EndSection
  
Edit the PKGBUILD of nvidia-utils. You may need to change the pkgver, the source item, and the md5sum. The most important thing is that nvidia-utils conflicts with libgl, but if you uninstall libgl, Gnome only starts in fallback mode (not sure about other DE). Because of this, you need to modify the PKGBUILD, so that it either does not install certain libraries (libglx.so, libGL.so) or that it installs them in another location. With the PKGBUILD below, those libraries are not installed (note the commented lines for the GLX extension module, and the empty 'conflicts' line).
+
Section "Device"
 +
        Identifier "intel"
 +
        Driver "modesetting"
 +
EndSection
  
===nvidia-utils PKGBUILD===
+
Section "Screen"
{{bc|<nowiki>
+
        Identifier "intel"
# $Id$
+
        Device "intel"
# Maintainer: Thomas Baechler <thomas@archlinux.org>
+
EndSection}}
# Contributor: James Rayner <iphitus@gmail.com>
+
pkgbase=nvidia-utils
+
pkgname=('nvidia-utils' 'opencl-nvidia')
+
pkgver=304.60
+
pkgrel=1
+
arch=('i686' 'x86_64')
+
url="http://www.nvidia.com/"
+
license=('custom')
+
options=('!strip')
+
  
if [ "$CARCH" = "i686" ]; then
+
The final step is to modify your {{ic|~/.xinitrc}} file to run two {{ic|xrandr}} commands. Add the following two lines at the beginning of your {{ic|.xinitrc}}:
    _arch='x86'
+
    _pkg="NVIDIA-Linux-${_arch}-${pkgver}"
+
    source=("ftp://download.nvidia.com/XFree86/Linux-${_arch}/${pkgver}/${_pkg}.run")
+
    md5sums=('42b9887076b2ebcf1af5ee13bc332ccb')
+
elif [ "$CARCH" = "x86_64" ]; then
+
    _arch='x86_64'
+
    _pkg="NVIDIA-Linux-${_arch}-${pkgver}-no-compat32"
+
    source=("ftp://download.nvidia.com/XFree86/Linux-${_arch}/${pkgver}/${_pkg}.run")
+
    md5sums=('7248399a125808e3bbc9c66da99a098d')
+
fi
+
  
create_links() {
+
{{hc|$ nano ~/.xinitrc|
    # create soname links
+
xrandr --setprovideroutputsource modesetting NVIDIA-0 &
    while read -d '' _lib; do
+
xrandr --auto &}}
        _soname="$(dirname "${_lib}")/$(readelf -d "${_lib}" | sed -nr 's/.*Library soname: \[(.*)\].*/\1/p')"
+
        [[ -e "${_soname}" ]] || ln -s "$(basename "${_lib}")" "${_soname}"
+
        [[ -e "${_soname/.[0-9]*/}" ]] || ln -s "$(basename "${_soname}")" "${_soname/.[0-9]*/}"
+
    done < <(find "${pkgdir}" -type f -name '*.so*' -print0)
+
}
+
  
build() {
+
Now reboot, and X should run. If you get a black screen after starting X, kill it and try starting X again (it may take several tries).
    cd "${srcdir}"
+
    sh "${_pkg}.run" --extract-only
+
}
+
 
+
package_opencl-nvidia() {
+
    pkgdesc="OpenCL implemention for NVIDIA"
+
    depends=('libcl' 'zlib')
+
    optdepends=('opencl-headers: headers necessary for OpenCL development')
+
    cd "${srcdir}/${_pkg}"
+
 
+
    # OpenCL
+
    install -D -m644 nvidia.icd "${pkgdir}/etc/OpenCL/vendors/nvidia.icd"
+
    install -D -m755 "libnvidia-compiler.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-compiler.so.${pkgver}"
+
    install -D -m755 "libnvidia-opencl.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-opencl.so.${pkgver}"
+
 
+
    create_links
+
}
+
 
+
package_nvidia-utils() {
+
    pkgdesc="NVIDIA drivers utilities and libraries."
+
    depends=('xorg-server' 'libxvmc')
+
    optdepends=('gtk2: nvidia-settings' 'pkg-config: nvidia-xconfig'
+
                'opencl-nvidia: OpenCL support')
+
    conflicts=('')
+
    provides=('libgl')
+
    cd "${srcdir}/${_pkg}"
+
 
+
    # X driver
+
    install -D -m755 nvidia_drv.so "${pkgdir}/usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
    # GLX extension module for X
+
    #install -D -m755 "libglx.so.${pkgver}" "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so.${pkgver}"
+
    #ln -s "libglx.so.${pkgver}" "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so" # X does not find glx otherwise
+
    # OpenGL library
+
    #install -D -m755 "libGL.so.${pkgver}" "${pkgdir}/usr/lib/libGL.so.${pkgver}"
+
    # OpenGL core library
+
    install -D -m755 "libnvidia-glcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glcore.so.${pkgver}"
+
    # XvMC
+
    install -D -m644 libXvMCNVIDIA.a "${pkgdir}/usr/lib/libXvMCNVIDIA.a"
+
    install -D -m755 "libXvMCNVIDIA.so.${pkgver}" "${pkgdir}/usr/lib/libXvMCNVIDIA.so.${pkgver}"
+
    # VDPAU
+
    install -D -m755 "libvdpau_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/vdpau/libvdpau_nvidia.so.${pkgver}"
+
    # nvidia-tls library
+
    install -D -m755 "tls/libnvidia-tls.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-tls.so.${pkgver}"
+
    install -D -m755 "libnvidia-cfg.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-cfg.so.${pkgver}"
+
 
+
    install -D -m755 "libnvidia-ml.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ml.so.${pkgver}"
+
    # CUDA
+
    install -D -m755 "libcuda.so.${pkgver}" "${pkgdir}/usr/lib/libcuda.so.${pkgver}"
+
    install -D -m755 "libnvcuvid.so.${pkgver}" "${pkgdir}/usr/lib/libnvcuvid.so.${pkgver}"
+
 
+
    # nvidia-xconfig
+
    install -D -m755 nvidia-xconfig "${pkgdir}/usr/bin/nvidia-xconfig"
+
    install -D -m644 nvidia-xconfig.1.gz "${pkgdir}/usr/share/man/man1/nvidia-xconfig.1.gz"
+
    # nvidia-settings
+
    install -D -m755 nvidia-settings "${pkgdir}/usr/bin/nvidia-settings"
+
    install -D -m644 nvidia-settings.1.gz "${pkgdir}/usr/share/man/man1/nvidia-settings.1.gz"
+
    install -D -m644 nvidia-settings.desktop "${pkgdir}/usr/share/applications/nvidia-settings.desktop"
+
    install -D -m644 nvidia-settings.png "${pkgdir}/usr/share/pixmaps/nvidia-settings.png"
+
    sed -e 's:__UTILS_PATH__:/usr/bin:' -e 's:__PIXMAP_PATH__:/usr/share/pixmaps:' -i "${pkgdir}/usr/share/applications/nvidia-settings.desktop"
+
    # nvidia-bug-report
+
    install -D -m755 nvidia-bug-report.sh "${pkgdir}/usr/bin/nvidia-bug-report.sh"
+
    # nvidia-smi
+
    install -D -m755 nvidia-smi "${pkgdir}/usr/bin/nvidia-smi"
+
    install -D -m644 nvidia-smi.1.gz "${pkgdir}/usr/share/man/man1/nvidia-smi.1.gz"
+
 
+
    install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/nvidia/LICENSE"
+
    ln -s nvidia "${pkgdir}/usr/share/licenses/nvidia-utils"
+
    install -D -m644 README.txt "${pkgdir}/usr/share/doc/nvidia/README"
+
    install -D -m644 NVIDIA_Changelog "${pkgdir}/usr/share/doc/nvidia/NVIDIA_Changelog"
+
    ln -s nvidia "${pkgdir}/usr/share/doc/nvidia-utils"
+
 
+
    create_links
+
}
+
 
+
</nowiki>}}
+
 
+
It is not necessary to patch other packages. If you want, you can also install nvidia-custom (https://aur.archlinux.org/packages.php?ID=60981) and opencl-nvidia-custom (https://aur.archlinux.org/packages.php?ID=61443) from the AUR, but they are not much different from the official ones (nvidia and opencl-nvidia from extra).
+
 
+
If you rebuild nvidia-utils yourself, you may want to add it to the IgnorePkg line of your /etc/pacman.conf, so that the next system update does not break your system.
+
 
+
===CUDA Toolkit===
+
 
+
Install the package from community (https://www.archlinux.org/packages/community/x86_64/cuda/).
+
 
+
===Configurations===
+
 
+
Since Linux 3.9, the acpi-handle-hack module is no longer necessary for the Nvidia video adapter to get recognized. Depending on your system, just loading the nvidia module may be enough, but it may be necessary to create devices for CUDA. One way to accomplish this is to add the following to your /etc/rc.local:
+
 
+
{{bc|<nowiki>
+
/sbin/modprobe nvidia
+
 
+
if [ "$?" -eq 0 ]; then
+
 
+
# Count the number of NVIDIA controllers found.
+
 
+
N3D=`lspci | grep -i NVIDIA | grep "3D controller" | wc -l`
+
 
+
NVGA=`lspci | grep -i NVIDIA | grep "VGA compatible controller" | wc -l`
+
 
+
N=`expr $N3D + $NVGA - 1`
+
 
+
for i in `seq 0 $N`; do
+
mknod -m 666 /dev/nvidia$i c 195 $i
+
done
+
 
+
mknod -m 666 /dev/nvidiactl c 195 255
+
else
+
exit 1
+
fi
+
</nowiki>}}
+
 
+
If you are using systemd, you can get the /etc/rc.local loaded at boot by adding a new service. Create the following file:
+
 
+
{{bc|1=
+
#/etc/systemd/system/rc-local.service
+
 
+
[Unit]
+
Description=/etc/rc.local Compatibility
+
 
+
[Service]
+
Type=oneshot
+
ExecStart=/etc/rc.local
+
TimeoutSec=0
+
StandardInput=tty
+
RemainAfterExit=yes
+
 
+
[Install]
+
WantedBy=multi-user.target
+
}}
+
 
+
Then make this service load at boot with:
+
 
+
systemctl enable rc-local.service
+
 
+
===Testing it===
+
The cuda package includes both the cuda-toolkit and sdk. Before testing it, reboot and it should be working. To compile and run deviceQuery from the sdk:
+
 
+
cd /opt/cuda/samples/1_Utilities/deviceQuery
+
make
+
./deviceQuery
+
 
+
Alternatively, you can compile your own code and run it. To compile, say hello.cu, use:
+
 
+
nvcc hello.cu
+
 
+
Now you can run the executable:
+
 
+
./a.out
+
 
+
If this works without errors, you are all set!
+

Revision as of 00:10, 30 September 2013

Intel graphics

This machine has two video cards, an Intel HD 4000 integrated chip and a discrete Nvidia GTX 660M.

If you don't wish to use the machine's NVIDIA card, simply install xf86-video-intel and use the Intel driver. This will leave the NVIDIA card disabled, but it will still use power. To completely disable the NVIDIA card, enter the Y580's BIOS and on the "Configuration" tab, change "Graphic Device" from "Switchable Graphic" to "UMA Graphic". If these options are not there, you may need to update the BIOS.

NVIDIA graphics

Since the NVIDIA card must have some form of Optimus to be used, the graphics configuration can be complicated. The current Arch Linux kernel and proprietary NVIDIA driver support Optimus, but configuration is somewhat involved. There are three options:

  • Use the proprietary NVIDIA driver
  • Use the open-source nouveau driver
  • Use Bumblebee, which is designed as a third-party Optimus-like solution

Each option has its advantages. Bumblebee allows power-saving methods like graphics-card switching, so if you don't want to constantly be running the NVIDIA card, follow the guides for Bumblebee on the wiki. The proprietary NVIDIA driver typically has better performance than the open-source driver as of September 2013, but typically has more bugs and compatibility issues. The nouveau driver is reverse-engineered due to Nvidia's lack of hardware documentation, and therefore does not perform as well as the proprietary driver, but is simpler to use and less prone to bugs. More information can be found on the wiki's article on NVIDIA Optimus.

Using nouveau

To use the nouveau drivers, install the xf86-video-nouveau and xf86-video-intel packages. After rebooting, X should automatically detect the drivers and work.

Using nvidia

To use the proprietary NVIDIA drivers, install the xf86-video-modesetting, nvidia, and xorg-xrandr packages.

The next step is to change /etc/X11/xorg.conf appropriately. First, you must determine the PCI address of the NVIDIA card. Using lspci, check the NVIDIA entry:

lspci | grep NVIDIA

The first number you see, which should be formatted something like ##:##.#, is the PCI address. In /etc/X11/xorg.conf, however, the format must be modified so each number is one digit separated by colons (i.e. 01:00.0 would be written as 1:0:0).

Now edit /etc/X11/xorg.conf:

# nano /etc/X11/xorg.conf
Section "ServerLayout"
        Identifier "layout"
        Screen 0 "nvidia"
        Inactive "intel"
EndSection

Section "Device"
        Identifier "nvidia"
        Driver "nvidia"
        BusID "PCI:PCI_address"
EndSection

Section "Screen"
        Identifier "nvidia"
        Device "nvidia"
        Option "UseDisplayDevice" "none"
EndSection

Section "Device"
        Identifier "intel"
        Driver "modesetting"
EndSection

Section "Screen"
        Identifier "intel"
        Device "intel"
EndSection

The final step is to modify your ~/.xinitrc file to run two xrandr commands. Add the following two lines at the beginning of your .xinitrc:

$ nano ~/.xinitrc
xrandr --setprovideroutputsource modesetting NVIDIA-0 &
xrandr --auto &

Now reboot, and X should run. If you get a black screen after starting X, kill it and try starting X again (it may take several tries).