[ubuntu-x] HW-specific xorg.conf files (Bug #257825)
kirkland at canonical.com
Fri Aug 15 21:39:19 BST 2008
*** Let me start this conversation by saying that I understand that
xorg.conf is going away. I fully support that, and hope to be able to
use all of my hardware to it's fullest capability (resolution, bit
depth, 3d acceleration) in the near future. That said, I do own some
hardware that absolutely requires the binary -nvidia driver. I try
the -nv driver every time a new one releases, but it's still not to a
point where my hardware performs at its fullest capability.
Okay, so I have a situation that I thought was fairly unique, I
developed a somewhat cute hack, and in retrospect, realized that it
might actually be a useful mechanism for more common situations.
I have a pair of Thinkpads, a t61p and an x61. The t61p is a larger,
bulkier, more powerful machine. The x61 is smaller, lighter, and has
a far longer battery life. When I'm working at home, and in most
situations, I use the t61p as my primary machine. When I'm traveling,
however, I like to swap my hard-drives, leaving the bulkier t61p at
home for my wife, and taking the more mobile one with me.
Here's the hitch...
The t61p has nVidia video and runs at 1400x1050 resolution, and the
x61 has Intel and maxes out at 1024x768.
The t61p needs an xorg.conf to really work well (full bit depth, 3d
acceleration) with the proprietary nVidia drivers.
So, I usually lug around a pair of xorg.confs, and swap them back and
forth. Similar to something tseliot independently suggested here:
Needless to say, I tired of handling this manually and decided to automate it.
I opened bug #257825, and attached a patch against the xorg package,
dropping a concise little block of code into /etc/init.d/x11-common.
I added a new action, "hwsign" to the init script. Once I'm done
fiddling with my xorg.conf, and I *know* it to be doing all the things
I need on the current set of hardware (full resolution, bit depth,
3d), I run:
# /etc/init.d/x11-common hwsign
* Signature succeeded: /etc/X11/xorg.conf.3f10230832426d64c7171e91afb18c63
The generates a unique signature for my hardware by doing:
# lspci | grep VGA | md5sum | sed "s/\s.*//
This generates an md5sum of my graphics card description, as reported by lspci.
Every time I boot, x11-common calculates my hw signature in just such
a manner and looks at my /etc/X11/last-hw-sig value.
If those two differ, AND if a file exists matching
/etc/X11/xorg.conf.$hw_sig, the current xorg.conf is backed up, and
/etc/X11/xorg.conf.$hw_sig is copied into its place.
And thus, I can move my hard drive back and forth among multiple
machines and have my video settings match. The remaining limitation
is that of conflicting GL libraries, between the Intel and Nvidia
drivers. That's a separate thread (please break off of this one, if
you want to discuss that). I'd love to see this handled via
update-alternatives, but I have no idea how much work this is.
I explained this to Bryce and others on IRC yesterday . Bryce
mentioned that this methodology could possibly be used by others with
odd hardware setups that continue to require xorg.conf's in the near
term. He asked me to bring this discussion to this mailing list.
Ubuntu Server Developer
kirkland at canonical.com
More information about the Ubuntu-x