xserver-xorg-video-tdfx: Changes to 'upstream-unstable'
.cvsignore | 19 -
.gitignore | 20 +
configure.ac | 14
man/.cvsignore | 2
man/.gitignore | 2
man/Makefile.am | 1
src/.cvsignore | 6
src/.gitignore | 6
src/tdfx.h | 67 +++
src/tdfx_accel.c | 1
src/tdfx_dga.c | 1
src/tdfx_dri.c | 11
src/tdfx_dri.h | 1
src/tdfx_dripriv.h | 1
src/tdfx_driver.c | 506 +++++++++++++++++++++------
src/tdfx_hwcurs.c | 1
src/tdfx_io.c | 1
src/tdfx_priv.c | 1
src/tdfx_priv.h | 1
src/tdfx_sli.c | 963 ++++++++++++++++++++++++++---------------------------
src/tdfx_video.c | 1
src/tdfxdefs.h | 23 +
22 files changed, 1011 insertions(+), 638 deletions(-)
New commits:
commit fdff22e2372635f47587f5cdaf888e26d913ee41
Author: Adam Jackson <ajax@redhat.com>
Date: Wed Mar 19 15:39:11 2008 -0400
tdfx 1.4.0
diff --git a/configure.ac b/configure.ac
index 9069993..6177e06 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
AC_PREREQ(2.57)
AC_INIT([xf86-video-tdfx],
- 1.3.0,
+ 1.4.0,
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
xf86-video-tdfx)
commit e270c5baeb00f45abacba2b2f4e82505c339e984
Author: Adam Jackson <ajax@redhat.com>
Date: Wed Mar 19 15:37:46 2008 -0400
Death to RCS tags.
diff --git a/src/tdfx.h b/src/tdfx.h
index 5f09401..15f6d11 100644
--- a/src/tdfx.h
+++ b/src/tdfx.h
@@ -5,7 +5,6 @@
Copyright: 1998,1999
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.26 2002/01/25 21:56:11 tsi Exp $ */
#ifndef _TDFX_H_
#define _TDFX_H_
diff --git a/src/tdfx_accel.c b/src/tdfx_accel.c
index a9a7dbf..6191aeb 100644
--- a/src/tdfx_accel.c
+++ b/src/tdfx_accel.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c,v 1.19 2001/04/05 21:29:17 dawes Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/src/tdfx_dga.c b/src/tdfx_dga.c
index ff872ed..f88c09b 100644
--- a/src/tdfx_dga.c
+++ b/src/tdfx_dga.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c,v 1.5 2001/01/13 00:06:29 mvojkovi Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/src/tdfx_dri.c b/src/tdfx_dri.c
index 9548c00..220e910 100644
--- a/src/tdfx_dri.c
+++ b/src/tdfx_dri.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.25 2003/02/08 21:26:59 dawes Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/src/tdfx_dri.h b/src/tdfx_dri.h
index 53ad09e..ca78293 100644
--- a/src/tdfx_dri.h
+++ b/src/tdfx_dri.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h,v 1.4 2001/03/03 22:41:34 tsi Exp $ */
#ifndef _TDFX_DRI_
#define _TDFX_DRI_
diff --git a/src/tdfx_dripriv.h b/src/tdfx_dripriv.h
index 69f0d04..322633c 100644
--- a/src/tdfx_dripriv.h
+++ b/src/tdfx_dripriv.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dripriv.h,v 1.2 1999/12/14 01:33:50 robin Exp $ */
#ifndef _TDFX_DRIPRIV_H_
#define _TDFX_DRIPRIV_H_
diff --git a/src/tdfx_driver.c b/src/tdfx_driver.c
index 1b51124..83f147a 100644
--- a/src/tdfx_driver.c
+++ b/src/tdfx_driver.c
@@ -35,7 +35,6 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.104tsi Exp $ */
/*
* Authors:
diff --git a/src/tdfx_hwcurs.c b/src/tdfx_hwcurs.c
index 3fd86b6..d5445a6 100644
--- a/src/tdfx_hwcurs.c
+++ b/src/tdfx_hwcurs.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c,v 1.4 2001/04/05 21:29:17 dawes Exp $ */
/*
Voodoo Banshee driver version 1.0.2
diff --git a/src/tdfx_io.c b/src/tdfx_io.c
index 190d3ae..173e772 100644
--- a/src/tdfx_io.c
+++ b/src/tdfx_io.c
@@ -24,7 +24,6 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c,v 1.6 2000/08/25 16:25:36 tsi Exp $ */
/*
* Authors:
diff --git a/src/tdfx_priv.c b/src/tdfx_priv.c
index 74c20ed..bffb20f 100644
--- a/src/tdfx_priv.c
+++ b/src/tdfx_priv.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c,v 1.15 2001/04/05 21:29:17 dawes Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/src/tdfx_priv.h b/src/tdfx_priv.h
index 28f72f3..e18d9df 100644
--- a/src/tdfx_priv.h
+++ b/src/tdfx_priv.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h,v 1.11 2001/06/05 15:54:15 alanh Exp $ */
#ifndef _TDFX_FIFO_H_
diff --git a/src/tdfx_sli.c b/src/tdfx_sli.c
index e7379fd..416edca 100644
--- a/src/tdfx_sli.c
+++ b/src/tdfx_sli.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c,v 1.6 2000/12/15 15:19:35 dawes Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/src/tdfx_video.c b/src/tdfx_video.c
index 5b7c7a3..22be0d3 100644
--- a/src/tdfx_video.c
+++ b/src/tdfx_video.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.20tsi Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/src/tdfxdefs.h b/src/tdfxdefs.h
index c661d64..c9c3ab5 100644
--- a/src/tdfxdefs.h
+++ b/src/tdfxdefs.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.14 2003/06/18 16:17:41 eich Exp $ */
/*
Voodoo Banshee driver version 1.0.1
commit b838b854e96c388081c0ae52320a849645f547c5
Author: Matthieu Herrb <matthieu.herrb@laas.fr>
Date: Sun Mar 9 00:00:33 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 8bbace5deb7b86c481ea3b0f764e8a6b879c5f7f
Author: Dave Airlie <airlied@redhat.com>
Date: Wed Feb 27 10:13:01 2008 +1000
update tdfx to use proper pciaccess detection
diff --git a/configure.ac b/configure.ac
index 77a8b9d..9069993 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,9 +51,6 @@ AC_ARG_ENABLE(dri, AC_HELP_STRING([--disable-dri],
[Disable DRI support [[default=auto]]]),
[DRI="$enableval"],
[DRI=auto])
-AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess],
- [Enable use of libpciaccess (default: disabled)]),
- [PCIACCESS=$enableval], [PCIACCESS=no])
# Checks for extensions
XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
@@ -65,14 +62,13 @@ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES])
sdkdir=$(pkg-config --variable=sdkdir xorg-server)
-AM_CONDITIONAL(PCIACCESS, [test "x$PCIACCESS" = xyes])
-if test "x$PCIACCESS" = xyes; then
- AC_DEFINE(PCIACCESS, 1, [Use libpciaccess])
- PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.7.0])
- XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
-fi
-
# 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
@@ -105,6 +101,12 @@ 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/tdfx.h b/src/tdfx.h
index 0663979..5f09401 100644
--- a/src/tdfx.h
+++ b/src/tdfx.h
@@ -38,7 +38,7 @@
/* Macros to aid source compatibilty between pci-rework and "classic" builds.
*/
-#ifdef PCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
#include <pciaccess.h>
#define DEVICE_ID(p) (p)->device_id
@@ -171,7 +171,7 @@ typedef struct TextureData_t {
#define MAXCHIPS 4
-#ifdef PCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
enum tdfx_chips {
Banshee = 0,
Voodoo3_2000,
@@ -183,7 +183,7 @@ enum tdfx_chips {
#endif
typedef struct _TDFXRec {
-#ifdef PCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
enum tdfx_chips match_id;
void *MMIOBase[MAXCHIPS];
void *FbBase;
@@ -200,7 +200,7 @@ typedef struct _TDFXRec {
int maxClip;
int MaxClock;
int ChipType;
-#ifdef PCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
struct pci_device *PciInfo[MAXCHIPS];
#else
pciVideoPtr PciInfo;
@@ -209,7 +209,7 @@ typedef struct _TDFXRec {
unsigned long MMIOAddr[MAXCHIPS];
EntityInfoPtr pEnt;
int numChips;
-#ifndef PCIACCESS
+#ifndef XSERVER_PCIACCESS
PCITAG PciTag[MAXCHIPS];
#endif
Bool Primary;
diff --git a/src/tdfx_dri.c b/src/tdfx_dri.c
index eb556bb..9548c00 100644
--- a/src/tdfx_dri.c
+++ b/src/tdfx_dri.c
@@ -345,7 +345,7 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen)
pDRIInfo->drmDriverName = TDFXKernelDriverName;
pDRIInfo->clientDriverName = TDFXClientDriverName;
-#ifdef PCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
pDRIInfo->busIdString = DRICreatePCIBusID(pTDFX->PciInfo[0]);
#else
if (xf86LoaderCheckSymbol("DRICreatePCIBusID")) {
@@ -518,7 +518,7 @@ TDFXDRIFinishScreenInit(ScreenPtr pScreen)
pTDFX->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT;
pTDFXDRI=(TDFXDRIPtr)pTDFX->pDRIInfo->devPrivate;
-#ifdef PCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
pTDFXDRI->deviceID = DEVICE_ID(pTDFX->PciInfo[0]);
#else
pTDFXDRI->deviceID = DEVICE_ID(pTDFX->PciInfo);
diff --git a/src/tdfx_driver.c b/src/tdfx_driver.c
index 6cc6c89..1b51124 100644
--- a/src/tdfx_driver.c
+++ b/src/tdfx_driver.c
@@ -112,7 +112,7 @@ static const OptionInfoRec * TDFXAvailableOptions(int chipid, int busid);
static void TDFXIdentify(int flags);
/* Identify if there is any hardware present that I know how to drive. */
-#ifdef PCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
static Bool TDFXPciProbe(DriverPtr drv, int entity_num,
struct pci_device *dev, intptr_t match_data);
#else
@@ -150,7 +150,7 @@ static void TDFXBlockHandler(int, pointer, pointer, pointer);
static void TDFXDisplayPowerManagementSet(ScrnInfoPtr pScrn,
int PowerManagermentMode, int flags);
-#ifdef PCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
#define TDFX_DEVICE_MATCH(d, sub, i) \
{ 0x121A, (d), PCI_MATCH_ANY, (sub), 0, 0, (i) }
@@ -181,7 +181,7 @@ _X_EXPORT DriverRec TDFX = {
TDFX_VERSION,
TDFX_DRIVER_NAME,
TDFXIdentify,
-#ifdef PCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
NULL,
#else
TDFXProbe,
@@ -192,7 +192,7 @@ _X_EXPORT DriverRec TDFX = {
0,
NULL,
-#ifdef PCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
tdfx_device_match,
TDFXPciProbe
#endif
@@ -206,7 +206,7 @@ static SymTabRec TDFXChipsets[] = {
{ -1, NULL }
};
-#ifndef PCIACCESS
+#ifndef XSERVER_LIBPCIACCESS
static PciChipsets TDFXPciChipsets[] = {
{ PCI_CHIP_BANSHEE, PCI_CHIP_BANSHEE, RES_SHARED_VGA },
{ PCI_CHIP_VOODOO3, PCI_CHIP_VOODOO3, RES_SHARED_VGA },
@@ -444,7 +444,7 @@ TDFXProbeDDC(ScrnInfoPtr pScrn, int index)
}
}
-#ifdef PCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
/**
* TDFXPciProbe
*
@@ -689,7 +689,7 @@ static int TDFXSizeToCfg(int size)
}
}
-#ifndef PCIACCESS
+#ifndef XSERVER_LIBPCIACCESS
static void
TDFXFindChips(ScrnInfoPtr pScrn, pciVideoPtr match)
{
@@ -888,7 +888,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
MessageType from;
int flags24;
rgb defaultWeight = {0, 0, 0};
-#ifdef PCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
struct pci_device *match;
#else
pciVideoPtr match;
@@ -898,7 +898,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
TDFXTRACE("TDFXPreInit start\n");
if (pScrn->numEntities != 1) return FALSE;
-#ifndef PCIACCESS
+#ifndef XSERVER_LIBPCIACCESS
/* Allocate driverPrivate */
pTDFX = TDFXGetRec(pScrn);
if (pTDFX == NULL) {
@@ -955,7 +955,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
#endif
#endif
-#ifdef PCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
match = pTDFX->PciInfo[0];
#else
match=pTDFX->PciInfo=xf86GetPciInfoForEntity(pTDFX->pEnt->index);
@@ -1150,7 +1150,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
pTDFX->MaxClock = pTDFX->pEnt->device->dacSpeeds[0];
from = X_CONFIG;
} else {
-#ifdef PCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
pTDFX->MaxClock = MaxClocks[pTDFX->match_id];
#else
switch (pTDFX->ChipType) {
@@ -1354,7 +1354,7 @@ TDFXMapMem(ScrnInfoPtr pScrn)
{
int i;
TDFXPtr pTDFX = TDFXPTR(pScrn);
-#ifdef PCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
int err;
#else
const int mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT;
@@ -1362,7 +1362,7 @@ TDFXMapMem(ScrnInfoPtr pScrn)
TDFXTRACE("TDFXMapMem start\n");
-#ifdef PCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
/* FIXME: I'm not convinced that this is correct for SLI cards, but I
* FIXME: don't have any such hardware to test.
*/
@@ -1420,7 +1420,7 @@ TDFXUnmapMem(ScrnInfoPtr pScrn)
TDFXTRACE("TDFXUnmapMem start\n");
pTDFX = TDFXPTR(pScrn);
-#ifdef PCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
pci_device_unmap_region(pTDFX->PciInfo[0], 0);
pci_device_unmap_region(pTDFX->PciInfo[0], 1);
@@ -1798,7 +1798,7 @@ TDFXInitWithBIOSData(ScrnInfoPtr pScrn)
if (!bios)
return FALSE;
-#ifdef PCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
pci_device_read_rom(pTDFX->PciInfo[0], bios);
#else
if (!xf86ReadPciBIOS(0, pTDFX->PciTag[0], 1, bios, T_B_SIZE)) {
commit 463f0590fdce3cfa0e74a6769ccf5f32dad33cbc
Author: James Cloos <cloos@jhcloos.com>
Date: Mon Sep 3 05:52:46 2007 -0400
Add *~ to .gitignore to skip patch/emacs droppings
diff --git a/.gitignore b/.gitignore
index fb1befd..2df4a8d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,4 @@ libtool
ltmain.sh
missing
stamp-h1
+*~
commit 36ee971310cd4536291829a1021ab8853cf62e9c
Author: James Cloos <cloos@jhcloos.com>
Date: Thu Aug 23 19:25:59 2007 -0400
Rename .cvsignore to .gitignore
diff --git a/.cvsignore b/.cvsignore
deleted file mode 100644
index fb1befd..0000000
--- a/.cvsignore
+++ /dev/null
@@ -1,19 +0,0 @@
-Makefile
-Makefile.in
-*.la
-*.lo
-aclocal.m4
-autom4te.cache
-config.guess
-config.h
-config.h.in
-config.log
-config.status
-config.sub
-configure
-depcomp
-install-sh
-libtool
-ltmain.sh
-missing
-stamp-h1
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fb1befd
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,19 @@
+Makefile
+Makefile.in
+*.la
+*.lo
+aclocal.m4
+autom4te.cache
+config.guess
+config.h
+config.h.in
+config.log
+config.status
+config.sub
+configure
+depcomp
+install-sh
+libtool
+ltmain.sh
+missing
+stamp-h1
diff --git a/man/.cvsignore b/man/.cvsignore
deleted file mode 100644
index 282522d..0000000
--- a/man/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-Makefile.in
diff --git a/man/.gitignore b/man/.gitignore
new file mode 100644
index 0000000..282522d
--- /dev/null
+++ b/man/.gitignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/src/.cvsignore b/src/.cvsignore
deleted file mode 100644
index 9730646..0000000
--- a/src/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.la
-*.lo
diff --git a/src/.gitignore b/src/.gitignore
new file mode 100644
index 0000000..9730646
--- /dev/null
+++ b/src/.gitignore
@@ -0,0 +1,6 @@
+.deps
+.libs
+Makefile
+Makefile.in
+*.la
+*.lo
commit 7f733531e54e455f9c27555c7552184f9da81f41
Author: Brice Goglin <bgoglin@debian.org>
Date: Tue Aug 7 11:57:02 2007 +0200
TDFX_*_VERSION using PACKAGE_VERSION_*
diff --git a/src/tdfx.h b/src/tdfx.h
index d1c9081..0663979 100644
--- a/src/tdfx.h
+++ b/src/tdfx.h
@@ -32,9 +32,9 @@
#define TDFX_VERSION 4000
#define TDFX_NAME "TDFX"
#define TDFX_DRIVER_NAME "tdfx"
-#define TDFX_MAJOR_VERSION 1
-#define TDFX_MINOR_VERSION 3
-#define TDFX_PATCHLEVEL 0
+#define TDFX_MAJOR_VERSION PACKAGE_VERSION_MAJOR
+#define TDFX_MINOR_VERSION PACKAGE_VERSION_MINOR
+#define TDFX_PATCHLEVEL PACKAGE_VERSION_PATCHLEVEL
/* Macros to aid source compatibilty between pci-rework and "classic" builds.
*/
commit 673c665c02f02e13d57303f817702177a170e80d
Author: Ian Romanick <idr@us.ibm.com>
Date: Fri Mar 30 08:00:12 2007 -0700
Initial pass at porting driver to pci-rework. DOES NOT WORK.
This is my initial pass at porting xf86-video-tdfx to the pci-rework
interfaces. For reasons that I'm not able to understand, it doesn't quite
work. It's clear that some piece of the hardware isn't being initialized
properly, but, by comparing the old code to the new, it's not clear why.
Does not impact the functionality of non-pci-rework builds.
diff --git a/configure.ac b/configure.ac
index 2bdc5a0..77a8b9d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,6 +51,9 @@ AC_ARG_ENABLE(dri, AC_HELP_STRING([--disable-dri],
[Disable DRI support [[default=auto]]]),
[DRI="$enableval"],
[DRI=auto])
+AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess],
+ [Enable use of libpciaccess (default: disabled)]),
+ [PCIACCESS=$enableval], [PCIACCESS=no])
# Checks for extensions
XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
@@ -62,6 +65,13 @@ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES])
sdkdir=$(pkg-config --variable=sdkdir xorg-server)
+AM_CONDITIONAL(PCIACCESS, [test "x$PCIACCESS" = xyes])
+if test "x$PCIACCESS" = xyes; then
+ AC_DEFINE(PCIACCESS, 1, [Use libpciaccess])
+ PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.7.0])
+ XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
+fi
+
# Checks for libraries.
# Checks for header files.
diff --git a/src/tdfx.h b/src/tdfx.h
index 617a5e2..d1c9081 100644
--- a/src/tdfx.h
+++ b/src/tdfx.h
@@ -36,12 +36,40 @@
#define TDFX_MINOR_VERSION 3
#define TDFX_PATCHLEVEL 0
+/* Macros to aid source compatibilty between pci-rework and "classic" builds.
+ */
+#ifdef PCIACCESS
+#include <pciaccess.h>
+
+#define DEVICE_ID(p) (p)->device_id
+
+#define PCI_READ_LONG(value, offset, card_index) \
+ pci_device_cfg_read_u32(pTDFX->PciInfo[(card_index)], & (value), (offset))
+
+#define PCI_WRITE_LONG(value, offset, card_index) \
+ pci_device_cfg_write_u32(pTDFX->PciInfo[(card_index)], (value), (offset))
+
+#define PCI_IO_BASE(p, region) \
+ (p)->regions[region].base_addr
+
+#define PCI_MEM_BASE(p, region) \
+ (p)->regions[region].base_addr
+#else
+#define DEVICE_ID(p) (p)->chipType
+
#define PCI_READ_LONG(value, offset, card_index) \
(value) = pciReadLong(pTDFX->PciTag[(card_index)], (offset))
#define PCI_WRITE_LONG(value, offset, card_index) \
pciWriteLong(pTDFX->PciTag[(card_index)], (offset), (value))
+#define PCI_IO_BASE(p, region) \
+ (p)->ioBase[region]
+
+#define PCI_MEM_BASE(p, region) \
+ (p)->memBase[region]
+#endif
+
struct _TDFXRec;
typedef struct _TDFXRec *TDFXPtr;
@@ -143,10 +171,27 @@ typedef struct TextureData_t {
#define MAXCHIPS 4
+#ifdef PCIACCESS
+enum tdfx_chips {
+ Banshee = 0,
+ Voodoo3_2000,
+ Voodoo3_3000,
+ Voodoo3_Unknown,
+ Voodoo5,
+ MAX_VOODOO_CARDS
+};
+#endif
+
typedef struct _TDFXRec {
+#ifdef PCIACCESS
+ enum tdfx_chips match_id;
+ void *MMIOBase[MAXCHIPS];
+ void *FbBase;
+#else
unsigned char *MMIOBase[MAXCHIPS];
unsigned char *FbBase;
unsigned char *myFbBase;
+#endif
IOADDRESS PIOBase[MAXCHIPS];
long FbMapSize;
int pixelFormat;
@@ -155,12 +200,18 @@ typedef struct _TDFXRec {
int maxClip;
int MaxClock;
int ChipType;
+#ifdef PCIACCESS
+ struct pci_device *PciInfo[MAXCHIPS];
+#else
pciVideoPtr PciInfo;
+#endif
unsigned long LinearAddr[MAXCHIPS];
unsigned long MMIOAddr[MAXCHIPS];
EntityInfoPtr pEnt;
int numChips;
+#ifndef PCIACCESS
PCITAG PciTag[MAXCHIPS];
+#endif
Bool Primary;
int HasSGRAM;
int PciCnt;
diff --git a/src/tdfx_dri.c b/src/tdfx_dri.c
index 765c716..eb556bb 100644
--- a/src/tdfx_dri.c
+++ b/src/tdfx_dri.c
@@ -345,6 +345,9 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen)
pDRIInfo->drmDriverName = TDFXKernelDriverName;
pDRIInfo->clientDriverName = TDFXClientDriverName;
+#ifdef PCIACCESS
+ pDRIInfo->busIdString = DRICreatePCIBusID(pTDFX->PciInfo[0]);
+#else
if (xf86LoaderCheckSymbol("DRICreatePCIBusID")) {
pDRIInfo->busIdString = DRICreatePCIBusID(pTDFX->PciInfo);
} else {
@@ -354,6 +357,7 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen)
((pciConfigPtr)pTDFX->PciInfo->thisCard)->devnum,
((pciConfigPtr)pTDFX->PciInfo->thisCard)->funcnum);
}
+#endif
pDRIInfo->ddxDriverMajorVersion = TDFX_MAJOR_VERSION;
pDRIInfo->ddxDriverMinorVersion = TDFX_MINOR_VERSION;
pDRIInfo->ddxDriverPatchVersion = TDFX_PATCHLEVEL;
@@ -514,7 +518,11 @@ TDFXDRIFinishScreenInit(ScreenPtr pScreen)
pTDFX->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT;
pTDFXDRI=(TDFXDRIPtr)pTDFX->pDRIInfo->devPrivate;
- pTDFXDRI->deviceID=pTDFX->PciInfo->chipType;
+#ifdef PCIACCESS
+ pTDFXDRI->deviceID = DEVICE_ID(pTDFX->PciInfo[0]);
+#else
+ pTDFXDRI->deviceID = DEVICE_ID(pTDFX->PciInfo);
+#endif
pTDFXDRI->width=pScrn->virtualX;
pTDFXDRI->height=pScrn->virtualY;
pTDFXDRI->mem=pScrn->videoRam*1024;
diff --git a/src/tdfx_driver.c b/src/tdfx_driver.c
index 01fa34d..6cc6c89 100644
--- a/src/tdfx_driver.c
+++ b/src/tdfx_driver.c
@@ -112,7 +112,12 @@ static const OptionInfoRec * TDFXAvailableOptions(int chipid, int busid);
static void TDFXIdentify(int flags);
/* Identify if there is any hardware present that I know how to drive. */
+#ifdef PCIACCESS
+static Bool TDFXPciProbe(DriverPtr drv, int entity_num,
+ struct pci_device *dev, intptr_t match_data);
+#else
static Bool TDFXProbe(DriverPtr drv, int flags);
+#endif
/* Process the config file and see if we have a valid configuration */
static Bool TDFXPreInit(ScrnInfoPtr pScrn, int flags);
@@ -145,15 +150,52 @@ static void TDFXBlockHandler(int, pointer, pointer, pointer);
static void TDFXDisplayPowerManagementSet(ScrnInfoPtr pScrn,
int PowerManagermentMode, int flags);
+#ifdef PCIACCESS
+#define TDFX_DEVICE_MATCH(d, sub, i) \
+ { 0x121A, (d), PCI_MATCH_ANY, (sub), 0, 0, (i) }
+
+static const struct pci_id_match tdfx_device_match[] = {
+ TDFX_DEVICE_MATCH(PCI_CHIP_BANSHEE, PCI_MATCH_ANY, Banshee),
+
+ /* There are *many* missing PCI IDs here.
+ */
+ TDFX_DEVICE_MATCH(PCI_CHIP_VOODOO3, 0x0036, Voodoo3_2000),
+ TDFX_DEVICE_MATCH(PCI_CHIP_VOODOO3, 0x003A, Voodoo3_3000),
+
+ TDFX_DEVICE_MATCH(PCI_CHIP_VOODOO3, PCI_MATCH_ANY, Voodoo3_Unknown),
+ TDFX_DEVICE_MATCH(PCI_CHIP_VOODOO5, PCI_MATCH_ANY, Voodoo5),
+ { 0, 0, 0 }
+};
+
+static const int MaxClocks[MAX_VOODOO_CARDS] = {
+ [Banshee] = 270000,
+ [Voodoo3_2000] = 300000,
+ [Voodoo3_3000] = 350000,
+ [Voodoo3_Unknown] = 300000,
+ [Voodoo5] = 350000
+};
+#endif
+
+
_X_EXPORT DriverRec TDFX = {
TDFX_VERSION,
TDFX_DRIVER_NAME,
TDFXIdentify,
+#ifdef PCIACCESS
+ NULL,
+#else
TDFXProbe,
+#endif
+
TDFXAvailableOptions,
NULL,
0,
- NULL
+ NULL,
+
+#ifdef PCIACCESS
+ tdfx_device_match,
+ TDFXPciProbe
+#endif
};
/* Chipsets */
@@ -164,12 +206,14 @@ static SymTabRec TDFXChipsets[] = {
{ -1, NULL }
};
+#ifndef PCIACCESS
static PciChipsets TDFXPciChipsets[] = {
{ PCI_CHIP_BANSHEE, PCI_CHIP_BANSHEE, RES_SHARED_VGA },
{ PCI_CHIP_VOODOO3, PCI_CHIP_VOODOO3, RES_SHARED_VGA },
{ PCI_CHIP_VOODOO5, PCI_CHIP_VOODOO5, RES_SHARED_VGA },
{ -1, -1, RES_UNDEFINED }
};
+#endif
/* !!! Do we want an option for alternate clocking? !!! */
@@ -400,15 +444,71 @@ TDFXProbeDDC(ScrnInfoPtr pScrn, int index)
}
}
-/*
- * TDFXProbe --
+#ifdef PCIACCESS
+/**
+ * TDFXPciProbe
*
* Look through the PCI bus to find cards that are TDFX boards.
* Setup the dispatch table for the rest of the driver functions.
+ */
+static Bool
+TDFXPciProbe(DriverPtr drv, int entity_num, struct pci_device *dev,
+ intptr_t match_data)
+{
+ ScrnInfoPtr pScrn;
+
+ TDFXTRACE("TDFXPciProbe start\n");
+
+
+ /* Allocate new ScrnInfoRec and claim the slot */
+ pScrn = xf86ConfigPciEntity(NULL, 0, entity_num, NULL, NULL,
+ NULL, NULL, NULL, NULL);
+ if (pScrn != NULL) {
+ TDFXPtr pTDFX;
+
+ pScrn->driverVersion = TDFX_VERSION;
+ pScrn->driverName = TDFX_DRIVER_NAME;
+ pScrn->name = TDFX_NAME;
+ pScrn->Probe = NULL;
+ pScrn->PreInit = TDFXPreInit;
+ pScrn->ScreenInit = TDFXScreenInit;
+ pScrn->SwitchMode = TDFXSwitchMode;
+ pScrn->AdjustFrame = TDFXAdjustFrame;
+ pScrn->EnterVT = TDFXEnterVT;
+ pScrn->LeaveVT = TDFXLeaveVT;
+ pScrn->FreeScreen = TDFXFreeScreen;
+ pScrn->ValidMode = TDFXValidMode;
+
+ /* Allocate driverPrivate */
+ pTDFX = TDFXGetRec(pScrn);
+ if (pTDFX == NULL) {
+ return FALSE;
+ }
+
+ pTDFX->initDone = FALSE;
+ pTDFX->match_id = (enum tdfx_chips) match_data;
+ pTDFX->pEnt = xf86GetEntityInfo(entity_num);
+ pTDFX->PciInfo[0] = dev;
+ pTDFX->numChips = 1;
+ pTDFX->Primary = xf86IsPrimaryPci(dev);
+
+ pTDFX->PIOBase[0] = dev->regions[2].base_addr;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "PIO base = 0x%lx\n", pTDFX->PIOBase[0]);
+ }
+
+ return (pScrn != NULL);
+}
+#else
+/**
+ * TDFXProbe
*
+ * Look through the PCI bus to find cards that are TDFX boards.
+ * Setup the dispatch table for the rest of the driver functions.
*/
static Bool
-TDFXProbe(DriverPtr drv, int flags) {
+TDFXProbe(DriverPtr drv, int flags)
+{
int i, numUsed, numDevSections, *usedChips;
GDevPtr *devSections;
Bool foundScreen = FALSE;
@@ -465,6 +565,7 @@ TDFXProbe(DriverPtr drv, int flags) {
return foundScreen;
}
+#endif
static int
TDFXCountRam(ScrnInfoPtr pScrn) {
@@ -588,6 +689,7 @@ static int TDFXSizeToCfg(int size)
}
}
+#ifndef PCIACCESS
static void
TDFXFindChips(ScrnInfoPtr pScrn, pciVideoPtr match)
{
@@ -613,6 +715,7 @@ TDFXFindChips(ScrnInfoPtr pScrn, pciVideoPtr match)
/* Disable the secondary chips for now */
pTDFX->numChips=1;
}
+#endif
static void
TDFXInitChips(ScrnInfoPtr pScrn)
@@ -785,12 +888,17 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
MessageType from;
int flags24;
rgb defaultWeight = {0, 0, 0};
+#ifdef PCIACCESS
+ struct pci_device *match;
+#else
pciVideoPtr match;
+#endif
int availableMem;
TDFXTRACE("TDFXPreInit start\n");
if (pScrn->numEntities != 1) return FALSE;
+#ifndef PCIACCESS
/* Allocate driverPrivate */
pTDFX = TDFXGetRec(pScrn);
if (pTDFX == NULL) {
@@ -800,6 +908,9 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
pTDFX->initDone=FALSE;
pTDFX->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
+#else
+ pTDFX = TDFXPTR(pScrn);
+#endif
if (flags & PROBE_DETECT) {
#if !defined(__powerpc__)
@@ -844,9 +955,13 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
#endif
#endif
+#ifdef PCIACCESS
+ match = pTDFX->PciInfo[0];
+#else
match=pTDFX->PciInfo=xf86GetPciInfoForEntity(pTDFX->pEnt->index);
TDFXFindChips(pScrn, match);
pTDFX->Primary = xf86IsPrimaryPci(pTDFX->PciInfo);
+#endif
if (xf86RegisterResources(pTDFX->pEnt->index, NULL, ResExclusive)) {
TDFXFreeRec(pScrn);
Reply to: