rpms/xorg-x11-drv-ati/devel r128-6.7.196-pciaccess.patch, NONE, 1.1 xorg-x11-drv-ati.spec, 1.73, 1.74

Adam Jackson (ajax) fedora-extras-commits at redhat.com
Wed Jan 2 18:32:37 UTC 2008


Author: ajax

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

Modified Files:
	xorg-x11-drv-ati.spec 
Added Files:
	r128-6.7.196-pciaccess.patch 
Log Message:
* Wed Jan 02 2008 Adam Jackson <ajax at redhat.com> 6.7.196-4
- r128-6.7.196-pciaccess.patch: Port r128 to libpciaccess.


r128-6.7.196-pciaccess.patch:

--- NEW FILE r128-6.7.196-pciaccess.patch ---
diff -up xf86-video-ati-6.7.196/src/r128_driver.c.jx xf86-video-ati-6.7.196/src/r128_driver.c
--- xf86-video-ati-6.7.196/src/r128_driver.c.jx	2007-08-22 23:00:48.000000000 -0400
+++ xf86-video-ati-6.7.196/src/r128_driver.c	2008-01-02 13:27:02.000000000 -0500
@@ -425,14 +425,21 @@ static Bool R128MapMMIO(ScrnInfoPtr pScr
     if (info->FBDev) {
 	info->MMIO = fbdevHWMapMMIO(pScrn);
     } else {
+#if defined(XSERVER_LIBPCIACCESS)
+	int err = pci_device_map_region(info->PciInfo, 2, TRUE);
+	if (err)
+	    return FALSE;
+	info->MMIO = info->PciInfo->regions[2].memory;
+#else
 	info->MMIO = xf86MapPciMem(pScrn->scrnIndex,
 				   VIDMEM_MMIO | VIDMEM_READSIDEEFFECT,
 				   info->PciTag,
 				   info->MMIOAddr,
 				   R128_MMIOSIZE);
+	if (!info->MMIO) return FALSE;
+#endif
     }
 
-    if (!info->MMIO) return FALSE;
     return TRUE;
 }
 
@@ -444,9 +451,13 @@ static Bool R128UnmapMMIO(ScrnInfoPtr pS
 
     if (info->FBDev)
 	fbdevHWUnmapMMIO(pScrn);
-    else {
+    else 
+#if defined(XSERVER_LIBPCIACCESS)
+	pci_device_unmap_region(info->PciInfo, 2);
+#else
 	xf86UnMapVidMem(pScrn->scrnIndex, info->MMIO, R128_MMIOSIZE);
-    }
+#endif
+
     info->MMIO = NULL;
     return TRUE;
 }
@@ -459,14 +470,21 @@ static Bool R128MapFB(ScrnInfoPtr pScrn)
     if (info->FBDev) {
 	info->FB = fbdevHWMapVidmem(pScrn);
     } else {
+#if defined(XSERVER_LIBPCIACCESS)
+	int err = pci_device_map_region(info->PciInfo, 0, TRUE);
+	if (err)
+	    return FALSE;
+	info->FB = info->PciInfo->regions[0].memory;
+#else
 	info->FB = xf86MapPciMem(pScrn->scrnIndex,
 				 VIDMEM_FRAMEBUFFER,
 				 info->PciTag,
 				 info->LinearAddr,
 				 info->FbMapSize);
+	if (!info->FB) return FALSE;
+#endif
     }
 
-    if (!info->FB) return FALSE;
     return TRUE;
 }
 
@@ -478,7 +496,11 @@ static Bool R128UnmapFB(ScrnInfoPtr pScr
     if (info->FBDev)
 	fbdevHWUnmapVidmem(pScrn);
     else
+#if defined(XSERVER_LIBPCIACCESS)
+	pci_device_unmap_region(info->PciInfo, 0);
+#else
 	xf86UnMapVidMem(pScrn->scrnIndex, info->FB, info->FbMapSize);
+#endif
     info->FB = NULL;
     return TRUE;
 }
@@ -650,6 +672,9 @@ static Bool R128GetBIOSParameters(ScrnIn
 	(void)memcpy(info->VBIOS, xf86int10Addr(pInt10, info->BIOSAddr),
 		     R128_VBIOS_SIZE);
     } else {
+#if defined(XSERVER_LIBPCIACCESS)
+	pci_device_read_rom(info->PciInfo, info->VBIOS);
+#else
 	xf86ReadPciBIOS(0, info->PciTag, 0, info->VBIOS, R128_VBIOS_SIZE);
 	if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) {
 	    xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
@@ -659,6 +684,7 @@ static Bool R128GetBIOSParameters(ScrnIn
 	    info->BIOSAddr = 0x000c0000;
 	    xf86ReadDomainMemory(info->PciTag, info->BIOSAddr, R128_VBIOS_SIZE, info->VBIOS);
 	}
+#endif
     }
     if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) {
 	info->BIOSAddr = 0x00000000;
@@ -997,7 +1023,7 @@ static Bool R128PreInitConfig(ScrnInfoPt
 	info->Chipset  = dev->chipID;
 	from           = X_CONFIG;
     } else {
-	info->Chipset = info->PciInfo->chipType;
+	info->Chipset = PCI_DEV_DEVICE_ID(info->PciInfo);
     }
     pScrn->chipset = (char *)xf86TokenToString(R128Chipsets, info->Chipset);
 
@@ -1021,7 +1047,7 @@ static Bool R128PreInitConfig(ScrnInfoPt
 				/* Framebuffer */
 
     from             = X_PROBED;
-    info->LinearAddr = info->PciInfo->memBase[0] & 0xfc000000;
+    info->LinearAddr = PCI_REGION_BASE(0) & 0xfc000000;
     pScrn->memPhysBase = info->LinearAddr;
     if (dev->MemBase) {
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -1040,7 +1066,7 @@ static Bool R128PreInitConfig(ScrnInfoPt
 
 				/* MMIO registers */
     from             = X_PROBED;
-    info->MMIOAddr   = info->PciInfo->memBase[2] & 0xffffff00;
+    info->MMIOAddr   = PCI_REGION_BASE(2) & 0xffffff00;
     if (dev->IOBase) {
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		   "MMIO address override, using 0x%08lx instead of 0x%08lx\n",
@@ -1055,6 +1081,7 @@ static Bool R128PreInitConfig(ScrnInfoPt
     xf86DrvMsg(pScrn->scrnIndex, from,
 	       "MMIO registers at 0x%08lx\n", info->MMIOAddr);
 
+#if !defined(XSERVER_LIBPCIACCESS)
 				/* BIOS */
     from              = X_PROBED;
     info->BIOSAddr    = info->PciInfo->biosBase & 0xfffe0000;
@@ -1070,6 +1097,7 @@ static Bool R128PreInitConfig(ScrnInfoPt
 	xf86DrvMsg(pScrn->scrnIndex, from,
 		   "BIOS at 0x%08lx\n", info->BIOSAddr);
     }
+#endif
 
 				/* Flat panel (part 1) */
     if (xf86GetOptValBool(info->Options, OPTION_PROG_FP_REGS,
@@ -2101,6 +2129,7 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int 
     }
 
     info->PciInfo      = xf86GetPciInfoForEntity(info->pEnt->index);
+#if !defined(XSERVER_LIBPCIACCESS)
     info->PciTag       = pciTag(info->PciInfo->bus,
 				info->PciInfo->device,
 				info->PciInfo->func);
@@ -2110,6 +2139,7 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int 
 	       info->PciInfo->bus,
 	       info->PciInfo->device,
 	       info->PciInfo->func);
+#endif
 
     if (xf86RegisterResources(info->pEnt->index, 0, ResNone)) goto fail;
     if (xf86SetOperatingState(resVga, info->pEnt->index, ResUnusedOpr)) goto fail;
diff -up xf86-video-ati-6.7.196/src/r128.h.jx xf86-video-ati-6.7.196/src/r128.h
--- xf86-video-ati-6.7.196/src/r128.h.jx	2007-08-21 20:09:50.000000000 -0400
+++ xf86-video-ati-6.7.196/src/r128.h	2008-01-02 13:20:22.000000000 -0500
@@ -37,6 +37,11 @@
 #ifndef _R128_H_
 #define _R128_H_
 
+#include "xorg-server.h"
+#ifdef XSERVER_LIBPCIACCESS
+#include <pciaccess.h>
+#endif
+
 #include <unistd.h>
 #include "xf86str.h"
 
@@ -223,8 +228,14 @@ typedef enum
 
 typedef struct {
     EntityInfoPtr     pEnt;
+#ifdef XSERVER_LIBPCIACCESS
+    struct pci_device *PciInfo;
+    int mmio_bar;
+    int fb_bar;
+#else
     pciVideoPtr       PciInfo;
     PCITAG            PciTag;
+#endif
     int               Chipset;
     Bool              Primary;
 
diff -up xf86-video-ati-6.7.196/src/Makefile.am.jx xf86-video-ati-6.7.196/src/Makefile.am
--- xf86-video-ati-6.7.196/src/Makefile.am.jx	2008-01-02 13:15:51.000000000 -0500
+++ xf86-video-ati-6.7.196/src/Makefile.am	2008-01-02 13:15:51.000000000 -0500
@@ -99,16 +99,12 @@ atimisc_drv_la_SOURCES = \
 	atiload.c atimisc.c atimach64probe.c $(ATIMISC_CPIO_SOURCES) \
 	$(ATIMISC_DGA_SOURCES) $(ATIMISC_DRI_SRCS) $(ATIMISC_EXA_SOURCES)
 
-if XSERVER_LIBPCIACCESS
-# r128 has not been ported yet
-else
 r128_drv_la_LTLIBRARIES = r128_drv.la
 r128_drv_la_LDFLAGS = -module -avoid-version
 r128_drv_ladir = @moduledir@/drivers
 r128_drv_la_SOURCES = \
 	r128_accel.c r128_cursor.c r128_dga.c r128_driver.c \
 	r128_video.c r128_misc.c r128_probe.c $(R128_DRI_SRCS)
-endif
 
 radeon_drv_la_LTLIBRARIES = radeon_drv.la
 radeon_drv_la_LDFLAGS = -module -avoid-version
diff -up xf86-video-ati-6.7.196/src/r128_dri.c.jx xf86-video-ati-6.7.196/src/r128_dri.c
--- xf86-video-ati-6.7.196/src/r128_dri.c.jx	2008-01-02 13:15:51.000000000 -0500
+++ xf86-video-ati-6.7.196/src/r128_dri.c	2008-01-02 13:28:27.000000000 -0500
@@ -470,8 +470,8 @@ static Bool R128DRIAgpInit(R128InfoPtr i
     xf86DrvMsg(pScreen->myNum, X_INFO,
 	       "[agp] Mode 0x%08lx [AGP 0x%04x/0x%04x; Card 0x%04x/0x%04x]\n",
 	       mode, vendor, device,
-	       info->PciInfo->vendor,
-	       info->PciInfo->chipType);
+	       PCI_DEV_VENDOR_ID(info->PciInfo),
+	       PCI_DEV_DEVICE_ID(info->PciInfo));
 
     if (drmAgpEnable(info->drmFD, mode) < 0) {
 	xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] AGP not enabled\n");
@@ -910,9 +910,16 @@ static void R128DRIIrqInit(R128InfoPtr i
    if (!info->irq) {
       info->irq = drmGetInterruptFromBusID(
 	 info->drmFD,
+#if XSERVER_LIBPCIACCESS
+	 (info->PciInfo->domain << 8) | info->PciInfo->bus,
+	 info->PciInfo->dev,
+	 info->PciInfo->func
+#else
 	 ((pciConfigPtr)info->PciInfo->thisCard)->busnum,
 	 ((pciConfigPtr)info->PciInfo->thisCard)->devnum,
-	 ((pciConfigPtr)info->PciInfo->thisCard)->funcnum);
+	 ((pciConfigPtr)info->PciInfo->thisCard)->funcnum
+#endif
+      );
 
       if((drmCtlInstHandler(info->drmFD, info->irq)) != 0) {
 	 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -1026,12 +1033,14 @@ Bool R128DRIScreenInit(ScreenPtr pScreen
     if (xf86LoaderCheckSymbol("DRICreatePCIBusID")) {
 	pDRIInfo->busIdString = DRICreatePCIBusID(info->PciInfo);
     } else {
+#if !defined XSERVER_LIBPCIACCESS
 	pDRIInfo->busIdString            = xalloc(64);
 	sprintf(pDRIInfo->busIdString,
 		"PCI:%d:%d:%d",
 		info->PciInfo->bus,
 		info->PciInfo->device,
 		info->PciInfo->func);
+#endif
     }
     pDRIInfo->ddxDriverMajorVersion      = R128_VERSION_MAJOR;
     pDRIInfo->ddxDriverMinorVersion      = R128_VERSION_MINOR;


Index: xorg-x11-drv-ati.spec
===================================================================
RCS file: /cvs/pkgs/rpms/xorg-x11-drv-ati/devel/xorg-x11-drv-ati.spec,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- xorg-x11-drv-ati.spec	19 Dec 2007 05:24:47 -0000	1.73
+++ xorg-x11-drv-ati.spec	2 Jan 2008 18:31:46 -0000	1.74
@@ -5,7 +5,7 @@
 Summary:   Xorg X11 ati video driver
 Name:      xorg-x11-drv-ati
 Version:   6.7.196
-Release:   3%{?dist}
+Release:   4%{?dist}
 URL:       http://www.x.org
 License:   MIT
 Group:     User Interface/X Hardware Support
@@ -22,6 +22,7 @@
 Patch4:     radeon-6.7.196-faster-ddc.patch
 
 # Rage 128 patches (100-199)
+Patch100: r128-6.7.196-pciaccess.patch
 
 # mach64 patches (200-299)
 
@@ -48,6 +49,8 @@
 %patch3 -p1 -b .atombios
 %patch4 -p1 -b .ddc
 
+%patch100 -p1 -b .jx
+
 %build
 aclocal ; automake -a ; autoconf
 %configure --disable-static
@@ -63,20 +66,17 @@
 install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/hwdata/videoaliases/
 install -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}/hwdata/videoaliases/
 
-# INFO: We don't want to ship the libtool archives (*.la) from modules
-# directory, as they serve no useful purpose.
 find $RPM_BUILD_ROOT -regex ".*\.la$" | xargs rm -f --
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-# XXX the # stuff here needs a second look
 %files
 %defattr(-,root,root,-)
 %doc README.ati README.r128
 %{driverdir}/ati_drv.so
 %{driverdir}/atimisc_drv.so
-#{driverdir}/r128_drv.so
+%{driverdir}/r128_drv.so
 %{driverdir}/radeon_drv.so
 %{_datadir}/hwdata/videoaliases/ati.xinf
 %{_datadir}/hwdata/videoaliases/r128.xinf
@@ -89,6 +89,9 @@
 %{_mandir}/man4/radeon.4*
 
 %changelog
+* Wed Jan 02 2008 Adam Jackson <ajax at redhat.com> 6.7.196-4
+- r128-6.7.196-pciaccess.patch: Port r128 to libpciaccess.
+
 * Wed Dec 19 2007 Dave Airlie <airlied at redhat.com> 6.7.196-3
 - radeon-git-upstream-fixes.patch - update for latest git master
 - radeon-6.7.196-atombios-support.patch - update for r500/r600




More information about the fedora-extras-commits mailing list