[ubuntu-x] Hybrid graphics detection

Evan Broder evan at ebroder.net
Mon Oct 31 18:36:39 UTC 2011


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.

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.

I'm currently using the following Upstart job when either
nvidia-current or fglrx are installed:

 start on starting gdm

 task
 script
     if [ "$(hybrid-detect)" = "integrated" ]; then
         update-alternatives --set gl_conf /usr/lib/mesa/ld.so.conf
         ldconfig
     fi
 end script

Both of these are a bit rough around the edges, and would definitely
need some tuning before being adapted by Ubuntu in general.

- Evan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hybrid-detect.c
Type: text/x-csrc
Size: 1809 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-x/attachments/20111031/4dac82a2/attachment.c>


More information about the Ubuntu-x mailing list