rpms/xorg-x11-drv-s3virge/devel s3v-pciaccess.patch, NONE, 1.1 xorg-x11-drv-s3virge.spec, 1.16, 1.17

Dave Airlie (airlied) fedora-extras-commits at redhat.com
Mon Mar 10 03:42:14 UTC 2008


Author: airlied

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

Modified Files:
	xorg-x11-drv-s3virge.spec 
Added Files:
	s3v-pciaccess.patch 
Log Message:
* Mon Mar 10 2008 Dave Airlie <airlied at redhat.com> 1.9.1-7
- pciaccess conversion


s3v-pciaccess.patch:

--- NEW FILE s3v-pciaccess.patch ---
diff --git a/configure.ac b/configure.ac
index d4cf68f..43e2a0d 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/s3v.h b/src/s3v.h
index a20630d..90800b6 100644
--- a/src/s3v.h
+++ b/src/s3v.h
@@ -28,6 +28,8 @@ in this Software without prior written authorization from the XFree86 Project.
 #ifndef _S3V_H
 #define _S3V_H
 
+#include "s3v_pcirename.h"
+
 #include <string.h>
 
 /* All drivers should typically include these */
diff --git a/src/s3v_dga.c b/src/s3v_dga.c
index 4449a67..626963f 100644
--- a/src/s3v_dga.c
+++ b/src/s3v_dga.c
@@ -67,12 +67,7 @@ in this Software without prior written authorization from the XFree86 Project.
 #include "xaa.h"
 #include "xaalocal.h"
 #include "s3v.h"
-#if 0
-#include "mga_bios.h"
-#include "mga.h"
-#include "mga_reg.h"
-#include "mga_macros.h"
-#endif
+
 #include "dgaproc.h"
 
 
@@ -84,10 +79,7 @@ static void S3V_SetViewport(ScrnInfoPtr, int, int, int);
 static void S3V_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
 static void S3V_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
 /* dummy... */
-#if 0
-static void MGA_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, 
-					unsigned long);
-#endif
+
 
 static
 DGAFunctionRec S3V_DGAFuncs = {
@@ -326,19 +318,7 @@ S3V_BlitRect(
     }
 }
 
-#if 0
-static void 
-MGA_BlitTransRect(
-   ScrnInfoPtr pScrn, 
-   int srcx, int srcy, 
-   int w, int h, 
-   int dstx, int dsty,
-   unsigned long color
-){
-  /* this one should be separate since the XAA function would
-     prohibit usage of ~0 as the key */
-}
-#endif
+
 
 static Bool 
 S3V_OpenFramebuffer(
@@ -352,7 +332,7 @@ S3V_OpenFramebuffer(
     S3VPtr ps3v = S3VPTR(pScrn);
 
     *name = NULL; 		/* no special device */
-    *mem = (unsigned char*)ps3v->PciInfo->memBase[0];
+    *mem = (unsigned char*)PCI_REGION_BASE(ps3v->PciInfo, 0, REGION_MEM);
     *size = ps3v->videoRambytes;
     *offset = 0;
     *flags = DGA_NEED_ROOT;
diff --git a/src/s3v_driver.c b/src/s3v_driver.c
index 49f87af..e5d8f8a 100644
--- a/src/s3v_driver.c
+++ b/src/s3v_driver.c
@@ -29,6 +29,7 @@ in this Software without prior written authorization from the XFree86 Project.
 #include "config.h"
 #endif
 
+#include <unistd.h>
 #include "xf86Resources.h"
 /* Needed by Resources Access Control (RAC) */
 #include "xf86RAC.h"
@@ -121,10 +122,10 @@ static int pix24bpp = 0;
  
 #define S3VIRGE_NAME "S3VIRGE"
 #define S3VIRGE_DRIVER_NAME "s3virge"
-#define S3VIRGE_VERSION_NAME "1.9.1"
-#define S3VIRGE_VERSION_MAJOR   1
-#define S3VIRGE_VERSION_MINOR   9
-#define S3VIRGE_PATCHLEVEL      1
+#define S3VIRGE_VERSION_NAME PACKAGE_VERSION
+#define S3VIRGE_VERSION_MAJOR   PACKAGE_VERSION_MAJOR
+#define S3VIRGE_VERSION_MINOR   PACKAGE_VERSION_MINOR
+#define S3VIRGE_PATCHLEVEL      PACKAGE_VERSION_PATCHLEVEL
 #define S3VIRGE_DRIVER_VERSION ((S3VIRGE_VERSION_MAJOR << 24) | \
 				(S3VIRGE_VERSION_MINOR << 16) | \
 				S3VIRGE_PATCHLEVEL)
@@ -418,7 +419,7 @@ s3virgeSetup(pointer module, pointer opts, int *errmaj, int *errmin)
 #endif /* XFree86LOADER */
 
 
-static unsigned char *find_bios_string(PCITAG Tag, int BIOSbase, char *match1, char *match2)
+static unsigned char *find_bios_string(S3VPtr ps3v, int BIOSbase, char *match1, char *match2)
 {
 #define BIOS_BSIZE 1024
 #define BIOS_BASE  0xc0000
@@ -429,8 +430,13 @@ static unsigned char *find_bios_string(PCITAG Tag, int BIOSbase, char *match1, c
 
    if (!init) {
       init = 1;
-      if (xf86ReadDomainMemory(Tag, BIOSbase, BIOS_BSIZE, bios) != BIOS_BSIZE)
+#ifndef XSERVER_LIBPCIACCESS
+      if (xf86ReadDomainMemory(ps3v->PciTag, BIOSbase, BIOS_BSIZE, bios) != BIOS_BSIZE)
 	 return NULL;
+#else
+      if (pci_device_read_rom(ps3v->PciInfo, bios))
+	return NULL;
+#endif
       if ((bios[0] != 0x55) || (bios[1] != 0xaa))
 	 return NULL;
    }
@@ -521,9 +527,12 @@ S3VProbe(DriverPtr drv, int flags)
 	 */
 	return FALSE;
     }
+
+#ifndef XSERVER_LIBPCIACCESS
     if (xf86GetPciVideoInfo() == NULL) {
 	return FALSE;
     }
+#endif
 
     numUsed = xf86MatchPciInstances(S3VIRGE_NAME, PCI_S3_VENDOR_ID,
 				    S3VChipsets, S3VPciChipsets, devSections,
@@ -941,7 +950,7 @@ S3VPreInit(ScrnInfoPtr pScrn, int flags)
 		   ps3v->Chipset);
     } else {
 	from = X_PROBED;
-	ps3v->Chipset = ps3v->PciInfo->chipType;
+	ps3v->Chipset = PCI_DEV_DEVICE_ID(ps3v->PciInfo);
 	pScrn->chipset = (char *)xf86TokenToString(S3VChipsets, ps3v->Chipset);
     }								    
     
@@ -950,7 +959,7 @@ S3VPreInit(ScrnInfoPtr pScrn, int flags)
 	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n",
 		   ps3v->ChipRev);
     } else {
-	ps3v->ChipRev = ps3v->PciInfo->chipRev;
+        ps3v->ChipRev = PCI_DEV_REVISION(ps3v->PciInfo);
     }
     xfree(pEnt);
     
@@ -975,8 +984,10 @@ S3VPreInit(ScrnInfoPtr pScrn, int flags)
 
     xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", pScrn->chipset);
 	
+#ifndef XSERVER_LIBPCIACCESS
     ps3v->PciTag = pciTag(ps3v->PciInfo->bus, ps3v->PciInfo->device,
 			  ps3v->PciInfo->func);
+#endif
 
     /* Handle XVideo after we know chipset, so we can give an */
     /* intelligent comment about support */
@@ -1197,7 +1208,7 @@ S3VPreInit(ScrnInfoPtr pScrn, int flags)
     *      <= 8bpp: 191500
     */
 
-   if (find_bios_string(ps3v->PciTag, BIOS_BASE, "S3 86C325",
+   if (find_bios_string(ps3v, BIOS_BASE, "S3 86C325",
 			"MELCO WGP-VG VIDEO BIOS") != NULL) {
       if (xf86GetVerbosity())
 	 xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "MELCO BIOS found\n");
@@ -2298,15 +2309,30 @@ S3VMapMem(ScrnInfoPtr pScrn)
 					/* so that we can use registers map */
 					/* structure - see newmmio.h */
 					/* around 0x10000 from MemBase */
+#ifndef XSERVER_LIBPCIACCESS
   ps3v->MapBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, ps3v->PciTag,
-			ps3v->PciInfo->memBase[0] + S3_NEWMMIO_REGBASE,
-			S3_NEWMMIO_REGSIZE);
+				PCI_REGION_BASE(ps3v->PciInfo, 0, REGION_MEM) + S3_NEWMMIO_REGBASE,
+				S3_NEWMMIO_REGSIZE);
 
   ps3v->MapBaseDense = xf86MapPciMem(pScrn->scrnIndex,
-			VIDMEM_MMIO_32BIT,
-			ps3v->PciTag,
-			ps3v->PciInfo->memBase[0] + S3_NEWMMIO_REGBASE,
-			0x8000);
+				     VIDMEM_MMIO_32BIT,
+				     ps3v->PciTag,
+				     PCI_REGION_BASE(ps3v->PciInfo, 0, REGION_MEM) + S3_NEWMMIO_REGBASE,
+				     0x8000);
+#else
+  {
+    void** result = (void**)&ps3v->MapBase;
+    int err = pci_device_map_range(ps3v->PciInfo,
+				   PCI_REGION_BASE(ps3v->PciInfo, 0, REGION_MEM) + S3_NEWMMIO_REGBASE,
+				   S3_NEWMMIO_REGSIZE,
+				   PCI_DEV_MAP_FLAG_WRITABLE,
+				   result);
+    
+    if (err) 
+      return FALSE;
+  }
+  ps3v->MapBaseDense = ps3v->MapBase;
+#endif
 
   if( !ps3v->MapBase ) {
     xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -2315,10 +2341,26 @@ S3VMapMem(ScrnInfoPtr pScrn)
   }
 					/* Map the framebuffer */
   if (ps3v->videoRambytes) { /* not set in PreInit() */
+#ifndef XSERVER_LIBPCIACCESS
       ps3v->FBBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, 
-				   ps3v->PciTag, ps3v->PciInfo->memBase[0],
+				   ps3v->PciTag, PCI_REGION_BASE(ps3v->PciInfo, 0, REGION_MEM),
 				   ps3v->videoRambytes );
 
+#else
+      {
+	void** result = (void**)&ps3v->FBBase;
+	int err = pci_device_map_range(ps3v->PciInfo,
+				       PCI_REGION_BASE(ps3v->PciInfo, 0, REGION_MEM),
+				       ps3v->videoRambytes,
+				       PCI_DEV_MAP_FLAG_WRITABLE |
+				       PCI_DEV_MAP_FLAG_WRITE_COMBINE,
+				       result);
+	
+	if (err) 
+	  return FALSE;
+      }
+#endif
+
       if( !ps3v->FBBase ) {
 	  xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		     "Internal error: could not map framebuffer.\n");
@@ -2329,7 +2371,7 @@ S3VMapMem(ScrnInfoPtr pScrn)
       ps3v->FBStart = ps3v->FBBase;
   }
   
-  pScrn->memPhysBase = ps3v->PciInfo->memBase[0];
+  pScrn->memPhysBase = PCI_REGION_BASE(ps3v->PciInfo, 0, REGION_MEM);
   pScrn->fbOffset = 0;
 
   				/* Set up offset to hwcursor memory area */
@@ -2376,14 +2418,24 @@ S3VUnmapMem(ScrnInfoPtr pScrn)
     ps3v->PrimaryVidMapped = FALSE;
   }
 
+#ifndef XSERVER_LIBPCIACCESS
   xf86UnMapVidMem(pScrn->scrnIndex, (pointer)ps3v->MapBase,
 		  S3_NEWMMIO_REGSIZE);
+#else
+  pci_device_unmap_range(ps3v->PciInfo, ps3v->MapBase,
+			 S3_NEWMMIO_REGSIZE);
+#endif
+
+#ifndef XSERVER_LIBPCIACCESS
   if (ps3v->FBBase)
       xf86UnMapVidMem(pScrn->scrnIndex, (pointer)ps3v->FBBase,
 		      ps3v->videoRambytes);
   xf86UnMapVidMem(pScrn->scrnIndex, (pointer)ps3v->MapBaseDense,
 		  0x8000);
-
+#else
+  pci_device_unmap_range(ps3v->PciInfo, ps3v->FBBase,
+			 ps3v->videoRambytes);
+#endif
   return;
 }
 
@@ -3633,9 +3685,9 @@ S3VEnableMmio(ScrnInfoPtr pScrn)
    * (EE 06/03/99)
    */
   outb(vgaCRIndex, 0x59);         /*@@@EE*/
-  outb(vgaCRReg, ps3v->PciInfo->memBase[0] >> 24);  
+  outb(vgaCRReg, PCI_REGION_MEM(ps3v->PciInfo, 0, REGION_MEM) >> 24);  
   outb(vgaCRIndex, 0x5A);
-  outb(vgaCRReg, ps3v->PciInfo->memBase[0] >> 16);
+  outb(vgaCRReg, PCI_REGION_MEM(ps3v->PciInfo, 0, REGION_MEM) >> 16);
   outb(vgaCRIndex, 0x53);
 #endif
   /* Save register for restore */
diff --git a/src/s3v_pcirename.h b/src/s3v_pcirename.h
new file mode 100644
index 0000000..9321046
--- /dev/null
+++ b/src/s3v_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 S3PCIRENAME_H
+#define S3PCIRENAME_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 */
diff --git a/src/s3v_xv.c b/src/s3v_xv.c
index 5e5476d..ea015c4 100644
--- a/src/s3v_xv.c
+++ b/src/s3v_xv.c
@@ -64,11 +64,7 @@ static XF86VideoAdaptorPtr S3VSetupImageVideoOverlay(ScreenPtr);
 static int  S3VSetPortAttributeOverlay(ScrnInfoPtr, Atom, INT32, pointer);
 static int  S3VGetPortAttributeOverlay(ScrnInfoPtr, Atom ,INT32 *, pointer);
 
-#if 0
-static XF86VideoAdaptorPtr MGASetupImageVideoTexture(ScreenPtr);
-static int  MGASetPortAttributeTexture(ScrnInfoPtr, Atom, INT32, pointer);
-static int  MGAGetPortAttributeTexture(ScrnInfoPtr, Atom ,INT32 *, pointer);
-#endif
+
 static void S3VStopVideo(ScrnInfoPtr, pointer, Bool);
 static void S3VQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, 
 			unsigned int *, unsigned int *, pointer);
@@ -78,9 +74,6 @@ static int  S3VPutImage(ScrnInfoPtr, short, short, short, short, short,
 static int  S3VQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, 
 			unsigned short *,  int *, int *);
 
-#if 0
-static void MGABlockHandler(int, pointer, pointer, pointer);
-#endif
 
 static void S3VResetVideoOverlay(ScrnInfoPtr);
 
@@ -132,28 +125,8 @@ void S3VInitVideo(ScreenPtr pScreen)
        && ps3v->XVideo
        )
     {
-#if 0
-	if((pMga->Overlay8Plus24 /* || dualhead */ || pMga->TexturedVideo) &&
-	   (pScrn->bitsPerPixel != 24))
-        {
-	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using texture video\n");
-	    newAdaptor = MGASetupImageVideoTexture(pScreen);
-	    pMga->TexturedVideo = TRUE;
-	} else {
-#endif
-
 	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using overlay video\n");
 	    newAdaptor = S3VSetupImageVideoOverlay(pScreen);
-
-#if 0
-	    pMga->TexturedVideo = FALSE;
-	}*/
-
-	if(!pMga->Overlay8Plus24 /* && !dualhead */)	  
-	  S3VInitOffscreenImages(pScreen);
-	pMga->BlockHandler = pScreen->BlockHandler;
-	pScreen->BlockHandler = MGABlockHandler;
-#endif
     }
     
 
@@ -241,43 +214,9 @@ S3VSetPortAttributeOverlay(
   INT32 value, 
   pointer data
 ){
-#if 0
-  MGAPtr pMga = MGAPTR(pScrn);
-  MGAPortPrivPtr pPriv = pMga->portPrivate;
-
-  CHECK_DMA_QUIESCENT(pMga, pScrn);
-
-  if(attribute == xvBrightness) {
-	if((value < -128) || (value > 127))
-	   return BadValue;
-	pPriv->brightness = value;
-	OUTREG(MGAREG_BESLUMACTL, ((pPriv->brightness & 0xff) << 16) |
-			           (pPriv->contrast & 0xff));
-  } else
-  if(attribute == xvContrast) {
-	if((value < 0) || (value > 255))
-	   return BadValue;
-	pPriv->contrast = value;
-	OUTREG(MGAREG_BESLUMACTL, ((pPriv->brightness & 0xff) << 16) |
-			           (pPriv->contrast & 0xff));
-  } else
-  if(attribute == xvColorKey) {
-	pPriv->colorKey = value;
-	outMGAdac(0x55, (pPriv->colorKey & pScrn->mask.red) >> 
-		    pScrn->offset.red);
-	outMGAdac(0x56, (pPriv->colorKey & pScrn->mask.green) >> 
-		    pScrn->offset.green);
-	outMGAdac(0x57, (pPriv->colorKey & pScrn->mask.blue) >> 
-		    pScrn->offset.blue);
-	REGION_EMPTY(pScrn->pScreen, &pPriv->clip);   
-  } else 
-#endif
 
 return BadMatch;
 
-#if 0
-  return Success;
-#endif
 }
 
 static int 
@@ -287,26 +226,10 @@ S3VGetPortAttributeOverlay(
   INT32 *value, 
   pointer data
 ){
-#if 0
-  MGAPtr pMga = MGAPTR(pScrn);
-  MGAPortPrivPtr pPriv = pMga->portPrivate;
-
-  if(attribute == xvBrightness) {
-	*value = pPriv->brightness;
-  } else
-  if(attribute == xvContrast) {
-	*value = pPriv->contrast;
-  } else
-  if(attribute == xvColorKey) {
-	*value = pPriv->colorKey;
-  } else 
-#endif
+
 
 return BadMatch;
 
-#if 0
-  return Success;
-#endif
 }
 
 
@@ -438,15 +361,8 @@ S3VSetupImageVideoOverlay(ScreenPtr pScreen)
     adapt->pFormats = Formats;
     adapt->nPorts = 1;
     adapt->pAttributes = NULL /*Attributes*/;
-#if 0
-    if (pMga->Chipset == PCI_CHIP_MGAG400) {
-	adapt->nImages = 4;
-	adapt->nAttributes = 3;
-    } else {
-#endif
-	adapt->nImages = 3;
-	adapt->nAttributes = 0;
-	/* }*/
+    adapt->nImages = 3;
+    adapt->nAttributes = 0;
     adapt->pImages = Images;
     adapt->PutVideo = NULL;
     adapt->PutStill = NULL;
@@ -475,13 +391,6 @@ S3VStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
   S3VPtr ps3v = S3VPTR(pScrn);
   S3VPortPrivPtr pPriv = ps3v->portPrivate;
 
-#if 0
-  MGAPtr pMga = MGAPTR(pScrn);
-  MGAPortPrivPtr pPriv = pMga->portPrivate;
-
-  if(pMga->TexturedVideo) return;
-#endif
-
   REGION_EMPTY(pScrn->pScreen, &pPriv->clip);   
 
   if(shutdown) {
@@ -602,12 +511,6 @@ S3VDisplayVideoOverlay(
    if(!ps3v->NeedSTREAMS)
      return;
 
-#if 0
-    /* got 64 scanlines to do it in */
-    tmp = INREG(MGAREG_VCOUNT) + 64;
-    if(tmp > pScrn->currentMode->VDisplay)
-	tmp -= pScrn->currentMode->VDisplay;
-#endif
     
     /* Reference at http://www.webartz.com/fourcc/ */
       /* Looks like ViRGE only supports YUY2 and Y211?, */
@@ -860,14 +763,6 @@ S3VPutImage(
     dst_start = ps3v->FBStart + offset + left + (top * dstPitch);
     /*dst_start = pMga->FbStart + offset + left + (top * dstPitch);*/
 
-#if 0
-    if(pMga->TexturedVideo && pMga->AccelInfoRec->NeedToSync &&
-	((long)data != pPriv->lastPort)) 
-    {
-	MGAStormSync(pScrn);
-	pMga->AccelInfoRec->NeedToSync = FALSE;
-    }
-#endif
 
     switch(id) {
     case FOURCC_YV12:
@@ -895,17 +790,7 @@ S3VPutImage(
         break;
     }
 
-#if 0
-    if(pMga->TexturedVideo) {
-	pPriv->lastPort = (long)data;
-	MGADisplayVideoTexture(pScrn, id, offset, 
-		REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes),
-		width, height, dstPitch, src_x, src_y, src_w, src_h,
-		drw_x, drw_y, drw_w, drw_h);
-	pPriv->videoStatus = FREE_TIMER;
-	pPriv->freeTime = currentTime.milliseconds + FREE_DELAY;
-    } else {
-#endif
+
     /* update cliplist */
 	if(!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)) {
 	    REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes);
@@ -918,10 +803,7 @@ S3VPutImage(
 	     x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h);
 
 	pPriv->videoStatus = CLIENT_VIDEO_ON;
-#if 0
-    }
-    pMga->VideoTimerCallback = MGAVideoTimerCallback;
-#endif
+
 
     return Success;
 }
@@ -934,22 +816,11 @@ S3VQueryImageAttributes(
     unsigned short *w, unsigned short *h, 
     int *pitches, int *offsets
 ){
-#if 0
-    MGAPtr pMga = MGAPTR(pScrn);
-#endif
+
     int size, tmp;
 
-#if 0
-    if(pMga->TexturedVideo) {
-	if(*w > 2046) *w = 2046;
-	if(*h > 2046) *h = 2046;
-    } else {
-#endif
 	if(*w > 1024) *w = 1024;
 	if(*h > 1024) *h = 1024;
-#if 0
-    }
-#endif
 
     *w = (*w + 1) & ~1;
     if(offsets) offsets[0] = 0;


Index: xorg-x11-drv-s3virge.spec
===================================================================
RCS file: /cvs/pkgs/rpms/xorg-x11-drv-s3virge/devel/xorg-x11-drv-s3virge.spec,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- xorg-x11-drv-s3virge.spec	20 Feb 2008 07:42:16 -0000	1.16
+++ xorg-x11-drv-s3virge.spec	10 Mar 2008 03:41:25 -0000	1.17
@@ -5,7 +5,7 @@
 Summary:   Xorg X11 s3virge video driver
 Name:      xorg-x11-drv-s3virge
 Version:   1.9.1
-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:   s3virge.xinf
 
+Patch0: s3v-pciaccess.patch
+
 ExcludeArch: s390 s390x
 
+BuildRequires: automake autoconf libtool
 BuildRequires: xorg-x11-server-sdk >= 1.3.0.0-6
 
 Requires:  hwdata
@@ -27,7 +30,10 @@
 %prep
 %setup -q -n %{tarball}-%{version}
 
+%patch0 -p1 -b .pciaccess
+
 %build
+autoreconf -v --install
 %configure --disable-static
 make
 
@@ -53,6 +59,9 @@
 %{_mandir}/man4/s3virge.4*
 
 %changelog
+* Mon Mar 10 2008 Dave Airlie <airlied at redhat.com> 1.9.1-7
+- pciaccess conversion
+
 * Wed Feb 20 2008 Fedora Release Engineering <rel-eng at fedoraproject.org> - 1.9.1-6
 - Autorebuild for GCC 4.3
 




More information about the fedora-extras-commits mailing list