[ubuntu-x] Hybrid graphics detection

Tormod Volden lists.tormod at gmail.com
Wed Nov 2 21:22:24 UTC 2011

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

Sorry for jumping in here without having followed the session - do you
have a link to a transcript or summary?

>>> 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.

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

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 :)

So I am very glad to see this being worked on. I am quite surprised of
the situation after years where the latest laptops would work
out-of-the-box in Linux. There have been issues with shaky 3D support
and troublesome sound and all that, but for a /laptop/ to have the
mobility crippled and go warm and noisy that's more serious in my
opinion. Couldn't, say, Intel have told us that most laptops would be
like this already some years ago?

>>> >
>>> > It's based on the code that X itself uses to pick which drivers to
>>> > load at startup, so it likely suffers from some of the issues we
>>> > discussed in the session. But it does seem to work for nVidia Optimus,
>>> > which is the only hybrid graphics system I have access to.
>>> >

And you, our last hope, have *one* system to test on? Can't some
corporate goodness throw a handful of lappies at you?


>> This works for the ati/intel system I now have - or, at least, it
>> correctly picks "Integrated" when I've tested it.  It's not possible to
>> switch to the radeon card because it's not hooked up to any outputs :)
> If you take out the "break" at line 51, does it still only print out
> "integrated"?
> Right now it will only print one or the other, but from the discussion
> it sounded like pci_device_is_boot_vga might return true for multiple
> devices under certain configurations. It would be nice to know.

More information about the Ubuntu-x mailing list