.cvsignore | 20 ----- .gitignore | 21 +++++ configure.ac | 16 +++- man/.cvsignore | 2 man/.gitignore | 2 man/Makefile.am | 1 src/.cvsignore | 6 - src/.gitignore | 6 + src/Makefile.am | 1 src/ct_BlitMM.h | 2 src/ct_Blitter.h | 2 src/ct_BltHiQV.h | 2 src/ct_accel.c | 5 - src/ct_bank.c | 1 src/ct_cursor.c | 1 src/ct_ddc.c | 1 src/ct_dga.c | 1 src/ct_driver.c | 207 ++++++++++++++++++++++++++++++++++++++++++++++++++--- src/ct_driver.h | 3 src/ct_pcirename.h | 122 +++++++++++++++++++++++++++++++ src/ct_regs.c | 1 src/ct_shadow.c | 1 src/ct_video.c | 5 - util/.cvsignore | 8 -- util/.gitignore | 8 ++ util/AsmMacros.h | 2 util/dRegs.c | 2 util/mRegs.c | 2 util/modClock.c | 1 29 files changed, 379 insertions(+), 73 deletions(-)
New commits: commit ce93cda53d399e3327577600e9bf2143f3128441 Author: Adam Jackson <[EMAIL PROTECTED]> Date: Wed Mar 19 13:39:29 2008 -0400 chips 1.2.0 diff --git a/configure.ac b/configure.ac index 8c87eb0..776f250 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ AC_PREREQ(2.57) AC_INIT([xf86-video-chips], - 1.1.1, + 1.2.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xf86-video-chips) commit 01348b9ec5202d4d5e81a4615361e6040fd5c8e4 Author: Adam Jackson <[EMAIL PROTECTED]> Date: Wed Mar 19 13:38:16 2008 -0400 Fix distcheck diff --git a/src/Makefile.am b/src/Makefile.am index a77c251..0ebf7ea 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -49,6 +49,7 @@ chips_drv_la_SOURCES = \ ct_dga.c \ ct_driver.c \ ct_driver.h \ + ct_pcirename.h \ ct_regs.c \ ct_shadow.c \ ct_video.c commit e5d3f0375d950387fb5b8e696675917861ab9158 Author: Adam Jackson <[EMAIL PROTECTED]> Date: Wed Mar 19 13:35:01 2008 -0400 Death to RCS tags. diff --git a/src/ct_BlitMM.h b/src/ct_BlitMM.h index 7660241..eea7763 100644 --- a/src/ct_BlitMM.h +++ b/src/ct_BlitMM.h @@ -1,10 +1,8 @@ -/* $XConsortium: ct_BlitMM.h /main/2 1996/10/25 10:28:31 kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_BlitMM.h,v 1.5 2002/11/25 14:04:58 eich Exp $ */ /* Definitions for the Chips and Technology BitBLT engine communication. */ /* These are done using Memory Mapped IO, of the registers */ diff --git a/src/ct_Blitter.h b/src/ct_Blitter.h index ecb84f1..6791ca9 100644 --- a/src/ct_Blitter.h +++ b/src/ct_Blitter.h @@ -1,10 +1,8 @@ -/* $XConsortium: ct_Blitter.h /main/2 1996/10/25 10:28:37 kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_Blitter.h,v 1.4 2002/01/25 21:55:58 tsi Exp $ */ /* Definitions for the Chips and Technology BitBLT engine communication. */ /* registers */ diff --git a/src/ct_BltHiQV.h b/src/ct_BltHiQV.h index 775aa54..8099d65 100644 --- a/src/ct_BltHiQV.h +++ b/src/ct_BltHiQV.h @@ -1,10 +1,8 @@ -/* $XConsortium: ct_BltHiQV.h /main/2 1996/10/25 10:28:43 kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_BltHiQV.h,v 1.10 2000/12/06 15:35:12 eich Exp $ */ /* Definitions for the Chips and Technology BitBLT engine communication. */ /* These are done using Memory Mapped IO, of the registers */ diff --git a/src/ct_accel.c b/src/ct_accel.c index 1ccb480..8d049eb 100644 --- a/src/ct_accel.c +++ b/src/ct_accel.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c,v 1.40tsi Exp $ */ /* * Copyright 1996, 1997, 1998 by David Bateman <[EMAIL PROTECTED]> * Modified 1997, 1998 by Nozomi Ytow diff --git a/src/ct_bank.c b/src/ct_bank.c index 7f50e3e..d79e2f4 100644 --- a/src/ct_bank.c +++ b/src/ct_bank.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_bank.c,v 1.6 2002/01/25 21:55:58 tsi Exp $ */ /* * Copyright 1997 diff --git a/src/ct_cursor.c b/src/ct_cursor.c index 34019e2..cc352d3 100644 --- a/src/ct_cursor.c +++ b/src/ct_cursor.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c,v 1.24 2001/10/01 13:44:03 eich Exp $ */ /* * Copyright 1994 The XFree86 Project diff --git a/src/ct_ddc.c b/src/ct_ddc.c index 2202fd6..5e86c17 100644 --- a/src/ct_ddc.c +++ b/src/ct_ddc.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_ddc.c,v 1.8 2001/05/09 19:57:04 dbateman Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/src/ct_dga.c b/src/ct_dga.c index e4d1c89..e3c1a00 100644 --- a/src/ct_dga.c +++ b/src/ct_dga.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_dga.c,v 1.3tsi Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/src/ct_driver.c b/src/ct_driver.c index c05798f..725fcab 100644 --- a/src/ct_driver.c +++ b/src/ct_driver.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c,v 1.132tsi Exp $ */ /* * Copyright 1993 by Jon Block <[EMAIL PROTECTED]> diff --git a/src/ct_driver.h b/src/ct_driver.h index 2b5dc7a..351e813 100644 --- a/src/ct_driver.h +++ b/src/ct_driver.h @@ -1,4 +1,3 @@ -/* $XConsortium: ct_driver.h /main/3 1996/10/27 11:49:29 kaleb $ */ /* * Modified 1996 by Egbert Eich <[EMAIL PROTECTED]> * Modified 1996 by David Bateman <[EMAIL PROTECTED]> @@ -22,7 +21,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h,v 1.33 2001/10/01 13:44:04 eich Exp $ */ #ifndef _CT_DRIVER_H_ diff --git a/src/ct_regs.c b/src/ct_regs.c index 5a88a1c..e2f62df 100644 --- a/src/ct_regs.c +++ b/src/ct_regs.c @@ -19,7 +19,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c,v 1.8tsi Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/src/ct_shadow.c b/src/ct_shadow.c index fe757c5..0750c19 100644 --- a/src/ct_shadow.c +++ b/src/ct_shadow.c @@ -1,4 +1,3 @@ -/* $XFree86: Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/src/ct_video.c b/src/ct_video.c index 01b93ca..a1e8044 100644 --- a/src/ct_video.c +++ b/src/ct_video.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c,v 1.16tsi Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/util/AsmMacros.h b/util/AsmMacros.h index 98e0b04..34ccc0a 100644 --- a/util/AsmMacros.h +++ b/util/AsmMacros.h @@ -1,4 +1,3 @@ -/* $XConsortium: AsmMacros.h /main/13 1996/10/25 11:33:12 kaleb $ */ /* * (c) Copyright 1993,1994 by David Wexelblat <[EMAIL PROTECTED]> * @@ -57,7 +56,6 @@ * */ -/* $XFree86$ */ #if defined(__GNUC__) #if defined(linux) && (defined(__alpha__) || defined(__ia64__)) diff --git a/util/dRegs.c b/util/dRegs.c index 0c8ee62..b7edc8f 100644 --- a/util/dRegs.c +++ b/util/dRegs.c @@ -1,10 +1,8 @@ -/* $XConsortium: dRegs.c /main/2 1996/10/27 11:49:40 kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/dRegs.c,v 1.9 2001/11/16 21:13:34 tsi Exp $ */ #ifdef __NetBSD__ # include <sys/types.h> diff --git a/util/mRegs.c b/util/mRegs.c index 4d8da11..f359738 100644 --- a/util/mRegs.c +++ b/util/mRegs.c @@ -1,10 +1,8 @@ -/* $XConsortium: mRegs.c /main/2 1996/10/27 11:49:43 kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/mRegs.c,v 1.6 2001/11/16 21:13:34 tsi Exp $ */ #ifdef __NetBSD__ # include <sys/types.h> diff --git a/util/modClock.c b/util/modClock.c index cce4f84..89a291a 100644 --- a/util/modClock.c +++ b/util/modClock.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/modClock.c,v 1.6 2001/11/16 21:13:34 tsi Exp $ */ #ifdef __NetBSD__ # include <sys/types.h> commit 2648205363fdf5587aa676e7d16d53be208b4448 Author: Dave Airlie <[EMAIL PROTECTED]> Date: Mon Mar 10 14:26:44 2008 +1000 chips: optionalise 1/4bpp support diff --git a/configure.ac b/configure.ac index 512a2dc..8c87eb0 100644 --- a/configure.ac +++ b/configure.ac @@ -63,6 +63,8 @@ CPPFLAGS="$CPPFLAGS $XORG_CFLAGS" AC_CHECK_DECL(XSERVER_LIBPCIACCESS, [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no], [#include "xorg-server.h"]) +AC_CHECK_HEADER(xf1bpp.h,[AC_DEFINE(HAVE_XF1BPP, 1, [Have 1bpp support])],[]) +AC_CHECK_HEADER(xf4bpp.h,[AC_DEFINE(HAVE_XF4BPP, 1, [Have 4bpp support])],[]) CPPFLAGS="$SAVE_CPPFLAGS" if test "x$XSERVER_LIBPCIACCESS" = xyes; then diff --git a/src/ct_driver.c b/src/ct_driver.c index b89c48b..c05798f 100644 --- a/src/ct_driver.c +++ b/src/ct_driver.c @@ -113,8 +113,12 @@ /* Needed for the 1 and 4 bpp framebuffers */ +#ifdef HAVE_XF1BPP #include "xf1bpp.h" +#endif +#ifdef HAVE_XF4BPP #include "xf4bpp.h" +#endif /* Needed by Resources Access Control (RAC) */ #include "xf86RAC.h" @@ -720,8 +724,12 @@ static const char *vgahwSymbols[] = { #ifdef XFree86LOADER static const char *miscfbSymbols[] = { +#ifdef HAVE_XF1BPP "xf1bppScreenInit", +#endif +#ifdef HAVE_XF4BPP "xf4bppScreenInit", +#endif "cfb8_16ScreenInit", NULL }; @@ -1390,6 +1398,7 @@ CHIPSPreInit(ScrnInfoPtr pScrn, int flags) /* Load bpp-specific modules */ switch (pScrn->bitsPerPixel) { +#ifdef HAVE_XF1BPP case 1: if (xf86LoadSubModule(pScrn, "xf1bpp") == NULL) { vbeFree(cPtr->pVbe); @@ -1399,6 +1408,8 @@ CHIPSPreInit(ScrnInfoPtr pScrn, int flags) } xf86LoaderReqSymbols("xf1bppScreenInit", NULL); break; +#endif +#ifdef HAVE_XF4BPP case 4: if (xf86LoadSubModule(pScrn, "xf4bpp") == NULL) { vbeFree(cPtr->pVbe); @@ -1408,6 +1419,7 @@ CHIPSPreInit(ScrnInfoPtr pScrn, int flags) } xf86LoaderReqSymbols("xf4bppScreenInit", NULL); break; +#endif case 16: if (cPtr->Flags & ChipsOverlay8plus16) { if (xf86LoadSubModule(pScrn, "xf8_16bpp") == NULL) { @@ -4114,18 +4126,22 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } switch (pScrn->bitsPerPixel) { +#ifdef HAVE_XF1BPP case 1: ret = xf1bppScreenInit(pScreen, FBStart, width,height, pScrn->xDpi, pScrn->yDpi, displayWidth); break; +#endif +#ifdef HAVE_XF4BPP case 4: ret = xf4bppScreenInit(pScreen, FBStart, width,height, pScrn->xDpi, pScrn->yDpi, displayWidth); break; +#endif case 16: if (cPtr->Flags & ChipsOverlay8plus16) { ret = cfb8_16ScreenInit(pScreen, (unsigned char *)FBStart + commit 23aa658bbf38c35df1769eb25882ce35c19cafc9 Author: Dave Airlie <[EMAIL PROTECTED]> Date: Mon Mar 10 14:04:38 2008 +1000 chips: remove ALLOCATE_LOCAL diff --git a/src/ct_accel.c b/src/ct_accel.c index d56f009..1ccb480 100644 --- a/src/ct_accel.c +++ b/src/ct_accel.c @@ -1182,7 +1182,7 @@ CTNAME(CacheMonoStipple)(ScrnInfoPtr pScrn, PixmapPtr pPix) } else funcNo = 2; pad = (((pCache->w * bpp) + 31) >> 5) << 2; - dstPtr = data = (unsigned char*)ALLOCATE_LOCAL(pad * pCache->h); + dstPtr = data = (unsigned char*)xalloc(pad * pCache->h); srcPtr = (unsigned char*)pPix->devPrivate.ptr; StippleFunc = StippleTab[funcNo]; @@ -1210,7 +1210,7 @@ CTNAME(CacheMonoStipple)(ScrnInfoPtr pScrn, PixmapPtr pPix) pScrn, pCache->x, pCache->y, pCache->w, pCache->h, data, pad, bpp, pScrn->depth); - DEALLOCATE_LOCAL(data); + xfree(data); return pCache; } commit c8e2b5506e0ae30abe455e63e596b502bd71748d Author: Matthieu Herrb <[EMAIL PROTECTED]> Date: Sat Mar 8 23:25:39 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 59d4f098f5dec528b67503ae63ab3fe5786fe7ef Author: Dave Airlie <[EMAIL PROTECTED]> Date: Wed Feb 27 15:13:46 2008 +1000 add another missing rename file diff --git a/src/ct_pcirename.h b/src/ct_pcirename.h new file mode 100644 index 0000000..f0f5cf8 --- /dev/null +++ b/src/ct_pcirename.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 CIRPCIRENAME_H +#define CIRPCIRENAME_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 /* CIRPCIRENAME_H */ commit a995c2a87b2bee71ee67d9fbcd6f65074e9ae72f Author: Dave Airlie <[EMAIL PROTECTED]> Date: Wed Feb 27 14:55:15 2008 +1000 chips: pciaccess conversion diff --git a/configure.ac b/configure.ac index d5e02ba..512a2dc 100644 --- a/configure.ac +++ b/configure.ac @@ -58,6 +58,18 @@ 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" + +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) # Checks for header files. AC_HEADER_STDC diff --git a/src/ct_driver.c b/src/ct_driver.c index 31fc0fb..b89c48b 100644 --- a/src/ct_driver.c +++ b/src/ct_driver.c @@ -137,7 +137,12 @@ /* Mandatory functions */ static const OptionInfoRec * CHIPSAvailableOptions(int chipid, int busid); static void CHIPSIdentify(int flags); +#ifdef XSERVER_LIBPCIACCESS +static Bool CHIPSPciProbe(DriverPtr drv, int entity_num, + struct pci_device *dev, intptr_t match_data); +#else static Bool CHIPSProbe(DriverPtr drv, int flags); +#endif static Bool CHIPSPreInit(ScrnInfoPtr pScrn, int flags); static Bool CHIPSScreenInit(int Index, ScreenPtr pScreen, int argc, char **argv); @@ -469,6 +474,25 @@ static DisplayModeRec ChipsNTSCMode = { #define CHIPS_MINOR_VERSION PACKAGE_VERSION_MINOR #define CHIPS_PATCHLEVEL PACKAGE_VERSION_PATCHLEVEL + +#ifdef XSERVER_LIBPCIACCESS + +#define CHIPS_DEVICE_MATCH(d, i) \ + { PCI_VENDOR_CHIPSTECH, (d), PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, (i) } + +static const struct pci_id_match chips_device_match[] = { + CHIPS_DEVICE_MATCH(PCI_CHIP_65545, 0), + CHIPS_DEVICE_MATCH(PCI_CHIP_65548, 0), + CHIPS_DEVICE_MATCH(PCI_CHIP_65550, 0), + CHIPS_DEVICE_MATCH(PCI_CHIP_65554, 0), + CHIPS_DEVICE_MATCH(PCI_CHIP_65555, 0), + CHIPS_DEVICE_MATCH(PCI_CHIP_68554, 0), + CHIPS_DEVICE_MATCH(PCI_CHIP_69000, 0), + CHIPS_DEVICE_MATCH(PCI_CHIP_69030, 0), + { 0, 0, 0 }, +}; +#endif + /* * This contains the functions needed by the server after loading the driver * module. It must be supplied, and gets passed back by the SetupProc @@ -481,10 +505,20 @@ _X_EXPORT DriverRec CHIPS = { CHIPS_VERSION, CHIPS_DRIVER_NAME, CHIPSIdentify, +#ifdef XSERVER_LIBPCIACCESS + NULL, +#else CHIPSProbe, +#endif CHIPSAvailableOptions, NULL, - 0 + 0, + NULL, + +#ifdef XSERVER_LIBPCIACCESS + chips_device_match, + CHIPSPciProbe, +#endif }; static SymTabRec CHIPSChipsets[] = { @@ -507,6 +541,7 @@ static SymTabRec CHIPSChipsets[] = { { -1, NULL } }; + /* Conversion PCI ID to chipset name */ static PciChipsets CHIPSPCIchipsets[] = { { CHIPS_CT65545, PCI_CHIP_65545, RES_SHARED_VGA }, @@ -854,6 +889,68 @@ CHIPSAvailableOptions(int chipid, int busid) } /* Mandatory */ +#ifdef XSERVER_LIBPCIACCESS +Bool +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 */ + pScrn = xf86ConfigPciEntity(pScrn, 0, entity_num, CHIPSPCIchipsets, NULL, + NULL, NULL, NULL, NULL); + if (pScrn != NULL) { + /* Fill in what we can of the ScrnInfoRec */ + pScrn->driverVersion = CHIPS_VERSION; + pScrn->driverName = CHIPS_DRIVER_NAME; + pScrn->name = CHIPS_NAME; + pScrn->Probe = NULL; + pScrn->PreInit = CHIPSPreInit; + pScrn->ScreenInit = CHIPSScreenInit; + pScrn->SwitchMode = CHIPSSwitchMode; + pScrn->AdjustFrame = CHIPSAdjustFrame; + pScrn->EnterVT = CHIPSEnterVT; + pScrn->LeaveVT = CHIPSLeaveVT; + pScrn->FreeScreen = CHIPSFreeScreen; + pScrn->ValidMode = CHIPSValidMode; + + /* + * For cards that can do dual head per entity, mark the entity + * as sharable. + */ + pEnt = xf86GetEntityInfo(entity_num); + if (pEnt->chipset == CHIPS_CT69030) { + CHIPSEntPtr cPtrEnt = NULL; + DevUnion *pPriv; + + xf86SetEntitySharable(entity_num); + /* Allocate an entity private if necessary */ + if (CHIPSEntityIndex < 0) + CHIPSEntityIndex = xf86AllocateEntityPrivateIndex(); + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], CHIPSEntityIndex); + if (!pPriv->ptr) { + pPriv->ptr = xnfcalloc(sizeof(CHIPSEntRec), 1); + cPtrEnt = pPriv->ptr; + cPtrEnt->lastInstance = -1; + } else { + cPtrEnt = pPriv->ptr; + } + /* + * Set the entity instance for this instance of the driver. For + * dual head per card, instance 0 is the "master" instance, driving + * the primary head, and instance 1 is the "slave". + */ + cPtrEnt->lastInstance++; + xf86SetEntityInstanceForScreen(pScrn, pScrn->entityList[0], + cPtrEnt->lastInstance); + } + } + + return (pScrn != NULL); +} +#else static Bool CHIPSProbe(DriverPtr drv, int flags) { @@ -974,6 +1071,7 @@ CHIPSProbe(DriverPtr drv, int flags) xfree(devSections); return foundScreen; } +#endif static int chipsFindIsaDevice(GDevPtr dev) @@ -1107,9 +1205,11 @@ CHIPSPreInit(ScrnInfoPtr pScrn, int flags) if (cPtr->pEnt->location.type == BUS_PCI) { pciPtr = xf86GetPciInfoForEntity(cPtr->pEnt->index); cPtr->PciInfo = pciPtr; +#ifndef XSERVER_LIBPCIACCESS cPtr->PciTag = pciTag(cPtr->PciInfo->bus, cPtr->PciInfo->device, cPtr->PciInfo->func); +#endif } } /* INT10 */ @@ -1536,10 +1636,10 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags) /* Tack on 0x800000 to access the big-endian aperture? */ #if X_BYTE_ORDER == X_BIG_ENDIAN if (BE_SWAP_APRETURE(pScrn,cPtr)) - cPtr->FbAddress = (cPtr->PciInfo->memBase[0] & 0xff800000) + 0x800000L; + cPtr->FbAddress = (PCI_REGION_BASE(cPtr->PciInfo, 0, REGION_MEM) & 0xff800000) + 0x800000L; else #endif - cPtr->FbAddress = cPtr->PciInfo->memBase[0] & 0xff800000; + cPtr->FbAddress = PCI_REGION_BASE(cPtr->PciInfo, 0, REGION_MEM) & 0xff800000; from = X_PROBED; if (xf86RegisterResources(cPtr->pEnt->index,NULL,ResNone)) @@ -3108,7 +3208,7 @@ chipsPreInit655xx(ScrnInfoPtr pScrn, int flags) mask &= 0xCF; } if (cPtr->pEnt->location.type == BUS_PCI) { - cPtr->FbAddress = cPtr->PciInfo->memBase[0] & 0xff800000; + cPtr->FbAddress = PCI_REGION_BASE(cPtr->PciInfo, 0, REGION_MEM) & 0xff800000; if (xf86RegisterResources(cPtr->pEnt->index,NULL,ResNone)) useLinear = FALSE; from = X_PROBED; @@ -7028,6 +7128,7 @@ chipsMapMem(ScrnInfoPtr pScrn) if (cPtr->Flags & ChipsLinearSupport) { if (cPtr->UseMMIO) { if (IS_HiQV(cPtr)) { +#ifndef XSERVER_LIBPCIACCESS if (cPtr->pEnt->location.type == BUS_PCI) cPtr->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO_32BIT,cPtr->PciTag, cPtr->IOAddress, @@ -7035,7 +7136,20 @@ chipsMapMem(ScrnInfoPtr pScrn) else cPtr->MMIOBase = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO_32BIT, cPtr->IOAddress, 0x20000L); +#else + { + void** result = (void**)&cPtr->MMIOBase; + int err = pci_device_map_range(cPtr->PciInfo, + cPtr->IOAddress, + 0x20000L, + PCI_DEV_MAP_FLAG_WRITABLE, + result); + if (err) + return FALSE; + } +#endif } else { +#ifndef XSERVER_LIBPCIACCESS if (cPtr->pEnt->location.type == BUS_PCI) cPtr->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO_32BIT, cPtr->PciTag, cPtr->IOAddress, @@ -7043,6 +7157,18 @@ chipsMapMem(ScrnInfoPtr pScrn) else cPtr->MMIOBase = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO_32BIT, cPtr->IOAddress, 0x10000L); +#else + { + void** result = (void**)&cPtr->MMIOBase; + int err = pci_device_map_range(cPtr->PciInfo, + cPtr->IOAddress, + 0x10000L, + PCI_DEV_MAP_FLAG_WRITABLE, + result); + if (err) + return FALSE; + } +#endif } if (cPtr->MMIOBase == NULL) @@ -7065,6 +7191,7 @@ chipsMapMem(ScrnInfoPtr pScrn) } } +#ifndef XSERVER_LIBPCIACCESS if (cPtr->pEnt->location.type == BUS_PCI) cPtr->FbBase = xf86MapPciMem(pScrn->scrnIndex,VIDMEM_FRAMEBUFFER, cPtr->PciTag, Addr, Map); @@ -7072,14 +7199,32 @@ chipsMapMem(ScrnInfoPtr pScrn) else cPtr->FbBase = xf86MapVidMem(pScrn->scrnIndex,VIDMEM_FRAMEBUFFER, Addr, Map); +#else + { + void** result = (void**)&cPtr->FbBase; + int err = pci_device_map_range(cPtr->PciInfo, + Addr, + Map, + PCI_DEV_MAP_FLAG_WRITABLE | + PCI_DEV_MAP_FLAG_WRITE_COMBINE, + result); + if (err) + return FALSE; + } + +#endif if (cPtr->FbBase == NULL) return FALSE; } if (cPtr->Flags & ChipsFullMMIOSupport) { +#ifndef XSERVER_LIBPCIACCESS cPtr->MMIOBaseVGA = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,cPtr->PciTag, cPtr->IOAddress, 0x2000L); +#else + cPtr->MMIOBaseVGA = cPtr->MMIOBase; +#endif /* 69030 MMIO Fix. * * The hardware lets us map the PipeB data registers @@ -7089,9 +7234,22 @@ chipsMapMem(ScrnInfoPtr pScrn) * pipe and to toggle between them as necessary. -GHB */ if (cPtr->Flags & ChipsDualChannelSupport) +#ifndef XSERVER_LIBPCIACCESS cPtr->MMIOBasePipeB = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,cPtr->PciTag, cPtr->IOAddress + 0x800000, 0x2000L); +#else + { + void** result = (void**)&cPtr->MMIOBasePipeB; + int err = pci_device_map_range(cPtr->PciInfo, + cPtr->IOAddress + 0x800000, + 0x2000L, + PCI_DEV_MAP_FLAG_WRITABLE, + result); + if (err) + return FALSE; + } +#endif cPtr->MMIOBasePipeA = cPtr->MMIOBaseVGA; } @@ -7115,21 +7273,39 @@ chipsUnmapMem(ScrnInfoPtr pScrn) if (cPtr->Flags & ChipsLinearSupport) { if (IS_HiQV(cPtr)) { +#ifndef XSERVER_LIBPCIACCESS if (cPtr->MMIOBase) xf86UnMapVidMem(pScrn->scrnIndex, (pointer)cPtr->MMIOBase, 0x20000); if (cPtr->MMIOBasePipeB) xf86UnMapVidMem(pScrn->scrnIndex, (pointer)cPtr->MMIOBasePipeB, 0x20000); +#else + if (cPtr->MMIOBase) + pci_device_unmap_range(cPtr->PciInfo, cPtr->MMIOBase, 0x20000); + + if (cPtr->MMIOBasePipeB) + pci_device_unmap_range(cPtr->PciInfo, cPtr->MMIOBasePipeB, 0x2000); + +#endif cPtr->MMIOBasePipeB = NULL; } else { +#ifndef XSERVER_LIBPCIACCESS if (cPtr->MMIOBase) xf86UnMapVidMem(pScrn->scrnIndex, (pointer)cPtr->MMIOBase, 0x10000); +#else + if (cPtr->MMIOBase) + pci_device_unmap_range(cPtr->PciInfo, cPtr->MMIOBase, 0x10000); +#endif } cPtr->MMIOBase = NULL; +#ifndef XSERVER_LIBPCIACCESS xf86UnMapVidMem(pScrn->scrnIndex, (pointer)cPtr->FbBase, cPtr->FbMapSize); +#else + pci_device_unmap_range(cPtr->PciInfo, cPtr->FbBase, cPtr->FbMapSize); +#endif } cPtr->FbBase = NULL; diff --git a/src/ct_driver.h b/src/ct_driver.h index 0c5b604..2b5dc7a 100644 --- a/src/ct_driver.h +++ b/src/ct_driver.h @@ -28,6 +28,7 @@ #ifndef _CT_DRIVER_H_ #define _CT_DRIVER_H_ +#include "ct_pcirename.h" #include "xaa.h" #include "vbe.h" #include "xaalocal.h" /* XAA internals as we replace some of XAA */ commit d449ee092bbc8b4e08371b8067f1d8e320c4297e Author: James Cloos <[EMAIL PROTECTED]> Date: Mon Sep 3 05:52:29 2007 -0400 Add *~ to .gitignore to skip patch/emacs droppings diff --git a/.gitignore b/.gitignore index c7bcbee..5d02f1c 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ libtool ltmain.sh missing stamp-h1 +*~ commit a4aff9cd9f213125993fd424aa555c466c48a7ed Author: James Cloos <[EMAIL PROTECTED]> Date: Thu Aug 23 19:25:46 2007 -0400 Rename .cvsignore to .gitignore diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index c7bcbee..0000000 --- a/.cvsignore +++ /dev/null @@ -1,20 +0,0 @@ -Makefile -Makefile.in -*.la -*.lo -aclocal.m4 -autom4te.cache -compile -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..c7bcbee --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +Makefile +Makefile.in +*.la +*.lo +aclocal.m4 +autom4te.cache +compile +config.guess +config.h +config.h.in -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]