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.

Saturday 21 April 2012

Apple Macbook Pro and Linux Hybrid Graphics -- current status

Apple implemented the switching of the two graphic cards using a
"chip" dubbed the "gmux". This gmux can power down the dedicated
graphics card, switch the DDC, internal and external display
connections individually between both cards and then set the backlight
brightness. Unlike most newer laptops with hybrid graphics, Apple's
Macbook Pros still use a physical mux.

The gmux has remained mostly the same between all models with
switchable graphics, so it should be possible to develop one Linux
driver that supports all of them.

Andreas Heider took over previous work that Seth Forshee (Canonical
Ltd.) recently rewrote it into a clean, backlight-only driver that (at
the time of this writing, 20120414) will hopefully find it's way into
the mainline Linux kernel soon.

Andreas has been developing on his MBP 6,2 model (MBP 6,1 should be
exactly the same) and his work is available at:

http://github.com/ah-/gmux

There is a version that works with the Nvidia nouveau drivers and is
integrated with Bumblebee 3.0+. The apple_gmux driver should work for
all models with switchable graphics, but the nouveau components and
the current method to enable the Intel card in BIOS emulation mode
will differ. But once switching works well on one model, it shouldn't
be too hard to make it work on the others.

So, not all is done and dusted, and this is the current status: at the
moment switching works, but it's not fully automated. It's still not
possible to simply boot the system, switch between nouveau/i915 and
turn the dedicated card on/off.

This is not only related to the gmux driver itself but also to
nouveau/i915 and how they handle not having a monitor attached at
boot. So one option to thousand+ members of the hybrid-graphics-linux
team is to just wait for a bit longer, or try the code in a test
system and help Andreas by reporting back the details of the
investigations.

In other news, Andreas found a first solution to the VBIOS
problem. There is a register on the card (0x619f04,
PDISPLAY.VGA.ROM_WINDOW) which points to where the VBIOS should
be. Initially this register is set to 0x000ffe09 on the card but after
a powercycle it's set to 0x1.

If one manually restores it to 0xffe09 using nvapoke and copy the
VBIOS back with nvafakebios, both nouveau and the nvidia-blob load
successfully.

A full demo showing the switching between the GPUs, Bumblebee with
both nvidia and nouveau is available here:

http://www.youtube.com/watch?v=0FYP3nMyxcQ

And a screen recording showing Bumblebee in action is here:

http://www.youtube.com/watch?v=qdY_qZWNM6E

The current issues are with using EFI boot, because the Intel card
doesn't work with suspend in BIOS mode. The IRC discussions with mjg59
and airlied resulted in patches to sort out the boot GPU detection on
Apple EFI. Another major issue is the Intel LVDS detection. According
to airlied, the way to go is switch_ddc, which requires to change all
GPU drivers to call a function before reading the EDID data for the
internal display. This in turn switches the EDID line. Some work has
already been done, but it's not finished yet. The other line of
investigation is using reprobe and try to redetect and recreate the
framebuffer upon a GPU switch. At the time of this writing, this
doesn't seem to work well with the current DRM/fbcon
infrastructure.

If you own a Macbook Pro 6,2 or 6,1 and are adventurous enough to try
it you can find the code here:

http://github.com/ah-/gmux-scripts
http://github.com/ah-/ubuntu-kernel-mbp
http://github.com/ah-/gmux

There's also some documentation here:

http://github.com/ah-/gmux-scripts/blob/master/README

The newer models use AMD graphics instead of Nvidia, although Apple is
rumoured to go back to Nvidia in upcoming models (as of 20120414). It
would be great to have users testing graphics switching on other
models, so email the mailing list if you are interested in tinkering
with this:

http://lists.launchpad.net/hybrid-graphics-linux/msg02169.html

The plan from now on is to clean things up and hopefully get some of
this work merged upstream. Please get in touch if you have experience
with the linux graphics stack and you are willing to help out solving
issues like the reprobe/lock_ddc situation. There are also issues with
the Intel cards that have to do with resuming after a suspend, which
are in need of expert hands.

For more information on the hardware details, find below an excellent
document:

http://github.com/pathscale/envytools/blob/master/hwdocs

See nvbars.txt and the source of the envytools.

Followers