NVIDIA/Optimus

Laptops with NVIDIA graphics cards using NVIDIA Optimus can be configured to render scenes on the discrete NVIDIA GPU (Graphics Processing Unit) card using x11-drivers/nvidia-drivers and copy the rendered scenes to the Intel GPU using XRandR.

It is recommended to have an alternative boot method available such as bootable CD-ROM or DVD.

Kernel configuration
Consider setting:

DeviceDrivers -> Graphics Support -> Intel 8xx/9xx/Gex/G4x/HD Graphics -> Enable modetting on intel by default

xorg.conf configuration
http://us.download.nvidia.com/XFree86/Linux-x86_64/331.38/README/optimus.html http://us.download.nvidia.com/XFree86/Linux-x86_64/331.38/README/randr14.html

Using monitor EDID saved to a file
It is probably best to try a simple configuration first like described in the NVIDIA driver manual. Some laptops may benefit from saving the EDID screen information to a file so it can be passed to the NVIDIA and Intel modesetting drivers. The EDID information can be saved like:

emerge -v x11-misc/read-edid get-edid >edid.bin

Example configuration using monitor EDID saved to a file

 * 1) nvidia-xconfig: X configuration file generated by nvidia-xconfig
 * 2) nvidia-xconfig:  version 331.20  (buildmeister@swio-display-x86-rhel47-05)  Wed Oct 30 18:20:53 PDT 2013

Section "ServerLayout" Identifier    "Layout0" Screen     0  "Screen0" Inactive      "intel" InputDevice   "Keyboard0" "CoreKeyboard" InputDevice   "Mouse0" "CorePointer" EndSection

Section "Files" EndSection

Section "InputDevice" # generated from data in "/etc/conf.d/gpm" Identifier    "Mouse0" Driver        "mouse" Option        "Protocol" Option        "Device" "/dev/input/mice" Option        "Emulate3Buttons" "no" Option        "ZAxisMapping" "4 5" EndSection

Section "InputDevice" # generated from default Identifier    "Keyboard0" Driver        "kbd" EndSection

Section "Monitor" Identifier    "Monitor0" VendorName    "Unknown" ModelName     "Unknown" EndSection Section "Device" Identifier    "Device0" Driver        "nvidia" VendorName    "NVIDIA Corporation" # Stuff on the net says to use BusID "PCI:1:0:0" but the manual says to use "1@0:0:0" BusID         "1@0:0:0" Option        "ConnectedMonitor" "DFP-0" Option        "CustomEDID" "DFP-0:/lib/firmware/edid/1920x1080_Clevo_W670SR.bin" Option        "UseEDID" "True" Option        "ModeValidation" "NoVirtualSizeCheck" # Option      "ModeDebug" "True" EndSection Section "Screen" Identifier    "Screen0" Device        "Device0" Monitor       "Monitor0" # DefaultDepth   24 Option        "RenderAccel" "True" Option        "NoRenderExtension" "False" Option        "AllowGLXWithComposite" "True" Option        "AddARGBGLXVisuals" "True" Option        "DamageEvents" "True" Option        "ConnectToAcpid" "True" SubSection    "Display" Depth      24 Modes     "1920x1080" EndSubSection EndSection Section "Device" Identifier    "intel" Driver        "modesetting" Option        "CustomEDID" "DFP-0:/lib/firmware/edid/1920x1080_Clevo_W670SR.bin" EndSection Section "Screen" Identifier   "intel" Device       "intel" SubSection    "Display" Depth      24 Modes     "1920x1080" EndSubSection Monitor      "Monitor0" EndSection

Section "Extensions" Option        "Composite" "Enable" EndSection

Qingy
emerge -v sys-apps/qingy

for menu option (a) KDE-4
Add the xrandr commands to the end of the file:

/etc/X11/Sessions/KDE-4

for menu option (b) Your .xsession
Add the xrandr commands to the file:

~/.xsession

qingy directfb
In the directfb configuration file:

/etc/directfbrc

It is necessary to set the busid parameter to the busid of the Intel graphics card reported by:

lsusb

For example, if lsusb says the Inntel graphics card is on busid 00:02.0, then add the following line to /etc/directfbrc:

busid=0:02:0

CDM
emerge -v x11-misc/cdm

Add the xrandr commands to the file:

~/.xinitrc

KDM KDE
emerge -v kde-base/kdm

Add the xrandr commands to the file:

/usr/share/config/kdm/Xsetup

Other display managers
Any Display Manager that starts using X-Windows then asks the user to log in will result in a black screen unless a way can be found to run the necessary xrandr commands before asking the user to log in.