Powering-Off Discrete Graphics on Switchable Graphics Laptops

Switchable graphics is gaining popularity as a solution to balance performance and power consumption. Linux support for this feature is still very much in development, and until it is the discrete graphics card may take resources even when you don’t use it.

The development of switchable graphics on Linux is being led by Hybrid graphics Linux group. They recently released a driver to turn off the external graphics card. On my system shutting down the card reduced power consumption by 5-10 watts.
Note: This is experimental stuff, your computer may hang or act unexpectedly. Please make sure the discrete graphics card is not being used before proceeding.

Here’s how to test it:
First, install and run poewrtop to get an idea for power consumption (the laptop needs to be disconnected from AC adapter):

sudo apt-get install powertop
sudo powertop

Second, it is recommended to rmmod any kernel modules that may be mapped to the device. For example if you have an Nvidia discrete graphics with the closed source driver running, you should:

sudo rmmod nvidia

Next, download and build the driver:

sudo apt-get install git linux-headers-`uname -r` build-essential
git clone http://github.com/mkottman/acpi_call.git
cd acpi_call
make
sudo insmod acpi_call.ko
sudo ./test_off.sh

The result of a run should look like (depending on your laptop’s hardware):

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.P0P2.PEGP._OFF: failed
Trying \_SB.PCI0.MXR0.MXM0._OFF: failed
Trying \_SB.PCI0.PEG1.GFX0._OFF: failed
Trying \_SB.PCI0.PEG1.GFX0.DOFF: failed
Trying \_SB.PCI0.XVR0.Z01I.DGOF: failed
Trying \_SB.PCI0.PEGR.GFX0._OFF: failed
Trying \_SB.PCI0.PEG.VID._OFF: works!

Running powertop now should give you about 5-10 watts less.
To test the card is really off you can run the following command:

sudo lspci -vvx

Locate your external graphics card (look for VGA controller with the right make). The card’s PCI configuration space should not be accessible, so it should look something like:

01:00.0 VGA compatible controller: nVidia Corporation GT218 [NVS 3100M] (rev ff) (prog-if ff)
        !!! Unknown header type 7f
00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
...

To re-enable the card, reboot the machine.

Please consider joining the Hybrid graphics Linux mailing list to help the development effort.

About these ads

1 Comment

Filed under howto, linux

One response to “Powering-Off Discrete Graphics on Switchable Graphics Laptops

  1. Pingback: Wire Jungle

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s