From 59fd25f7fcedb5e75c576e66a63514a11bca3bb7 Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Sat, 18 Jul 2009 20:16:01 +0000 Subject: Correct patch for libpciaccess issue from X.Org bug 18122, by Marien Zwart. Tested by Pierre Cardoso. --- driver/xf86-video-chips/src/ct_driver.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/driver/xf86-video-chips/src/ct_driver.c b/driver/xf86-video-chips/src/ct_driver.c index 9f47bf94e..46a2b3c15 100644 --- a/driver/xf86-video-chips/src/ct_driver.c +++ b/driver/xf86-video-chips/src/ct_driver.c @@ -900,7 +900,6 @@ CHIPSPciProbe(DriverPtr drv, int entity_num, struct pci_device * dev, intptr_t match_data) { ScrnInfoPtr pScrn = NULL; - EntityInfoPtr pEnt; CHIPSPtr cPtr; /* Allocate a ScrnInfoRec and claim the slot */ @@ -921,12 +920,16 @@ CHIPSPciProbe(DriverPtr drv, int entity_num, struct pci_device * dev, pScrn->FreeScreen = CHIPSFreeScreen; pScrn->ValidMode = CHIPSValidMode; + if (!CHIPSGetRec(pScrn)) { + return FALSE; + } + cPtr = CHIPSPTR(pScrn); + cPtr->Chipset = match_data; /* * For cards that can do dual head per entity, mark the entity * as sharable. */ - pEnt = xf86GetEntityInfo(entity_num); - if (pEnt->chipset == CHIPS_CT69030) { + if (match_data == CHIPS_CT69030) { CHIPSEntPtr cPtrEnt = NULL; DevUnion *pPriv; @@ -1202,7 +1205,11 @@ CHIPSPreInit(ScrnInfoPtr pScrn, int flags) for (i = 0; inumEntities; i++) { cPtr->pEnt = xf86GetEntityInfo(pScrn->entityList[i]); if (cPtr->pEnt->resources) return FALSE; - cPtr->Chipset = cPtr->pEnt->chipset; + /* If we are using libpciaccess this is already set in CHIPSPciProbe. + * If we are using something else we need to set it here. + */ + if (!cPtr->Chipset) + cPtr->Chipset = cPtr->pEnt->chipset; pScrn->chipset = (char *)xf86TokenToString(CHIPSChipsets, cPtr->pEnt->chipset); if ((cPtr->Chipset == CHIPS_CT64200) || -- cgit v1.2.3