Update 18/03/2014: I'm sad to announce I no longer have this computer nor any PC with hybrid graphics... My ASUSM51Ta passed away, so I no longer could compile kernels and test things on hybrid graphics. As far as I know this technology is already supported more easily Hybrid Graphics Wiki.

First of all, this HowTo is intended to people like me with almost no knowledge about compiling and patching kernels. Also to people that may want to share their experience using the vga_switcheroo (now included in kernel 2.6.35 onwards) from David Airlie with their own machines with switchable graphics.


If you want to test this HowTo on your computer, please post your experience at the mailing list of https://launchpad.net/%7Ehybrid-graphics-linux

For more info about hybrid graphics consult:
http://linux-hybrid-graphics.blogspot.com/


Notes:





GNU/Linux used: Fedora / Ubuntu
Machine: ASUS M51Ta
Graphic card configuration:
- Integrated: 01:05.0 VGA compatible controller: ATI Technologies Inc RS780M/RS780MN [Radeon HD 3200 Graphics]
- Discrete: 02:00.0 VGA compatible controller: ATI Technologies Inc Mobility Radeon HD 3650



[28/05/2010] Fedora 13 + kernel 2.6.34 + vga_switcheroo + switch scripts


(0.a) Downloads:
kernel 2.6.34 and untar it to: ~/linuxKernels/
R600_rlc.bin and copy it to: /lib/firmware/radeon/
R700_rlc.bin and copy it to /lib/firmware/radeon/


Or, if you prefer everything from command line:
(0.b) Downloads:

$ su -c 'yum update'
$ su -c 'yum install wget'
$ mkdir ~/linuxKernels
$ wget -P ~/linuxKernels/ http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.34.tar.bz2
$ su -c 'wget -P /lib/firmware/radeon/ http://people.freedesktop.org/%7Eagd5f/radeon_ucode/R600_rlc.bin'
$ su -c 'wget -P /lib/firmware/radeon/ http://people.freedesktop.org/%7Eagd5f/radeon_ucode/R700_rlc.bin'
$ cd ~/linuxKernels/
$ tar -xvjf linux-2.6.34.tar.bz2


(1) Compile kernel with CONFIG_VGA_SWITCHEROO:

$ su -c 'yum install patch qt3-devel gcc-c++ libXi-devel mkinitrd' # install development tools + mkinitrd
$ cd ~/linuxKernels/linux-2.6.34/
$ make mrproper
$ cp /boot/config-"kernel" .config # in my case: "kernel" = 2.6.33.4-95.fc13.x86_64
$ make xconfig # select (-> Device Drivers -> Graphics support ->) Laptop Hybrid Grapics - GPU switching support (VGA_SWITCHEROO)
$ gedit Makefile # and change "EXTRAVERSION =" for "EXTRAVERSION = -vgaswitcheroo"
$ make clean
$ make -j4 bzImage # the -j specifies the number of jobs (commands) to run simultaneously; put your number of CPUs x 2
$ make -j4 modules
$ su -c 'make -j4 modules_install'
$ su -c 'make -j4 install'


(2) Run the new kernel and test:

$ su
$ mount -t debugfs none /sys/kernel/debug
$ cd /sys/kernel/debug/vgaswitcheroo
$ cat switch # to see which card is active
$ echo DDIS > switch # to go to discrete card (log off and then log in after this command)
$ echo DIGD > switch # to go to integrated card (log off and then log in after this command)
$ echo OFF > switch # to just power off the card you aren't using


(3) Switch & logout scripts & launchers
First of all, to use these new scripts & launchers you will need the following package:

$ su -c 'yum install gxmessage'

Also, the /etc/fstab should be changed so that it mounts automatically the /sys/kernel/debug/vgaswitcheroo/ so that we can use the switch file inside it. So we must:

$ su -c 'gedit /etc/fstab'
And add the following line:
none                    /sys/kernel/debug debugfs defaults 0 0
And then, we must change switch file permissions permanently every time the computer initiates:
su -c 'gedit /etc/rc.d/rc.local'
And add the following line:
chown "username" /sys/kernel/debug/vgaswitcheroo/switch # change "username" with your user name


Ok, so now we are ready to use the launchers and scripts. The first desktop launcher is used to switch between the graphic cards directly from your desktop, and the logout launcher is needed to turn off the computer (see below for details of why it is needed on my case). They work great on my laptop ASUS M51Ta. Each of the launchers calls a script that is detailled below. It would be a good idea to copy the scripts to /home/"username"/bin/ so that they are executable from any directory and copy the icons into /home/"username"/.local/share/icons/:

$ wget -P /home/"$USER"/.local/share/icons/ https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYqzYlP-BgyTv19LpPlAhqZfODsNZB-eyiNOf6e__FS8AOudy-wIEhyLXMLVnSndIkv9rrii3Sy58mJnx8O3IlrdrY5nr4Rf7CHhbqlaRsH5vLIkr1xB3Kg_TTkWmBHogBu-HOEcGX-8w/s800/hardware_down.png
$ wget -P /home/"$USER"/.local/share/icons/ https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgdTtB-ginD408jKwWn5eKv7_Yf1MJ0I2H4yVP-Ot8z633v34txixBOxVh4AoetVM5MJBi80bBMH3D9zdIHdBEtLsIbaLHDHA2RG2YbVcHj_I_VJslyKq9g448x18PjX_JDxuwk4GGvpQ/s800/hardware_up.png
$ wget -P /home/"$USER"/.local/share/icons/ https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhE-3j1pcKz4LgPkxJteB-NmwakzVigVRIHyCJNEkfRTLUcAAIeB2N87ZJuRllp1i5Wubhmy5WO3IG1WXTrhXyf1l_fmnogoTt3KYND50Pv-8fc44Emw3InJ0dcv1Rpg8xOpDbeizV1NQs/s800/hardware.png
$ wget -P /home/"$USER"/.local/share/icons/ https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGcHDeXc2UtTpphrPGhwCabFs-k9Rg_nzwgUO2G-LSOSrvd-oYDK5hNHyDS7F9_yj-7VAEZeFRPhe4TlfmMV68FODmDyEelcLTLG_PUOPgA70p-UTdFDTnCNa3LeHKS-e-5Kox4O9VG3E/s800/switch_before_shutdown.png

To switch between graphic cards the following launcher is used:


switch_between_cards.desktop


[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=switch between cards
Exec=/"location of script"/switch_between_cards.sh
# change "location of script" with location of script described below
Type=Application
Categories=Other;
Icon=/"location"/hardware.png
# change "location" with the location of the icon
Terminal=false


switch_between_cards.sh


#!/bin/bash
# "switch_between_cards.sh" script by RM, with useful changes from LoLL
# version 20100528

pci_integrated=$(lspci | grep VGA | sed -n '1p' | cut -f 1 -d " ")
pci_discrete=$(lspci | grep VGA | sed -n '2p' | cut -f 1 -d " ")

integrated=$(cat /sys/kernel/debug/vgaswitcheroo/switch | grep $pci_integrated | grep -o -P ':.:...:')
discrete=$(cat /sys/kernel/debug/vgaswitcheroo/switch | grep $pci_discrete | grep -o -P ':.:...:')

name_integrated=$(lspci | grep VGA | sed -n '1p' | sed -e "s/.* VGA compatible controller[ :]*//g" | sed -e "s/ Corporation//g" | sed -e "s/ Technologies Inc//g" | sed -e 's/\[[0-9]*\]: //g' | sed -e 's/\[[0-9:a-z]*\]//g' | sed -e 's/(rev [a-z0-9]*)//g' | sed -e "s/ Integrated Graphics Controller//g")

name_discrete=$(lspci | grep VGA | sed -n '2p' | sed -e "s/.* VGA compatible controller[ :]*//g" | sed -e "s/ Corporation//g" | sed -e "s/ Technologies Inc//g" | sed -e 's/\[[0-9]*\]: //g' | sed -e 's/\[[0-9:a-z]*\]//g' | sed -e 's/(rev [a-z0-9]*)//g' | sed -e "s/ Integrated Graphics Controller//g")

if [ "$integrated" = ":+:Pwr:" ]
then
integrated_condition="(*) - Power ON"
elif [ "$integrated" = ": :Pwr:" ]
then
integrated_condition="( ) - Power ON"
elif [ "$integrated" = ": :Off:" ]
then
integrated_condition="( ) - Power OFF"
fi

if [ "$discrete" = ":+:Pwr:" ]
then
discrete_condition="(*) - Power ON"
elif [ "$discrete" = ": :Pwr:" ]
then
discrete_condition="( ) - Power ON"
elif [ "$discrete" = ": :Off:" ]
then
discrete_condition="( ) - Power OFF"
fi

gxmessage -center \
-buttons "_Cancel":1,"switch to _Integrated":101,"switch to _Discrete":102 \
-wrap \
-title "Choose Hybrid Graphic Card" \
"Choose Hybrid Graphic Card
=================
Integrated: $integrated_condition : $name_integrated
Discrete: $discrete_condition : $name_discrete"


whichCard=$?

case "$whichCard" in

1)
echo "Exit"
;;
101)
if [ "$integrated" == ":+:Pwr:" ] && [ "$discrete" == ": :Pwr:" ]
then
notify-send -t 5000 --icon="/home/$USER/.local/share/icons/hardware_down.png" "switching to $name_integrated"
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
elif [ "$integrated" == ": :Pwr:" ] && [ "$discrete" == ":+:Pwr:" ]
then
notify-send -t 5000 --icon="/home/$USER/.local/share/icons/hardware_down.png" "switching to $name_integrated"
echo DIGD > /sys/kernel/debug/vgaswitcheroo/switch
killall -u "$USER" # or gnome-session-save --logout
elif [ "$integrated" == ": :Off:" ] && [ "$discrete" == ":+:Pwr:" ]
then
notify-send -t 5000 --icon="/home/$USER/.local/share/icons/hardware_down.png" "switching to $name_integrated"
echo ON > /sys/kernel/debug/vgaswitcheroo/switch
echo DIGD > /sys/kernel/debug/vgaswitcheroo/switch
killall -u "$USER" # or gnome-session-save --logout
elif [ "$integrated" == ":+:Pwr:" ] && [ "$discrete" == ": :Off:" ]
then
notify-send -t 5000 --icon="/home/$USER/.local/share/icons/hardware_down.png" "already switched to $name_integrated"
fi
;;
102)
if [ "$integrated" == ":+:Pwr:" ] && [ "$discrete" == ": :Pwr:" ]
then
notify-send -t 5000 --icon="/home/$USER/.local/share/icons/hardware_up.png" "switching to $name_discrete"
echo DDIS > /sys/kernel/debug/vgaswitcheroo/switch
killall -u "$USER" # or gnome-session-save --logout
elif [ "$integrated" == ": :Pwr:" ] && [ "$discrete" == ":+:Pwr:" ]
then
notify-send -t 5000 --icon="/home/$USER/.local/share/icons/hardware_up.png" "switching to $name_discrete"
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
elif [ "$integrated" == ":+:Pwr:" ] && [ "$discrete" == ": :Off:" ]
then
notify-send -t 5000 --icon="/home/$USER/.local/share/icons/hardware_up.png" "switching to $name_discrete"
echo ON > /sys/kernel/debug/vgaswitcheroo/switch
echo DDIS > /sys/kernel/debug/vgaswitcheroo/switch
killall -u "$USER" # or gnome-session-save --logout
elif [ "$integrated" == ": :Off:" ] && [ "$discrete" == ":+:Pwr:" ]
then
notify-send -t 5000 --icon="/home/$USER/.local/share/icons/hardware_up.png" "already switched to $name_discrete"
fi
;;
esac


In this way, you can switch between graphic cards with just a couple of clicks. In this snapshot you can see the script showing the two hybrid graphic cards. The "(*)" symbol represents which card is currently being used and the Power ON/OFF indicates their power state. Have in mind that a graphic card can be ON but not currently being used... which of course we want to avoid. If you are using GNOME as graphical interface (instead of Openbox, like me), change al the instances of killall -u "$USER" by gnome-session-save --logout.



So, if you want to switch to the discrete card (in this case the HD3650), you just click "switch to Discrete", and a message will appear: "switchig to (name of discrete card)". Then the system will log off, and after you log in again the cards have switched.



Therefore, after loging out and login in, if you run again the script, it tells you which card is running "(*)":



If you try to switch to the current card being used (in this case HD3650) a message will tell you "already switched to that card":



And, of course, you can come back to the integrated card (running the script, choosing "switch to Integrated", and going through a log out and log in process):



This next launcher is used to turn off the computer. Because, in my case, if I turn off the computer without switching on both cards (specially when the integrated card is on and the discrete card is off), the fan runs at full speed when I turn it on again, stoping only after rebooting. Hence, to avoid this, this other launcher can be used to turn off the computer:


switch_before_shutdown.desktop


[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=switch before shutdown
Exec=/"location of script"/switch_before_shutdown.sh
# change "location of script" with the location of the script described below
Type=Application
Categories=Other;
Icon=/"location"/switch_before_shutdown.png
# change "location" with the location of the icon
Terminal=false


switch_before_shutdown.sh


#!/bin/bash

gxmessage "Are you sure you want to shut down your computer?" -center -title "Take action" -font "Sans bold 10" -default "Cancel" -buttons "_Cancel":1,"L_ock screen":101,"_Log out":102,"_Reboot":103,"_Shut down":104

case $? in

1)
echo "Exit";;

101)
xscreensaver-command -lock;;

102)
killall -u "$USER";;

103)
echo ON > /sys/kernel/debug/vgaswitcheroo/switch;
gnome-terminal -e 'sudo shutdown -r now';;

104)
echo ON > /sys/kernel/debug/vgaswitcheroo/switch
gnome-terminal -e 'sudo shutdown -h now';;

esac


And finally, enjoy your hybrid graphics!!


By the way, if you like my desktop, I use OpenBox with LXPanel and two conkys, one for the panel bar with a summary of CPUs, memory, network and hard disk functioning; and another one with more details in the desktop. Here are the conky files:


.conkyrc_bar

alignment top_right
background yes
border_margin 0
border_width 0
default_color grey
double_buffer yes
draw_borders no
draw_outline yes
draw_shades no
gap_x 290
gap_y -5
maximum_width 286
minimum_size 286
no_buffers yes
own_window yes
own_window_colour green
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes
own_window_type desktop
stippled_borders 0
total_run_times 0
update_interval 1
uppercase no
use_spacer yes

TEXT
${cpugraph cpu1 18,29 0092e6 0092e6}${cpugraph cpu2 18,29 0092e6 0092e6} ${memgraph 18,29 00b35b 00b35b} ${downspeedgraph 18,29 fce94f fce94f}${upspeedgraph 18,29 c4a000 c4a000} ${diskiograph_read /dev/sda1 18,29 c65000 c65000}${diskiograph_write /dev/sda1 18,29 ff6700 ff6700} ${diskiograph_read /dev/sda5 18,29 c65000 c65000}${diskiograph_write /dev/sda5 18,29 ff6700 ff6700}$color


.conkyrc_full

alignment top_right
background yes
border_margin 0
border_width 0
default_color grey
double_buffer yes
draw_borders no
draw_outline yes
draw_shades no
gap_x 0
gap_y 0
maximum_width 286
minimum_size 286
no_buffers yes
override_utf8_locale yes
own_window yes
own_window_colour green
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes
own_window_type desktop
stippled_borders 0
total_run_times 0
update_interval 1
uppercase no
use_spacer yes

TEXT
${battery_bar 10,20 BAT0} ${battery_percent BAT0}% ${iconv_start UTF-8 ISO_8859-1}[$desktop/$desktop_number] CPU: ${color green}${acpitemp}°C ${color}HDD: ${color green}${hddtemp /dev/sda 127.0.0.1 7634}°C $alignr$color${time %H:%M:%S}${iconv_stop}

${color green}SYSTEM ${hr 2}$color
$nodename $alignr$sysname $kernel $machine
Uptime:$alignr$uptime

${color green}CPU 0 ${hr 2}$color
${freq 1}MHz $alignr Load: ${loadavg}
${cpubar cpu1}
${cpugraph cpu1 004973 0092e6}
${color green}CPU 1 ${hr 2}$color
${freq 2}MHz $alignr Load: ${loadavg}
${cpubar cpu2}
${cpugraph cpu2 004973 0092e6}

${top pid 1} ${top name 1} ${top cpu 1}% CPU ${top mem 1}% MEM
${top pid 2} ${top name 2} ${top cpu 2}% CPU ${top mem 2}% MEM
${top pid 3} ${top name 3} ${top cpu 3}% CPU ${top mem 3}% MEM
${top pid 4} ${top name 4} ${top cpu 4}% CPU ${top mem 4}% MEM
${top pid 5} ${top name 5} ${top cpu 5}% CPU ${top mem 5}% MEM

${top_mem pid 1} ${top_mem name 1} ${top_mem mem_res 1} MEM ${top_mem mem 1}% MEM
${top_mem pid 2} ${top_mem name 2} ${top_mem mem_res 2} MEM ${top_mem mem 2}% MEM
${top_mem pid 3} ${top_mem name 3} ${top_mem mem_res 3} MEM ${top_mem mem 3}% MEM
${top_mem pid 4} ${top_mem name 4} ${top_mem mem_res 4} MEM ${top_mem mem 4}% MEM
${top_mem pid 5} ${top_mem name 5} ${top_mem mem_res 5} MEM ${top_mem mem 5}% MEM
Processes: $processes ${alignr}Running: $running_processes

${color green}MEMORY / DISK ${hr 2}$color
RAM: $mem/$memmax - $memperc%
${membar 6}$color
${memgraph 006333 00b35b}
swap: ${swap}/${swapmax} - $swapperc% ${swapbar 6}$color
sda1: ${fs_used /}/${fs_size /} - ${fs_used_perc /}% ${color green}${hr 1}$color
${fs_bar 6 /}$color
Read: ${diskio_read /dev/sda1} k/s ${alignr}Write: ${diskio_write /dev/sda1} k/s
${diskiograph_read /dev/sda1 25,140 5e2600 c65000} ${diskiograph_write /dev/sda1 25,140 823500 ff6700}
sda5: ${fs_used /home/"username"/CONTAINER/}/${fs_size /home/"username"/CONTAINER/} - ${fs_used_perc /home/"username"/CONTAINER}% ${color green}${hr 1}$color
${fs_bar 6 /home/"username"/CONTAINER}$color
Read: ${diskio_read /dev/sda5} k/s ${alignr}Write: ${diskio_write /dev/sda5} k/s
${diskiograph_read /dev/sda5 25,140 5e2600 c65000} ${diskiograph_write /dev/sda5 25,140 823500 ff6700}

${color green}NETWORK eth0 (${addr eth0}) ${hr 2}$color
Down: $color${downspeed eth0} k/s ${alignr}Up: ${upspeed eth0} k/s
${downspeedgraph eth0 20,140 8c822c fce94f} ${upspeedgraph eth0 20,140 705b00 c4a000}$color
Total: ${totaldown eth0} ${alignr}Total: ${totalup eth0}

${color green}NETWORK wlan0 (${addr wlan0}) ${hr 2}$color
Down: $color${downspeed wlan0} k/s ${alignr}Up: ${upspeed wlan0} k/s
${downspeedgraph wlan0 20,140 8c822c fce94f} ${upspeedgraph wlan0 20,140 705b00 c4a000}$color
Total: ${totaldown wlan0} ${alignr}Total: ${totalup wlan0}
Inbound: ${tcp_portmon 1 32767 count} Outbound: ${tcp_portmon 32768 61000 count}${alignr}Total: ${tcp_portmon 1 65535 count}

${color green}${hr 2}$color

93 comments:

  1. Thanks for the great guide! I wanted to try this since I found out that David Airlie was working on the patch, but it was too scary and difficult for me without such a guide.

    So far I've compiled the kernel and modules without any problems, but seem not to be able to make them work, alas. For one thing, I believe the part of making a new initrd image is omitted in the guide, but even after I create a new image (and I hope I am doing it correctly), the kernel still doesn't boot.

    When I choose to boot the kernel, nothing happens, it just sits there with a blank screen and no errors. When I tried to boot the Rescue Mode for the new kernel, it said that it timed out waiting for a boot device and also couldn't find /lib/modules/2.6.34-rc4-swicheroo/modules.dep.

    So far I'm stuck at this point. Do you probably have any guidance as for where to look next?

    ReplyDelete
  2. I am amazed to confirm that it totally works!
    The previous problem was solved by using update-initramfs command to create an initrd image, for some reason the image created with mkinitramfs was not correct. But I still believe you should include a section on this in the guide.

    Once again, thanks for the great solution, I've been waiting for it for ages and cannot believe the wait is over!

    ReplyDelete
  3. As a final question, is there any way to make the system boot with the ATI card disabled? I've tried adding a script to init.d which would echo OFF, but it still boots up with both GPUs enabled.
    Thanks!

    ReplyDelete
  4. @ER: Thanks for your comments. To initialize with only one graphic card ON, you must edit the following script: "/etc/rc.d/rc.local" and, after the line you already added following the HowTo:
    'chown "username" /sys/kernel/debug/vgaswitcheroo/switch'
    ... add this line:
    'echo OFF > /sys/kernel/debug/vgaswitcheroo/switch'
    In this way you turn OFF the card that is not being used.

    ReplyDelete
  5. Hey, nice guide and job for the scripts.
    I need to tweak them as the list of cards from /sys changed between 2.6.33+patch and 2.6.34 ! So all the "^[0|1]:" must be omitted to be sure the script can run either the IGD is listed first or second.

    Only problem : all the cards runs after hybernation ... and a switch to igd makes me crash :-/ maybe i must switch to DIS before [deep]sleeping ?!

    Bye

    ReplyDelete
  6. @Loll: Hi, in my case it didn't change. When I make "cat /sys/kernel/debug/vgaswitcheroo/switch" I get the same output in kernel 2.6.33+patch & in kernel 2.6.34:
    0:+:Pwr:0000:01:05.0
    1: :Off:0000:02:00.0
    Always an initial "0:" or "1:" marking the integrated or the discrete card respectively. So in my case I didn't have to change the switch_between_cards.sh script.
    And for the hybernation question, I don't use it actually so I cannot tell you. Right now I'm using Fedora 13 & openbox, when I tried to use it with Fedora 11 & gnome it didn't work and I haven't try it since then...

    ReplyDelete
  7. Hi Roberto,

    I put a copy of modded script online :
    http://ljr.free.fr/archives/acer_4810TZG/switch_cards.sh

    changes :
    * don't care order list of IGD/DIS cards
    * display more popup messages when switching (show ON/OFF operation)
    * reuse "gnome-session-save --logout" to avoid warning with tasks still alive at session close.

    I put also rc.local and eco.sh (notebook power optimizations). It could interest you...

    Bye

    ReplyDelete
  8. Additionnal info : i'm running F13 with rawhide kernel 2.6.34-11.f13 x86_64 (version 'du jour'. I installed kernel, kernel-devel and kernel-headers rpms from rawhide depot only).

    Available here : http://fr2.rpmfind.net/linux/fedora/development/rawhide/i386/os/Packages/kernel-2.6.34-11.fc14.i686.rpm (32 bits) or http://fr2.rpmfind.net/linux/fedora/development/rawhide/x86_64/os/Packages/kernel-2.6.34-11.fc14.x86_64.rpm (64 bits) .

    Users, you easily installed them with rpm -ivh http://....blahblahblah.... .

    ReplyDelete
  9. Do you know which .bin file I would need for a RadeonHD 4570? This is the dedicated gpu, the integrated one is 3200 series.

    ReplyDelete
  10. @LoLL: Thanks a lot for your useful changes in the script. I already updated the switch_between_cards.sh.
    Something useful I found: Last time I re-installed the system, I used a pre-compiled kernel 2.6.34 which had the VGA_SWITCHEROO already selected by default. I did like this:
    (a) installed Fedora 13
    (b) su -c 'yum update'
    (c) wget -P ~/Downloads/ http://kojipkgs.fedoraproject.org/packages/kernel/2.6.34/11.fc14/x86_64/kernel-2.6.34-11.fc14.x86_64.rpm
    (d) cd ~/Downloads/
    (e) su -c 'rpm -Uvh kernel-2.6.34-11.fc14.x86_64.rpm'

    Then anyone can follow this HowTo from "(2) Run the new kernel and test:" onwards...
    Pretty simple, no?

    @Anonymous: I don't know if you need a .bin for the RadeonHD4570, at least for me (HD3650 and HD3200), last time I just installed the pre-compiled kernel and didn't need to copy the .bins...

    ReplyDelete
  11. Is it possible to implement it the same way in lets say Lucid Lynx? Just curious.. My girlfriend have M51TR based /HD3200+HD3400/ notebook.

    ReplyDelete
  12. Hi !

    I'm french so I'm sorry for my english

    I tried to follow this article and all works fine on step Compile kernel with CONFIG_VGA_SWITCHEROO
    The next step when I type cd /sys/kernel/debug/vgaswitcheroo I have an error :

    bash: cd: /sys/kernel/debug/vgaswitcheroo: Aucun fichier ou dossier de ce type

    In english is : No such file or directory.

    I didn't have Fedora but Mandriva 2010.0

    What does it means ?

    Thank you !

    ReplyDelete
  13. Hello again!
    There is a rather strange side-effect I'm having with the switcheroo on Ubuntu 10.04 2.6.34-5 kernel which came with the switcheroo already enabled. The thing is that when I boot the system with discrete card disabled, everything works perfectly and my power consumption is low (11-13W). However, when I resume from standby, the wattage gets higher (17-20W), but not as high as when both GPUs are enabled (25-27W). The /switch reports that only the integrated card is working, but only reboot helps to get wattage low again.

    Does anyone have any ideas what might cause this strange behaviour and how is it possible at all?
    Thanks!

    ReplyDelete
  14. Ok !
    All works fine with Fedora 13.
    So under Mandriva 2010.0 doesn't works..

    ReplyDelete
  15. Works great with acer aspire 8530g, fedora 13 x86_64, thanks!

    ReplyDelete
  16. I've a problem with my Thinkpad T400 and switcheroo.

    I installed the 2.6.34 kernel from rawhide but switch doesn't seem to work. My wattage is always about 27-30w even if the switch shows that only the integrated card is on. :(

    Any help would be appreciated.

    ReplyDelete
  17. > ER :

    Same for me. If i wake up after hybernation, the system seems to activated both cards and switch doesn't work. I think i must switch to ATI before hybernation as the ACER bios activated this card by default....

    ReplyDelete
  18. Also, there is a new way to manage VGA switch : /proc/acpi/call !

    You must know the ACPI function to use with your notebook and echo it to /proc/acpi/call...
    It's usable by all PC in fact and can be use for something else also....

    source : http://www.mail-archive.com/hybrid-graphics-linux@lists.launchpad.net/msg00074.html

    Time to test...

    ReplyDelete
  19. Hi!
    I've another problem...

    First i've installed the new kernel without problem with vgaswitcheroo...
    Now i've tried to install the ati drivers, and if i try to go to the '/sys/kernel/debug/vgaswitcheroo' the system tell me this - No such file or directory -

    Can i resolve? thanks

    ReplyDelete
  20. Also, ATI drm driver include power control with 2.6.35.
    To check if it enables :
    # dmesg | grep drm | grep power
    [drm] radeon: power management initialized

    You can set the current profile (low|auto|dynpm) as follow in /etc/rc.local :
    echo low > /sys/class/drm/card?/device/power_profile

    And check the speed and voltage (debugfs is need to be loaded, as for vgaswitchroo) :
    # cat /sys/kernel/debug/dri/?/radeon_pm_info
    default engine clock: 450000 kHz
    current engine clock: 3455890 kHz
    default memory clock: 600000 kHz
    current memory clock: 575980 kHz
    voltage: 950 mV
    PCIE lanes: 16

    (my ati card is off at this time so current values are bad).

    Good for ATI users !

    ReplyDelete
  21. Hi
    Is this the same thing as Hybrid SLI or another
    setup ?

    ReplyDelete
  22. hi! im newbie in linux i have a packard bell laptop with an intel mobile integrated card and an ATI Radeon hd 3470, does it work for me??
    thanks ^^

    ReplyDelete
  23. por el nombre creo que hablas español, podrias decirme si esta guia funcionaria en un packardbell?? es un rs 66, tiene una intel y una ATI radeon hd 3470
    agradeceria mucho tu ayuda :D

    ReplyDelete
  24. @Anonymous: Me encantaría poder decirte que sí funciona... Pero la verdad es que tendrías que probar y ver por ti mismo dado que no he probado el vgaswitcheroo con esa configuración. Pero la buena noticia es que es muy fácil hacerlo: sólo corre el Ubuntu 10.10 Live (desde un USB o un CD) y abre una terminal e ingresa los siguientes comandos:
    > sudo su
    > cd /sys/kernel/debug/vgaswitcheroo/
    > cat switch
    Si aparece algo como esto:
    0:+:Pwr:0000:01:05.0
    1: :Off:0000:02:00.0
    Es que el vgaswitcheroo ha reconocido tus dos placas de video. Esto significa que tu PC es compatible con este módulo del kernel (vga_switcheroo) y este HowTo funcionará con tu máquina. Espero que lo pruebes y te funcione bien. Saludos!

    ReplyDelete
  25. ok voy a probar, muchas gracias, tengo otra duda, es seguo hcerlo o se corre algun riesgo?

    ReplyDelete
  26. hice lo que dijiste y aparecio esto, que significa??

    0:+:Pwr:0000:00:02.0
    1: :Pwr:0000:01:00.0

    ReplyDelete
  27. @Anonymous: That means vga_switcheroo is working! Now just follow the HowTo from "(3) Switch & logout scripts & launchers" onwards (no need to compile the kernel). I'm sorry the HowTo is for Fedora, I will make a new HowTo for Ubuntu as soon as I have more time. If you have any more doubts just write me in spanish (roberto_mertinet_79@yahoo.com).

    ReplyDelete
  28. ok thanks a lot, i'll wait for the ubuntu's HowTo, thanks a lot, added u in msn

    ReplyDelete
  29. Hi again, Roberto!
    I just wanted to ask if there is no /vgaswitcheroo folder in /sys/kernel/debug on a newly installed Ubuntu 10.10 is there any chance to work out in some way and use hybrid graphics ?
    Have an Asus X56TR /M51TR/, with two AMD's but probably without hybrid graphics solution implemented onboard.
    Is the absence of that folder an indicator for the inability to switch from the one GPU to another one in the chipset? Thanks!

    ReplyDelete
  30. Hi Roberto!
    I have an Asus X56T/M51TA and have the same problem that Rewind. With lspci result 2 graphic card (hd 3200 and 3650) but with "aticonfig --adapter -list" result only one card (hd 3200).
    Have you a solution?
    Thanks.

    Ps: sorry for my english

    ReplyDelete
  31. Hey...

    No success from me here yet @ Acer 5553G (ATI HD4250 / HD5650) @ Wolvix (Slackware) / XFCE 4. I can't get into xorg at all now. with the old xorg.conf it complains about not having the discrete card's device section (and vice versa if I add it). If I completely remove xorg.conf it also complains about not having a device section for the discrete 2:0:0 one.

    Anyone have a idea of how it should be configured? or why it isn't working?

    With an ubuntu (10.10) live cd I got as far as the cat switch telling me what card is running (switching didn't work because the livecd doesn't have enough permission).

    ReplyDelete
  32. I see the same problem as ER, power consumption goes up once I resume from standby. The script shows that only the integrated card is active. Any idea how to fix this? I'm running Ubuntu 10.10 on HP Envy 14.

    ReplyDelete
  33. Dear All...has anyone this tried at Asus 1215N? Am thinking if this solution may work at 1215n running at Ubuntu 10.10

    ReplyDelete
  34. Hi. Please change the lines
    integrated=$(cat /sys/kernel/debug/vgaswitcheroo/switch | grep $pci_integrated | grep -o -P ':.:...:')
    discrete=$(cat /sys/kernel/debug/vgaswitcheroo/switch | grep $pci_discrete | grep -o -P ':.:...:')

    to
    integrated=$(cat /sys/kernel/debug/vgaswitcheroo/switch | grep $pci_integrated$ | grep -o -P ':.:...:')
    discrete=$(cat /sys/kernel/debug/vgaswitcheroo/switch | grep $pci_discrete$ | grep -o -P ':.:...:')

    to remove risk of dual matching

    ReplyDelete
  35. I just wanted to ask.

    Is there a way to prevent Linux (doesn't matter which one - Ubuntu, Debian, whatever) from finding Intel VGA card?

    What I mean is if you set switchable graphics OFF in the BIOS, your Linux only detects one card - the ATI card.

    If there is a way to do something with the same effect via some modification of files or issuing some command, then I believe it will be possible to write a useful script.

    The script will toggle the switchable graphics detection by Linux and install/remove ATI proprietary driver fglrx. Ideally, with simple logout required (i.e. no reboot)

    So, to install fglrx you should issue some apt-get install statements, and set up xorg.conf in /etc/X11.

    To remove it, you should launch fglrx_uninstall.sh, and issue some apt-get remove --purge statements + some apt-get install statements to get the Radeon open source driver back.

    Another two parts left is what I asked - somehow simulating BIOS settings on the fly, and doing it without reboot.

    If this is possible we can use Intel card when we don't need graphics, and there will be no heating due to ATI card, and when you need the intensive graphics - you can launch that switcher and use proprietary driver.

    ReplyDelete
  36. Thanks for the great guide.

    Can you make one small change though? In kernel config you need to ensure that 'Kernel hacking -> Debug filesystem' is set.

    It's the default, yes, but I'm running my own kernel, and it stumped me for a bit.

    Thanks

    ReplyDelete
  37. great guide but i'm having a problem. when I try to change to my ati graphics I get a black screen and have to alt+prt sc REISUB. i'm running linux mint 10 with the open source radeon drivers on an HP dv7. intel i5, ati hd mobility 5650. not sure what I have to do. any help would be great.

    ReplyDelete
  38. hi! I have ubuntu (2.6.35-25). Can I use this scripts on my kernel?
    karol

    ReplyDelete
  39. I'm really grateful for your work! David Airlie great job!

    ReplyDelete
  40. it's normal that every time I change card restart the account ?

    ReplyDelete
  41. Thanks for your great how to. It works for my Lenovo Ideapad Y460, well partially. Im able to turn off the discrete graphic and use only the integrated

    0:DIS: :Off:0000:01:00.0
    1:IGD:+:Pwr:0000:00:02.0

    but if i try to switch from the integrate to the discrete card all I got is to turn on the discrete card but the change is not done and the integrate card is still on so both are turn on and I continue using the integrate instead than the discrete.

    0:DIS: :Pwr:0000:01:00.0
    1:IGD:+:Pwr:0000:00:02.0

    Any one knows why this happen and how can I fix it in case i just want to use the discrete card?

    ReplyDelete
  42. Hi guys

    I am using ubuntu 10.10 64bit on HP dv6 3150 sa with switchable graphics between ATI HD 5000 series and intel.

    Since april 2010 I am struggling it make it work with no joy. Ubuntu 11.04 completly broke the laptop and i have to coem bak to 10.10

    I am using the latest update kernal. i know that switcheroro is enabled in the kernal. I have ubuntu control centre and when i switch to high perfomance graphic theough VGA switcheroo it looses compiz desktop. another issue is laptop heats up like anything when i am using ubuntu with fan in full speed.

    what I want to know is

    1) is it really possible to switch the card use on linux as windows does? or is it just the one card by default you can use.

    2) if i am happy to use the closed driver from the site would it make the whole switching hasless?

    3) the open source driver coming with ubuntu1.10 can it handle bothe graphics card?

    4) If fixing the switch issue is beyond my reach can any one help me to run on ATI card by default when it starts up? obviously fixing the fan issue. i can use another 10 gb dedicated with ubuntu to use intel one.

    please help

    ReplyDelete
  43. I fuc*ing love you!! <3 <3 :D
    [ greetings from a HP Envy 14 Beats Ed. with a very happy ArchLinux ]

    ReplyDelete
  44. Hi Roberto, many thanks for this!
    I tried to follow your steps on my Acer 4810TG and Ubuntu 11.04 x64. I could successfully switch off the ATI card by editing rc.local but the switch-cards script does not work. Is this an issue with Ubuntu Natty? Another major problem is that even if the ATI is switched off after boot, as soon as I resume the pc from suspend or hibernation both cards seem to be active again (powertop shows again an increased power consumption).
    Could you tell me how to use your script with Ubuntu 11.04 and solve the resume issue?

    Many thanks!

    ReplyDelete
  45. Hi, I get this error, could you please help?
    cat: /sys/kernel/debug/vgaswitcheroo/switch: No such file or directory
    cat: /sys/kernel/debug/vgaswitcheroo/switch: No such file or directory
    [: 120: unexpected operator
    [: 120: unexpected operator
    [: 120: unexpected operator
    [: 120: unexpected operator

    ReplyDelete
  46. Marios -- you are getting the error because you are not using vgaswitcheroo. That indicates that either (a) you don't have a hybrid graphics card, or (b) you are not using modesetting (for instance, you might have modeset=0 in your boot line).

    ReplyDelete
  47. Roberto -- THANK YOU for this! I have slightly rewritten your script to simplify it and allow it to work with KDE3, KDE4 and GNOME3, as well as display only useful buttons.

    You can find it at ftp.johnfreed.com

    I hope you like it.

    ReplyDelete
  48. sorry ... that should be
    http://johnfreed.com/switch_between_cards.sh

    ReplyDelete
  49. Hi,
    I, too, wrote a script, but mine uses Zenity, for use with Ubuntu 11.10+ and GNOME-shell or Unity
    https://www.dropbox.com/s/0izv3vfouixq4va/switch_between_cards.sh

    Peace and Love,
    Joseph S

    ReplyDelete
  50. Hi everybody,

    I'm running Ubuntu 12.04 on an MSI FX420. It has Intel HD 3000 and Radeon HD6470M. I'm trying to make this work, but I thinks it's not working.
    I've changed from "killall -u "$USER"" to "gnome-session-save --logout" and changed /ect/rc.local and /etc/init.d/rc.local as Roberto said and how I saw in the Ubuntu Community, but everytime I run the script, it does nothing. I ran it in Terminal and got this:

    cat: /sys/kernel/debug/vgaswitcheroo/switch: Permission denied
    cat: /sys/kernel/debug/vgaswitcheroo/switch: Permission denied

    I don't understand much of Linux, but I think it's regarding one of the rc.local files.

    Can someone help me, please?

    Thanks for any help,
    Max

    ReplyDelete
    Replies
    1. Max, you may try changing the line in /etc/rc.local to the following:
      chown username:username -R /sys/kernel/debug

      Delete
  51. Yeah but if I'm at a command line anyway, this is more convenient. Hope you write more articles soon.

    ReplyDelete
  52. I have seen a complete guide here on using vga_switcheroo with switchable graphics and I am amazed that will it really work? minecraft vps

    ReplyDelete
  53. Check it Out The New Smart PC
    http://superitgadgets.blogspot.com/

    ReplyDelete
  54. thanks for this great howto!
    i finally managed to get the vgaswitcheroo stuff to work on my t500
    running xubuntu 13.04 with some improvements to your script. In short i use sudoers file to solve the problems with permissions, so
    that the script is usable for different users.
    a brief description and the improved script can be found here:
    http://wp.me/p43PR4-3

    -- lada

    ReplyDelete
  55. Great how-to!
    I bought a Hp Pavilion g4-1316br, with A6-3420M cpu, quadcore, and a 6XXX integrated graphic card, and a 7XXX discrete graphic card, AMD.
    What about work temperature using your script?
    I can not see temperature of your laptop cores in your conky...
    I tried a Linuxmint LiveDVD, and cores temperature run at 69 º C (hot!); running windows7, cores temperatures down to 45º C (cold keyboard)
    I am thinking install Linux in my new laptop and I am searching a how-to for a distro that works fine with double graphics card.
    Thanks!

    ReplyDelete
  56. linux online training| linux training| call us+919000444287 ...
    www.21cssindia.com/courses/linux-online-training-104.html
    Linux Online Training, Linux training, Linux course contents, Linux , call us: +919000444287,dharani@21cssindia.com.

    ReplyDelete
  57. It was very nice article and it is very useful to Linux learners.We also provide Linux online training

    ReplyDelete
  58. Very nice post, impressive. its quite different from other posts. Thanks for sharing.
    Data Recovery Services Services In Delhi

    ReplyDelete
  59. which operating system is best ios or android?
    iOS Android laptop

    ReplyDelete
  60. Thank you for providing useful information and this is the best article blog for the students.learn Python programming training course.

    Python Training in Hyderabad

    ReplyDelete
  61. Thank you for sharing your valuable article this is the best blog for the students.learn Workday HCM Online Training.

    Workday HCM Online Training

    ReplyDelete
  62. Thank you for providing such an awesome article and it is a very useful blog for others to read.

    Oracle ICS Online Training


    ReplyDelete
  63. Thanks for providing a useful article containing valuable information. start learning the best online software courses.

    Workday Online Training


    ReplyDelete
  64. Dalam permainan judi ceme, terkecuali memerhatikan kartu bandar (apabila anda bertindak jadi player)
    asikqq
    dewaqq
    sumoqq
    interqq
    pionpoker
    bandar ceme terbaik
    hobiqq
    paito warna
    forum prediksi

    ReplyDelete
  65. thanks for posting informative post to learn

    ReplyDelete

  66. That is nice article from you , this is informative stuff . Hope more articles from you . I also want to share some information about cognos training and iib tutorial

    ReplyDelete
  67. How do I sign into Amazon Prime movie in my TV?
    Open the Amazon Prime Video program or download it in your living room apparatus's app shop.
    Register your device by choosing"signal in and begin watching" to put in your account data directly in your device or select"enroll on the Amazon site" to find a 5--6 character code to input on your own account. www.amazon.com/mytv

    ReplyDelete
  68. Much obliged as a results a reasonable setup as you have been endorsed to share direction thinking us. we can totally praise through and through you have completed here because of the reality you have made my comport your self as pleasantly ventilated as ABC. Hotspot Shield Activation Code Free

    ReplyDelete
  69. You comprehend your errands stand separated of the gathering. there may be something uncommon almost them. It appears to me all of them are in truth amazing!File Viewer Plus Activation Key Free

    ReplyDelete
  70. A Beautiful rose for a Beautiful woman who is my Beautiful wife and has given me a Beautiful lyf. Happy anniversary.10Th Anniversary Auotes For Wife

    ReplyDelete
  71. Digital Marketing Institue
    can be defined as any kind of marketing made available through digital channels that include search engine websites, social media, and more. The primary goal is to increase and promote brands using a variety using digital mediums. The greatest benefit that digital marketing has is that it provides access to conglomerate markets

    ReplyDelete
  72. What is it that makes the field of digital marketing a money-spinning career?
    Click hereDigital marketing is an enormous field of its own. Today, it is the most well-known and adored type of marketing. Nowadays, every company regardless of size or small understands the significance of appearing on Google. This requirement of business has expanded the scope of digital marketing as anything else. Companies today are creating budgets for their online marketing strategies. The companies are reported to spend around 10 percent of their annual revenues on digital marketing. At present, Lucknow is also ready to invest in the field of digital marketing. Numerous institutes have been established in the last five years. You are the only one to choose which is the most effective digital marketing institution located in Lucknow.

    ReplyDelete
  73. Imunify360 License stands as a robust security solution for Linux web servers, offering proactive defence against digital threats with its advanced firewall, malware scanning, and intrusion detection systems.

    ReplyDelete

Followers