# VGA switcheroo howto

## peltco

for those with laptops both both a ati and an intel card i put toget a howto to make switching easy(er). should work with nvidia/intel combinations too with little change.

if anyone has any other tips/feedback let me know and i'll include it.

http://en.gentoo-wiki.com/wiki/Vga_switcheroo

----------

## corphi

I needed to explicitly

```
# mount -t debugfs debugfs /sys/kernel/debug
```

/etc/fstab helped:

```
debugfs    /sys/kernel/debug    debugfs    rw    0 0
```

----------

## Goeland86

I don't know if it's my connection, of gentoo-wiki is down. Could I ask you to make the howto available somewhere else? I've got a laptop with two ATI cards (one IGP one discrete), and would really like to find a way to select the proper VGA card when I need it. (Using the radeon driver atm, fglrx doesn't support the PowerXpress settings afaik.

Thanks,

Goeland

----------

## tclover

deleted on May 30, 2011, at 00:30.Last edited by tclover on Sun May 29, 2011 10:32 pm; edited 1 time in total

----------

## kkspeed

Recently, in kernel 2.6.38, the contents in /sys/kernel/debug/vgaswitheroo/switch has changed.

Now it is sth like:

0:DIS: :Off:0000:01:00.0

1:IGD:+:Pwr:0000:00:02.0

so in the /etc/hprofile/profiles/graphics/ptest, you may need to change sth or you'll always get "invalid"  :Very Happy:  .

I changed it like this:

```

#!/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 [ `uname -r | grep 2.6.38` ] ; then

   if [ `grep "DIS:+" /sys/kernel/debug/vgaswitcheroo/switch` ] ; then

      echo "radeon"

      exit 0

   fi

   if [ `grep "IGD:+" /sys/kernel/debug/vgaswitcheroo/switch` ] ; then

      echo "intel"

      exit 0

   fi

else

   if [ `grep "0:+" /sys/kernel/debug/vgaswitcheroo/switch` ] ; then

      echo "radeon"

      exit 0

   fi

   if [ `grep "1:+" /sys/kernel/debug/vgaswitcheroo/switch` ] ; then

      echo "intel"

      exit 0

   fi

fi

echo "invalid"

exit 1

```

----------

## tclover

Thanks kkspeed. I will make the necessary changes. Since I updated to kernel 2.6.38 I don't remember to have run my image to my laptop yet. I'm actually trying to figure out how to make a squashed /lib64 to get rid of definitely of the disk i/o bottleneck. 

See this thread https://forums.gentoo.org/viewtopic-t-646289.html  for info. Well, I still have to fix splash for kernel 2.6.38, but that's not important. And then I'll update my image and extract it to my notebook disk.

----------

## Blue-Sick

As someone tried ( is it even possible ? ) to run switcheroo with the closed amd drivers ( ati-drivers) and an intel igp?

----------

