.cvsignore | 19 ----- .gitignore | 20 ++++++ configure.ac | 15 ++++ man/.cvsignore | 2 man/.gitignore | 2 man/Makefile.am | 1 src/.cvsignore | 6 - src/.gitignore | 6 + src/Makefile.am | 1 src/glint.h | 17 +++-- src/glint_dri.c | 11 +-- src/glint_driver.c | 166 ++++++++++++++++++++++++++++++++------------------- src/glint_regs.h | 42 ++++++------ src/glintpcirename.h | 122 +++++++++++++++++++++++++++++++++++++ src/pm2_video.c | 16 +++- src/pm3_dac.c | 24 ++++++- src/tx_dac.c | 6 - 17 files changed, 340 insertions(+), 136 deletions(-)
New commits: commit 27da4e81ea2eceed69b37a5c6a19def9d1146258 Author: Adam Jackson <[EMAIL PROTECTED]> Date: Wed Mar 19 14:01:42 2008 -0400 glint 1.2.0 diff --git a/configure.ac b/configure.ac index 2f9eeec..aa46117 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ AC_PREREQ(2.57) AC_INIT([xf86-video-glint], - 1.1.1, + 1.2.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xf86-video-glint) commit 71635ce6e595705c8841f68668d3efd7db9cec57 Author: Adam Jackson <[EMAIL PROTECTED]> Date: Wed Mar 19 13:58:54 2008 -0400 Fix distcheck diff --git a/src/Makefile.am b/src/Makefile.am index 8896038..79c9e54 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -33,6 +33,7 @@ glint_drv_la_SOURCES = \ glint_dga.c \ glint_driver.c \ glint.h \ + glintpcirename.h \ glint_regs.h \ glint_shadow.c \ IBMramdac.c \ commit 7c0a6d5e978fbd3f635ba4a35dd24a9cb08ede92 Author: Dave Airlie <[EMAIL PROTECTED]> Date: Tue Mar 11 15:47:34 2008 +1000 fix regression in tinderbox diff --git a/src/glint_driver.c b/src/glint_driver.c index 8f2bb76..eb375ec 100644 --- a/src/glint_driver.c +++ b/src/glint_driver.c @@ -1539,7 +1539,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) */ pGlint->IOAddress = base3copro; #ifndef XSERVER_LIBPCIACCESS - pGlint->memBase[0] = base3copro; + pGlint->PciInfo->memBase[0] = base3copro; #endif xf86DrvMsg(pScrn->scrnIndex, from, "Delta Bug - Changing MMIO registers to 0x%lX\n", commit bee9cba6766271c1e0e007eae8dcd853aa8ef361 Author: Dave Airlie <[EMAIL PROTECTED](none)> Date: Tue Mar 11 10:15:00 2008 +1000 hey look a flying pig.... it builds, but it may or may not work at all. diff --git a/src/glint_driver.c b/src/glint_driver.c index 692ff5a..8f2bb76 100644 --- a/src/glint_driver.c +++ b/src/glint_driver.c @@ -49,7 +49,6 @@ #include "xf86int10.h" #include "dixstruct.h" #include "vbe.h" -#include "cfb8_32.h" #include "compiler.h" #include "mipointer.h" @@ -653,9 +652,11 @@ GLINTProbe(DriverPtr drv, int flags) 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 @@ -722,7 +723,9 @@ GLINTProbe(DriverPtr drv, int flags) 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 +748,8 @@ GLINTProbe(DriverPtr drv, int flags) 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 +759,16 @@ GLINTProbe(DriverPtr drv, int flags) /* Claim specifics, when we KNOW ! the board */ - +#ifndef XSERVER_LIBPCIACCESS /* Appian Jeronimo J2000 */ 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); @@ -809,6 +814,7 @@ GLINTProbe(DriverPtr drv, int flags) checkusedPci++; } } +#endif /* Fill in what we can of the ScrnInfoRec */ pScrn->driverVersion = GLINT_VERSION; @@ -1531,8 +1537,10 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) /* * now update our internal structure accordingly */ - pGlint->IOAddress = - pGlint->PciInfo->memBase[0] = base3copro; + pGlint->IOAddress = base3copro; +#ifndef XSERVER_LIBPCIACCESS + pGlint->memBase[0] = base3copro; +#endif xf86DrvMsg(pScrn->scrnIndex, from, "Delta Bug - Changing MMIO registers to 0x%lX\n", (unsigned long)pGlint->IOAddress); commit faabfbccbe0516f461590eee05cf44122135d9ee Author: Matthieu Herrb <[EMAIL PROTECTED]> Date: Sat Mar 8 23:29:30 2008 +0100 Makefile.am: nuke RCS Id diff --git a/man/Makefile.am b/man/Makefile.am index bf7ec17..f0eb29b 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -1,4 +1,3 @@ -# $Id$ # # Copyright 2005 Sun Microsystems, Inc. All rights reserved. # commit 6a56ee0b6b409c36d4f7e9b1f784ec3eeebd20b9 Author: Dave Airlie <[EMAIL PROTECTED]> Date: Mon Mar 3 10:47:24 2008 +1000 fix typos in dac code from last commit diff --git a/src/pm3_dac.c b/src/pm3_dac.c index 5aa0ecb..e11d190 100644 --- a/src/pm3_dac.c +++ b/src/pm3_dac.c @@ -485,7 +485,7 @@ Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg) if (pGlint->MultiAperture) { STOREREG(GMultGLINTAperture, pGlint->realWidth); STOREREG(GMultGLINT1, PCI_REGION_BASE(pGlint->MultiPciInfo[0], 2, REGION_MEM) & 0xFF800000); - STOREREG(GMultGLINT2, PCI_REGION_BASE(pGlint->MultiPciInfo[1], 2, REIGON_MEM) & 0xFF800000); + STOREREG(GMultGLINT2, PCI_REGION_BASE(pGlint->MultiPciInfo[1], 2, REGION_MEM) & 0xFF800000); } STOREREG(PM3MemBypassWriteMask, 0xffffffff); diff --git a/src/tx_dac.c b/src/tx_dac.c index cabb4fb..0ad4ef1 100644 --- a/src/tx_dac.c +++ b/src/tx_dac.c @@ -70,7 +70,7 @@ TXInit(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg) */ STOREREG(GMultGLINTAperture, pGlint->realWidth); STOREREG(GMultGLINT1, PCI_REGION_BASE(pGlint->MultiPciInfo[0], 2, REGION_MEM) & 0xFF800000); - STOREREG(GMultGLINT2, PCI_REGION_BASE(pGlint->MultiPciInfo[1], 2, REIGON_MEM) & 0xFF800000); + STOREREG(GMultGLINT2, PCI_REGION_BASE(pGlint->MultiPciInfo[1], 2, REGION_MEM) & 0xFF800000); } if (IS_GMX2000 || IS_GLORIAXXL) { commit c4b0de8dc27ce4c3145dca36f75f3b3e4fdd20b9 Author: Dave Airlie <[EMAIL PROTECTED]> Date: Wed Feb 27 15:45:37 2008 +1000 half attempt at pciaccess conversion for glint - doesn't build yet but this gets most of the mechanical changes diff --git a/configure.ac b/configure.ac index e672296..2f9eeec 100644 --- a/configure.ac +++ b/configure.ac @@ -64,6 +64,12 @@ PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_M sdkdir=$(pkg-config --variable=sdkdir xorg-server) # Checks for libraries. +SAVE_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $XORG_CFLAGS" +AC_CHECK_DECL(XSERVER_LIBPCIACCESS, + [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no], + [#include "xorg-server.h"]) +CPPFLAGS="$SAVE_CPPFLAGS" # Checks for header files. AC_HEADER_STDC @@ -96,6 +102,13 @@ if test "$DRI" = yes; then AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support]) fi +if test "x$XSERVER_LIBPCIACCESS" = xyes; then + PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0]) + XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS" +fi +AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes) + + AC_SUBST([DRI_CFLAGS]) AC_SUBST([XORG_CFLAGS]) AC_SUBST([moduledir]) diff --git a/src/glint.h b/src/glint.h index 80f88f6..54f9d18 100644 --- a/src/glint.h +++ b/src/glint.h @@ -30,6 +30,12 @@ #ifndef _GLINT_H_ #define _GLINT_H_ +#include <stdio.h> +#include <errno.h> +#include <string.h> + +#include "glintpcirename.h" + #include "xaa.h" #include "xf86RamDac.h" #include "xf86cmap.h" @@ -44,9 +50,6 @@ #include "GL/glxint.h" #include "glint_dripriv.h" #endif -#include <stdio.h> -#include <errno.h> -#include <string.h> #define GLINT_MAX_MULTI_DEVICES 2 @@ -77,7 +80,9 @@ typedef struct { int numMultiDevices; int MultiChip; Bool MultiAperture; +#ifndef XSERVER_LIBPCIACCESS PCITAG PciTag; +#endif EntityInfoPtr pEnt; GLINTEntPtr entityPrivate; RamDacHelperRecPtr RamDac; diff --git a/src/glint_dri.c b/src/glint_dri.c index 63d0cfd..b244b73 100644 --- a/src/glint_dri.c +++ b/src/glint_dri.c @@ -489,11 +489,13 @@ GLINTDRIScreenInit(ScreenPtr pScreen) 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; @@ -775,12 +777,9 @@ GLINTDRIScreenInit(ScreenPtr pScreen) 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; diff --git a/src/glint_driver.c b/src/glint_driver.c index 5162d5f..692ff5a 100644 --- a/src/glint_driver.c +++ b/src/glint_driver.c @@ -652,7 +652,7 @@ GLINTProbe(DriverPtr drv, int flags) &devSections)) <= 0) { return FALSE; } - + checkusedPci = xf86GetPciVideoInfo(); if (checkusedPci == NULL && devSections /* for xf86DoProbe */) { @@ -723,7 +723,6 @@ GLINTProbe(DriverPtr drv, int flags) xfree(devSections); } else if (checkusedPci) { - if (flags & PROBE_DETECT) { /* HACK, Currently when -configuring, we only return VGA * based chips. Manual configuring is necessary to poke @@ -759,8 +758,8 @@ GLINTProbe(DriverPtr drv, int flags) /* Claim specifics, when we KNOW ! the board */ /* 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; if (!xf86IsEntityShared(usedChips[i])) { eIndex = xf86ClaimPciSlot(pPci->bus, @@ -779,15 +778,15 @@ GLINTProbe(DriverPtr drv, int flags) } } 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, @@ -800,9 +799,9 @@ GLINTProbe(DriverPtr drv, int flags) 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; } @@ -826,8 +825,8 @@ GLINTProbe(DriverPtr drv, int flags) /* 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) @@ -1032,8 +1031,10 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) 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 */ @@ -1047,14 +1048,14 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) 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", @@ -1072,9 +1073,9 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) 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"); @@ -1086,9 +1087,9 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) 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 @@ -1315,8 +1316,8 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) 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); } @@ -1325,7 +1326,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n", pGlint->ChipRev); } else { - pGlint->ChipRev = pGlint->PciInfo->chipRev; + pGlint->ChipRev = PCI_DEV_REVISION(pGlint->PciInfo); } } @@ -1371,7 +1372,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) 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) @@ -1381,11 +1382,11 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) /* 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"); @@ -1401,7 +1402,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) pGlint->IOAddress = pGlint->pEnt->device->IOBase; from = X_CONFIG; } else { - pGlint->IOAddress = pGlint->PciInfo->memBase[0] & 0xFFFFC000; + pGlint->IOAddress = PCI_REGION_BASE(pGlint->MultiPciInfo[0], 0, REGION_MEM) & 0xFFFFC000; } if ((IS_J2000) && (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA)) { @@ -1485,12 +1486,9 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) /* 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) ) { @@ -1500,7 +1498,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) } 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 @@ -1516,25 +1514,25 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) * 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->PciInfo->memBase[0] = base3copro; + pGlint->PciInfo->memBase[0] = base3copro; xf86DrvMsg(pScrn->scrnIndex, from, "Delta Bug - Changing MMIO registers to 0x%lX\n", (unsigned long)pGlint->IOAddress); @@ -2459,17 +2457,47 @@ GLINTMapMem(ScrnInfoPtr pScrn) * 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, 0x20000); +#else + { + void** result = (void**)&pGlint->IOBase; + int err = pci_device_map_range(pGlint->PciInfo, + pGlint->IOAddress, + 0x20000, + 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; } @@ -2504,11 +2532,20 @@ GLINTUnmapMem(ScrnInfoPtr pScrn) /* * Unmap IO registers to virtual address space */ +#ifndef XSERVER_LIBPCIACCESS xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pGlint->IOBase, 0x20000); +#else + pci_device_unmap_range(pGlint->PciInfo, pGlint->IOBase, 0x20000); +#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"); diff --git a/src/glint_regs.h b/src/glint_regs.h index c120641..426e9ae 100644 --- a/src/glint_regs.h +++ b/src/glint_regs.h @@ -34,46 +34,46 @@ #define PCI_CHIP_3DLABS_GAMMA2 0x0E /* The boards we know */ -#define IS_GLORIAXXL ((pGlint->PciInfo->subsysVendor == 0x1048) && \ - (pGlint->PciInfo->subsysCard == 0x0a42)) +#define IS_GLORIAXXL ((PCI_SUB_VENDOR_ID(pGlint->PciInfo) == 0x1048) && \ + (PCI_SUB_DEVICE_ID(pGlint->PciInfo) == 0x0a42)) -#define IS_GLORIASYNERGY ((pGlint->PciInfo->subsysVendor == 0x1048) && \ - (pGlint->PciInfo->subsysCard == 0x0a32)) +#define IS_GLORIASYNERGY ((PCI_SUB_VENDOR_ID(pGlint->PciInfo) == 0x1048) && \ + (PCI_SUB_DEVICE_ID(pGlint->PciInfo) == 0x0a32)) -#define IS_GMX2000 ((pGlint->PciInfo->subsysVendor == 0x3d3d) && \ - (pGlint->PciInfo->subsysCard == 0x0106)) +#define IS_GMX2000 ((PCI_SUB_VENDOR_ID(pGlint->PciInfo) == 0x3d3d) && \ + (PCI_SUB_DEVICE_ID(pGlint->PciInfo) == 0x0106)) -#define IS_J2000 ((pGlint->PciInfo->subsysVendor == 0x1097) && \ - (pGlint->PciInfo->subsysCard == 0x3d32)) +#define IS_J2000 ((PCI_SUB_VENDOR_ID(pGlint->PciInfo) == 0x1097) && \ + (PCI_SUB_DEVICE_ID(pGlint->PciInfo) == 0x3d32)) -#define IS_JPRO ((pGlint->PciInfo->subsysVendor == 0x1097) && \ - (pGlint->PciInfo->subsysCard == 0x3db3)) +#define IS_JPRO ((PCI_SUB_VENDOR_ID(pGlint->PciInfo) == 0x1097) && \ + (PCI_SUB_DEVICE_ID(pGlint->PciInfo) == 0x3db3)) /* COMPAQ OEM VX1 PCI * subsys == 0x0121 if VGA is enabled * subsys == 0x000a if VGA has never been enabled */ -#define IS_PCI_QVX1 (pGlint->PciInfo->subsysVendor == 0x3d3d && \ - ((pGlint->PciInfo->subsysCard == 0x0121) || \ - (pGlint->PciInfo->subsysCard == 0x000a))) +#define IS_PCI_QVX1 (PCI_SUB_VENDOR_ID(pGlint->PciInfo) == 0x3d3d && \ + ((PCI_SUB_DEVICE_ID(pGlint->PciInfo) == 0x0121) || \ + (PCI_SUB_DEVICE_ID(pGlint->PciInfo) == 0x000a))) /* COMPAQ OEM VX1 AGP * subsys == 0x0144 if VGA is enabled * subsys == 0x000c if VGA has never been enabled */ -#define IS_AGP_QVX1 (pGlint->PciInfo->subsysVendor == 0x3d3d && \ - ((pGlint->PciInfo->subsysCard == 0x0144) || \ - (pGlint->PciInfo->subsysCard == 0x000c))) +#define IS_AGP_QVX1 (PCI_SUB_VENDOR_ID(pGlint->PciInfo) == 0x3d3d && \ + ((PCI_SUB_DEVICE_ID(pGlint->PciInfo) == 0x0144) || \ + (PCI_SUB_DEVICE_ID(pGlint->PciInfo) == 0x000c))) #define IS_QVX1 (IS_PCI_QVX1 || IS_AGP_QVX1) -#define IS_ELSA_SYNERGY ((pGlint->PciInfo->subsysVendor == 0x1048) && \ - (pGlint->PciInfo->subsysCard == 0x0a32)) +#define IS_ELSA_SYNERGY ((PCI_SUB_VENDOR_ID(pGlint->PciInfo) == 0x1048) && \ + (PCI_SUB_DEVICE_ID(pGlint->PciInfo) == 0x0a32)) /* COMPAQ OEM Permedia 2V with VGA disable jumper - 0x13e9 ? */ -#define IS_QPM2V ((pGlint->PciInfo->subsysVendor == 0x13e9) && \ - ((pGlint->PciInfo->subsysCard == 0x0100) || \ - (pGlint->PciInfo->subsysCard == 0x0002))) +#define IS_QPM2V ((PCI_SUB_VENDOR_ID(pGlint->PciInfo) == 0x13e9) && \ + ((PCI_SUB_DEVICE_ID(pGlint->PciInfo) == 0x0100) || \ + (PCI_SUB_DEVICE_ID(pGlint->PciInfo) == 0x0002))) /********************************************** * GLINT 500TX Configuration Region Registers * diff --git a/src/glintpcirename.h b/src/glintpcirename.h new file mode 100644 index 0000000..c4beac6 --- /dev/null +++ b/src/glintpcirename.h @@ -0,0 +1,122 @@ +/* + * Copyright 2007 George Sapountzis + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/** + * Macros for porting drivers from legacy xfree86 PCI code to the pciaccess + * library. The main purpose being to facilitate source code compatibility. + */ + +#ifndef SISPCIRENAME_H +#define SISPCIRENAME_H + +enum region_type { + REGION_MEM, + REGION_IO +}; + +#ifndef XSERVER_LIBPCIACCESS + +/* pciVideoPtr */ +#define PCI_DEV_VENDOR_ID(_pcidev) ((_pcidev)->vendor) +#define PCI_DEV_DEVICE_ID(_pcidev) ((_pcidev)->chipType) +#define PCI_DEV_REVISION(_pcidev) ((_pcidev)->chipRev) + +#define PCI_SUB_VENDOR_ID(_pcidev) ((_pcidev)->subsysVendor) +#define PCI_SUB_DEVICE_ID(_pcidev) ((_pcidev)->subsysCard) + +#define PCI_DEV_TAG(_pcidev) pciTag((_pcidev)->bus, \ + (_pcidev)->device, \ + (_pcidev)->func) +#define PCI_DEV_BUS(_pcidev) ((_pcidev)->bus) +#define PCI_DEV_DEV(_pcidev) ((_pcidev)->device) +#define PCI_DEV_FUNC(_pcidev) ((_pcidev)->func) + +/* pciConfigPtr */ +#define PCI_CFG_TAG(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->tag) +#define PCI_CFG_BUS(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->busnum) +#define PCI_CFG_DEV(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->devnum) +#define PCI_CFG_FUNC(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->funcnum) + +/* region addr: xfree86 uses different fields for memory regions and I/O ports */ +#define PCI_REGION_BASE(_pcidev, _b, _type) \ + (((_type) == REGION_MEM) ? (_pcidev)->memBase[(_b)] \ + : (_pcidev)->ioBase[(_b)]) + +/* region size: xfree86 uses the log2 of the region size, + * but with zero meaning no region, not size of one XXX */ +#define PCI_REGION_SIZE(_pcidev, _b) \ + (((_pcidev)->size[(_b)] > 0) ? (1 << (_pcidev)->size[(_b)]) : 0) + +/* read/write PCI configuration space */ +#define PCI_READ_BYTE(_pcidev, _value_ptr, _offset) \ + *(_value_ptr) = pciReadByte(PCI_CFG_TAG(_pcidev), (_offset)) + +#define PCI_READ_LONG(_pcidev, _value_ptr, _offset) \ + *(_value_ptr) = pciReadLong(PCI_CFG_TAG(_pcidev), (_offset)) + +#define PCI_WRITE_LONG(_pcidev, _value, _offset) \ + pciWriteLong(PCI_CFG_TAG(_pcidev), (_offset), (_value)) + +#else /* XSERVER_LIBPCIACCESS */ + +typedef struct pci_device *pciVideoPtr; + +#define PCI_DEV_VENDOR_ID(_pcidev) ((_pcidev)->vendor_id) +#define PCI_DEV_DEVICE_ID(_pcidev) ((_pcidev)->device_id) +#define PCI_DEV_REVISION(_pcidev) ((_pcidev)->revision) + +#define PCI_SUB_VENDOR_ID(_pcidev) ((_pcidev)->subvendor_id) +#define PCI_SUB_DEVICE_ID(_pcidev) ((_pcidev)->subdevice_id) + +/* pci-rework functions take a 'pci_device' parameter instead of a tag */ +#define PCI_DEV_TAG(_pcidev) (_pcidev) + +/* PCI_DEV macros, typically used in printf's, add domain ? XXX */ +#define PCI_DEV_BUS(_pcidev) ((_pcidev)->bus) +#define PCI_DEV_DEV(_pcidev) ((_pcidev)->dev) +#define PCI_DEV_FUNC(_pcidev) ((_pcidev)->func) + +/* pci-rework functions take a 'pci_device' parameter instead of a tag */ +#define PCI_CFG_TAG(_pcidev) (_pcidev) + +/* PCI_CFG macros, typically used in DRI init, contain the domain */ +#define PCI_CFG_BUS(_pcidev) (((_pcidev)->domain << 8) | \ + (_pcidev)->bus) +#define PCI_CFG_DEV(_pcidev) ((_pcidev)->dev) +#define PCI_CFG_FUNC(_pcidev) ((_pcidev)->func) + +#define PCI_REGION_BASE(_pcidev, _b, _type) ((_pcidev)->regions[(_b)].base_addr) +#define PCI_REGION_SIZE(_pcidev, _b) ((_pcidev)->regions[(_b)].size) + +#define PCI_READ_BYTE(_pcidev, _value_ptr, _offset) \ + pci_device_cfg_read_u8((_pcidev), (_value_ptr), (_offset)) + +#define PCI_READ_LONG(_pcidev, _value_ptr, _offset) \ + pci_device_cfg_read_u32((_pcidev), (_value_ptr), (_offset)) + +#define PCI_WRITE_LONG(_pcidev, _value, _offset) \ + pci_device_cfg_write_u32((_pcidev), (_value), (_offset)) + +#endif /* XSERVER_LIBPCIACCESS */ + +#endif /* SISPCIRENAME_H */ diff --git a/src/pm2_video.c b/src/pm2_video.c index a5f8dc2..46d5d74 100644 --- a/src/pm2_video.c +++ b/src/pm2_video.c @@ -2769,9 +2769,9 @@ NewAdaptorPriv(ScrnInfoPtr pScrn, Bool VideoIO) xvipc.pAPriv = pAPriv; /* Server head ID */ xvipc.op = OP_CONNECT; - xvipc.a = pGlint->PciInfo->bus; - xvipc.b = pGlint->PciInfo->device; - xvipc.c = pGlint->PciInfo->func; + xvipc.a = PCI_DEV_BUS(pGlint->PciInfo); + xvipc.b = PCI_DEV_DEV(pGlint->PciInfo); + xvipc.c = PCI_DEV_FUNC(pGlint->PciInfo); xvipc.d = pScrn->videoRam << 10; /* XF86Config overrides probing */ @@ -3006,8 +3006,10 @@ Permedia2VideoInit(ScreenPtr pScreen) break; } - if (VideoIO) - switch (pciReadLong(pGlint->PciTag, PCI_SUBSYSTEM_ID_REG)) { + if (VideoIO) { + unsigned int temp; + PCI_READ_LONG(pGlint->PciInfo, &temp, PCI_SUBSYSTEM_ID_REG); + switch (temp) { case PCI_SUBSYSTEM_ID_WINNER_2000_P2A: case PCI_SUBSYSTEM_ID_WINNER_2000_P2C: case PCI_SUBSYSTEM_ID_GLORIA_SYNERGY_P2A: @@ -3018,7 +3020,7 @@ Permedia2VideoInit(ScreenPtr pScreen) xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 1, "No Xv vio support for this board\n"); VideoIO = FALSE; } - + } if (pGlint->NoAccel && !VideoIO) return; diff --git a/src/pm3_dac.c b/src/pm3_dac.c index c390c4d..5aa0ecb 100644 --- a/src/pm3_dac.c +++ b/src/pm3_dac.c @@ -65,10 +65,24 @@ Permedia3MemorySizeDetect(ScrnInfoPtr pScrn) * regardless of memory configuration */ pGlint->FbMapSize = 64*1024*1024; +#ifndef XSERVER_LIBPCIACCESS /* Mark as VIDMEM_MMIO to avoid write-combining while detecting memory */ pGlint->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, 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, + result); + + if (err) + return FALSE; + } +#endif if (pGlint->FbBase == NULL) return 0; @@ -119,8 +133,12 @@ Permedia3MemorySizeDetect(ScrnInfoPtr pScrn) GLINT_SLOW_WRITE_REG(temp, PM3MemBypassWriteMask); +#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; pGlint->FbMapSize = 0; @@ -466,10 +484,8 @@ Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg) if (pGlint->MultiAperture) { STOREREG(GMultGLINTAperture, pGlint->realWidth); - STOREREG(GMultGLINT1, - pGlint->MultiPciInfo[0]->memBase[2] & 0xFF800000); - STOREREG(GMultGLINT2, - pGlint->MultiPciInfo[1]->memBase[2] & 0xFF800000); + STOREREG(GMultGLINT1, PCI_REGION_BASE(pGlint->MultiPciInfo[0], 2, REGION_MEM) & 0xFF800000); + STOREREG(GMultGLINT2, PCI_REGION_BASE(pGlint->MultiPciInfo[1], 2, REIGON_MEM) & 0xFF800000); } STOREREG(PM3MemBypassWriteMask, 0xffffffff); diff --git a/src/tx_dac.c b/src/tx_dac.c index 3ec4888..cabb4fb 100644 --- a/src/tx_dac.c +++ b/src/tx_dac.c @@ -69,10 +69,8 @@ TXInit(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg) * as incorrect scanline interleaving when software rendering. */ STOREREG(GMultGLINTAperture, pGlint->realWidth); - STOREREG(GMultGLINT1, - pGlint->MultiPciInfo[0]->memBase[2] & 0xFF800000); - STOREREG(GMultGLINT2, - pGlint->MultiPciInfo[1]->memBase[2] & 0xFF800000); + STOREREG(GMultGLINT1, PCI_REGION_BASE(pGlint->MultiPciInfo[0], 2, REGION_MEM) & 0xFF800000); + STOREREG(GMultGLINT2, PCI_REGION_BASE(pGlint->MultiPciInfo[1], 2, REIGON_MEM) & 0xFF800000); } if (IS_GMX2000 || IS_GLORIAXXL) { commit f87b7c663c8ae2c4abf270f8f941a4c068da7e8b Author: Julien Cristau <[EMAIL PROTECTED]> Date: Tue Feb 5 13:45:05 2008 +0100 Add missing #includes to fix compiler warnings. Fixes the following warnings: ../../src/glint_driver.c: In function 'GLINTScreenInit': ../../src/glint_driver.c:2968: warning: implicit declaration of function 'cfb8_32ScreenInit' ../../src/glint_driver.c:3147: warning: implicit declaration of function 'xf86Overlay8Plus32Init' ../../src/pm2_video.c: In function 'StopVideoStream': ../../src/pm2_video.c:1339: warning: implicit declaration of function 'usleep' ../../src/pm2_video.c: In function 'xvipcHandshake': ../../src/pm2_video.c:2413: warning: implicit declaration of function 'ioctl' ../../src/pm2_video.c: In function 'xvipcOpen': ../../src/pm2_video.c:2622: warning: implicit declaration of function 'close' diff --git a/src/glint_driver.c b/src/glint_driver.c index ed7b07c..5162d5f 100644 --- a/src/glint_driver.c +++ b/src/glint_driver.c @@ -49,6 +49,7 @@ #include "xf86int10.h" #include "dixstruct.h" #include "vbe.h" +#include "cfb8_32.h" #include "compiler.h" #include "mipointer.h" diff --git a/src/pm2_video.c b/src/pm2_video.c index e64d991..a5f8dc2 100644 --- a/src/pm2_video.c +++ b/src/pm2_video.c -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]