Comment 0 for bug 385703

Revision history for this message
Bojan Vitnik (bvitnik) wrote :

Binary package hint: xserver-xorg-video-nv

In my case, "/usr/share/xserver-xorg/pci/nv.ids" was missing PCI-ID for my 7600 GS AGP (10de:02e1). X server autodetection failed and -vesa was used instead. By manualy adding appropriate PCI-ID to "nv.ids" and restarting X server, autodetection worked like a charm and I didn't have any problems with nv driver - changing resolution and refresh rate worked.

I took some time to figure out what was realy going on here. It seems that a large number of supported cards are affected by this bug. The problem is the way "nv.ids" is generated. As far as I could tell, it's generated from "nv_driver.c" (NVKnownChipsets[] to be exact) by a simple awk+sed script. The problem is that not all PCI-IDs of supported cards are listed there and therefore, "nv.ids" is missing PCI-IDs that are not explicitely found in "nv_driver.c". Some supported cards, for example, AGP versions of the cards where both AGP and PCI-E versions exist, are handled diferently by the code.

Here is the code snippet from nv_driver.c:

    const CARD32 id = ((dev->device_id & 0xfff0) == 0x00F0 ||
                       (dev->device_id & 0xfff0) == 0x02E0) ?
                      NVGetPCIXpressChip(dev) : dev->vendor_id << 16 | dev->device_id;
    const char *name = xf86TokenToString(NVKnownChipsets, id);

So, cards with PCI-IDs 02Ex and 00Fx (AGP) are handled by translating their PCI-IDs in PCI-E equivalent PCI-IDs and then looked up in NVKnownChipsets[]. For example, PCI-IDs of my card, 02E1 is translated to 0392, looked up in NVKnownChipsets[] and then handled properly. NVGetPCIXpressChip() is used in the process and, as far as I could tell, it's medling with registers to do its job. Even more supported cards are handled by NVIsSupported() and NVIsG80() using bitmasks.

All in all, "nv.ids" is incomplete because of the way it's generated at the moment.

Solutions:

1) Add supported PCI-IDs, 02Ex and 00Fx, to "nv.ids" manualy, after "nv.ids" is generated with awk+sed script. Consult "pci.ids" if needed.
2) Add supported PCI-IDs in NVKnownChipsets[] and then generate "nv.ids". Those entries in NVKnownChipsets[] would never be used by the code so the question is should they even be there.
3) Change how X server handle .ids files upstream, by adding support for whildcards/bitmasks. "nv.ids" would be generated differently. (ideal)