For more information, join the team subscribe to the mailing list 
at the bottom of the Launchpad page

    http://launchpad.net/~hybrid-graphics-linux 

Please join this team if you are new by clicking on the "Join 
Team" link at the right of the Launchpad page. It's important to 
have as many users in the community as possible to request for 
appropriate support.

Friday, 12 February 2010

HOWTO Install vga_switcheroo for Linux Switchable graphics -- step by step instructions



One of the Hybrid Graphics Linux Launchpad team members has posted the detailed instructions to install vga_switcheroo for Linux Switchable graphics. Here is the permanent link:

http://asusm51ta-with-linux.blogspot.com/

Thanks to David Airlie and Matthew Garrett's work on switchable graphics, we now have pretty good switchable graphics support for Linux, both for discrete-Nvidia and discrete-ATI configurations.

If you have tried the instructions above and got it to work successfully, or if you are just interested in hybrid graphics features in Linux, please subscribe to the hybrid-graphics-linux Launchpad team here:

http://launchpad.net/~hybrid-graphics-linux

Reports, either positive and negative, are gratefully accepted!

Monday, 8 February 2010

What's in nouveau_acpi? Support for nvidia Linux switchable graphics

Have you tried the recent version of nouveau?


It comes with new code in drivers/gpu/drm/nouveau/nouveau_acpi.c that provides support for switchable graphics in *all* nvidia cards with the _DSM method.

If your DSDT.dsl table has a '_DSM' method, it should be supported.

The easiest way to try it out on your laptop is to wait for a distribution to incorporate the latest nouveau_acpi code in a alpha/beta Live CD version. Otherwise, you can compile the latest kernel yourself, activate nouveau and see how it goes...

Wednesday, 3 February 2010

switchable graphics in Linux -- now as good as OSX

David Airlie has posted a video (low quality) that shows the process of GPU switching he has been coding in the past 4 days. It basically shows how one would switch on the discrete graphics card through a terminal command, although this could have a simple graphical menu like OSX. Then, after the log-out and login, the discrete graphics card is in use.
http://airlied.livejournal.com/71012.html

Windows 7
Windows 7 does this seamlessly, although the level of functionality varies from laptop to laptop. For some laptops, you need to close certain applications before doing the switch. For example, if you are running the discrete graphics card and playing a game that uses 3D acceleration, you cannot simply switch if off and keep playing. You need to exit the game, then switch the card off. Otherwise, it crashes.

It is not a problem to leave non-3D accelerated applications or background applications open though, which is why it doesn't require the log-out/login mechanism like Apple's OSX. Right now, Apple is only providing a hybrid graphics configuration for the high end MacBook Pro line (15 and 17? inch MBPs). The 13 inch MacBook only has an integrated nvidia 9400 chipset, which is why people with this laptop see some lag in graphical applications like Keynote slide editing and so on. The nvidia 9400 integrated chipset is not so different to an integrated Intel GMA chipset, so some 3D-intense jobs suffer from the lack of power.

Current roadmap for switchable graphics in Linux

David Airlie and Matthew Garrett have done some more investigations and the current roadmap for switchable graphics in Linux looks like this:

  • ATI/ATI and Intel/ATI configurations will use ATPX and maybe XPTX calls.
  • Intel/nvidia and nvidia/nvidia configurations will use _DCM related calls.

_OFF methods are abstracted behind the ones above, so they shouldn't be used directly.

Hot switching:
Given a on/off switch event, the switch will be delayed until the X.Org Server is restarted. This will need a switch call, then a log-out and GDM restart.


Tuesday, 2 February 2010

David Airlie solves Intel/ATI and ATI/ATI switchable graphics, mjg59 solves nvidia in nouveau land

Not much more to say apart from "We've got it!".

We started this blog a year ago and we were hopeful that switchable graphics in Linux would be a reality some day. David Airlie's patch for the Intel/ATI and ATI/ATI configurations, together with mjg59's work on nvidia support in nouveau completes the basic kernel/hardware support in Linux.

As David Airlie's post suggests at the end, there is still work to be done in the gdm/Xorg side of things, but current support is comparable to Apple's OSX switchable graphics capabilities. Windows 7 is still one step ahead with seamless hot switching in new laptop models...

airlied: hybrid graphics on Linux (Part 2)
Okay v4 of the patch is available at

http://people.freedesktop.org/~airlied/vgaswitcheroo/
http://people.freedesktop.org/~airlied/vgaswitcheroo/0001-vga_switcheroo-initial-implementation-v4.patch

First thing I added was power up/down methods. This calls the DRM suspend/resume methods + along with the cut power for discrete GPU. I'm not sure dynamic Windows ever does this as it seems to take a bit of work, I suspect they just run the second GPU in really low power modes. This is slow because we have to repost the ATI card after turning it back on.

I then talked to mjg59 and worked over the ATPX detection. I removed all the DMI code and it should detect *any* laptop that uses ATPX (i.e. ATI/ATI and Intel/ATI) from what I can see. I've tested on Lenovo W500 and T500 now and it appears to work on both. Would be nice if someone on a ATI/ATI and/or ASUS ATI/ATI or ATI/Intel machines could give it a whirl. I think the main problem with ATI/ATI is the poweroff methods have a hardcoded Intel PCI ID. I've no idea yet how to tell on an ATI/ATI which device is the IGD and which is discrete. Its probably more than likely the IGD is the one with the ATPX method on it.

It doesn't switch off at boot yet but I've added commands to let you do it.

echo "OFF" > switch - turns off the not in use card, so if Intel and ATI are on at boot, it will turn off ATI
echo "ON" > switch - turns back on not in use card
echo "PCIID" > switch - causes a switch with full off/on cycles.

nvidia combos appear to use a DSM method and in theory nouveau_acpi.c should be detecting that, so it might be possible for someone to hook that up.

I've also started looking at some desktop integration via gdm or logout - but its not my usual place to code so going is a bit slower ;-)


Monday, 1 February 2010

... and Phoronix blogs about David Airlie's post

[Phoronix] Hybrid Graphics Comes To Linux In Crude Form
[...]
David does know how to power-down the Radeon GPU using ACPI and for the Intel GPU to potentially put it in a suspended state, but that code is not found in today's patch called the vga_switcheroo. Lastly, David is also going to lobby the GDM developers to have a log-out button for GNOME that says "Switch GPU" to provide a bit more transparent experience without having to manually change run-levels and write to the debugfs switch.
[...]


David Airlie's experiments with Lenovo W500

airlied: hybrid graphics on Linux
So someone thought it would be a good idea to make laptops with two graphics chips in them and switch betweem them to save power.

Now other OSes support this to varying degrees, I think XP + MacOSX require a logout cycle and Vista/Win7 can dynamically switch while running, while Linux basically falls over in a heap.

So I sat down today with a Lenovo W500 which has an Intel GM45 and AMD Radeon 3650 Mobility in it, and I wrote a patch to try and get closer to the XP/MacOSX level.

The result of one days straight hacking is at:
http://people.freedesktop.org/~airlied/vgaswitcheroo/

The patch is totally focused on the Lenovo W500, other switchers will need to add stuff to this codebase.

So what works?
Boot in switchable graphics - which boots with intel and radeon turned on
KMS drivers load for radeon and intel, radeon BIOS stored in start of VRAM (driver hacked to read it)
bind to both drivers + fbs for both.
mount debugfs - cat /sys/kernel/debug/vgaswitcheroo/switch
2
0 :0000:01:00.0
1+:0000:00:02.0
shows the 02.0 (intel) device is in charge of the MUX.
goto runlevel 5, play with X under the Intel driver, goto runlevel 3 kill X
at fbcon echo "0000:01:00.0" > /sys/kernel/debug/vgaswitcheroo/switch
barely glitches console and switches
goto runlevel 5, play with X under the ATI driver, goto runlevel 3 kill X
echo "0000:00:02.0" > /sys/kernel/debug/vgaswitcheroo/switch
goto runlevel 5, play with X under intel again.
wash and repeat.

What does it do?
So far its just switching the MUX using the ACPI method and remapping all the console to the other framebuffer device,
it also reset the bits that denotes which devices is the boot vga device which X uses to pick the primary GPU. This
means X doesn't need an xorg.conf to switch. (I think all those patches are in upstream X server).

What does it not do?
It doesn't powerdown the radeon when its not in use yet. I know the ACPI call to power it off/on, and since I have
the BIOS I should be able to repost it. So I'll try adding the callbacks into the KMS driver to do this soon.
It doesn't poewrdown the intel when its not in use yet. Not sure what I can do here, since there is no ACPI method to turn
it off. I think I can just D3 the GPU, and use the normal s/r paths to bring it back. Again requires more investigation.
The whole what ACPI + methods map to what device, how the mux ids match etc will probably all need to be stored in the DMI table.
Anything not a Lenovo W500 - probably not that hard to add other Intel/AMD variants to this, add DMI and mux switching method.
nouveau isn't hooked up - this could probably be done by some interested party - the driver hooks so far aren't very hard.
No idea about ATI/ATI or NV/NV ones either.

I'm really hoping interested community people can make this actually useful to them on other hw, I won't have permanent access to the W500 to keep this all tested in the future.

Can we do dynamic switch without restarting X?
No. X needs a lot of work, a lot more than the day it took to hack the kernel.

How do we go forward?
We probably need to add gdm support to move this forward. A logout button that is "Switch GPU", that gdm kills the X server,
then hits the switch port and starts a new X server. I'll try and talk to some gdm hackers over the next few days.
I'll try and push this into a git tree against Linus current, and we can add tested patches for other machines as they go in.
Also the DMI section is only imaginary of what I think others might need, we might have to rip it all out. Also I've no idea
if there are ACPI methods to query the switchable modes etc.


Followers