Fix autoloading of drivers for pci-rework
This commit is contained in:
parent
6033d8150b
commit
847fbbf4d2
|
@ -350,7 +350,8 @@ autoConfigDevice(GDevPtr preconf_device)
|
||||||
char*
|
char*
|
||||||
chooseVideoDriver(void)
|
chooseVideoDriver(void)
|
||||||
{
|
{
|
||||||
pciVideoPtr *pciptr, info = NULL;
|
struct pci_device * info = NULL;
|
||||||
|
struct pci_device_iterator *iter;
|
||||||
DIR *idsdir;
|
DIR *idsdir;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
struct dirent *direntry;
|
struct dirent *direntry;
|
||||||
|
@ -359,7 +360,7 @@ chooseVideoDriver(void)
|
||||||
size_t len;
|
size_t len;
|
||||||
ssize_t read;
|
ssize_t read;
|
||||||
char path_name[256], vendor_str[5], chip_str[5];
|
char path_name[256], vendor_str[5], chip_str[5];
|
||||||
int vendor, chip;
|
uint16_t vendor, chip;
|
||||||
int i, j;
|
int i, j;
|
||||||
char *matches[20]; /* If we have more than 20 drivers we're in trouble */
|
char *matches[20]; /* If we have more than 20 drivers we're in trouble */
|
||||||
|
|
||||||
|
@ -367,22 +368,17 @@ chooseVideoDriver(void)
|
||||||
matches[i] = NULL;
|
matches[i] = NULL;
|
||||||
|
|
||||||
/* Find the primary device, and get some information about it. */
|
/* Find the primary device, and get some information about it. */
|
||||||
if (xf86PciVideoInfo) {
|
iter = pci_slot_match_iterator_create(NULL);
|
||||||
for (pciptr = xf86PciVideoInfo; (info = *pciptr); pciptr++) {
|
while ((info = pci_device_next(iter)) != NULL) {
|
||||||
if (xf86IsPrimaryPci(info)) {
|
if (xf86IsPrimaryPci(info)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!info) {
|
|
||||||
ErrorF("Primary device is not PCI\n");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ErrorF("xf86PciVideoInfo is not set\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pci_iterator_destroy(iter);
|
||||||
|
|
||||||
if (!info) {
|
if (!info) {
|
||||||
ErrorF("Could not get primary PCI info\n");
|
ErrorF("Primary device is not PCI\n");
|
||||||
goto end;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
idsdir = opendir("/usr/share/xserver-xorg/pci");
|
idsdir = opendir("/usr/share/xserver-xorg/pci");
|
||||||
|
@ -427,8 +423,8 @@ chooseVideoDriver(void)
|
||||||
chip = (int)strtol(chip_str, NULL, 16);
|
chip = (int)strtol(chip_str, NULL, 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (vendor == info->vendor &&
|
if (vendor == info->vendor_id &&
|
||||||
(chip == info->chipType || chip == -1)) {
|
(chip == info->device_id || chip == -1)) {
|
||||||
i = 0;
|
i = 0;
|
||||||
while (matches[i]) {
|
while (matches[i]) {
|
||||||
i++;
|
i++;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user