rpms/xorg-x11-drv-i740/devel i740-pciaccess.patch, NONE, 1.1 xorg-x11-drv-i740.spec, 1.16, 1.17
Dave Airlie (airlied)
fedora-extras-commits at redhat.com
Mon Mar 10 02:31:03 UTC 2008
Author: airlied
Update of /cvs/pkgs/rpms/xorg-x11-drv-i740/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv8725
Modified Files:
xorg-x11-drv-i740.spec
Added Files:
i740-pciaccess.patch
Log Message:
* Mon Mar 10 2008 Dave Airlie <airlied at redhat.com> 1.1.0-7
- pciaccess conversion
i740-pciaccess.patch:
--- NEW FILE i740-pciaccess.patch ---
diff --git a/configure.ac b/configure.ac
index e5524fb..bf213be 100644
--- a/configure.ac
+++ b/configure.ac
@@ -58,10 +58,23 @@ 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/i740.h b/src/i740.h
index 267c13c..aa31e3c 100644
--- a/src/i740.h
+++ b/src/i740.h
@@ -36,6 +36,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef _I740_H_
#define _I740_H_
+#include "i740_pcirename.h"
+
#include "xf86PciInfo.h"
#include "xf86Pci.h"
@@ -99,7 +101,9 @@ typedef struct _I740Rec {
unsigned long MMIOAddr;
EntityInfoPtr pEnt;
pciVideoPtr PciInfo;
+#ifndef XSERVER_LIBPCIACCESS
PCITAG PciTag;
+#endif
int HasSGRAM;
I740RegRec SavedReg;
I740RegRec ModeReg;
diff --git a/src/i740_driver.c b/src/i740_driver.c
index c21163d..ee25967 100644
--- a/src/i740_driver.c
+++ b/src/i740_driver.c
@@ -142,9 +142,9 @@ static Bool I740UnmapMem(ScrnInfoPtr pScrn);
#define I740_VERSION 4000
#define I740_NAME "I740"
#define I740_DRIVER_NAME "i740"
-#define I740_MAJOR_VERSION 1
-#define I740_MINOR_VERSION 1
-#define I740_PATCHLEVEL 0
+#define I740_MAJOR_VERSION PACKAGE_VERSION_MAJOR
+#define I740_MINOR_VERSION PACKAGE_VERSION_MINOR
+#define I740_PATCHLEVEL PACKAGE_VERSION_PATCHLEVEL
_X_EXPORT DriverRec I740 = {
I740_VERSION,
@@ -508,8 +508,10 @@ I740PreInit(ScrnInfoPtr pScrn, int flags) {
if (!vgaHWGetHWRec(pScrn)) return FALSE;
pI740->PciInfo = xf86GetPciInfoForEntity(pI740->pEnt->index);
+#ifndef XSERVER_LIBPCIACCESS
pI740->PciTag = pciTag(pI740->PciInfo->bus, pI740->PciInfo->device,
pI740->PciInfo->func);
+#endif
if (xf86RegisterResources(pI740->pEnt->index, 0, ResNone))
return FALSE;
@@ -598,7 +600,7 @@ I740PreInit(ScrnInfoPtr pScrn, int flags) {
pI740->pEnt->device->chipID);
} else {
from = X_PROBED;
- pScrn->chipset = (char *)xf86TokenToString(I740Chipsets, pI740->PciInfo->chipType);
+ pScrn->chipset = (char *)xf86TokenToString(I740Chipsets, PCI_DEV_DEVIE_ID(pI740->PciInfo));
}
if (pI740->pEnt->device->chipRev >= 0) {
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n",
@@ -611,8 +613,8 @@ I740PreInit(ScrnInfoPtr pScrn, int flags) {
pI740->LinearAddr = pI740->pEnt->device->MemBase;
from = X_CONFIG;
} else {
- if (pI740->PciInfo->memBase[1] != 0) {
- pI740->LinearAddr = pI740->PciInfo->memBase[0]&0xFF000000;
+ if (PCI_REGION_BASE(pI740->PciInfo, 0, REGION_MEM) != 0) {
+ pI740->LinearAddr = PCI_REGION_BASE(pI740->PciInfo, 0, REGION_MEM)&0xFF000000;
from = X_PROBED;
} else {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -628,8 +630,8 @@ I740PreInit(ScrnInfoPtr pScrn, int flags) {
pI740->MMIOAddr = pI740->pEnt->device->IOBase;
from = X_CONFIG;
} else {
- if (pI740->PciInfo->memBase[1]) {
- pI740->MMIOAddr = pI740->PciInfo->memBase[1]&0xFFF80000;
+ if (PCI_REGION_BASE(pI740->PciInfo, 1, REGION_MEM)) {
+ pI740->MMIOAddr = PCI_REGION_BASE(pI740->PciInfo, 1, REGION_MEM)&0xFFF80000;
from = X_PROBED;
} else {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -871,18 +873,48 @@ static Bool I740MapMem(ScrnInfoPtr pScrn)
pI740 = I740PTR(pScrn);
+#ifndef XSERVER_LIBPCIACCESS
mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT;
pI740->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags,
pI740->PciTag,
pI740->MMIOAddr,
0x80000);
+#else
+ {
+ void** result = (void**)&pI740->MMIOBase;
+ int err = pci_device_map_range(pI740->PciInfo,
+ pI740->MMIOAddr,
+ 0x80000,
+ PCI_DEV_MAP_FLAG_WRITABLE,
+ result);
+
+ if (err)
+ return FALSE;
+ }
+
+#endif
if (!pI740->MMIOBase) return FALSE;
+#ifndef XSERVER_LIBPCIACCESS
pI740->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
pI740->PciTag,
pI740->LinearAddr,
pI740->FbMapSize);
+#else
+ {
+ void** result = (void**)&pI740->FbBase;
+ int err = pci_device_map_range(pI740->PciInfo,
+ pI740->LinearAddr,
+ pI740->FbMapSize,
+ PCI_DEV_MAP_FLAG_WRITABLE |
+ PCI_DEV_MAP_FLAG_WRITE_COMBINE,
+ result);
+
+ if (err)
+ return FALSE;
+ }
+#endif
if (!pI740->FbBase) return FALSE;
return TRUE;
@@ -894,10 +926,18 @@ static Bool I740UnmapMem(ScrnInfoPtr pScrn)
pI740 = I740PTR(pScrn);
+#ifndef XSERVER_LIBPCIACCESS
xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pI740->MMIOBase, 0x80000);
+#else
+ pci_device_unmap_range(pI740->PciInfo, pI740->MMIOBase, 0x80000);
+#endif
pI740->MMIOBase=0;
+#ifndef XSERVER_LIBPCIACCESS
xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pI740->FbBase, pI740->FbMapSize);
+#else
+ pci_device_unmap_range(pI740->PciInfo, pI740->FbBase, pI740->FbMapSize);
+#endif
pI740->FbBase = 0;
return TRUE;
}
diff --git a/src/i740_pcirename.h b/src/i740_pcirename.h
new file mode 100644
index 0000000..cbd3dcf
--- /dev/null
+++ b/src/i740_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 ASTPCIRENAME_H
+#define ASTPCIRENAME_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-i740.spec
===================================================================
RCS file: /cvs/pkgs/rpms/xorg-x11-drv-i740/devel/xorg-x11-drv-i740.spec,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- xorg-x11-drv-i740.spec 20 Feb 2008 07:26:06 -0000 1.16
+++ xorg-x11-drv-i740.spec 10 Mar 2008 02:30:24 -0000 1.17
@@ -5,7 +5,7 @@
Summary: Xorg X11 i740 video driver
Name: xorg-x11-drv-i740
Version: 1.1.0
-Release: 6%{?dist}
+Release: 7%{?dist}
URL: http://www.x.org
License: MIT
Group: User Interface/X Hardware Support
@@ -14,8 +14,11 @@
Source0: ftp://ftp.x.org/pub/individual/driver/%{tarball}-%{version}.tar.bz2
Source1: i740.xinf
+Patch1: i740-pciaccess.patch
+
ExcludeArch: s390 s390x
+BuildRequires: automake autoconf libtool
BuildRequires: xorg-x11-server-sdk >= 1.3.0.0-6
Requires: hwdata
@@ -27,7 +30,9 @@
%prep
%setup -q -n %{tarball}-%{version}
+%patch1 -p1 -b .pciaccess
%build
+autoreconf -v --install
%configure --disable-static
make
@@ -53,6 +58,9 @@
%{_mandir}/man4/i740.4*
%changelog
+* Mon Mar 10 2008 Dave Airlie <airlied at redhat.com> 1.1.0-7
+- pciaccess conversion
+
* Wed Feb 20 2008 Fedora Release Engineering <rel-eng at fedoraproject.org> - 1.1.0-6
- Autorebuild for GCC 4.3
More information about the fedora-extras-commits
mailing list