Friday, April 27, 2012

Switch off ATI VGA in Hybrid cards with Intel on Ubuntu (solving overheating)


On my HP Pavilion dv7-6190ed (FW F.18) I have an AMD Radeon HD 6700M series video card, which sometimes it make my laptop overheat until 97 C.
The ATI Radeon and Intel VGA both run, and seem to go rogue at times. At the time of my install, (around Jan. 2012) the Catalyst drivers seem to have a problem with Ubuntu 11.10 (oneiric).
By switch off VGA AMD Radeon part of the card, it seem to decrease the running temperature, to about 60 C on av. Along with that it runs way more quiet. (no cooling fans going ballistic)
So basically, turning off the ATI VGA part of the card will decrease the heat problem in Ubuntu.

NOTE:  Since posting this workaround, there has been an upgrade for the BIOS (FW F.1B). They fixed option available now for ATI, may reduce heat too. so try upgrading the BIOS FIRST !!. here is the link>> BIOS FW F.18)




1st Workaround:

Check your dual VGA by :




lspci -vnnn | grep VGA





00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0116] (rev 09) (prog-if 00 [VGA controller])
01:00.0 VGA compatible controller [0300]: ATI Technologies Inc Whistler XT [AMD Radeon HD 6700M Series] [1002:6740] (rev ff) (prog-if 00)


De-activate “AMD Radeon HD 6700M”:









sudo apt-get install git && cd ~/
git clone https://github.com/mkottman/acpi_call.git
cd acpi_call && make
sudo insmod acpi_call.ko
sudo chmod a+x turn_off_gpu.sh
sh turn_off_gpu.sh


Output Result or the script:

Trying \_SB.PCI0.P0P1.VGA._OFF: failed
Trying \_SB.PCI0.P0P2.VGA._OFF: failed
Trying \_SB_.PCI0.OVGA.ATPX: failed
Trying \_SB_.PCI0.OVGA.XTPX: failed
Trying \_SB.PCI0.P0P3.PEGP._OFF: failed
Trying \_SB.PCI0.P0P2.PEGP._OFF: failed
Trying \_SB.PCI0.P0P1.PEGP._OFF: failed
Trying \_SB.PCI0.MXR0.MXM0._OFF: failed
Trying \_SB.PCI0.PEG1.GFX0._OFF: failed
Trying \_SB.PCI0.PEG0.GFX0.DOFF: failed
Trying \_SB.PCI0.PEG1.GFX0.DOFF: failed
Trying \_SB.PCI0.PEG0.PEGP._OFF: works!
Trying \_SB.PCI0.XVR0.Z01I.DGOF: failed
Trying \_SB.PCI0.PEGR.GFX0._OFF: failed
Trying \_SB.PCI0.PEG.VID._OFF: failed
Trying \_SB.PCI0.PEG0.VID._OFF: failed
Trying \_SB.PCI0.P0P2.DGPU._OFF: failed
Trying \_SB.PCI0.P0P4.DGPU.DOFF: failed
Trying \_SB.PCI0.IXVE.IGPU.DGOF: failed
Trying \_SB.PCI0.RP00.VGA._PS3: failed
Trying \_SB.PCI0.RP00.VGA.P3MO: failed
Trying \_SB.PCI0.GFX0.DSM._T_0: failed
Trying \_SB.PCI0.LPC.EC.PUBS._OFF: failed
Trying \_SB.PCI0.P0P2.NVID._OFF: failed
Trying \_SB.PCI0.P0P2.VGA.PX02: failed
Trying \_SB_.PCI0.PEGP.DGFX._OFF: failed
Trying \_SB_.PCI0.VGA.PX02: failed

As you can see, all failed but one.
That is the turn-off-code for your Card.



Check if your ATI VGA is disabled:




lspci -vnnn | grep VGA






00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0116] (rev 09) (prog-if 00 [VGA controller])
01:00.0 VGA compatible controller [0300]: ATI Technologies Inc Whistler XT [AMD Radeon HD 6700M Series] [1002:6740] (rev ff) (prog-if ff)

( prog-if ff) indicates that the card is off.




Turn off Discrete GPU at boot:

You need to add the following 2 lines to /etc/rc.local :
(Use the working code from previous script)





sudo insmod <YOUR-HOME-USER-PATH>/acpi_call/acpi_call.ko
sudo echo '\_SB.PCI0.PEG0.PEGP._OFF' > /proc/acpi/call



Un-blacklist radeon:

Edit /etc/modprobe.d/blacklist.conf :




#blacklist radeon



Sleep/Hibernate/Resume:

Previous settings will turn off your discrete card at boot time, but after resuming from sleep or hibernation mode, your discrete card will be on again. To prevent that, you need to repeat the code from higher to be executed leaving sleep mode.

You do that by adding the same code as above to "/etc/pm/sleeep.d" directory.
Create a new bash file in this directory.
The files names here will be preceded by a number (order of execution)

In my case I picked the following name:  " 30_hybridoff "


#!/bin/bash
case "$1" in
    thaw|resume)
        sudo insmod /
<YOUR-HOME-USER-PATH>/acpi_call/acpi_call.ko
        sudo echo '\_SB.PCI0.PEG0.PEGP._OFF' > /proc/acpi/call
        ;;
esac
exit $?




2nd Workaround:


A second workaround to turn off the second Video Card is changing the switch in the vgaswitcheroo directory.

  1. Open a terminal screen (CTRL+ALT+T)

    First you will have to become root: sudo su  (type password when asked)

    Now Change user rights on some directories and files:

    chmod -R 705 /sys/kernel/debug
    chown -R $yourusername:$yourusername /sys/kernel/debug/vgaswitcheroo

     
  2. Changing to hybrid graphics card: (Integrated Graphics Device)

    echo IGD > /sys/kernel/debug/vgaswitcheroo/switch
     
  3. Turn off the discrete graphics card:

    echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

If you want to turn off the discrete video card at boot time every time, you have to add the previous commands in the rc.local file. 

  1. Open /etc/rc.local with you editor

    Sudo gedit /etc/rc.local
     
  2. Add the following lines to your file, but before the exit 0 line.

    echo IGD > /sys/kernel/debug/vgaswitcheroo/switch
    echo OFF > /sys/kernel/debug/vgaswitcheroo/switch


You can check the result by the following command:

sudo cat /sys/kernel/debug/vgaswitcheroo/switch

the result should look like this:

0:IGD:+:Pwr:0000:00:02.0  (this card is powered up)
1:DIS: :Off:0000:01:00.0
    (this card is turned off)


alternatively you can also use the check method as shown in the first workaround by entering lspci -vnnn | grep VGA  (see higher for explanation on the result information)




4 comments:

  1. Hi, interesting guide :)

    Everything seemed going fine until I launched the "chmod a+x turn_off_gpu.sh" command.

    It says that "chmod: cannot access `turn_off_gpu.sh': No such file or directory".

    Any tip?

    Thank you a lot! :)

    ReplyDelete
    Replies
    1. Hi,

      3 things you can do.

      First: make sure you are in the correct directory. (cd ~/acpi_call)

      Second: check if the extracted files haven't changed in the latest download. Sometimes the coders change file names. so check if "turn_off_gpu.sh" exists.

      Third: Try running that line of code with sudo preceding. (sudo chmod a+x turn_off_gpu.sh)

      I hope that works for you.

      Delete
  2. Using the 2nd workaround was succesful!

    Now I see:

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

    Thanks a lot, very appreciated :)

    Regards.

    ReplyDelete
  3. I went 1st Workaround and found it really very easy to use. It worked for me very well though. Thanks mate.

    ReplyDelete

Please be courteous, even if you do not share the same view.