Module Name:    xsrc
Committed By:   mrg
Date:           Wed Jun 10 00:52:03 UTC 2009

Modified Files:
        xsrc/external/mit/xf86-video-glint/dist/src: glint_dri.c glint_driver.c

Log Message:
merge xf86-video-glint 1.2.2


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
    xsrc/external/mit/xf86-video-glint/dist/src/glint_dri.c \
    xsrc/external/mit/xf86-video-glint/dist/src/glint_driver.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xf86-video-glint/dist/src/glint_dri.c
diff -u xsrc/external/mit/xf86-video-glint/dist/src/glint_dri.c:1.2 xsrc/external/mit/xf86-video-glint/dist/src/glint_dri.c:1.3
--- xsrc/external/mit/xf86-video-glint/dist/src/glint_dri.c:1.2	Tue Oct 28 20:26:50 2008
+++ xsrc/external/mit/xf86-video-glint/dist/src/glint_dri.c	Wed Jun 10 00:52:03 2009
@@ -489,16 +489,18 @@
     if (xf86LoaderCheckSymbol("DRICreatePCIBusID")) {
 	pDRIInfo->busIdString = DRICreatePCIBusID(pGlint->PciInfo);
     } else {
+#ifndef XSERVER_LIBPCIACCESS
 	pDRIInfo->busIdString = xalloc(64); /* Freed in DRIDestroyInfoRec */
 	sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d",
 		((pciConfigPtr)pGlint->PciInfo->thisCard)->busnum,
 		((pciConfigPtr)pGlint->PciInfo->thisCard)->devnum,
 		((pciConfigPtr)pGlint->PciInfo->thisCard)->funcnum);
+#endif
     }
     pDRIInfo->ddxDriverMajorVersion = GLINT_MAJOR_VERSION;
     pDRIInfo->ddxDriverMinorVersion = GLINT_MINOR_VERSION;
     pDRIInfo->ddxDriverPatchVersion = GLINT_PATCHLEVEL;
-    pDRIInfo->frameBufferPhysicalAddress = (void *)pGlint->FbAddress;
+    pDRIInfo->frameBufferPhysicalAddress = (pointer) pGlint->FbAddress;
     pDRIInfo->frameBufferSize = pGlint->FbMapSize;
     pDRIInfo->frameBufferStride = 
 	    pScrn->displayWidth * (pScrn->bitsPerPixel >> 3);
@@ -775,12 +777,9 @@
 
     if (pGlint->irq <= 0) {
 	pGlint->irq = drmGetInterruptFromBusID(pGlint->drmSubFD,
-					       ((pciConfigPtr)pGlint->PciInfo
-						->thisCard)->busnum,
-					       ((pciConfigPtr)pGlint->PciInfo
-						->thisCard)->devnum,
-					       ((pciConfigPtr)pGlint->PciInfo
-						->thisCard)->funcnum);
+					       PCI_CFG_BUS(pGlint->PciInfo),
+					       PCI_CFG_DEV(pGlint->PciInfo),
+					       PCI_CFG_FUNC(pGlint->PciInfo));
     }
     
     return TRUE;
Index: xsrc/external/mit/xf86-video-glint/dist/src/glint_driver.c
diff -u xsrc/external/mit/xf86-video-glint/dist/src/glint_driver.c:1.2 xsrc/external/mit/xf86-video-glint/dist/src/glint_driver.c:1.3
--- xsrc/external/mit/xf86-video-glint/dist/src/glint_driver.c:1.2	Tue Oct 28 20:27:36 2008
+++ xsrc/external/mit/xf86-video-glint/dist/src/glint_driver.c	Wed Jun 10 00:52:03 2009
@@ -28,7 +28,6 @@
  * this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen, 
  * Siemens Nixdorf Informationssysteme and Appian Graphics.
  */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.162 2003/11/03 05:11:11 tsi Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -38,7 +37,6 @@
 #include "micmap.h"
 #include "xf86.h"
 #include "xf86_OSproc.h"
-#include "xf86Version.h"
 #include "xf86PciInfo.h"
 #include "xf86Pci.h"
 #include "xf86cmap.h"
@@ -344,7 +342,7 @@
 
 #ifdef XFree86LOADER
 
-#ifdef XF86DRI
+#ifdef XF86DRI_DEVEL
 static const char *drmSymbols[] = {
     "drmAddBufs",
     "drmAddMap",
@@ -414,7 +412,7 @@
 			  xaaSymbols, xf8_32bppSymbols,
 			  shadowSymbols, fbdevHWSymbols, GLINTint10Symbols,
 			  vbeSymbols, ramdacSymbols,
-#ifdef XF86DRI
+#ifdef XF86DRI_DEVEL
 			  drmSymbols, driSymbols,
 #endif
 			  NULL);
@@ -651,10 +649,12 @@
   					  &devSections)) <= 0) {
   	return FALSE;
     }
-  
+
+#ifndef XSERVER_LIBPCIACCESS
     checkusedPci = xf86GetPciVideoInfo();
      
-    if (checkusedPci == NULL && devSections /* for xf86DoProbe */) {
+    if (checkusedPci == NULL && devSections /* for xf86DoProbe */) 
+      {
   	/*
  	 * Changed the behaviour to try probing using the FBDev support
  	 * when no PCI cards have been found. This is for systems without
@@ -692,17 +692,8 @@
  		    if (pScrn)
   			xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
   				   "claimed PCI slot %d:%d:%d\n",bus,device,func);
- 		} else {
- 		    /* XXX This is a quick hack */
- 		    int entity;
- 		    
- 		    entity = xf86ClaimIsaSlot(drv, 0,
- 					      devSections[i], TRUE);
- 		    pScrn = xf86ConfigIsaEntity(pScrn,0,entity,
- 					      NULL,RES_SHARED_VGA,
- 					      NULL,NULL,NULL,NULL);
  		}
- 		if (pScrn) {
+		if (pScrn) {
   		    /* Fill in what we can of the ScrnInfoRec */
  		    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
  			       "%s successfully probed\n", dev ? dev : "default framebuffer device");
@@ -721,8 +712,9 @@
 	
     	xfree(devSections);
 	
-    } else  if (checkusedPci) {
-	
+    } else  if (checkusedPci) 
+#endif
+{
 	if (flags & PROBE_DETECT) {
 	   /* HACK, Currently when -configuring, we only return VGA
 	    * based chips. Manual configuring is necessary to poke
@@ -745,8 +737,8 @@
 	if (!(flags & PROBE_DETECT))
 	    for (i = 0; i < numUsed; i++) {
 		ScrnInfoPtr pScrn = NULL;
-		GLINTEntPtr pGlintEnt = NULL;					
-		DevUnion *pPriv;						
+		GLINTEntPtr pGlintEnt = NULL;
+		DevUnion *pPriv;
 	
 		pPci = xf86GetPciInfoForEntity(usedChips[i]);
 		/* Allocate a ScrnInfoRec and claim the slot */
@@ -756,14 +748,16 @@
 
 
 		/* Claim specifics, when we KNOW ! the board */
-
+#ifndef XSERVER_LIBPCIACCESS
 		/* Appian Jeronimo J2000 */
-		if ((pPci->subsysVendor == 0x1097) && 
-	    	    (pPci->subsysCard   == 0x3d32)) {
+		if ((PCI_SUB_VENDOR_ID(pPci) == 0x1097) && 
+	    	    (PCI_SUB_DEVICE_ID(pPci)   == 0x3d32)) {
 			int eIndex;
+			int init_func;
+
 			if (!xf86IsEntityShared(usedChips[i])) {
 		    	eIndex = xf86ClaimPciSlot(pPci->bus, 
-						  pPci->device, 
+						  pPci->device,
 						  1,
 						  drv, -1 /* XXX */,
 						  NULL, FALSE);
@@ -778,15 +772,15 @@
 			}
 		} else
     		/* Only claim other chips when GAMMA is used */	
-    		if ((pPci->chipType == PCI_CHIP_GAMMA) ||
-		    (pPci->chipType == PCI_CHIP_GAMMA2) ||
-		    (pPci->chipType == PCI_CHIP_DELTA)) {
+    		if ((PCI_DEV_DEVICE_ID(pPci) ==  PCI_CHIP_GAMMA) ||
+		    (PCI_DEV_DEVICE_ID(pPci) == PCI_CHIP_GAMMA2) ||
+		    (PCI_DEV_DEVICE_ID(pPci) == PCI_CHIP_DELTA)) {
 		    while (*checkusedPci != NULL) {
 	    	    	int eIndex;
 	    	    	/* make sure we claim all but our source device */
-	    	    	if ((pPci->bus ==    (*checkusedPci)->bus && 		
-	         	     pPci->device == (*checkusedPci)->device) &&
-	         	     pPci->func !=   (*checkusedPci)->func) {
+	    	    	if ((pPci->bus ==    PCI_DEV_BUS(*checkusedPci) &&
+	         	     pPci->device == PCI_DEV_DEV((*checkusedPci)) &&
+	         	     pPci->func !=   PCI_DEV_FUNC(*checkusedPci))) {
 		 							   
 		    	/* Claim other entities on the same card */	
 		    	eIndex = xf86ClaimPciSlot((*checkusedPci)->bus, 
@@ -799,9 +793,9 @@
 		    	    xf86AddEntityToScreen(pScrn,eIndex);		
 		    	} else {						
 		    	    ErrorF("BusID %d:%d:%d already claimed\n",		
-					(*checkusedPci)->bus,		
-					(*checkusedPci)->device,	
-					(*checkusedPci)->func);		
+				   PCI_DEV_BUS(*checkusedPci),
+				   PCI_DEV_DEV(*checkusedPci),
+				   PCI_DEV_FUNC(*checkusedPci));	
     		    	    xfree(usedChips);					
 		    	    return FALSE;					
 		        }	
@@ -809,6 +803,7 @@
 	                checkusedPci++;						
 	            }
 		}
+#endif
 
 		/* Fill in what we can of the ScrnInfoRec */
 		pScrn->driverVersion	= GLINT_VERSION;
@@ -825,8 +820,8 @@
 		/* Allow sharing if Appian J2000 detected */			
 		/* (later Diamond FireGL3000 support too) */
 
-		if ((pPci->subsysVendor == 0x1097) && 
-	    	    (pPci->subsysCard   == 0x3d32)) {
+		if ((PCI_SUB_VENDOR_ID(pPci) == 0x1097) && 
+	    	    (PCI_SUB_DEVICE_ID(pPci) == 0x3d32)) {
 	    	    xf86SetEntitySharable(usedChips[i]);
 	    	    /* Allocate an entity private if necessary */		
 	    	    if (GLINTEntityIndex < 0)					
@@ -1031,8 +1026,10 @@
     if (pGlint->pEnt->location.type == BUS_PCI)
     {
         pGlint->PciInfo = xf86GetPciInfoForEntity(pGlint->pEnt->index);
+#ifndef XSERVER_LIBPCIACCESS
         pGlint->PciTag = pciTag(pGlint->PciInfo->bus, pGlint->PciInfo->device,
 			    pGlint->PciInfo->func);
+#endif
     }
 
     pGlint->InFifoSpace = 0;	/* Force a Read of FIFO space on first run */
@@ -1046,14 +1043,14 @@
 	for (i = 1; i < pScrn->numEntities; i++) {
 	    pEnt = xf86GetEntityInfo(pScrn->entityList[i]);
 	    pPci = xf86GetPciInfoForEntity(pEnt->index);
-	    if ( (pPci->chipType == PCI_CHIP_MX) ||
-		 (pPci->chipType == PCI_CHIP_PERMEDIA) ||
-		 (pPci->chipType == PCI_CHIP_TI_PERMEDIA) ||
-		 (pPci->chipType == PCI_CHIP_500TX) ||
-		 (pPci->chipType == PCI_CHIP_300SX) ||
-		 (pPci->chipType == PCI_CHIP_R4) ||
-		 (pPci->chipType == PCI_CHIP_PERMEDIA3) ) {
-		pGlint->MultiChip = pPci->chipType;
+	    if ( (PCI_DEV_DEVICE_ID(pPci) == PCI_CHIP_MX) ||
+		 (PCI_DEV_DEVICE_ID(pPci) == PCI_CHIP_PERMEDIA) ||
+		 (PCI_DEV_DEVICE_ID(pPci) == PCI_CHIP_TI_PERMEDIA) ||
+		 (PCI_DEV_DEVICE_ID(pPci) == PCI_CHIP_500TX) ||
+		 (PCI_DEV_DEVICE_ID(pPci) == PCI_CHIP_300SX) ||
+		 (PCI_DEV_DEVICE_ID(pPci) == PCI_CHIP_R4) ||
+		 (PCI_DEV_DEVICE_ID(pPci) == PCI_CHIP_PERMEDIA3) ) {
+		pGlint->MultiChip = PCI_DEV_DEVICE_ID(pPci);
 		if (pGlint->numMultiDevices >= GLINT_MAX_MULTI_DEVICES) {
 		    xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 			"%d multiple chips unsupported, aborting. (Max - 2)\n",
@@ -1071,9 +1068,9 @@
 	EntityInfoPtr pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
 	pciVideoPtr pPci = xf86GetPciInfoForEntity(pEnt->index);
 
-        if ( ((pPci->chipType == PCI_CHIP_GAMMA) ||
-	      (pPci->chipType == PCI_CHIP_GAMMA2) ||
-	      (pPci->chipType == PCI_CHIP_DELTA)) && 
+        if ( ((PCI_DEV_DEVICE_ID(pPci) == PCI_CHIP_GAMMA) ||
+	      (PCI_DEV_DEVICE_ID(pPci) == PCI_CHIP_GAMMA2) ||
+	      (PCI_DEV_DEVICE_ID(pPci) == PCI_CHIP_DELTA)) && 
              (pGlint->numMultiDevices == 0) ) {
 	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 			"Gamma/Delta with ZERO connected chips, aborting\n");
@@ -1085,9 +1082,9 @@
 	EntityInfoPtr pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
 	pciVideoPtr pPci = xf86GetPciInfoForEntity(pEnt->index);
 
-        if ((pPci->chipType != PCI_CHIP_GAMMA) &&
-	    (pPci->chipType != PCI_CHIP_GAMMA2) &&
-	    (pPci->chipType != PCI_CHIP_DELTA)) {
+        if ((PCI_DEV_DEVICE_ID(pPci) != PCI_CHIP_GAMMA) &&
+	    (PCI_DEV_DEVICE_ID(pPci) != PCI_CHIP_GAMMA2) &&
+	    (PCI_DEV_DEVICE_ID(pPci) != PCI_CHIP_DELTA)) {
 	    GLINTProbeDDC(pScrn, pGlint->pEnt->index);
 	    return TRUE;
 	} else 
@@ -1314,8 +1311,8 @@
 		   pGlint->Chipset);
     } else {
 	from = X_PROBED;
-	pGlint->Chipset = pGlint->PciInfo->vendor << 16 | 
-			  pGlint->PciInfo->chipType;
+	pGlint->Chipset = PCI_DEV_VENDOR_ID(pGlint->PciInfo) << 16 | 
+ 	                  PCI_DEV_DEVICE_ID(pGlint->PciInfo);
 	pScrn->chipset = (char *)xf86TokenToString(GLINTChipsets,
 						   pGlint->Chipset);
     }
@@ -1324,7 +1321,7 @@
 	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n",
 		   pGlint->ChipRev);
     } else {
-	pGlint->ChipRev = pGlint->PciInfo->chipRev;
+        pGlint->ChipRev = PCI_DEV_REVISION(pGlint->PciInfo);
     }
     }
 
@@ -1370,7 +1367,7 @@
 	pGlint->FbAddress = pGlint->pEnt->device->MemBase;
 	from = X_CONFIG;
     } else {
-	pGlint->FbAddress = pGlint->PciInfo->memBase[2] & 0xFF800000;
+        pGlint->FbAddress = PCI_REGION_BASE(pGlint->PciInfo, 2, REGION_MEM) & 0xFF800000;
     }
 
     if (pGlint->FbAddress)
@@ -1380,11 +1377,11 @@
     /* Trap GAMMA & DELTA specification, with no linear address */
     /* Find the first GLINT chip and use that address */
     if (pGlint->FbAddress == 0) {
-	if (pGlint->MultiPciInfo[0]->memBase[2]) {
-	    pGlint->FbAddress = pGlint->MultiPciInfo[0]->memBase[2];
+        if (PCI_REGION_BASE(pGlint->MultiPciInfo[0], 2, REGION_MEM)) {
+	    pGlint->FbAddress = PCI_REGION_BASE(pGlint->MultiPciInfo[0], 2, REGION_MEM);
 	    xf86DrvMsg(pScrn->scrnIndex, X_PROBED, 
 		"FrameBuffer used from first rasterizer chip at 0x%lx\n", 
-				pGlint->MultiPciInfo[0]->memBase[2]);
+				PCI_REGION_BASE(pGlint->MultiPciInfo[0], 2, REGION_MEM));
 	} else {
 	    xf86DrvMsg(pScrn->scrnIndex, X_PROBED, 	
 			"No FrameBuffer memory - aborting\n");
@@ -1400,7 +1397,7 @@
 	pGlint->IOAddress = pGlint->pEnt->device->IOBase;
 	from = X_CONFIG;
     } else {
-	pGlint->IOAddress = pGlint->PciInfo->memBase[0] & 0xFFFFC000;
+	pGlint->IOAddress = PCI_REGION_BASE(pGlint->PciInfo, 0, REGION_MEM) & 0xFFFFC000;
     }
 
     if ((IS_J2000) && (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA)) {
@@ -1484,12 +1481,9 @@
 		/* Delta has a bug, we need to fix it here */
 		{
 		    int basecopro = 
-			pGlint->MultiPciInfo[0]->memBase[0] & 0xFFFFC000;
-		    int basedelta = pGlint->PciInfo->memBase[0] & 0xFFFFC000;
-		    int glintdelta = pGlint->PciTag;
-        	    int glintcopro = pciTag(pGlint->MultiPciInfo[0]->bus, 
-						pGlint->MultiPciInfo[0]->device,
-			    			pGlint->MultiPciInfo[0]->func);
+			PCI_REGION_BASE(pGlint->MultiPciInfo[0], 0, REGION_MEM) & 0xFFFFC000;
+		    int basedelta = PCI_REGION_BASE(pGlint->PciInfo, 0, REGION_MEM)  & 0xFFFFC000;
+		    int dummy;
 		    int base3copro, offset;
 
     		    if( (basedelta & 0x20000) ^ (basecopro & 0x20000) ) {
@@ -1499,7 +1493,7 @@
          		} else {
  			    offset = 0x1c; /* base3 */
  			}
-			base3copro = pciReadLong(glintcopro, offset);
+			PCI_READ_LONG(pGlint->MultiPciInfo[0], &base3copro, offset);
 			if( (basecopro & 0x20000) ^ (base3copro & 0x20000) ) {
 	    			/*
 	     		 	 * oops, still different; we know that base3 
@@ -1515,25 +1509,27 @@
 	 		 * read value
 	 		 * write new value
 	 		 */
-			(void) pciReadLong(glintdelta, 0x10);
-			pciWriteLong(glintdelta, 0x10, 0xffffffff);
-			(void) pciReadLong(glintdelta, 0x10);
-			pciWriteLong(glintdelta, 0x10, base3copro);
+			PCI_READ_LONG(pGlint->PciInfo, &dummy, 0x10);
+			PCI_WRITE_LONG(pGlint->PciInfo, 0xffffffff, 0x10);
+			PCI_READ_LONG(pGlint->PciInfo, &dummy, 0x10);
+			PCI_WRITE_LONG(pGlint->PciInfo, base3copro, 0x10);
 
 			/*
 	 		 * additionally,sometimes we see the baserom which might
 	 		 * confuse the chip, so let's make sure that is disabled
 	 		 */
-			(void) pciReadLong(glintcopro, 0x30);
-			pciWriteLong(glintcopro, 0x30, 0xffffffff);
-			(void) pciReadLong(glintcopro, 0x30);
-			pciWriteLong(glintcopro, 0x30, 0);
+			PCI_READ_LONG(pGlint->MultiPciInfo[0], &dummy, 0x30);
+			PCI_WRITE_LONG(pGlint->MultiPciInfo[0], 0xffffffff, 0x30);
+			PCI_READ_LONG(pGlint->MultiPciInfo[0], &dummy, 0x30);
+			PCI_WRITE_LONG(pGlint->MultiPciInfo[0], 0, 0x30);
 
 			/*
 	 		 * now update our internal structure accordingly
 	 		 */
-			pGlint->IOAddress = 
+			pGlint->IOAddress = base3copro;
+#ifndef XSERVER_LIBPCIACCESS
 			pGlint->PciInfo->memBase[0] = base3copro;
+#endif
     			xf86DrvMsg(pScrn->scrnIndex, from, 
 			       "Delta Bug - Changing MMIO registers to 0x%lX\n",
 	       		       (unsigned long)pGlint->IOAddress);
@@ -2053,6 +2049,64 @@
     xf86DrvMsg(pScrn->scrnIndex, from, "Max pixel clock is %d MHz\n",
 	       pGlint->MaxClock / 1000);
 
+    /* Load DDC */
+    if (!xf86LoadSubModule(pScrn, "ddc")) {
+	GLINTFreeRec(pScrn);
+	return FALSE;
+    }
+    xf86LoaderReqSymLists(ddcSymbols, NULL);
+    /* Load I2C if needed */
+    if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2) ||
+	(pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) ||
+	(pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) ||
+	(pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA4) ||
+	(pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_R4) ||
+	(pGlint->Chipset == PCI_VENDOR_TI_CHIP_PERMEDIA2)) {
+	if (xf86LoadSubModule(pScrn, "i2c")) {
+	    I2CBusPtr pBus;
+
+	    xf86LoaderReqSymLists(i2cSymbols, NULL);
+	    if ((pBus = xf86CreateI2CBusRec())) {
+		pBus->BusName = "DDC";
+		pBus->scrnIndex = pScrn->scrnIndex;
+		pBus->I2CUDelay = Permedia2I2CUDelay;
+		pBus->I2CPutBits = Permedia2I2CPutBits;
+		pBus->I2CGetBits = Permedia2I2CGetBits;
+		pBus->DriverPrivate.ptr = pGlint;
+		if (!xf86I2CBusInit(pBus)) {
+		    xf86DestroyI2CBusRec(pBus, TRUE, TRUE);
+		} else
+		    pGlint->DDCBus = pBus; 
+	    }
+
+	    if ((pBus = xf86CreateI2CBusRec())) {
+	        pBus->BusName = "Video";
+	        pBus->scrnIndex = pScrn->scrnIndex;
+		pBus->I2CUDelay = Permedia2I2CUDelay;
+		pBus->I2CPutBits = Permedia2I2CPutBits;
+		pBus->I2CGetBits = Permedia2I2CGetBits;
+		pBus->DriverPrivate.ptr = pGlint;
+		if (!xf86I2CBusInit(pBus)) {
+		    xf86DestroyI2CBusRec(pBus, TRUE, TRUE);
+		} else
+		    pGlint->VSBus = pBus;
+	    }
+	}
+    }
+    
+    /* DDC */
+    {
+	xf86MonPtr pMon = NULL;
+	
+	if (pGlint->DDCBus)
+	    pMon = xf86DoEDID_DDC2(pScrn->scrnIndex, pGlint->DDCBus);
+	    
+	if (!pMon)
+	    /* Try DDC1 */;
+	    
+	xf86SetDDCproperties(pScrn,xf86PrintEDID(pMon));
+    }
+
     /*
      * Setup the ClockRanges, which describe what clock ranges are available,
      * and what sort of modes they can be used for.
@@ -2379,51 +2433,6 @@
 	xf86LoaderReqSymLists(shadowSymbols, NULL);
     }
 
-    /* Load DDC */
-    if (!xf86LoadSubModule(pScrn, "ddc")) {
-	GLINTFreeRec(pScrn);
-	return FALSE;
-    }
-    xf86LoaderReqSymLists(ddcSymbols, NULL);
-    /* Load I2C if needed */
-    if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2) ||
-	(pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) ||
-	(pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) ||
-	(pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA4) ||
-	(pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_R4) ||
-	(pGlint->Chipset == PCI_VENDOR_TI_CHIP_PERMEDIA2)) {
-	if (xf86LoadSubModule(pScrn, "i2c")) {
-	    I2CBusPtr pBus;
-
-	    xf86LoaderReqSymLists(i2cSymbols, NULL);
-	    if ((pBus = xf86CreateI2CBusRec())) {
-		pBus->BusName = "DDC";
-		pBus->scrnIndex = pScrn->scrnIndex;
-		pBus->I2CUDelay = Permedia2I2CUDelay;
-		pBus->I2CPutBits = Permedia2I2CPutBits;
-		pBus->I2CGetBits = Permedia2I2CGetBits;
-		pBus->DriverPrivate.ptr = pGlint;
-		if (!xf86I2CBusInit(pBus)) {
-		    xf86DestroyI2CBusRec(pBus, TRUE, TRUE);
-		} else
-		    pGlint->DDCBus = pBus; 
-	    }
-
-	    if ((pBus = xf86CreateI2CBusRec())) {
-	        pBus->BusName = "Video";
-	        pBus->scrnIndex = pScrn->scrnIndex;
-		pBus->I2CUDelay = Permedia2I2CUDelay;
-		pBus->I2CPutBits = Permedia2I2CPutBits;
-		pBus->I2CGetBits = Permedia2I2CGetBits;
-		pBus->DriverPrivate.ptr = pGlint;
-		if (!xf86I2CBusInit(pBus)) {
-		    xf86DestroyI2CBusRec(pBus, TRUE, TRUE);
-		} else
-		    pGlint->VSBus = pBus;
-	    }
-	}
-    }
-    
     TRACE_EXIT("GLINTPreInit");
     return TRUE;
 }
@@ -2458,17 +2467,47 @@
      * Map IO registers to virtual address space
      * We always map VGA IO registers - even if we don't need them
      */ 
+#ifndef XSERVER_LIBPCIACCESS
     pGlint->IOBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO_32BIT, 
 	       pGlint->PciTag, pGlint->IOAddress, 0x10000);
+#else
+    {
+      void** result = (void**)&pGlint->IOBase;
+      int err = pci_device_map_range(pGlint->PciInfo,
+				     pGlint->IOAddress,
+				     0x10000,
+				     PCI_DEV_MAP_FLAG_WRITABLE,
+				     result);
+      
+      if (err) 
+	return FALSE;
+    }
+#endif
 
     if (pGlint->IOBase == NULL)
 	return FALSE;
 
     if (pGlint->FbMapSize != 0) {
+#ifndef XSERVER_LIBPCIACCESS
     	pGlint->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
 				 pGlint->PciTag,
 				 pGlint->FbAddress,
 				 pGlint->FbMapSize);
+#else
+	{
+	  void** result = (void**)&pGlint->FbBase;
+	  int err = pci_device_map_range(pGlint->PciInfo,
+					 pGlint->FbAddress,
+					 pGlint->FbMapSize,
+					 PCI_DEV_MAP_FLAG_WRITABLE |
+					 PCI_DEV_MAP_FLAG_WRITE_COMBINE,
+					 result);
+	  
+	  if (err) 
+	    return FALSE;
+	}
+
+#endif
         if (pGlint->FbBase == NULL)
 	    return FALSE;
     }
@@ -2503,11 +2542,20 @@
     /*
      * Unmap IO registers to virtual address space
      */ 
+#ifndef XSERVER_LIBPCIACCESS
     xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pGlint->IOBase, 0x10000);
+#else
+    pci_device_unmap_range(pGlint->PciInfo, pGlint->IOBase, 0x10000);
+#endif
     pGlint->IOBase = NULL;
 
-    if (pGlint->FbBase != NULL)
+    if (pGlint->FbBase != NULL) {
+#ifndef XSERVER_LIBPCIACCESS
     	xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pGlint->FbBase, pGlint->FbMapSize);
+#else
+	pci_device_unmap_range(pGlint->PciInfo, pGlint->FbBase, pGlint->FbMapSize);
+#endif
+    }
     pGlint->FbBase = NULL;
 
     TRACE_EXIT("GLINTUnmapMem");
@@ -2839,7 +2887,9 @@
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
     GLINTPtr pGlint = GLINTPTR(pScrn);
     int ret, displayWidth;
+#if HAVE_CFB8_32
     int init_picture = 0;
+#endif
     unsigned char *FBStart;
     VisualPtr visual;
     
@@ -2859,19 +2909,6 @@
     /* Save the current state */
     GLINTSave(pScrn);
 
-    /* DDC */
-    {
-	xf86MonPtr pMon = NULL;
-	
-	if (pGlint->DDCBus)
-	    pMon = xf86DoEDID_DDC2(pScrn->scrnIndex, pGlint->DDCBus);
-	    
-	if (!pMon)
-	    /* Try DDC1 */;
-	    
-	xf86SetDDCproperties(pScrn,xf86PrintEDID(pMon));
-    }
-
     /* Initialise the first mode */
     if ( (!pGlint->FBDev) && !(GLINTModeInit(pScrn, pScrn->currentMode))) {
 	xf86DrvMsg(scrnIndex, X_ERROR,
@@ -2924,7 +2961,7 @@
 	    return FALSE;
     }
 
-#ifdef XF86DRI
+#ifdef XF86DRI_DEVEL
     /*
      * Setup DRI after visuals have been established, but before fbScreenInit
      * is called. fbScreenInit will eventually call into the drivers
@@ -2957,10 +2994,14 @@
     case 8:
     case 16:
     case 24:
+#if !HAVE_CFB8_32
+    case 32:
+#endif
 	ret = fbScreenInit(pScreen, FBStart,
 			pScrn->virtualX, pScrn->virtualY,
 			pScrn->xDpi, pScrn->yDpi,
 			displayWidth, pScrn->bitsPerPixel);
+#if HAVE_CFB8_32
 	init_picture = 1;
 	break;
     case 32:
@@ -2976,6 +3017,7 @@
 			displayWidth, pScrn->bitsPerPixel);
 	    init_picture = 1;
 	}
+#endif
 	break;
     default:
 	xf86DrvMsg(scrnIndex, X_ERROR,
@@ -3013,7 +3055,9 @@
     }
 
     /* must be after RGB ordering fixed */
+#if HAVE_CFB8_32
     if (init_picture)
+#endif
 	fbPictureInit(pScreen, 0, 0);
     if (!pGlint->NoAccel) {
         switch (pGlint->Chipset)
@@ -3142,18 +3186,20 @@
 	}
     }
 
+#if HAVE_CFB8_32
     if((pScrn->overlayFlags & OVERLAY_8_32_PLANAR) && 
 						(pScrn->bitsPerPixel == 32)) {
 	if(!xf86Overlay8Plus32Init(pScreen))
 	    return FALSE;
     }
+#endif
 
     if(pGlint->ShadowFB)
 	ShadowFBInit(pScreen, GLINTRefreshArea);
 
     xf86DPMSInit(pScreen, (DPMSSetProcPtr)GLINTDisplayPowerManagementSet, 0);
 
-#ifdef XF86DRI
+#ifdef XF86DRI_DEVEL
     if (pGlint->directRenderingEnabled) {
 	/* Now that mi, cfb, drm and others have done their thing, 
          * complete the DRI setup.
@@ -3462,7 +3508,7 @@
     GLINTPtr pGlint = GLINTPTR(pScrn);
 
     TRACE_ENTER("GLINTCloseScreen");
-#ifdef XF86DRI
+#ifdef XF86DRI_DEVEL
     if (pGlint->directRenderingEnabled) {
 	GLINTDRICloseScreen(pScreen);
     }

Reply via email to