mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-12 02:16:17 +00:00
pci: Search for the first Intel GPU, rather than assume a fixed slot
Everywhere else we search for a match based on an Intel display device, so if the quick check of the fixed slot fails, fallback to walking the PCI bus looking for a match. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
51f08301ab
commit
50fdf32e46
@ -54,8 +54,27 @@ intel_get_pci_device(void)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Grab the graphics card */
|
/* Grab the graphics card. Try the canonical slot first, then
|
||||||
|
* walk the entire PCI bus for a matching device. */
|
||||||
pci_dev = pci_device_find_by_slot(0, 0, 2, 0);
|
pci_dev = pci_device_find_by_slot(0, 0, 2, 0);
|
||||||
|
if (pci_dev == NULL || pci_dev->vendor_id != 0x8086) {
|
||||||
|
struct pci_device_iterator *iter;
|
||||||
|
struct pci_id_match match;
|
||||||
|
|
||||||
|
match.vendor_id = 0x8086; /* Intel */
|
||||||
|
match.device_id = PCI_MATCH_ANY;
|
||||||
|
match.subvendor_id = PCI_MATCH_ANY;
|
||||||
|
match.subdevice_id = PCI_MATCH_ANY;
|
||||||
|
|
||||||
|
match.device_class = 0x3 << 16;
|
||||||
|
match.device_class_mask = 0xff << 16;
|
||||||
|
|
||||||
|
match.match_data = 0;
|
||||||
|
|
||||||
|
iter = pci_id_match_iterator_create(&match);
|
||||||
|
pci_dev = pci_device_next(iter);
|
||||||
|
pci_iterator_destroy(iter);
|
||||||
|
}
|
||||||
if (pci_dev == NULL)
|
if (pci_dev == NULL)
|
||||||
errx(1, "Couldn't find graphics card");
|
errx(1, "Couldn't find graphics card");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user