video driver matching via xorg.conf.d

Alan Coopersmith alan.coopersmith at oracle.com
Wed Jun 9 23:15:33 PDT 2010


Dan Nicholson wrote:
> On Wed, Jun 9, 2010 at 7:27 AM, Alan Coopersmith
> <alan.coopersmith at oracle.com> wrote:
>> Tiago Vignatti wrote:
>>> Vendor and board naming were never used to create the configure file a device.
>>> This patch remove their references.
>> I have been wanting for a while to move the autoconfiguration matching for
>> video cards from a hardcoded list in the code to xorg.conf.d-style files like
>> we use for input devices, and wonder if we'd want to use these in Match rules
>> like the input devices have - though obviously we can do MatchPCIVendor "0x8086"
>> just as well as MatchPCIVendor "Intel", and probably more reliably since pci.ids
>> names can change without warning.
> 
> Of course, getting the strings from pci.ids during autoconfig puts you
> right back to a slow initialization. I think it would be easy enough
> to use the IDs. I did something similar for USB IDs and InputClass:
> 
> http://lists.freedesktop.org/archives/xorg-devel/2010-June/009802.html

Yeah, that's probably much like what we'll want.

>> Of course, wanting to do it, and having a couple weeks free to actually do it
>> are two very different things.
> 
> If you want some help on this, let me know. I'm pretty familiar with
> how the configuration/matching part works, but less familiar with the
> Device initialization code.

I don't think the device initialization code is involved.   What I was thinking
of was replacing the code currently in xf86AutoConfig() in
common/xf86AutoConfig.c and videoPtrToDriverList() in xf86pciBus.c (and I guess
matchDriverFromFiles() in there, though I don't know much about it)

with a something like:

xorg.conf.d/90-video-driver-defaults.conf:


        Section "Device"
                Identifier "ati"
		MatchPCIVendor "0x1002"
                Driver  "ati"
        EndSection

        Section "Device"
                Identifier "i740"
		MatchPCIId "0x8086:0x00di"
		Driver "i740"
        EndSection

        Section "Device"
                Identifier "i740"
		MatchPCIId "0x8086:0x7800"
		Driver "i740"
        EndSection

        Section "Device"
                Identifier "poulsbo"
		MatchPCIId "0x8086:0x8018"
		Driver "vesa"
        EndSection

        Section "Device"
                Identifier "intel"
		MatchPCIVendor "0x8086"
		Driver "intel"
        EndSection

        Section "Device"
                Identifier "nv"
		MatchPCIVendor "0x10de"
                Driver  "nv"
        EndSection


xorg.conf.d/99-video-driver-fallbacks.conf:

        Section "Device"
                Identifier "vesa"
                Driver  "vesa"
        EndSection

        Section "Device"
                Identifier "fbdev"
                Driver  "fbdev"
		MatchOS "linux"
        EndSection

        Section "Device"
                Identifier "wsfb"
                Driver  "wsfb"
		MatchOS "!linux"
        EndSection

And nvidia's driver could install xorg.conf.d/80-nvidia.conf:

        Section "Device"
                Identifier "nvidia"
		MatchPCIVendor "0x10de"
                Driver  "nvidia"
        EndSection

And nouveau could install  xorg.conf.d/80-nouveau.conf:

        Section "Device"
                Identifier "nouveau"
		MatchPCIVendor "0x10de"
                Driver  "nouveau"
        EndSection

and we'd never argue about or have to have distros patch the
hardcoded defaults table in the code again.

(I'm sure I've mangled the syntax above, since I've not yet learned
 how the input device matching clauses work, but you should get the
 idea.)

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list