Vga switcheroo
Some laptops have both a low-power intel and a performance-oriented ati or nvidia graphics card. This page will describe how you can setup your system so it works under linux.
Unfortunately, under linux it isn't possible (yet) to switch graphics cards while X is running - it is possible however to switch GPUs with just a single command.
Contents |
[edit] Kernel Configuration
The first thing you need to do is compile your kernel with the following options:
| Linux Kernel Configuration: VGA Switcheroo |
Device Drivers --->
Graphics Support --->
[*] Laptop Hybrid Graphics - GPU switching support
<*> Direct Rendering Manager --->
<*> ATI Radeon
[*] Enable modesetting on radeon by default
<*> Intel 830M, *45G, 852GM, 855GM, 865G
<*> i915 driver
[*] Enable modesetting on intel by default
Console display driver support --->
-*- Framebuffer Console support
[*] Map the console to the primary display device
Kernel hacking --->
[*] Debug Filesystem
|
For Lenovo T400 with ATI:
- CONFIG_EXTRA_FIRMWARE is 'radeon/R600_rlc.bin'
- CONFIG_EXTRA_FIRMWARE_DIR is '/lib/firmware'
Choose a graphics driver from those available for your card and follow the linked guide.
Do not forget to add the following line to /etc/fstab (otherwise /sys/kernel/debug/vgaswitcheroo/switch is not accessible)
none /sys/kernel/debug debugfs defaults 0 0
[edit] Kernel parameters
For NVIDIA's (OR AMD )issues,I have tested some parameters that is successfully switched without any errors in kernel's If you have faced blank screen after with the tutorial,please check
1. Have you blacklisted the driver needed?
2. Have you not enabled the function in kernel's parameters?
In order to reduce the problem,kernel's parameter may need to change in order to load the modules needed. In grub.conf(/boot/grub/grub.conf,you know how to open it,I don't want to tell you much)
Please Check if you have these patterns in your config
My being is from FEDORA 14,2.6.35-11 ,the setting is blocking the external driver,my stuff is NVIDIA
title Fedora (2.6.35.11-83.fc14.i686) root (hd0,2) kernel /boot/vmlinuz-2.6.35.11-83.fc14.i686 rdblacklist=nouveau nouveau.modeset=0
Theoretically,just use nouveau.modeset=0 in order to disable the modules
Enabling the function:
title FedoraHybrid(2.6.35.11-83.fc14.i686) root (hd0,2) kernel /boot/vmlinuz-2.6.35.11-83.fc14.i686 nouveau.modeset=1 initrd /boot/initramfs-2.6.35.11-83.fc14.i686.img
If you have made a custom-kernel, make sure you have add the followings before you boot,otherwise it will be default to switch to IGD or just both ON
Currently,the method is for second generation of 'smart-switch' only,the third one is still under development.
End of the update
[edit] Hprofile
After configuring (and installing) our kernel it is possible to switch graphics cards. However, changes in configuration files isn't taken care of; also, switching graphics cards isn't easy. That's why we will install hprofile, which will allow us to do some quick configuration switches. In hprofile we will create a new graphics profile:
emerge hprofile ... mkdir -p /etc/hprofile/profiles/graphics
Then we need the following files to have a 'radeon' and 'intel' profile option:
radeon intel
radeon
#!/bin/bash
# This script should echo the name of the profile that should be used (only).
#check if we have switchable graphics
if [ ! -f /sys/kernel/debug/vgaswitcheroo/switch ] ; then
echo "radeon"
exit 0
fi
if [ `grep "0:DIS:+" /sys/kernel/debug/vgaswitcheroo/switch` ] ; then
echo "radeon"
exit 0
fi
if [ `grep "1:IGD:+" /sys/kernel/debug/vgaswitcheroo/switch` ] ; then
echo "intel"
exit 0
fi
echo "invalid"
exit 1
Now we have the profiles set up. We still have to set up the commands to be executed to actually switch profiles.
#!/bin/bash
# This script will be run when the profile named "first_profile" is started.
echo "Starting ${0%.*}"
echo "DIGD" > /sys/kernel/debug/vgaswitcheroo/switch
#echo "OFF" > /sys/kernel/debug/vgaswitcheroo/switch
#!/bin/bash
# This script will be run when the profile named "first_profile" is started.
echo "Starting ${0%.*}"
echo "DDIS" > /sys/kernel/debug/vgaswitcheroo/switch
#echo "OFF" > /sys/kernel/debug/vgaswitcheroo/switch
also as mentioned earlier we can't switch graphics cards while X is running. so we will turn X off and on.
#!/bin/bash
echo "Finished starting profile ${1}"
/etc/init.d/xdm start
#!/bin/bash
echo "Finished Stopping profile ${1}"
/etc/init.d/xdm stop
Additionally you have to set execute rights for this scripts
chmod +x /etc/hprofile/profiles/graphics/scripts/*.start chmod +x /etc/hprofile/profiles/graphics/post-start chmod +x /etc/hprofile/profiles/graphics/stop chmod +x /etc/hprofile/profiles/graphics/ptest
now the final missing piece is setting up a different x configuration file for the different profiles. For more details look at guides on the individual cards.
... Section "Device" Identifier "video" Driver "intel" EndSection Section "Extensions" Option "Composite" "Disable" EndSection ...
... Section "Device" Identifier "video" Driver "radeon" EndSection Section "Extensions" Option "Composite" "Enable" EndSection ...
after this we can switch profile with the commands
hprofile graphics.intelor
hprofile graphics.radeon