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 26 February 2010

GPU Switching Goes For The Gold: Mainline Inclusion @ www.phoronix.com

Nice to see "Hybrid Graphics" Linux being mentioned in www.phoronix.com!

Now the aim of the Team http://launchpad.net/~hybrid-graphics-linux goes beyond switchable graphics, and includes heterogeneous platform computing ideas like OpenCL and parallel computing ideas like CUDA. But switchable graphics is the first natural step in filling the Linux feature space in this area.

[Phoronix] GPU Switching Goes For The Gold: Mainline Inclusion
At the start of the month we talked about GPU switching coming to Linux in a crude form
that allowed notebooks with dual GPUs (one being a low-power,
low-performance integrated chip and the other being the more
performance-oriented GPU that's power hungry) to be switched from
without the need for a reboot in Linux. This initial work was just a
collection of hacks by David Airlie and it required VT switching after
killing the X Server, etc. It also didn't power down the unused GPU.
However, as the days passed, this code did more and delayed GPU switching came too.



The Linux GPU switching (a.k.a. "Hybrid Graphics") still isn't as
clean of a solution as what can be found with the Windows 7 support
where GPUs can be switched between in real-time, but that's because of
limitations with the current X.Org Server. However, with the Linux 2.6.33 kernel having just been released, David is hoping to finish off this work that he calls "vga_switcheroo" and to push it into the mainline Linux kernel.



The vga_switcheroo kernel code is now up to its 13th revision with
some of the later changes being ATRM support for the Radeon BIOS, a fix
for resuming the Intel GPU, and avoid putting an already inactive GPU
through suspend-and-resume. David Airlie talked about the revival of
this work on his blog. This Red Hat engineer has also started pushing patches on the DRI development list as well as the Linux kernel mailing list.



Assuming some of the remaining issues are cleared up in this code,
GPU switching in the form of vga_switcheroo should be here with the Linux 2.6.34 kernel release.

Sunday 14 February 2010

Fedora 13 with Nouveau Gallium3D and switchable graphics

The Linux graphics landscape looks better and better by the day. Nouveau recently picked up steam with its inclusion in the mainline kernel, and now Gallium3D is also moving forward. Although NVIDIA is doing a *decent* job at providing closed-source binary drivers for Linux, features like switchable graphics or reliable suspend/hibernate features have been lagging behind the binary blob that NVIDIA provides, compared to other proprietary OSes. Instead, Nouveau is now providing switchable graphics support for Intel/NVIDIA laptop configurations, and with the recent update in Gallium3D (see below), a fairly decent 3D acceleration support.

If you have tested Gallium3D, OpenCL/CUDA or switchable graphics in Fedora 13, please consider reporting your experiences by joining the hybrid-graphics-linux Launchpad team here:

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

Click on the "Join the team" link on the right, and participate with your experiences using the mailing list:

hybrid-graphics-linux@lists.launchpad.net

Happy Testing!

[Phoronix] NVIDIA Has Gallium3D Support In Fedora 13
With Fedora 13,
Red Hat is again shipping with the latest free software NVIDIA bits,
which now includes 3D support. Thanks to an update to the mesa-dri-drivers-experimental
package, there is 3D / OpenGL support enabled for NVIDIA hardware. This
3D support is coming from Nouveau's Gallium3D driver for most of the
NVIDIA graphics hardware while there is also a classic Mesa driver for old NV hardware
that recently came about. Yes, there is finally a deployed
Nouveau-NVIDIA Gallium3D driver that will be easily deployable out in
the wild with Fedora 13.



Fedora 13 is scheduled to be released towards the middle of May
while the first alpha release is coming in early March. Red Hat's Adam
Williamson mentioned this 3D support on Nouveau via his blog
where he mentions that the Spring RTS framework, Compiz, Neverball,
Foobillard, and Quake 3 are all working for him with a GeForce 9400GT
graphics card and the Gallium3D driver.



Adam also sent in a screenshot to us of the Nouveau NV95 Gallium3D
driver also running with Nexuiz. Needless to say, this week we will be
delivering Nouveau Gallium3D benchmarks atop Fedora Rawhide.

Saturday 13 February 2010

Give Ubuntu Lucid Alpha a good Nouveau test

[Phoronix] Ubuntu 10.04's Nouveau Stack Gets Ready
The Ubuntu-X testers have been feverishly testing their 2.6.33-pulled Nouveau DRM on the Linux 2.6.32 kernel along with their KMS-supported xf86-video-nouveau DDX driver. Canonical's Bryce Harrington describes this Nouveau stack as being "nearly ready" for Lucid and is requesting a final test among those interested in the open-source NVIDIA graphics hardware support. This is only for 2D/video and kernel mode-setting support, but the Gallium3D driver for providing OpenGL acceleration isn't going to be deployed, so users are left with the software rasterizer.

If you are interested in testing out Ubuntu 10.04's Nouveau stack you can do so by following this call for testing thread and checking out the Nouveau evaluation Wiki page.

Ubuntu developers are interested in knowing whether the system boots, if VT switching functions, whether the default resolution that is mode-set is correct, the resolution listing is correct, whether RandR-driven screen inverting and rotation works, can movies play with Nouveau in Totem, if Adobe Flash correctly works, if software 3D will not crash the X Server, and lastly is if suspend-and-resume/hibernation works accordingly.

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