video driver matching via xorg.conf.d

Dan Nicholson dbn.lists at gmail.com
Thu Jun 10 06:32:16 PDT 2010


On Wed, Jun 9, 2010 at 11:15 PM, Alan Coopersmith
<alan.coopersmith at oracle.com> wrote:
> 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)

Yeah, I didn't say that correctly. Not the device initialization, but
the server initialization.

One related thing I'd like to see is having the device configuration
be smarter. Right now if you have no xorg.conf, autoconfig basically
creates a whole dummy configuration for you. However, if you have
parts of a xorg.conf, filling in the missing details (like the driver
autoselection) is really hacky.

It would be much better if this all got handled in a unified way by
walking down a configuration tree so that you have a full
configuration from ServerLayout through Screen. At each step down,
you'd either grab an existing section or create one. E.g., the user
has no Device, so you generate a stub configuration. But they do have
a Screen section, so use that instead of generating one. Some of the
details seem tricky, but I think we could do better.

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

Yeah, that's basically what I had brewing in my head. To keep the same
behavior as the InputClass matching, I'd suggest putting the generic
vesa match first and then having the later sections override. These
are just the minor details, though.

As a side note, for the USB ID matching, I don't have the 0x hex
prefix. They just go "0000:ffff". Do you or others feel strongly about
that? If so, I'd rather change my patch now.

--
Dan


More information about the xorg-devel mailing list