Skip to content

Instantly share code, notes, and snippets.

@NigoroJr
Created November 29, 2016 07:21
Show Gist options
  • Save NigoroJr/d96632561defec22d7a85eac7142ac5f to your computer and use it in GitHub Desktop.
Save NigoroJr/d96632561defec22d7a85eac7142ac5f to your computer and use it in GitHub Desktop.
# ft=conf
Section "ServerLayout"
Identifier "layout"
Screen 1 "nvidia"
Inactive "intel"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:1:0:0"
EndSection
Section "Screen"
Identifier "nvidia"
Device "nvidia"
Option "AllowEmptyInitialConfiguration"
# Uncomment this line if your computer has no display devices connected to
# the NVIDIA GPU. Leave it commented if you have display devices
# connected to the NVIDIA GPU that you would like to use.
Option "UseDisplayDevice" "none"
EndSection
Section "Device"
Identifier "intel"
Driver "intel"
#Driver "modesetting"
BusID "PCI:0:2:0"
EndSection
Section "Screen"
Identifier "intel"
Device "intel"
EndSection
How to Enable NVIDIA Optimus
============================
Author: Naoki Mizuno (NigoroJr)
Written: 2016-11-29
This quick how-to is a guide on how to enable NVIDIA Optimus without using
Bumblebee. This has worked on my hardware but it is not guaranteed that it will
work on any computer.
Put the following code snippet as 30nvidia.conf in /etc/X11/xorg.conf.d/ after
adjusting the BusID. Make sure you have nvidia-drivers and
x11-drivers/xf86-video-intel and VIDEO_CARD in make.conf set to "nvidia
intel".
# ft=conf
Section "ServerLayout"
Identifier "layout"
Screen 1 "nvidia"
Inactive "intel"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:1:0:0"
EndSection
Section "Screen"
Identifier "nvidia"
Device "nvidia"
Option "AllowEmptyInitialConfiguration"
# Uncomment this line if your computer has no display devices connected to
# the NVIDIA GPU. Leave it commented if you have display devices
# connected to the NVIDIA GPU that you would like to use.
Option "UseDisplayDevice" "none"
EndSection
Section "Device"
Identifier "intel"
Driver "intel"
BusID "PCI:0:2:0"
EndSection
Section "Screen"
Identifier "intel"
Device "intel"
EndSection
In your .xinitrc (for startx; probably better considering the caveats written
in the next section) or .xsession put the following line:
xrandr --setprovideroutputsource Intel NVIDIA-0
xrandr --output HDMI1 --primary --auto --output eDP1 --right-of HDMI1 --auto
Don't forget to adjust the output names and the options according to your
configurations.
Caveats
-------
The display manager (like SLiM, KDM, GDM etc.) will probably not work (i.e.
will show a blank screen) because xrandr is only run after the login. In SLiM,
you might be able to set the sessionstart_cmd. Even when the login screen is
black it will still accept inputs and you will be able to login if you input
the correct username and password.
There also seems to be a problem regarding monitor refreshing and sometimes
there are black parts on the built-in moniter. This goes away if you make a
movement in that moniter.
References
----------
Some useful webpages when configuring:
https://forums.gentoo.org/viewtopic-p-7309924.html
https://wiki.gentoo.org/wiki/NVIDIA/Optimus/xorg.conf
https://wiki.archlinux.org/index.php/NVIDIA_Optimus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment