Categories
Computers

1015PN Graphics Switching

UPDATE 7/21/2011:
Except for the xorg.conf files, this post is outdated. I’ve written an update here.

This thread shows how to accomplish graphics switching for ubuntu on the 1015PN. I’ve managed to apply it to the debian/wheezy install on my 1015PN. After the jump are the scripts I created as well as some simple directions.

To start, I’ll note that I’m using a stock 2.6.38-2 kernel from wheezy. I’m also using the nvidia proprietary video drivers using dkms, so I already had the linux header package installed. That’ll be required to build the acpi_call module. Also, since we’ll be switching with the Intel GMA3150, make sure the xorg Intel driver package, xserver-xorg-video-intel, is installed.

Once all the necessary packages are installed, grab the source code for the acpi-call module from https://github.com/mkottman/acpi_call. Build the project, then install the resulting acpi_call.ko into /lib/modules/2.6.38-2-amd64/kernel/drivers/acpi.

Mirroring the ubuntu solution linked above, 2 xorg.conf files are needed, one for each graphics chip. Here’s the xorg.conf for the nvidia setup:

Section "Device"
        Identifier      "Nvidia Ion"
        Driver          "nvidia"
        BusID           "PCI:4:0:0"
        Option          "NoLogo"        "true"
EndSection

Section "Monitor"
        Identifier      "Configured Monitor"
EndSection

Section "Screen"
        Identifier      "Default Screen"
        Device          "Nvidia Ion"
        Monitor         "Configured Monitor"
EndSection

Section "Server Layout"
        Identifier      "Default Layout"
        Screen          "Default Screen"
EndSection

And here’s the one for the intel chip:

Section "Device"
        Identifier      "Intel GMA3150"
        Driver          "intel"
        BusID           "PCI:0:2:0"
EndSection

Section "Monitor"
        Identifier      "Configured Monitor"
EndSection

Section "Screen"
        Identifier      "Default Screen"
        Device          "Intel GMA3150"
        Monitor         "Configured Monitor"
EndSection

Section "Server Layout"
        Identifier      "Default Layout"
        Screen          "Default Screen"
EndSection

I named the two xorg files xorg.conf.nvidia and xorg.conf.intel, respectively.

Finally, the two scripts that actually do the switching. First, the one for nvidia:

#! /bin/sh

if lsmod | grep -q acpi_call; then
    echo "acpi_call module already loaded"
else
    modprobe acpi_call
    sleep 2
fi

echo "\OSGS 0x02" > /proc/acpi/call
update-alternatives --set libGL.so.1 /usr/lib/nvidia/libGL.so.1
update-alternatives --set libglx.so /usr/lib/nvidia/libglx.so
ldconfig
cp ~/xorg.conf.nvidia /etc/X11/xorg.conf

The one for intel is similar:

#! /bin/sh

if lsmod | grep -q acpi_call; then
    echo "acpi_call module already loaded"
else
    modprobe acpi_call
    sleep 2
fi

echo "\OSGS 0x01" > /proc/acpi/call

update-alternatives --set libGL.so.1 /usr/lib/nvidia/diversions/libGL.so.1
update-alternatives --set libglx.so /usr/lib/nvidia/diversions/libglx.so
ldconfig
cp ~/xorg.conf.intel /etc/X11/xorg.conf

I named these scripts nvidia_on.sh and intel.sh respectively. Make sure they are executable and that all of these files are in the same directory. I just threw all of mine into root‘s home.

It’s as simple as invoking whichever script. The main limitation of the approach is that the nvidia chip defaults to on and the intel chip defaults off. So if you reboot with the intel chip and then forget to set everything back up for nvidia prior to shutting down, X won’t be able to start on the next boot because it will be configured for the intel chipset, which will be turned off. Using lspci the success of each operation can be checked. Read the ubuntu thread linked above for a technical explanation of what’s going on- it’ll be more thorough than anything I could write up.

Another issue I’ve noticed is font rendering is different between the two cards; so terminals, particularly, will appear different and may require a little tweaking on each switch. Well, that and running videos at 720p don’t look so great with the intel setup. On the plus side, battery life goes up to around 8 hours or so, so the switch definitely has it’s upside. Particularly for ‘normal’ usage like surfing, email and the like.

3 replies on “1015PN Graphics Switching”

Leave a Reply

Your email address will not be published. Required fields are marked *