https://wiki.archlinux.org/api.php?action=feedcontributions&user=AHacking&feedformat=atomArchWiki - User contributions [en]2024-03-19T13:57:45ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=NVIDIA_Optimus&diff=305126NVIDIA Optimus2014-03-16T15:52:05Z<p>AHacking: Added display manager configuration section and included specific instructions for LightDM</p>
<hr />
<div>[[Category:Graphics]]<br />
{{Related articles start}}<br />
{{Related|Bumblebee}}<br />
{{Related|Nouveau}}<br />
{{Related|NVIDIA}}<br />
{{Related articles end}}<br />
<br />
NVIDIA Optimus is a technology that allows an Intel integrated GPU and discrete NVIDIA GPU to be built into and accessed by a laptop. Getting Optimus graphics to work on Arch Linux requires a few somewhat complicated steps, explained below. There are several method available:<br />
<br />
* disabling one of the devices in BIOS, which may result in improved battery life if the NVIDIA device is disabled, but may not be available with all BIOSes and does not allow GPU switching<br />
<br />
* using the official Optimus support included with the proprietary NVIDIA driver, which offers the best NVIDIA performance but does not allow GPU switching and can be more buggy than the open-source driver<br />
<br />
* using the PRIME functionality of the open-source nouveau driver, which allows GPU switching but offers poor performance compared to the proprietary NVIDIA driver and does not currently implement any powersaving<br />
<br />
* using the third-party Bumblebee program to implement Optimus-like functionality, which offers GPU switching and powersaving but requires extra configuration<br />
<br />
These options are explained in detail below.<br />
<br />
== Disabling switchable graphics ==<br />
<br />
If you only care to use a certain GPU without switching, check the options in your system's BIOS. There should be an option to disable one of the cards. Some laptops only allow disabling of the discrete card, or vice-versa, but it is worth checking if you only plan to use one of the cards. If you want to use both cards, or cannot disable the card you do not want, see the options below.<br />
<br />
== Using nvidia ==<br />
<br />
The [[NVIDIA|proprietary NVIDIA driver]] does not support dynamic switching like the nouveau driver (meaning it can only use the NVIDIA device). It also has notable screen-tearing issues that NVIDIA recognizes but has not fixed. However, it does allow use of the discrete GPU and has (as of October 2013) a marked edge in performance over the nouveau driver.<br />
<br />
First install the modesetting and nvidia drivers:<br />
<br />
# pacman -S xf86-video-modesetting nvidia<br />
<br />
Then install {{ic|xrandr}}:<br />
<br />
# pacman -S xorg-xrandr<br />
<br />
Next, you must create a custom {{ic|xorg.conf}}. You will need to know the PCI address of the NVIDIA card, which you can find by issuing<br />
<br />
$ lspci <nowiki>|</nowiki> grep VGA<br />
<br />
The PCI address is the first 7 characters of the line that mentions NVIDIA. It will look something like {{ic|01:00.0}}. In the {{ic|xorg.conf}}, you will need to format it as {{ic|#:#:#}}; e.g. {{ic|01:00.0}} would be formatted as {{ic|1:0:0}}. Also, if the NVIDIA card has no display devices attached to it (all video goes through the Intel chip), uncomment the line that reads {{ic|Option "UseDisplayDevice" "none"}}.<br />
<br />
{{hc|# nano /etc/X11/xorg.conf|<br />
Section "ServerLayout"<br />
Identifier "layout"<br />
Screen 0 "nvidia"<br />
Inactive "intel"<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "nvidia"<br />
Driver "nvidia"<br />
BusID "PCI:''PCI address determined earlier''"<br />
# e.g. BusID "PCI:1:0:0"<br />
EndSection<br />
<br />
Section "Screen"<br />
Identifier "nvidia"<br />
Device "nvidia"<br />
#Option "UseDisplayDevice" "none"<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "intel"<br />
Driver "modesetting"<br />
EndSection<br />
<br />
Section "Screen"<br />
Identifier "intel"<br />
Device "intel"<br />
EndSection}}<br />
<br />
Next, add the following two lines to the beginning of your {{ic|~/.xinitrc}}:<br />
<br />
{{hc|$ nano ~/.xinitrc|<br />
xrandr --setprovideroutputsource modesetting NVIDIA-0<br />
xrandr --auto}}<br />
<br />
Now reboot to load the drivers, and X should start.<br />
<br />
If you get a black screen when starting X, make sure that there are no ampersands after the two {{ic|xrandr}} commands in {{ic|~/.xinitrc}}; if there are ampersands, it seems that the window manager can run before the {{ic|xrandr}} commands finish executing, leading to the black screen.<br />
<br />
=== Display Managers ===<br />
<br />
If you are using a display manager then you will need to create or edit a display setup script for your display manager instead of using {{ic|~/.xinitrc}}.<br />
<br />
==== LightDM ====<br />
<br />
For the [[LightDM]] display manager:<br />
<br />
{{hc|# nano /etc/lightdm/display_setup.sh|<br />
xrandr --setprovideroutputsource modesetting NVIDIA-0<br />
xrandr --auto}}<br />
<br />
Make the script executable:<br />
<br />
# chmod +x /etc/lightdm/display_setup.sh<br />
<br />
Now configure lightdm to run the script by editing the {{ic|[SeatDefaults]}} section in {{ic|/etc/lightdm/lightdm.conf}}:<br />
<br />
{{hc|# nano /etc/lightdm/lightdm.conf|output=<br />
[SeatDefaults]<br />
display-setup-script=/etc/lightdm/display_setup.sh}}<br />
<br />
Now reboot and your display manager should start.<br />
<br />
=== Checking 3D ===<br />
<br />
You can check if the NVIDIA graphics are being used by installing {{Pkg|mesa-demos}} and running<br />
<br />
$ glxinfo <nowiki>|</nowiki> grep NVIDIA<br />
<br />
=== Further Information ===<br />
<br />
For more information, look at NVIDIA's official page on the topic [http://http.download.nvidia.com/XFree86/Linux-x86_64/319.23/README/randr14.html here].<br />
<br />
== Using nouveau ==<br />
<br />
The open-source [[nouveau]] driver ({{Pkg|xf86-video-nouveau}})can dynamically switch with the Intel driver ({{Pkg|xf86-video-intel}}) using a technology called PRIME. For more information, see the wiki article on [[PRIME]].<br />
<br />
== Using Bumblebee ==<br />
<br />
If you wish to use Bumblebee, which will implement powersaving and some other useful features, see the wiki article on [[Bumblebee]].</div>AHacking