rpms/xorg-x11-drv-amd/devel amd-pciaccess.patch, NONE, 1.1 xorg-x11-drv-amd.spec, 1.16, 1.17
Dave Airlie (airlied)
fedora-extras-commits at redhat.com
Mon Mar 10 06:28:57 UTC 2008
- Previous message (by thread): rpms/scim-python/devel .cvsignore, 1.8, 1.9 scim-python.spec, 1.12, 1.13 sources, 1.8, 1.9
- Next message (by thread): rpms/xorg-x11-drv-amd/devel .cvsignore, 1.7, 1.8 sources, 1.9, 1.10 xorg-x11-drv-amd.spec, 1.17, 1.18 amd-build-fixes.patch, 1.1, NONE amd-pciaccess.patch, 1.1, NONE lx-downscaling-fix.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: airlied
Update of /cvs/pkgs/rpms/xorg-x11-drv-amd/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv16763
Modified Files:
xorg-x11-drv-amd.spec
Added Files:
amd-pciaccess.patch
Log Message:
* Mon Mar 10 2008 Dave Airlie <airlied at redhat.com> 0.0-24.20070625
- pciaccess fixups
amd-pciaccess.patch:
--- NEW FILE amd-pciaccess.patch ---
diff --git a/configure.ac b/configure.ac
index c219e06..b13576f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,10 +86,21 @@ PKG_CHECK_MODULES(XORG, [xorg-server xproto fontsproto $REQUIRED_MODULES])
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
+
AC_SUBST([XORG_CFLAGS])
AC_SUBST([moduledir])
AC_SUBST([AMD_CFLAGS])
diff --git a/src/amd.h b/src/amd.h
index 8eb2253..fe2ac54 100644
--- a/src/amd.h
+++ b/src/amd.h
@@ -28,6 +28,8 @@
#ifndef _AMD_GEODE_H_
#define _AMD_GEODE_H_
+#include "amd_pcirename.h"
+
#include "xaa.h"
#include "exa.h"
#include "xf86Cursor.h"
diff --git a/src/amd_driver.c b/src/amd_driver.c
index 42e49ba..b153295 100644
--- a/src/amd_driver.c
+++ b/src/amd_driver.c
@@ -419,7 +419,10 @@ AmdProbe(DriverPtr drv, int flags)
}
DEBUGMSG(1, (0, X_INFO, "AmdProbe: Before MatchPciInstances!\n"));
/* PCI BUS */
- if (xf86GetPciVideoInfo()) {
+#ifndef XSERVER_LIBPCIACCESS
+ if (xf86GetPciVideoInfo())
+#endif
+ {
numUsed = xf86MatchPciInstances(AMD_NAME, PCI_VENDOR_ID_NS,
GeodeChipsets, GeodePCIchipsets,
devSections, numDevSections, drv, &usedChips);
diff --git a/src/amd_gx_driver.c b/src/amd_gx_driver.c
index da4fa0b..09ad47a 100644
--- a/src/amd_gx_driver.c
+++ b/src/amd_gx_driver.c
@@ -317,7 +317,27 @@ GXSaveScreen(ScreenPtr pScrn, int mode)
/* Common function - used by the LX too */
-
+#ifdef XSERVER_LIBPCIACCESS
+static inline void * map_pci_mem(ScrnInfoPtr pScrni, int vram,
+ struct pci_device *dev,
+ int bar, int size)
+{
+ void *ptr;
+ void** result = (void**)&ptr;
+ int map_size = size ? size : dev->regions[bar].size;
+
+ int err = pci_device_map_range(dev,
+ dev->regions[bar].base_addr
+ map_size,
+ PCI_DEV_MAP_FLAG_WRITABLE |
+ (vram ? PCI_DEV_MAP_FLAG_WRITE_COMBINE : 0),
+ result);
+
+ if (err)
+ return NULL;
+ return ptr;
+}
+#endif
extern unsigned long gfx_gx2_scratch_base;
@@ -330,6 +350,7 @@ GXMapMem(ScrnInfoPtr pScrni)
pciVideoRec *pci = xf86GetPciInfoForEntity(pGeode->pEnt->index);
+#ifndef XSERVER_LIBPCIACCESS
gfx_virt_regptr = (unsigned char *)xf86MapVidMem(index, VIDMEM_MMIO,
pci->memBase[2], pci->size[2]);
@@ -341,6 +362,12 @@ GXMapMem(ScrnInfoPtr pScrni)
gfx_virt_fbptr = (unsigned char *)xf86MapVidMem(index, VIDMEM_FRAMEBUFFER,
pci->memBase[0], pGeode->FBAvail);
+#else
+ gfx_virt_regptr = map_pci_mem(pScrni, 0, pci, 2, 0);
+ gfx_virt_gpptr = map_pci_mem(pScrni, 0, pci, 1, 0);
+ gfx_virt_vidptr = map_pci_mem(pScrni, 0, pci, 3, 0);
+ gfx_virt_fbptr = map_pci_mem(pScrni, 1, pci, 0, pGeode->FBAvail);
+#endif
gfx_gx2_scratch_base = pGeode->FBAvail - 0x4000;
diff --git a/src/amd_lx_driver.c b/src/amd_lx_driver.c
index a2db90e..09882de 100644
--- a/src/amd_lx_driver.c
+++ b/src/amd_lx_driver.c
@@ -391,6 +391,27 @@ LXWriteMSR(unsigned long addr, unsigned long lo, unsigned long hi)
LX_MSR_WRITE(addr, lo, hi);
}
+#ifdef XSERVER_LIBPCIACCESS
+static inline void * map_pci_mem(ScrnInfoPtr pScrni, int vram,
+ struct pci_device *dev,
+ int bar, int size)
+{
+ void *ptr;
+ void** result = (void**)&ptr;
+ int map_size = size ? size : dev->regions[bar].size;
+
+ int err = pci_device_map_range(dev,
+ dev->regions[bar].base_addr
+ map_size,
+ PCI_DEV_MAP_FLAG_WRITABLE |
+ (vram ? PCI_DEV_MAP_FLAG_WRITE_COMBINE : 0),
+ result);
+
+ if (err)
+ return NULL;
+ return ptr;
+}
+#endif
static Bool
LXMapMem(ScrnInfoPtr pScrni)
@@ -403,6 +424,7 @@ LXMapMem(ScrnInfoPtr pScrni)
pciVideoRec *pci = xf86GetPciInfoForEntity(pGeode->pEnt->index);
tag = pciTag(pci->bus, pci->device, pci->func);
+#ifndef XSERVER_LIBPCIACCESS
cim_gp_ptr = (unsigned char *)xf86MapPciMem(index, VIDMEM_MMIO,
tag, pci->memBase[1], LX_GP_REG_SIZE);
@@ -417,18 +439,26 @@ LXMapMem(ScrnInfoPtr pScrni)
cim_fb_ptr = (unsigned char *)xf86MapPciMem(index, VIDMEM_FRAMEBUFFER,
tag, pci->memBase[0], pGeode->FBAvail + CIM_CMD_BFR_SZ);
+#else
+ cim_gp_ptr = map_pci_mem(pScrni, 0, pci, 1, LX_GP_REG_SIZE);
+ cim_vg_ptr = map_pci_mem(pScrni, 0, pci, 2, LX_VG_REG_SIZE);
+ cim_vid_ptr = map_pci_mem(pScrni, 0, pci, 3, LX_VID_REG_SIZE);
+ cim_vip_ptr = map_pci_mem(pScrni, 0, pci, 4, LX_VIP_REG_SIZE);
+ cim_fb_ptr = map_pci_mem(pScrni, 1, pci, 0, pGeode->FBAvail + CIM_CMD_BFR_SZ);
+#endif
if (pScrni->memPhysBase == 0)
- pScrni->memPhysBase = pci->memBase[0];
+ pScrni->memPhysBase = PCI_REGION_BASE(pci, 0, REGION_MEM);
+
- cmd_bfr_phys = pci->memBase[0] + pGeode->CmdBfrOffset;
+ cmd_bfr_phys = PCI_REGION_BASE(pci, 0, REGION_MEM) + pGeode->CmdBfrOffset;
cim_cmd_base_ptr = cim_fb_ptr + pGeode->CmdBfrOffset;
if (!cim_gp_ptr || !cim_vg_ptr || !cim_vid_ptr || !cim_fb_ptr ||
!cim_vip_ptr)
return FALSE;
- gp_set_frame_buffer_base(pci->memBase[0], pGeode->FBAvail);
+ gp_set_frame_buffer_base(PCI_REGION_BASE(pci, 0, REGION_MEM), pGeode->FBAvail);
gp_set_command_buffer_base(cmd_bfr_phys, 0, pGeode->CmdBfrSize);
XpressROMPtr = xf86MapVidMem(index, VIDMEM_FRAMEBUFFER, 0xF0000, 0x10000);
diff --git a/src/amd_pcirename.h b/src/amd_pcirename.h
new file mode 100644
index 0000000..f0f5cf8
--- /dev/null
+++ b/src/amd_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-amd.spec
===================================================================
RCS file: /cvs/pkgs/rpms/xorg-x11-drv-amd/devel/xorg-x11-drv-amd.spec,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- xorg-x11-drv-amd.spec 20 Feb 2008 07:06:20 -0000 1.16
+++ xorg-x11-drv-amd.spec 10 Mar 2008 06:28:02 -0000 1.17
@@ -7,7 +7,7 @@
Summary: Xorg X11 AMD Geode video driver
Name: xorg-x11-drv-amd
Version: 0.0
-Release: 23.%{gitdate}%{?dist}
+Release: 24.%{gitdate}%{?dist}
URL: http://git.infradead.org/?p=users/jcrouse/xf86-video-amd.git
Source0: xf86-video-amd-0.0-git%{gitdate}.tar.bz2
#Source1: amd.xinf
@@ -38,6 +38,7 @@
Patch0: lx-disable-compression.patch
Patch1: amd-build-fixes.patch
Patch2: lx-downscaling-fix.patch
+Patch3: amd-pciaccess.patch
%description
X.Org X11 AMD Geode video driver.
@@ -47,6 +48,7 @@
%patch0 -p1 -b .jx
%patch1 -p1 -b .build-fix
%patch2 -p1 -b .lx-downscale-fix
+%patch3 -p1 -b .pciaccess
# remind myself to do snapshots properly
if [ -e %{tarball}/.git ] ; then
@@ -55,6 +57,7 @@
fi
%build
+autoreconf -v --install
%configure --disable-static --libdir=%{_libdir} --mandir=%{_mandir} \
--enable-visibility
make
@@ -80,6 +83,9 @@
%{driverdir}/ztv_drv.so
%changelog
+* Mon Mar 10 2008 Dave Airlie <airlied at redhat.com> 0.0-24.20070625
+- pciaccess fixups
+
* Wed Feb 20 2008 Fedora Release Engineering <rel-eng at fedoraproject.org> - 0.0-23.20070625
- Autorebuild for GCC 4.3
- Previous message (by thread): rpms/scim-python/devel .cvsignore, 1.8, 1.9 scim-python.spec, 1.12, 1.13 sources, 1.8, 1.9
- Next message (by thread): rpms/xorg-x11-drv-amd/devel .cvsignore, 1.7, 1.8 sources, 1.9, 1.10 xorg-x11-drv-amd.spec, 1.17, 1.18 amd-build-fixes.patch, 1.1, NONE amd-pciaccess.patch, 1.1, NONE lx-downscaling-fix.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list