rpms/xorg-x11-drv-neomagic/devel neomagic-1.1.1-pciaccess.patch, NONE, 1.1 xorg-x11-drv-neomagic.spec, 1.14, 1.15

Dave Airlie (airlied) fedora-extras-commits at redhat.com
Wed Feb 27 01:48:24 UTC 2008


Author: airlied

Update of /cvs/pkgs/rpms/xorg-x11-drv-neomagic/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv13817

Modified Files:
	xorg-x11-drv-neomagic.spec 
Added Files:
	neomagic-1.1.1-pciaccess.patch 
Log Message:
* Wed Feb 27 2008 Dave Airlie <airlied at redhat.com> - 1.1.1-6
- add pciaccess support


neomagic-1.1.1-pciaccess.patch:

--- NEW FILE neomagic-1.1.1-pciaccess.patch ---
diff --git a/configure.ac b/configure.ac
index 50c0a20..1b0f433 100644
--- a/configure.ac
+++ b/configure.ac
@@ -59,10 +60,22 @@ 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
 
+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([XORG_CFLAGS])
 AC_SUBST([moduledir])
 
diff --git a/src/Makefile.am b/src/Makefile.am
index cf5ab19..c09962b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -43,4 +43,5 @@ neomagic_drv_la_SOURCES = \
          neo_reg.h \
          neo_shadow.c \
          neo_video.c \
-         neo_video.h
+         neo_video.h \
+	 neo_pcirename.h
diff --git a/src/neo.h b/src/neo.h
index 23f2c7c..27ec566 100644
--- a/src/neo.h
+++ b/src/neo.h
@@ -37,6 +37,9 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
 #include <string.h>
+
+#include "neo_pcirename.h"
+
 /* All drivers should typically include these */
 #include "xf86.h"
 #include "xf86_OSproc.h"
@@ -201,7 +204,9 @@ typedef struct neoRec
 {
     int NeoChipset;
     pciVideoPtr PciInfo;
+#ifndef XSERVER_LIBPCIACCESS
     PCITAG      PciTag;
+#endif
     EntityInfoPtr pEnt;
     XAAInfoRecPtr	AccelInfoRec;
     NEOACLRec Accel;
diff --git a/src/neo_driver.c b/src/neo_driver.c
index 1fca1f5..3d18916 100644
--- a/src/neo_driver.c
+++ b/src/neo_driver.c
@@ -158,9 +158,9 @@ static int      neoFindMode(int xres, int yres, int depth);
 #define NEO_NAME "NEOMAGIC"
 #define NEO_DRIVER_NAME "neomagic"
 
-#define NEO_MAJOR_VERSION 1
-#define NEO_MINOR_VERSION 1
-#define NEO_PATCHLEVEL 1
+#define NEO_MAJOR_VERSION PACKAGE_VERSION_MAJOR
+#define NEO_MINOR_VERSION PACKAGE_VERSION_MINOR
+#define NEO_PATCHLEVEL PACKAGE_VERSION_PATCHLEVEL
 
 /*
  * This is intentionally screen-independent.  It indicates the binding
@@ -778,9 +778,11 @@ NEOPreInit(ScrnInfoPtr pScrn, int flags)
 	/* This driver can handle ISA and PCI buses */
 	if (nPtr->pEnt->location.type == BUS_PCI) {
 	    nPtr->PciInfo = xf86GetPciInfoForEntity(nPtr->pEnt->index);
+#ifndef XSERVER_LIBPCIACCESS
 	    nPtr->PciTag = pciTag(nPtr->PciInfo->bus, 
 				  nPtr->PciInfo->device,
 				  nPtr->PciInfo->func);
+#endif
 	}
     }
     xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Chipset is a ");
@@ -1221,7 +1223,7 @@ NEOPreInit(ScrnInfoPtr pScrn, int flags)
 	
     if (nPtr->pEnt->location.type == BUS_PCI) {
 	if (!nPtr->NeoLinearAddr) {
-	    nPtr->NeoLinearAddr = nPtr->PciInfo->memBase[0];
+	    nPtr->NeoLinearAddr = PCI_REGION_BASE(nPtr->PciInfo, 0, REGION_MEM);
 	    xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
 		       "FB base address is set at 0x%lX.\n",
 		       nPtr->NeoLinearAddr);
@@ -1241,8 +1243,8 @@ NEOPreInit(ScrnInfoPtr pScrn, int flags)
 	    case NM2230:
 	    case NM2360:
 	    case NM2380:
-		nPtr->NeoMMIOAddr = nPtr->PciInfo->memBase[1];
-		nPtr->NeoMMIOAddr2 = nPtr->PciInfo->memBase[2];
+		nPtr->NeoMMIOAddr = PCI_REGION_BASE(nPtr->PciInfo, 1, REGION_MEM);
+		nPtr->NeoMMIOAddr2 = PCI_REGION_BASE(nPtr->PciInfo, 2, REGION_MEM);
 		break;
 	    }
 	    xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
@@ -2057,6 +2059,8 @@ neoMapMem(ScrnInfoPtr pScrn)
     if (!nPtr->noLinear) {
 	if (!nPtr->noMMIO) {
 	    if (nPtr->pEnt->location.type == BUS_PCI){
+
+#ifndef XSERVER_LIBPCIACCESS
 		nPtr->NeoMMIOBase =
 		    xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,
 				  nPtr->PciTag, nPtr->NeoMMIOAddr,
@@ -2067,6 +2071,29 @@ neoMapMem(ScrnInfoPtr pScrn)
 				      nPtr->PciTag, nPtr->NeoMMIOAddr2,
 				      0x100000L);
 		}
+
+#else
+		void** result = (void**)&nPtr->NeoMMIOBase;
+		int err = pci_device_map_range(nPtr->PciInfo,
+					       nPtr->NeoMMIOAddr,
+					       0x200000L,
+					       PCI_DEV_MAP_FLAG_WRITABLE,
+					       result);
+		if (err)
+		    return FALSE;
+		
+		if (nPtr->NeoMMIOAddr2 != 0){
+		    result = (void**)&nPtr->NeoMMIOBase2;
+		    int err = pci_device_map_range(nPtr->PciInfo,
+						   nPtr->NeoMMIOAddr2,
+						   0x100000L,
+						   PCI_DEV_MAP_FLAG_WRITABLE,
+						   result);
+
+		    if (err) 
+			return FALSE;
+		}
+#endif
 	    } else
 		nPtr->NeoMMIOBase =
 		    xf86MapVidMem(pScrn->scrnIndex,
@@ -2077,11 +2104,26 @@ neoMapMem(ScrnInfoPtr pScrn)
 	}
 
 	if (nPtr->pEnt->location.type == BUS_PCI)
+
+#ifndef XSERVER_LIBPCIACCESS
 	    nPtr->NeoFbBase =
 		xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
 			      nPtr->PciTag,
 			      (unsigned long)nPtr->NeoLinearAddr,
 			      nPtr->NeoFbMapSize);
+#else
+	{
+	    void** result = (void**)&nPtr->NeoFbBase;
+	    int err = pci_device_map_range(nPtr->PciInfo,
+					   nPtr->NeoLinearAddr,
+					   nPtr->NeoFbMapSize,
+					   PCI_DEV_MAP_FLAG_WRITABLE |
+					   PCI_DEV_MAP_FLAG_WRITE_COMBINE,
+					   result);
+	    if (err)
+		return FALSE;
+	}
+#endif
 	else
 	    nPtr->NeoFbBase =
 		xf86MapVidMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
diff --git a/src/neo_pcirename.h b/src/neo_pcirename.h
new file mode 100644
index 0000000..f0f5cf8
--- /dev/null
+++ b/src/neo_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 */


Index: xorg-x11-drv-neomagic.spec
===================================================================
RCS file: /cvs/pkgs/rpms/xorg-x11-drv-neomagic/devel/xorg-x11-drv-neomagic.spec,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- xorg-x11-drv-neomagic.spec	20 Feb 2008 07:36:22 -0000	1.14
+++ xorg-x11-drv-neomagic.spec	27 Feb 2008 01:47:49 -0000	1.15
@@ -7,7 +7,7 @@
 Summary:   Xorg X11 neomagic video driver
 Name:      xorg-x11-drv-neomagic
 Version:   1.1.1
-Release:   5%{?dist}
+Release:   6%{?dist}
 URL:       http://www.x.org
 License:   MIT
 Group:     User Interface/X Hardware Support
@@ -16,20 +16,25 @@
 Source0:   ftp://ftp.x.org/pub/individual/driver/%{tarball}-%{version}.tar.bz2
 Source1:   neomagic.xinf
 
+Patch0: neomagic-1.1.1-pciaccess.patch
+
 ExclusiveArch: %{ix86}
 
 BuildRequires: pkgconfig
-BuildRequires: xorg-x11-server-sdk >= 1.0.99.901
+BuildRequires: xorg-x11-server-sdk >= 1.4.99.1
+BuildRequires: automake autoconf libtool pkgconfig
 
-Requires:  xorg-x11-server-Xorg >= 1.0.99.901
+Requires:  xorg-x11-server-Xorg >= 1.4.99.1
 
 %description 
 X.Org X11 neomagic video driver.
 
 %prep
 %setup -q -n %{tarball}-%{version}
+%patch0 -p1 -b .pciaccess
 
 %build
+aclocal; autoheader; automake -a; autoconf
 %configure --disable-static
 make
 
@@ -55,6 +60,9 @@
 %{_mandir}/man4/neomagic.4*
 
 %changelog
+* Wed Feb 27 2008 Dave Airlie <airlied at redhat.com> - 1.1.1-6
+- add pciaccess support
+
 * Wed Feb 20 2008 Fedora Release Engineering <rel-eng at fedoraproject.org> - 1.1.1-5
 - Autorebuild for GCC 4.3
 




More information about the fedora-extras-commits mailing list