Next steps for pci-rework branches

Ian Romanick idr at
Wed Aug 9 09:21:50 PDT 2006

Hash: SHA1


With yesterday's push, I believe that the xserver, xf86-video-mga, and
xf86-video-savage components are reasonably stable on non-exotic
platforms (i.e., x86 PCs and x86-64 PCs running Linux).

The current head of the pci-rework branch in the xf86-video-savage tree
is the minimum change set required to convert a driver to the new
interfaces.  If people would like to start converting other drivers,
this is a good model to follow.  There are a couple of important things.

1. Make sure that the driver calls xf86AddDriver with a 1 for the flags
parameter.  Technically speaking, all drivers should do this anyway.
It's an ABI backwards compatibility thing that we no longer need.

2. Create a table of pci_id_match structures to match the devices that
the driver supports.  For people who have done Linux kernel driver work,
this will be very familiar.  Make good use of the match_data field!
This field, along with the matching pci_device, gets passed into the
driver's probe routine.

3. Convert the driver's FooProbe function to FooPciProbe.  The Savage
and MGA drivers are good examples.  This routine gets a pointer to the
pci_device, the entity number, and the match_data (see #2 above).  In
most cases this means that about 50% of the old FooProbe routine can
just be cut.

4. Replace any calls to the old PCI accessor routines (e.g.,
pciReadLong, xf86MapPciMem, etc.) with calls to the new accessor
routines.  The APIs are similar, but there are some differences.  The
biggest difference, which bit me during the Savage driver conversion, is
that the new routines only allow an entire BAR to be mapped, whereas the
old routines allowed subranges of a BAR to be mapped.  I suggest
converting subrange mappings to full BAR mappings *before* converting to
the new interfaces.  This is the approach that I took with the Savage

5. Update the DriverRec with the pointer to the pci_id_match table and
the FooPciProbe routine.  Drivers that support only PCI or PCI-like
(i.e., AGP and PCI-e) devices do NOT need a FooProbe routine.  That
field in the DriverRec should be NULL.  Drivers that support non-PCI
devices will need a FooProbe, but the FooProbe should *NOT* detect PCI
devices.  FooPciProbe is called by the server before FooProbe.
Admittedly, this path has not been tested and may have problems.

As far as I can tell, there's not a lot of development left.  I'm sure
there will be a lot of debugging and minor tweaking, though.  I believe
that the main things are:

1. Port libpciaccess to the other platforms that was care about.

2. Add code to libpciaccess to enable and disable routing of VGA to
different buses.  There was also code in xf86pciBus.c to enable and
disable access to memory and IO BARs on a device, but I'm not convinced
that we need that.  Thoughts?

3. Related to #2, gut everything from the server that has to do with the
pciBusInfo_t structure.

4. Convert all of the drivers to the new interfaces.

5. A few other changes / clean-ups to the interface between the server
and the drivers, but most of these can wait for a bit.

My dream is that we can move this over to the trunk immediately *after*
7.2 ships.  Given the magnitude of these changes, I'm guessing it will
be the driving factor of 7.3 or 8.0 or whatever we call the release
after 7.2.  Opinions?
Version: GnuPG v1.4.2.2 (GNU/Linux)


More information about the xorg mailing list