diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-10-08 13:59:55 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-10-08 13:59:55 +0100 |
commit | c139e2fb95f2db0b39aadcd58cc63b316a278951 (patch) | |
tree | a3ddbf756e480d3d00e93e73d16d2ffeeb19e507 /src/intel_module.c | |
parent | 57c48e4973ac0dad09744eaa82315a5f023094e7 (diff) |
intel: Store pointer to struct intel_device
Beware the barbarians at the gate, who invade and steal your ScrnInfoPtr
and its Entity from underneath you. In some configurations, we lose
access to the struct intel_device stored on the Entity after
initialisation, causing havoc. Workaround this by storing the
intel_device that we open in our driverPrivate.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/intel_module.c')
-rw-r--r-- | src/intel_module.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/src/intel_module.c b/src/intel_module.c index e3da2908..2fbb4df2 100644 --- a/src/intel_module.c +++ b/src/intel_module.c @@ -325,27 +325,31 @@ static const struct pci_id_match intel_device_match[] = { }; void -intel_detect_chipset(ScrnInfoPtr scrn, EntityInfoPtr ent) +intel_detect_chipset(ScrnInfoPtr scrn, struct intel_device *dev) { - MessageType from = X_PROBED; - const char *name = NULL; int devid; + const char *name = NULL; int i; - if (ent->device->chipID >= 0) { - xf86DrvMsg(scrn->scrnIndex, from = X_CONFIG, - "ChipID override: 0x%04X\n", - ent->device->chipID); - devid = ent->device->chipID; - } else { + if (dev == NULL) { + EntityInfoPtr ent; struct pci_device *pci; - pci = xf86GetPciInfoForEntity(ent->index); - if (pci != NULL) - devid = pci->device_id; - else - devid = intel_get_device_id(scrn); - } + ent = xf86GetEntityInfo(scrn->entityList[0]); + if (ent->device->chipID >= 0) { + xf86DrvMsg(scrn->scrnIndex, X_CONFIG, + "ChipID override: 0x%04X\n", + ent->device->chipID); + devid = ent->device->chipID; + } else { + pci = xf86GetPciInfoForEntity(ent->index); + if (pci) + devid = pci->device_id; + else + devid = ~0; + } + } else + devid = intel_get_device_id(dev); for (i = 0; intel_chipsets[i].name != NULL; i++) { if (devid == intel_chipsets[i].token) { @@ -365,7 +369,7 @@ intel_detect_chipset(ScrnInfoPtr scrn, EntityInfoPtr ent) } if (gen) { - xf86DrvMsg(scrn->scrnIndex, from, + xf86DrvMsg(scrn->scrnIndex, X_PROBED, "gen%d engineering sample\n", gen); } else { xf86DrvMsg(scrn->scrnIndex, X_WARNING, @@ -374,7 +378,7 @@ intel_detect_chipset(ScrnInfoPtr scrn, EntityInfoPtr ent) name = "unknown"; } else { - xf86DrvMsg(scrn->scrnIndex, from, + xf86DrvMsg(scrn->scrnIndex, X_PROBED, "Integrated Graphics Chipset: Intel(R) %s\n", name); } |