Blob Blame History Raw
diff -uNr xf86-video-ivtv-1.0.0/ChangeLog xf86-video-ivtv/ChangeLog
--- xf86-video-ivtv-1.0.0/ChangeLog	2007-10-14 18:36:10.000000000 +0200
+++ xf86-video-ivtv/ChangeLog	2008-03-05 15:01:29.000000000 +0100
@@ -1,3 +1,4 @@
+#1.0.1  - Add support for newer X org versions with libpciaccess
 #1.0.0 	- Renamed to ivtv_drv and xf86-video-ivtv for consistency with X11R7
 	  naming convention.
 	- When the ivtv X driver is loaded, it ensures the osd/framebuffer is switched
diff -uNr xf86-video-ivtv-1.0.0/config.h.in xf86-video-ivtv/config.h.in
--- xf86-video-ivtv-1.0.0/config.h.in	2007-02-17 14:21:08.000000000 +0100
+++ xf86-video-ivtv/config.h.in	2008-03-05 15:01:29.000000000 +0100
@@ -50,8 +50,20 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Major version of this package */
+#undef PACKAGE_VERSION_MAJOR
+
+/* Minor version of this package */
+#undef PACKAGE_VERSION_MINOR
+
+/* Patch version of this package */
+#undef PACKAGE_VERSION_PATCHLEVEL
+
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
 /* Version number of package */
 #undef VERSION
+
+/* Update some functions to new X parameter list */
+#undef X_NEW_PARMS
diff -uNr xf86-video-ivtv-1.0.0/configure.ac xf86-video-ivtv/configure.ac
--- xf86-video-ivtv-1.0.0/configure.ac	2007-08-25 21:01:09.000000000 +0200
+++ xf86-video-ivtv/configure.ac	2008-03-05 15:01:29.000000000 +0100
@@ -22,7 +22,7 @@
 
 AC_PREREQ(2.57)
 AC_INIT([xf86-video-ivtv],
-        1.0.0,
+        1.0.1,
         [http://ivtvdriver.org/trac],
         xf86-video-ivtv)
 
@@ -47,16 +47,30 @@
             [moduledir="$withval"],
             [moduledir="$libdir/xorg/modules"])
 
+PKG_CHECK_EXISTS([xorg-server >= 1.0.99.901],
+                  [AC_DEFINE(X_NEW_PARMS,1,[Update some functions to new X parameter list])])
+
 # Checks for pkg-config packages
-PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES])
+PKG_CHECK_MODULES(XORG, [xorg-server xproto fontsproto $REQUIRED_MODULES])
 sdkdir=$(pkg-config --variable=sdkdir xorg-server)
 
 # Checks for extensions
 XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
 XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
+XORG_DRIVER_CHECK_EXT(XSERVER_LIBPCIACCESS, pciaccess)
 XORG_DRIVER_CHECK_EXT(XV, videoproto)
 
-# Checks for libraries.
+save_CFLAGS="$CFLAGS"
+CFLAGS="$XORG_CFLAGS"
+AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
+              [XSERVER_LIBPCIACCESS=yes], [XSERVER_LIBPCIACCESS=no],
+              [#include "xorg-server.h"])
+CFLAGS="$save_CFLAGS"
+
+if test "x$XSERVER_LIBPCIACCESS" = xyes; then
+    PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
+fi
+AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
 
 # Checks for header files.
 AC_HEADER_STDC
diff -uNr xf86-video-ivtv-1.0.0/src/ivtv.c xf86-video-ivtv/src/ivtv.c
--- xf86-video-ivtv-1.0.0/src/ivtv.c	2007-10-12 09:12:46.000000000 +0200
+++ xf86-video-ivtv/src/ivtv.c	2008-03-05 15:01:28.000000000 +0100
@@ -114,7 +114,7 @@
 #define IVTVDEV_DRIVER_NAME	"ivtv"
 #define IVTVDEV_VERSION_MAJOR	1
 #define IVTVDEV_VERSION_MINOR	0
-#define IVTVDEV_VERSION_PATCH	0
+#define IVTVDEV_VERSION_PATCH	1
 #define IVTVDEV_VERSION	((IVTVDEV_VERSION_MAJOR << 16) | \
 			(IVTVDEV_VERSION_MINOR << 8) | \
 			(IVTVDEV_VERSION_PATCH))
@@ -198,7 +198,7 @@
 static void
 IVTVshadowUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf)
 {
-#ifdef X_MODULAR
+#ifdef X_NEW_PARMS
     RegionPtr damage = DamageRegion(pBuf->pDamage);
 #else
     RegionPtr damage = &pBuf->damage;
@@ -330,9 +330,6 @@
 	    xf86MatchDevice(IVTVDEV_DRIVER_NAME, &devSections)) <= 0)
 	return FALSE;
 
-    if (xf86GetPciVideoInfo() == NULL)
-	return FALSE;
-
     numUsed = xf86MatchPciInstances(IVTVDEV_DRIVER_NAME,
 	PCI_HAUPPAUGE_VENDOR_ID,
 	IVTVChipsets,
diff -uNr xf86-video-ivtv-1.0.0/src/ivtv_hw.c xf86-video-ivtv/src/ivtv_hw.c
--- xf86-video-ivtv-1.0.0/src/ivtv_hw.c	2007-10-12 09:14:57.000000000 +0200
+++ xf86-video-ivtv/src/ivtv_hw.c	2008-03-05 15:01:28.000000000 +0100
@@ -269,7 +269,13 @@
 		xf86DrvMsg(scrnIndex, X_ERROR,
 			"Unable to open yuv device '%s'\n", yuvDevFull);
 	    }
+	} else if (yuvFd == -1 && errno == EACCES) {
+		/* Device exists, but we weren't allowed to open it */
+		xf86DrvMsg(scrnIndex, X_ERROR,
+		    "Unable to open yuv device '%s'. "
+                    "Check device permissions.\n", yuvDevFull);
 	}
+
 	if (yuvFd == -1)
 		continue;
 
@@ -350,7 +356,11 @@
 /* -------------------------------------------------------------------- */
 
 Bool
+#if XSERVER_LIBPCIACCESS
+ivtvHWProbe(struct pci_device *PciInfo, char *device, char **namep)
+#else
 ivtvHWProbe(pciVideoPtr pPci, char *device, char **namep)
+#endif
 {
     int fd;
     Bool retVal = TRUE;
@@ -377,7 +387,11 @@
 }
 
 Bool
+#if XSERVER_LIBPCIACCESS
+ivtvHWInit(ScrnInfoPtr pScrn, struct pci_device *PciInfo, char *device)
+#else
 ivtvHWInit(ScrnInfoPtr pScrn, pciVideoPtr pPci, char *device)
+#endif
 {
     ivtvHWPtr hwPtr;
 
diff -uNr xf86-video-ivtv-1.0.0/src/ivtv_hw.h xf86-video-ivtv/src/ivtv_hw.h
--- xf86-video-ivtv-1.0.0/src/ivtv_hw.h	2007-08-28 10:37:51.000000000 +0200
+++ xf86-video-ivtv/src/ivtv_hw.h	2008-03-05 15:01:28.000000000 +0100
@@ -44,6 +44,10 @@
 # include "xorgVersion.h"
 #endif
 
+#ifdef XSERVER_LIBPCIACCESS
+#include <pciaccess.h>
+#endif
+
 typedef struct
 {
     /* framebuffer device: filename (/dev/fb*), handle, more */
@@ -90,17 +94,15 @@
 # define IVTVDEVHW_BYTE_SWAP 1
 #endif
 
-/* FIXME - There must be a better way to do this..... */
-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(7,0,0,0,0)
-# define X_MODULAR 1
-#elif XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(6,0,0,0,0)
-# define X_MODULAR 1
-#endif
-
 Bool ivtvHWGetRec(ScrnInfoPtr pScrn);
 void ivtvHWFreeRec(ScrnInfoPtr pScrn);
+#if XSERVER_LIBPCIACCESS
+Bool ivtvHWProbe(struct pci_device *PciInfo, char *device, char **namep);
+Bool ivtvHWInit(ScrnInfoPtr pScrn, struct pci_device *PciInfo, char *device);
+#else
 Bool ivtvHWProbe(pciVideoPtr pPci, char *device, char **namep);
 Bool ivtvHWInit(ScrnInfoPtr pScrn, pciVideoPtr pPci, char *device);
+#endif
 char *ivtvHWGetName(ScrnInfoPtr pScrn);
 int ivtvHWGetDepth(ScrnInfoPtr pScrn, int *fbbpp);
 int ivtvHWGetLineLength(ScrnInfoPtr pScrn);
diff -uNr xf86-video-ivtv-1.0.0/src/ivtv_xv.c xf86-video-ivtv/src/ivtv_xv.c
--- xf86-video-ivtv-1.0.0/src/ivtv_xv.c	2007-08-28 10:37:51.000000000 +0200
+++ xf86-video-ivtv/src/ivtv_xv.c	2008-03-05 15:01:28.000000000 +0100
@@ -66,7 +66,7 @@
 static void IVTVQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short,
     unsigned int *, unsigned int *, pointer);
 
-#ifdef X_MODULAR
+#ifdef X_NEW_PARMS
 static int IVTVPutImage(ScrnInfoPtr, short, short, short, short, short,
     short, short, short, int, unsigned char *, short,
     short, Bool, RegionPtr, pointer, DrawablePtr);
@@ -566,11 +566,12 @@
 		((sc_y & 15) << 4) + (blk_index & 15) + suv_offset;
 
 	    /* Copy v */
-	    dst[dst_offset] = src[(width >> 1) * us_y + v_offset + us_x];
-	    blk_index++;
+	    dst[dst_offset++] = src[(width >> 1) * us_y + v_offset + us_x];
+
 	    /* Copy u */
 	    dst[dst_offset] = src[(width >> 1) * us_y + u_offset + us_x];
-	    blk_index++;
+
+	    blk_index+=2;
 
 	    if (xskip_count != xskip) {
 		/* Count towards the next horizontal skip */
@@ -676,7 +677,7 @@
     return (sc_x << 16) | sc_y;
 }
 
-#ifdef X_MODULAR
+#ifdef X_NEW_PARMS
 static int
 IVTVPutImage(ScrnInfoPtr pScrn,
     short src_x, short src_y,