[ubuntu-x] Hybrid graphics detection

erappleman at gmail.com erappleman at gmail.com
Wed Nov 2 23:04:26 UTC 2011

Hi guys. I and the rest of the Bumblebee Team are working on a wide variety of new software-level solutions to replace our VirtualGL one, including Nouveau, PCI/ACPI toggling for the card, and window dumping. We would like to avail our knowledge and work closer with the Ubuntu-X team.

Eric Appleman
Sent with Verizon Mobile Email

---Original Message---
From: "Evan Broder" <evan at ebroder.net>
Sent: 11/2/2011 6:00 pm
To: "Tormod Volden" <lists.tormod at gmail.com>
Cc: "ubuntu-x" <ubuntu-x at lists.ubuntu.com>, "Bryce Harrington" <bryce at canonical.com>, "Christopher James Halse Rogers" <chalserogers at gmail.com>
Subject: Re: [ubuntu-x] Hybrid graphics detection

On Wed, Nov 2, 2011 at 5:22 PM, Tormod Volden <lists.tormod at gmail.com> wrote:
> On Wed, Nov 2, 2011 at 6:38 PM, Evan Broder <evan at ebroder.net> wrote:
>> On Wed, Nov 2, 2011 at 11:35 AM, Christopher James Halse Rogers
>> <chalserogers at gmail.com> wrote:
>>> On Mon, 2011-10-31 at 11:54 -0700, Bryce Harrington wrote:
>>>> Thanks Evan
> Hi,
> Sorry for jumping in here without having followed the session - do you
> have a link to a transcript or summary?

Well, there are notes from the session, though they are mostly notes
Timo compiled beforehand:

There are also recordings, but I can't swear to their quality:

>>>> On Mon, Oct 31, 2011 at 11:36:39AM -0700, Evan Broder wrote:
>>>> > At the hybrid graphics session today, we discussed how we could detect
>>>> > which GPU was actively being used in a hybrid graphics configuration.
>>>> > I have some code that I've been using to do this, using libpciaccess.
> Can you explain what you really want to find out? Above you say "which
> GPU was actively being used", while the code has the comment "which
> GPU [...] should be used". For me the code seems to tell if the card
> in use by the BIOS was made by Intel.

To briefly summarize the session, we felt that we couldn't present any
"true" hybrid graphics support (any sort of GPU switching, dynamic or
otherwise) to non-power users within the scope of Precise, so we
wanted to focus on not making it possible to use your hardware at all
under the standard configuration.

The issue I'm concerned about is that with most hybrid graphics
hardware configurations, the OS sees multiple GPUs, and most of the
tools assume there will only be one.

For example, if you have nVidia Optimus, Jockey sees an nVidia GPU,
and installs the nvidia-current driver. That changes your default
libGL. When you reboot, and the Intel GPU is connected to the outputs,
the nVidia libGL doesn't work with the Intel driver.

At least for Optimus, the card that was in use by the BIOS is the card
to which outputs are connected, and the card whose libGL library we
should be using. The C code, combined with the Upstart code snippet,
will switch from nvidia-current's libGL back to mesa if you boot with
the integrated chip connected, which is the default on all Optimus
setups I have seen.

The code I submitted certainly has deficiencies, which I felt were
obvious but possibly were not:
 - It equates "made by Intel" as "should be using mesa instead of a
binary driver's libGL"
 - It will only switch away from a binary driver's libGL to mesa, and
not the other way
 - It doesn't deal with pci_device_is_boot_vga returning true for
multiple devices.
 - etc.

I'm also trying to be cautious and careful with words because we
discovered there are a lot of unknowns in the current state of hybrid
graphics. Some configurations will return true from
pci_device_is_boot_vga for multiple devices. Sometimes this means the
integrated card is active. Sometimes it means the discrete card is
active. Or maybe that doesn't happen. We're not entirely sure.

> And why, is the motivation to get a mapping against the
> /sys/kernel/debug/vgaswitcheroo/switch output? Or is that interface
> being obsoleted?

I certainly used vgaswitcheroo as inspiration for the terminology I
used, but my code is not connected to switcheroo at all. Based on
discussion at UDS, I don't believe there was any intent to use
vgaswitcheroo without manual user intervention.

> Is the goal just to switch mesa libraries if you are using evil
> proprietary drivers? So to foresee which card (and driver) Xorg will
> pick up?
> As you understand I am not an expert on the issue, just recently got
> my hands on some of these hybrid GPU laptops. To me the biggest
> problem, and one that actually makes Linux unusable for many users
> (those who know even less than me and actually use it on the go), is
> that the unused card is running full power. Either the battery is
> drained in no time, or the laptop overheats. And fans running full
> speed. So people have come up with scripts to decode the vgaswitcheroo
> output and power down the disconnected card. I would fix that, maybe
> adding a GUI to let the user switch card for next restart, before
> doing anything else. "I would" in the sense "you should", of course :)

Power use is certainly important, but on my laptop, if I follow the
prompts given to me by Jockey, I currently end up with a system
without functioning graphics, and I think that's far more critical
than higher-than-expected power use. Hence my focus on this.

However, we talked about powering off the discrete card as well. My
recollection is that the X team was planning to look into that, but
there are unknowns about how and when we can do that.

> So I am very glad to see this be

More information about the Ubuntu-x mailing list