summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--community/ccrtp/PKGBUILD37
-rw-r--r--community/ccrtp/ccrtp.install22
-rw-r--r--community/commoncpp2/PKGBUILD32
-rw-r--r--community/commoncpp2/commoncpp2.install22
-rw-r--r--community/freerdp/PKGBUILD22
-rw-r--r--community/nginx/PKGBUILD8
-rw-r--r--community/remmina/PKGBUILD25
-rw-r--r--community/synfig/PKGBUILD8
-rw-r--r--community/synfigstudio/PKGBUILD8
-rw-r--r--community/synfigstudio/synfigstudio.install1
-rw-r--r--community/twinkle/PKGBUILD36
-rw-r--r--community/twinkle/twinkle.desktop4
-rw-r--r--core/kmod/0001-libkmod-module-probe-Fix-ignore-loaded-flag-not-bein.patch28
-rw-r--r--core/kmod/PKGBUILD38
-rw-r--r--core/ncurses/PKGBUILD34
-rw-r--r--core/udev/PKGBUILD85
-rw-r--r--core/udev/initcpio-hooks-udev9
-rw-r--r--core/udev/initcpio-install-udev26
-rw-r--r--core/udev/udev.install14
-rw-r--r--extra/systemd/PKGBUILD86
-rw-r--r--extra/systemd/os-release5
-rw-r--r--extra/systemd/systemd.install53
-rw-r--r--extra/twisted/PKGBUILD8
-rw-r--r--extra/xfce4-timer-plugin/PKGBUILD9
-rw-r--r--extra/xfce4-timer-plugin/xfce4-timer-plugin.install11
-rw-r--r--libre/kdelibs-libre/PKGBUILD2
-rw-r--r--libre/metalog/PKGBUILD2
-rw-r--r--libre/thunderbird-libre/PKGBUILD15
-rw-r--r--libre/thunderbird-libre/libvpx.patch12
-rw-r--r--multilib/lib32-libjpeg-turbo/PKGBUILD6
-rw-r--r--testing/libpciaccess/PKGBUILD28
-rw-r--r--testing/libx11/PKGBUILD41
-rw-r--r--testing/libx11/xorg.csh15
-rw-r--r--testing/libx11/xorg.sh15
-rw-r--r--testing/libxcb/PKGBUILD32
-rw-r--r--testing/libxcb/libxcb-1.1-no-pthread-stubs.patch12
-rw-r--r--testing/libxi/PKGBUILD29
-rw-r--r--testing/mesa/LICENSE82
-rw-r--r--testing/mesa/PKGBUILD301
-rw-r--r--testing/xf86-input-acecad/PKGBUILD35
-rw-r--r--testing/xf86-input-acecad/assign-local-private-after-allocating.patch24
-rw-r--r--testing/xf86-input-aiptek/PKGBUILD32
-rw-r--r--testing/xf86-input-evdev/PKGBUILD31
-rw-r--r--testing/xf86-input-joystick/50-joystick.conf6
-rw-r--r--testing/xf86-input-joystick/PKGBUILD40
-rw-r--r--testing/xf86-input-joystick/git-fixes.patch399
-rw-r--r--testing/xf86-input-keyboard/PKGBUILD30
-rw-r--r--testing/xf86-input-mouse/PKGBUILD30
-rw-r--r--testing/xf86-input-synaptics/10-synaptics.conf9
-rw-r--r--testing/xf86-input-synaptics/PKGBUILD48
-rw-r--r--testing/xf86-input-void/PKGBUILD33
-rw-r--r--testing/xf86-input-wacom/70-wacom.rules12
-rw-r--r--testing/xf86-input-wacom/PKGBUILD35
-rw-r--r--testing/xf86-video-apm/PKGBUILD33
-rw-r--r--testing/xf86-video-apm/apm-1.2.3-git.patch34
-rw-r--r--testing/xf86-video-ark/PKGBUILD34
-rw-r--r--testing/xf86-video-ark/git-fixes.patch118
-rw-r--r--testing/xf86-video-ast/PKGBUILD33
-rw-r--r--testing/xf86-video-ast/ast-0.93.9-vga.patch38
-rw-r--r--testing/xf86-video-ati/PKGBUILD31
-rw-r--r--testing/xf86-video-chips/PKGBUILD35
-rw-r--r--testing/xf86-video-chips/chips-1.2.4-git.patch912
-rw-r--r--testing/xf86-video-cirrus/PKGBUILD33
-rw-r--r--testing/xf86-video-cirrus/cirrus-1.3.2-git.patch846
-rw-r--r--testing/xf86-video-dummy/PKGBUILD30
-rw-r--r--testing/xf86-video-fbdev/PKGBUILD30
-rw-r--r--testing/xf86-video-glint/PKGBUILD30
-rw-r--r--testing/xf86-video-i128/PKGBUILD33
-rw-r--r--testing/xf86-video-i128/i128-1.3.4-git.patch173
-rw-r--r--testing/xf86-video-i740/PKGBUILD30
-rw-r--r--testing/xf86-video-intel/PKGBUILD30
-rw-r--r--testing/xf86-video-mach64/PKGBUILD30
-rw-r--r--testing/xf86-video-mga/PKGBUILD34
-rw-r--r--testing/xf86-video-mga/git-fixes.patch800
-rw-r--r--testing/xf86-video-neomagic/PKGBUILD30
-rw-r--r--testing/xf86-video-nouveau/PKGBUILD41
-rw-r--r--testing/xf86-video-nouveau/xf86-video-nouveau.install16
-rw-r--r--testing/xf86-video-nv/PKGBUILD31
-rw-r--r--testing/xf86-video-openchrome/PKGBUILD31
-rw-r--r--testing/xf86-video-r128/PKGBUILD36
-rw-r--r--testing/xf86-video-r128/git-fixes.patch842
-rw-r--r--testing/xf86-video-rendition/PKGBUILD35
-rw-r--r--testing/xf86-video-rendition/rendition-4.2.4-git.patch809
-rw-r--r--testing/xf86-video-s3/LICENSE25
-rw-r--r--testing/xf86-video-s3/PKGBUILD35
-rw-r--r--testing/xf86-video-s3/git-fixes.patch458
-rw-r--r--testing/xf86-video-s3virge/PKGBUILD38
-rw-r--r--testing/xf86-video-s3virge/copyright.patch82
-rw-r--r--testing/xf86-video-s3virge/s3virge-1.10.4-vga.patch76
-rw-r--r--testing/xf86-video-savage/PKGBUILD31
-rw-r--r--testing/xf86-video-siliconmotion/PKGBUILD35
-rw-r--r--testing/xf86-video-siliconmotion/smi-1.7.5-vga.patch25
-rw-r--r--testing/xf86-video-sis/PKGBUILD34
-rw-r--r--testing/xf86-video-sis/sis-0.10.3-git.patch1460
-rw-r--r--testing/xf86-video-sisusb/PKGBUILD33
-rw-r--r--testing/xf86-video-sisusb/sisusb-0.9.4-git.patch794
-rw-r--r--testing/xf86-video-tdfx/PKGBUILD36
-rw-r--r--testing/xf86-video-trident/PKGBUILD34
-rw-r--r--testing/xf86-video-trident/trident-1.3.4-git.patch523
-rw-r--r--testing/xf86-video-tseng/PKGBUILD33
-rw-r--r--testing/xf86-video-tseng/tseng-1.2.4-git.patch317
-rw-r--r--testing/xf86-video-unichrome/LICENSE23
-rw-r--r--testing/xf86-video-unichrome/PKGBUILD30
-rw-r--r--testing/xf86-video-v4l/LICENSE826
-rw-r--r--testing/xf86-video-v4l/PKGBUILD36
-rw-r--r--testing/xf86-video-v4l/git-fixes.patch4362
-rw-r--r--testing/xf86-video-vesa/PKGBUILD40
-rw-r--r--testing/xf86-video-vesa/git-fixes.patch444
-rw-r--r--testing/xf86-video-vesa/revert-kernelcheck.patch31
-rw-r--r--testing/xf86-video-voodoo/PKGBUILD30
-rw-r--r--testing/xf86-video-xgixp/PKGBUILD33
-rw-r--r--testing/xf86-video-xgixp/api-compat-fix-for-DRAWABLE_BUFFER.patch23
-rw-r--r--testing/xorg-server/10-quirks.conf10
-rw-r--r--testing/xorg-server/PKGBUILD191
-rw-r--r--testing/xorg-server/autoconfig-nvidia.patch28
-rw-r--r--testing/xorg-server/autoconfig-sis.patch19
-rw-r--r--testing/xorg-server/git-fixes.patch161
-rw-r--r--testing/xorg-server/xvfb-run180
-rw-r--r--testing/xorg-server/xvfb-run.1282
-rw-r--r--testing/xorg-xinput/PKGBUILD28
-rw-r--r--~mtjm/python2-pydns/PKGBUILD4
-rw-r--r--~mtjm/python2-pyflakes/PKGBUILD33
-rw-r--r--~mtjm/python2-pyspf/PKGBUILD6
123 files changed, 17902 insertions, 212 deletions
diff --git a/community/ccrtp/PKGBUILD b/community/ccrtp/PKGBUILD
index 13ac0026b..c95d26ca8 100644
--- a/community/ccrtp/PKGBUILD
+++ b/community/ccrtp/PKGBUILD
@@ -1,34 +1,41 @@
-# $Id: PKGBUILD 47033 2011-05-14 10:27:41Z jelle $
+# $Id: PKGBUILD 64382 2012-02-12 15:47:02Z arodseth $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
-# Contributor:
# Contributor: Jeff Mickey <jeff@archlinux.org>
# Contributor: John Proctor <jproctor@prium.net>
+# Contributor: Alexander Rødseth <rodseth@gmail.com>
pkgname=ccrtp
pkgver=1.8.0
-pkgrel=1
+pkgrel=2
pkgdesc="GNU ccRTP"
-arch=('i686' 'x86_64')
-url="http://www.gnu.org/software/ccrtp"
+arch=('x86_64' 'i686')
+url="http://www.gnu.org/software/ccrtp/"
license=('GPL' 'custom')
depends=('commoncpp2' 'zlib' 'libxml2' 'libgcrypt')
options=('!libtool')
-source=(ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz gcc46.patch)
-md5sums=('3410d2f43a6a28679bd091ed8b2ed228'
- '17ce9c79c4518f35f484b539bcff570d')
+install=$pkgname.install
+source=("ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz"
+ 'gcc46.patch')
+sha256sums=('365feddd276c78104600204ae6db4e76c66036df1e5b905e855239daac6a2473'
+ '4ac9385228dc8b8893e0868d5a06477e4009e9fb2dc191460406da58fc6a6fb3')
build() {
- cd ${srcdir}/${pkgname}-${pkgver}
- patch -Np1 -i $srcdir/gcc46.patch
+ cd "$srcdir/$pkgname-$pkgver"
+
+ patch -Np1 -i "$srcdir/gcc46.patch"
# arch64 fix from Mandriva
[ "$CARCH" == "x86_64" ] && export CXXFLAGS="$CXXFLAGS -fpermissive"
- ./configure --prefix=/usr
+ export LDFLAGS="$LDFLAGS `pkg-config --libs libccgnu2`"
+ ./configure --prefix=/usr --mandir=/usr/share/man
make
}
package() {
- cd ${srcdir}/${pkgname}-${pkgver}
- make DESTDIR=${pkgdir} install
- install -D -m644 COPYING.addendum ${pkgdir}/usr/share/licenses/$pkgname/LICENSE
- rm -rf ${pkgdir}/usr/share/info/dir
+ cd "$srcdir/$pkgname-$pkgver"
+
+ make DESTDIR="$pkgdir" install
+ install -Dm644 COPYING.addendum "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+ #rm -rf "$pkgdir/usr/share/info/dir"
}
+
+# vim:set ts=2 sw=2 et:
diff --git a/community/ccrtp/ccrtp.install b/community/ccrtp/ccrtp.install
new file mode 100644
index 000000000..51b971c5c
--- /dev/null
+++ b/community/ccrtp/ccrtp.install
@@ -0,0 +1,22 @@
+infodir=usr/share/info
+filelist=(ccrtp.info)
+
+post_install() {
+ [[ -x usr/bin/install-info ]] || return 0
+ for file in "${filelist[@]}"; do
+ install-info "$infodir/$file.gz" "$infodir/dir" 2> /dev/null
+ done
+}
+
+post_upgrade() {
+ post_install "$1"
+}
+
+pre_remove() {
+ [[ -x usr/bin/install-info ]] || return 0
+ for file in "${filelist[@]}"; do
+ install-info --delete "$infodir/$file.gz" "$infodir/dir" 2> /dev/null
+ done
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/community/commoncpp2/PKGBUILD b/community/commoncpp2/PKGBUILD
index 411a1d3f2..806cc23a9 100644
--- a/community/commoncpp2/PKGBUILD
+++ b/community/commoncpp2/PKGBUILD
@@ -1,36 +1,38 @@
-# $Id: PKGBUILD 32643 2010-11-16 09:56:02Z spupykin $
+# $Id: PKGBUILD 64380 2012-02-12 11:04:24Z arodseth $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
-# Mantainer: Franco Tortoriello <franco.tortoriello@gmail.com>
+# Contributor: Franco Tortoriello <franco.tortoriello@gmail.com>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Jeff Mickey <jeff@archlinux.org>
# Contributor: John Proctor <jproctor@prium.net>
+# Contributor: Alexander Rødseth <rodseth@gmail.com>
pkgname=commoncpp2
pkgver=1.8.1
-pkgrel=2
+pkgrel=3
pkgdesc="GNU Common C++ 2"
-arch=('i686' 'x86_64')
+arch=('x86_64' 'i686')
url='http://www.gnu.org/software/commoncpp/'
license=('GPL' 'custom')
depends=('gcc-libs' 'zlib' 'sh')
options=('!libtool' '!makeflags')
-source=("http://ftp.gnu.org/pub/gnu/commoncpp/${pkgname}-${pkgver}.tar.gz")
-md5sums=('4804b184e609154ba2bc0aa9f61dc6ef')
-md5sums=('4804b184e609154ba2bc0aa9f61dc6ef')
+install=$pkgname.install
+source=("http://ftp.gnu.org/pub/gnu/commoncpp/$pkgname-$pkgver.tar.gz")
+sha256sums=('53ced4aff74e28a1d8018eb2b4974519028db3c12471ab6dff1c873578c9af4e')
build() {
- cd ${srcdir}/${pkgname}-${pkgver}
+ cd "$srcdir/$pkgname-$pkgver"
+
sed -i -e '50 a\#include <sys/stat.h>' inc/cc++/applog.h
- ./configure --prefix=/usr
+ ./configure --prefix=/usr --mandir=/usr/share/man
make
}
package() {
- cd ${srcdir}/${pkgname}-${pkgver}
- make DESTDIR=${pkgdir} install
-
- gzip -9 ${pkgdir}/usr/share/info/commoncpp2.info
- rm ${pkgdir}/usr/share/info/dir
+ cd "$srcdir/$pkgname-$pkgver"
- install -D -m644 COPYING.addendum ${pkgdir}/usr/share/licenses/$pkgname/LICENSE
+ make DESTDIR="$pkgdir" install
+ install -Dm644 COPYING.addendum \
+ "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
+
+# vim:set ts=2 sw=2 et:
diff --git a/community/commoncpp2/commoncpp2.install b/community/commoncpp2/commoncpp2.install
new file mode 100644
index 000000000..762cdfb8e
--- /dev/null
+++ b/community/commoncpp2/commoncpp2.install
@@ -0,0 +1,22 @@
+infodir=usr/share/info
+filelist=(commoncpp2.info)
+
+post_install() {
+ [[ -x usr/bin/install-info ]] || return 0
+ for file in "${filelist[@]}"; do
+ install-info "$infodir/$file.gz" "$infodir/dir" 2> /dev/null
+ done
+}
+
+post_upgrade() {
+ post_install "$1"
+}
+
+pre_remove() {
+ [[ -x usr/bin/install-info ]] || return 0
+ for file in "${filelist[@]}"; do
+ install-info --delete "$infodir/$file.gz" "$infodir/dir" 2> /dev/null
+ done
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/community/freerdp/PKGBUILD b/community/freerdp/PKGBUILD
index 6c8447953..1d53ff9d9 100644
--- a/community/freerdp/PKGBUILD
+++ b/community/freerdp/PKGBUILD
@@ -1,30 +1,30 @@
-# $Id: PKGBUILD 54447 2011-08-18 15:06:31Z bluewind $
+# $Id: PKGBUILD 64418 2012-02-13 04:02:27Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Stijn Segers <francesco dot borromini at gmail dot com>
pkgname=freerdp
-pkgver=0.8.2
-pkgrel=3
+pkgver=1.0.1
+pkgrel=1
pkgdesc="Free RDP client"
arch=('i686' 'x86_64')
url="http://freerdp.sourceforge.net"
license=('GPL')
-depends=('openssl' 'libxcursor' 'libcups' 'alsa-lib')
-makedepends=('krb5')
+depends=('openssl' 'libxcursor' 'libcups' 'alsa-lib' 'libxext' 'libxdamage'
+ 'ffmpeg' 'libxkbfile' 'libxinerama' 'libxv')
+makedepends=('krb5' 'cmake' 'damageproto')
conflicts=('freerdp-git')
changelog=${pkgname}.changelog
options=('!libtool')
-source=(http://downloads.sourceforge.net/project/freerdp/${pkgver%.*}/${pkgname}-${pkgver}.tar.gz)
-md5sums=('cde590336292c977dfc1b4b7badf24d2')
+source=(https://github.com/downloads/FreeRDP/FreeRDP/FreeRDP-$pkgver.tar.gz)
+md5sums=('1282189a87893bf196da20382e45f6c1')
build() {
- cd `find ${srcdir}/ -type d -name freerdp-\*`
- [ -x configure ] || sh ./autogen.sh
- ./configure --prefix=/usr
+ cd `find ${srcdir}/ -type d -name FreeRDP-\*`
+ cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/usr/lib .
make
}
package() {
- cd `find ${srcdir}/ -type d -name freerdp-\*`
+ cd `find ${srcdir}/ -type d -name FreeRDP-\*`
make DESTDIR="${pkgdir}" install
}
diff --git a/community/nginx/PKGBUILD b/community/nginx/PKGBUILD
index 2aacb6a5d..430ab54b3 100644
--- a/community/nginx/PKGBUILD
+++ b/community/nginx/PKGBUILD
@@ -1,11 +1,11 @@
-# $Id: PKGBUILD 64339 2012-02-11 23:22:19Z allan $
+# $Id: PKGBUILD 64420 2012-02-13 04:03:13Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Maintainer: Bartłomiej Piotrowski <barthalion@gmal.com>
# Contributor: Miroslaw Szot <mss@czlug.icis.pcz.pl>
pkgname=nginx
-pkgver=1.0.11
-pkgrel=2
+pkgver=1.0.12
+pkgrel=1
pkgdesc="lightweight HTTP server and IMAP/POP3 proxy server"
arch=('i686' 'x86_64')
depends=('pcre' 'zlib' 'openssl')
@@ -36,6 +36,8 @@ _tmp_path=/var/spool/nginx
_log_path=/var/log/nginx
_user=http
_group=http
+md5sums=('d0ceefeb2a68ecb19e78ee894a5b52a3'
+ '0e8032d3ba26c3276e8c7c30588d375f')
build() {
cd "$srcdir/nginx-${pkgver}"
diff --git a/community/remmina/PKGBUILD b/community/remmina/PKGBUILD
index be4e4b23b..fb0ec9527 100644
--- a/community/remmina/PKGBUILD
+++ b/community/remmina/PKGBUILD
@@ -1,27 +1,28 @@
-# $Id: PKGBUILD 42194 2011-03-15 12:36:34Z spupykin $
+# $Id: PKGBUILD 64408 2012-02-13 02:27:42Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
pkgname=remmina
-pkgver=0.9.3
+pkgver=1.0.0
pkgrel=1
pkgdesc="Remmina is a remote desktop client written in GTK+. "
arch=(i686 x86_64)
url="http://sourceforge.net/projects/remmina/"
license=('GPL')
-provides=("grdc" "grdc=$pkgver")
+depends=('gtk2' 'zlib' 'libjpeg' 'libssh' 'libunique' 'avahi' 'vte3' 'libgcrypt' 'libxdmcp' 'libgnome-keyring')
+makedepends=('intltool' 'pkgconfig' 'cmake'
+ 'avahi' 'libxkbfile' 'freerdp' 'telepathy-glib')
+optdepends=('avahi' 'libxkbfile' 'freerdp' 'telepathy-glib')
+replaces=('remmina-plugins')
+provides=("grdc" "grdc=$pkgver" 'remmina-plugins')
conflicts=("grdc")
-depends=('gtk2' 'zlib' 'libjpeg' 'libssh' 'libunique' 'avahi' 'vte' 'libgcrypt' 'libxdmcp')
-makedepends=('intltool' 'pkgconfig')
-optdepends=('remmina-plugins: Plugins for remmina, including xdmcp vnc telepathy rdp and nx')
install=remmina.install
-source=($pkgname-$pkgver.tar.gz::"http://downloads.sourceforge.net/project/remmina/0.9/$pkgname-$pkgver.tar.gz")
-md5sums=('c87004a70ec62acbae732e8d47f71ba7')
+source=(https://github.com/downloads/FreeRDP/Remmina/Remmina-$pkgver.tar.gz)
+md5sums=('701c540acaab961bc3adf130a2ddb8b1')
build() {
- cd ${srcdir}/$pkgname-$pkgver
- ./configure --prefix=/usr --enable-nls --disable-unique \
- --enable-avahi --enable-vte \
- --enable-vnc --enable-ssh --enable-gcrypt
+ cd ${srcdir}/FreeRDP-Remmina-*/
+ export LDFLAGS="-lX11 -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lpthread"
+ cmake -DWITH_APPINDICATOR=OFF -DCMAKE_INSTALL_PREFIX=/usr .
make
make DESTDIR=${pkgdir} install
}
diff --git a/community/synfig/PKGBUILD b/community/synfig/PKGBUILD
index 7f6eb2c40..220779a00 100644
--- a/community/synfig/PKGBUILD
+++ b/community/synfig/PKGBUILD
@@ -1,10 +1,10 @@
-# $Id: PKGBUILD 63750 2012-02-05 12:11:41Z ibiru $
+# $Id: PKGBUILD 64414 2012-02-13 03:46:16Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Franco Iacomella <yaco@gnu.org>
pkgname=synfig
-pkgver=0.63.03
-pkgrel=2
+pkgver=0.63.04
+pkgrel=1
pkgdesc="Professional vector animation program (CLI renderer only)"
arch=(i686 x86_64)
url="http://synfig.org"
@@ -18,7 +18,7 @@ options=(!libtool)
source=(http://downloads.sourceforge.net/project/synfig/synfig/$pkgver/synfig-$pkgver.tar.gz
build-fix.patch
ffmpeg-0.8.patch)
-md5sums=('9bd77cd2fc2381adfbd50a7b9c1c6e7c'
+md5sums=('baa0df3a51d101600771e0d45fcc7d22'
'b5568b06fae1a7ee465b5380b1139b83'
'ebf41046097cfd778dee9a9854561dae')
diff --git a/community/synfigstudio/PKGBUILD b/community/synfigstudio/PKGBUILD
index bbd4b7842..b468906c6 100644
--- a/community/synfigstudio/PKGBUILD
+++ b/community/synfigstudio/PKGBUILD
@@ -1,10 +1,10 @@
-# $Id: PKGBUILD 60377 2011-12-12 14:49:30Z spupykin $
+# $Id: PKGBUILD 64416 2012-02-13 03:47:06Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Franco Iacomella <yaco@gnu.org>
pkgname=synfigstudio
-pkgver=0.63.03
-pkgrel=2
+pkgver=0.63.04
+pkgrel=1
pkgdesc="Professional vector animation program (GUI)"
arch=(i686 x86_64)
url="http://synfig.org"
@@ -15,7 +15,7 @@ makedepends=('openexr' 'imagemagick' 'xorg-fonts-100dpi' 'xorg-fonts-75dpi'
install=synfigstudio.install
options=('!libtool')
source=(http://downloads.sourceforge.net/project/synfig/synfigstudio/$pkgver/synfigstudio-$pkgver.tar.gz)
-md5sums=('a166ff4917b0e058cae96e51aa273080')
+md5sums=('6bc0d5410df032df6c518adca824ddb6')
build() {
cd $srcdir/synfigstudio-$pkgver
diff --git a/community/synfigstudio/synfigstudio.install b/community/synfigstudio/synfigstudio.install
index b95cc069d..6110a6f18 100644
--- a/community/synfigstudio/synfigstudio.install
+++ b/community/synfigstudio/synfigstudio.install
@@ -1,4 +1,5 @@
post_install() {
+ update-mime-database usr/share/mime || true
which xdg-icon-resource 1>/dev/null 2>/dev/null && xdg-icon-resource forceupdate || true
}
diff --git a/community/twinkle/PKGBUILD b/community/twinkle/PKGBUILD
index 5d64f1bc1..7088849a9 100644
--- a/community/twinkle/PKGBUILD
+++ b/community/twinkle/PKGBUILD
@@ -1,34 +1,44 @@
-# $Id: PKGBUILD 62127 2012-01-16 09:29:34Z spupykin $
+# $Id: PKGBUILD 64393 2012-02-12 19:27:33Z arodseth $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Jeff Mickey <jeff@archlinux.org>
# Contributor: Alexander Baldeck <alexander@archlinux.org>
# Contributor: Federico Quagliata (quaqo) <quaqo@despammed.com>
+# Contributor: Alexander Rødseth <rodseth@gmail.com>
pkgname=twinkle
pkgver=1.4.2
-pkgrel=13
-pkgdesc="A softphone for voice over IP and instant messaging communications using the SIP protocol"
-arch=('i686' 'x86_64')
+pkgrel=14
+pkgdesc="Softphone for voice over IP and IM communication using SIP"
+arch=('x86_64' 'i686')
url="http://www.twinklephone.com/"
license=('GPL')
-depends=('file' 'speex' 'boost-libs' 'libsndfile' 'commoncpp2' 'libxml2' 'libx11'
- 'qt3' 'libzrtpcpp')
+depends=('file' 'speex' 'boost-libs' 'libsndfile' 'qt3' 'libzrtpcpp')
makedepends=('pkg-config' 'boost')
-source=(http://www.xs4all.nl/~mfnboer/${pkgname}/download/${pkgname}-${pkgver}.tar.gz)
-md5sums=('d70c8972f296ffd998c7fb698774705b')
+source=("http://www.xs4all.nl/~mfnboer/$pkgname/download/$pkgname-$pkgver.tar.gz"
+ "twinkle.desktop")
+sha256sums=('807686c7ac1b54bb0ea27ff4be362db6926d1d3d6f1802f6d359a353157e89a5'
+ '88578b314f434d88ef387ee8bf541dcdd4dfeffba161c1c66e43ac54103b3862')
build() {
- cd ${srcdir}/${pkgname}-${pkgver}
+ cd "$srcdir/$pkgname-$pkgver"
+
. /etc/profile.d/qt3.sh
./configure --prefix=/usr \
--without-kde \
--with-speex \
- --without-ilbc
+ --without-ilbc \
+ --mandir=/usr/share/man
make
}
package() {
- cd ${srcdir}/${pkgname}-${pkgver}
- make DESTDIR=${pkgdir} install
- install -D -m644 twinkle.desktop ${pkgdir}/usr/share/applications/twinkle.desktop
+ cd "$srcdir/$pkgname-$pkgver"
+
+ make DESTDIR="$pkgdir" install
+ install -Dm644 "$pkgdir/usr/share/twinkle/twinkle48.png" \
+ "$pkgdir/usr/share/pixmaps/twinkle.png"
+ install -Dm644 twinkle.desktop \
+ "$pkgdir/usr/share/applications/twinkle.desktop"
}
+
+# vim:set ts=2 sw=2 et:
diff --git a/community/twinkle/twinkle.desktop b/community/twinkle/twinkle.desktop
index e85a32e51..60688b5fe 100644
--- a/community/twinkle/twinkle.desktop
+++ b/community/twinkle/twinkle.desktop
@@ -1,7 +1,7 @@
[Desktop Entry]
Name=Twinkle
-Comment=A SIP softphone for Qt
-Icon=/usr/share/twinkle/twinkle48.png
+Comment=SIP softphone for Qt
+Icon=twinkle.png
Exec=twinkle
Terminal=false
Type=Application
diff --git a/core/kmod/0001-libkmod-module-probe-Fix-ignore-loaded-flag-not-bein.patch b/core/kmod/0001-libkmod-module-probe-Fix-ignore-loaded-flag-not-bein.patch
new file mode 100644
index 000000000..4ffc3e53b
--- /dev/null
+++ b/core/kmod/0001-libkmod-module-probe-Fix-ignore-loaded-flag-not-bein.patch
@@ -0,0 +1,28 @@
+From 269de2e0bf5011072da2f40f4f2d4023fad696b9 Mon Sep 17 00:00:00 2001
+From: Lucas De Marchi <lucas.demarchi@profusion.mobi>
+Date: Tue, 7 Feb 2012 09:48:59 -0200
+Subject: [PATCH] libkmod-module: probe: Fix ignore-loaded flag not being
+ applied
+
+---
+ TODO | 3 +++
+ libkmod/libkmod-module.c | 3 ++-
+ 2 files changed, 5 insertions(+), 1 deletions(-)
+
+diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
+index 0af3e2e..b5eb7c9 100644
+--- a/libkmod/libkmod-module.c
++++ b/libkmod/libkmod-module.c
+@@ -1132,7 +1132,8 @@ KMOD_EXPORT int kmod_module_probe_insert_module(struct kmod_module *mod,
+ if (mod == NULL)
+ return -ENOENT;
+
+- if (module_is_inkernel(mod)) {
++ if (!(flags & KMOD_PROBE_IGNORE_LOADED)
++ && module_is_inkernel(mod)) {
+ if (flags & KMOD_PROBE_FAIL_ON_LOADED)
+ return -EEXIST;
+ else
+--
+1.7.9
+
diff --git a/core/kmod/PKGBUILD b/core/kmod/PKGBUILD
index ac327eac1..a219e2d8f 100644
--- a/core/kmod/PKGBUILD
+++ b/core/kmod/PKGBUILD
@@ -1,41 +1,32 @@
-# $Id: PKGBUILD 148463 2012-02-01 13:16:33Z dreisner $
+# $Id: PKGBUILD 150108 2012-02-12 15:37:16Z dreisner $
# Maintainer: Dave Reisner <dreisner@archlinux.org>
pkgname=kmod
-pkgver=4
+pkgver=5
pkgrel=2
pkgdesc="Linux kernel module handling"
arch=('i686' 'x86_64')
url="http://git.profusion.mobi/cgit.cgi/kmod.git"
license=('GPL2')
depends=('glibc' 'zlib')
-makedepends=('docbook2x')
options=('!libtool')
provides=('module-init-tools=3.16')
conflicts=('module-init-tools')
replaces=('module-init-tools')
source=("http://packages.profusion.mobi/$pkgname/$pkgname-$pkgver.tar.xz"
- 0001-partially-fix-parsing-of-alias-with-dots.patch
- 0002-libkmod-module-used-shared-code-in-module-creation.patch
- 0003-modprobe-handle-all-error-returns-from-init_module.patch
- 0004-modprobe-remove-0-refcnt-deps.patch
+ '0001-libkmod-module-probe-Fix-ignore-loaded-flag-not-bein.patch'
"depmod-search.conf")
-md5sums=('e14450a066a48accd0af1995b3c0232d'
- '5f497ab3466ee1a616b6e6c97b330706'
- '23a9257a152862753ce4c4ee7287761a'
- '3a57671b0f37b1203b207f35a4442ae3'
- '1fe88eee9302104b179124ce6bfc55d2'
+md5sums=('b271c2ec54aba1c67bda63c8579d8c15'
+ '81545a1509b43008f85c03fb980f0e86'
'4b8cbcbc54b9029c99fd730e257d4436')
build() {
cd "$pkgname-$pkgver"
- patch -Np1 <"$srcdir/0001-partially-fix-parsing-of-alias-with-dots.patch"
- patch -Np1 <"$srcdir/0002-libkmod-module-used-shared-code-in-module-creation.patch"
- patch -Np1 <"$srcdir/0003-modprobe-handle-all-error-returns-from-init_module.patch"
- patch -Np1 <"$srcdir/0004-modprobe-remove-0-refcnt-deps.patch"
+ # fix modprobe --show-depends failures on loaded modules
+ patch -Np1 <"$srcdir/0001-libkmod-module-probe-Fix-ignore-loaded-flag-not-bein.patch"
- ./configure \
+ CFLAGS+=' -g -O0' ./configure \
--sysconfdir=/etc \
--with-rootprefix= \
--with-zlib
@@ -50,16 +41,13 @@ check() {
package() {
make -C "$pkgname-$pkgver" DESTDIR="$pkgdir" install
- # binary directories
- install -dm755 "$pkgdir"/{,s}bin
-
- # configuration directories
- install -dm755 "$pkgdir"/{etc,lib}/{depmod,modprobe}.d
+ # extra directories
+ install -dm755 "$pkgdir"/{etc,lib}/{depmod,modprobe}.d "$pkgdir/sbin"
# add symlinks to kmod
- ln -s /usr/bin/kmod "$pkgdir/bin/lsmod"
- for tool in {ins,rm,dep}mod mod{info,probe}; do
- ln -s ../usr/bin/kmod "$pkgdir/sbin/$tool"
+ ln -s ../usr/bin/kmod "$pkgdir/sbin/modprobe"
+ for tool in {dep,ins,ls,rm}mod modinfo; do
+ ln -s kmod "$pkgdir/usr/bin/$tool"
done
# install depmod.d file for search/ dir
diff --git a/core/ncurses/PKGBUILD b/core/ncurses/PKGBUILD
index fdf6a0343..b55c21040 100644
--- a/core/ncurses/PKGBUILD
+++ b/core/ncurses/PKGBUILD
@@ -1,10 +1,10 @@
-# $Id: PKGBUILD 142072 2011-11-04 23:36:06Z allan $
+# $Id: PKGBUILD 150103 2012-02-12 13:47:59Z allan $
# Maintainer: Allan McRae <allan@archlinux.org>
# Contributor: judd <jvinet@zeroflux.org>
pkgname=ncurses
pkgver=5.9
-pkgrel=2
+pkgrel=3
pkgdesc="System V Release 4.0 curses emulation library"
arch=('i686' 'x86_64')
url="http://www.gnu.org/software/ncurses/"
@@ -21,7 +21,8 @@ build() {
cd ${srcdir}/ncursesw-build
../${pkgname}-${pkgver}/configure --prefix=/usr --mandir=/usr/share/man \
--with-shared --with-normal --without-debug --without-ada \
- --with-install-prefix=${pkgdir} --enable-widec
+ --with-install-prefix=${pkgdir} --enable-widec \
+ --enable-pc-files
# add --enable-ext-colors with next soname bump
make
@@ -38,34 +39,27 @@ package() {
cd ${srcdir}/ncursesw-build
make install
- # move libraries needed for boot to /lib (we call tput in initscripts)
- install -dm755 ${pkgdir}/lib
- mv ${pkgdir}/usr/lib/libncursesw.so.5* ${pkgdir}/lib
- ln -sf ../../lib/libncursesw.so.5 ${pkgdir}/usr/lib/libncursesw.so
-
# Fool packages looking to link to non-wide-character ncurses libraries
- for lib in curses ncurses form panel menu; do
- rm -f ${pkgdir}/usr/lib/lib${lib}.so
+ for lib in ncurses form panel menu; do
echo "INPUT(-l${lib}w)" >${pkgdir}/usr/lib/lib${lib}.so
- ln -sf lib${lib}w.a ${pkgdir}/usr/lib/lib${lib}.a
+ ln -s lib${lib}w.a ${pkgdir}/usr/lib/lib${lib}.a
done
- ln -sf libncurses++w.a ${pkgdir}/usr/lib/libncurses++.a
+ ln -s libncurses++w.a ${pkgdir}/usr/lib/libncurses++.a
- # install tput to /bin
- install -dm755 ${pkgdir}/bin/
- mv ${pkgdir}/usr/bin/tput ${pkgdir}/bin/tput
+ for lib in ncurses ncurses++ form panel menu; do
+ ln -s ${lib}w.pc ${pkgdir}/usr/lib/pkgconfig/${lib}.pc
+ done
# Some packages look for -lcurses during build
- rm -f ${pkgdir}/usr/lib/libcursesw.so
echo "INPUT(-lncursesw)" >${pkgdir}/usr/lib/libcursesw.so
- ln -sf libncurses.so ${pkgdir}/usr/lib/libcurses.so
- ln -sf libncursesw.a ${pkgdir}/usr/lib/libcursesw.a
- ln -sf libncurses.a ${pkgdir}/usr/lib/libcurses.a
+ ln -s libncurses.so ${pkgdir}/usr/lib/libcurses.so
+ ln -s libncursesw.a ${pkgdir}/usr/lib/libcursesw.a
+ ln -s libncurses.a ${pkgdir}/usr/lib/libcurses.a
# non-widec compatibility library
cd ${srcdir}/ncurses-build
install -Dm755 lib/libncurses.so.${pkgver} ${pkgdir}/usr/lib/libncurses.so.${pkgver}
- ln -sf libncurses.so.${pkgver} ${pkgdir}/usr/lib/libncurses.so.5
+ ln -s libncurses.so.${pkgver} ${pkgdir}/usr/lib/libncurses.so.5
# install license, rip it from the readme
cd ${srcdir}/${pkgname}-${pkgver}
diff --git a/core/udev/PKGBUILD b/core/udev/PKGBUILD
index 7b3d060c2..8e4448343 100644
--- a/core/udev/PKGBUILD
+++ b/core/udev/PKGBUILD
@@ -1,30 +1,33 @@
-# $Id: PKGBUILD 148430 2012-01-31 19:55:52Z tomegun $
+# $Id: PKGBUILD 150105 2012-02-12 15:37:11Z dreisner $
# Maintainer: Tom Gundersen <teg@jklm.no>
# Contributor: Aaron Griffin <aaron@archlinux.org>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Thomas Bächler <thomas@archlinux.org>
-pkgbase="udev"
-pkgname=('udev' 'udev-compat')
-pkgver=180
-pkgrel=1
+pkgname=udev
+pkgver=181
+pkgrel=2
+pkgdesc="The userspace dev tools (udev)"
+depends=('util-linux' 'libusb-compat' 'glib2' 'kmod' 'pciutils' 'usbutils' 'pciutils')
+install=udev.install
arch=(i686 x86_64)
-url="http://git.kernel.org/?p=linux/hotplug/udev.git;a=summary"
license=('GPL')
+makedepends=('gobject-introspection' 'gperf' 'libxslt' 'usbutils' 'kmod')
+source=(ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/$pkgname-$pkgver.tar.xz
+ initcpio-hooks-udev
+ initcpio-install-udev)
+url="http://git.kernel.org/?p=linux/hotplug/udev.git;a=summary"
+backup=(etc/udev/udev.conf)
groups=('base')
options=(!makeflags !libtool)
-makedepends=('gobject-introspection' 'gperf' 'libxslt' 'usbutils' 'kmod')
-source=(ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/$pkgbase-$pkgver.tar.xz)
build() {
- cd $srcdir/$pkgbase-$pkgver
+ cd $srcdir/$pkgname-$pkgver
./configure --prefix=/usr \
--with-rootprefix= \
--sysconfdir=/etc \
- --bindir=/sbin \
--libdir=/usr/lib \
- --with-rootlibdir=/lib \
--libexecdir=/lib \
--with-systemdsystemunitdir=/lib/systemd/system \
--enable-udev_acl
@@ -32,30 +35,19 @@ build() {
make
}
-package_udev() {
- pkgdesc="The userspace dev tools (udev)"
- depends=('util-linux' 'libusb-compat' 'glib2' 'kmod' 'pciutils' 'usbutils' 'pciutils')
- install=udev.install
- backup=(etc/udev/udev.conf)
-
- cd $srcdir/$pkgbase-$pkgver
+package() {
+ cd $srcdir/$pkgname-$pkgver
make DESTDIR=${pkgdir} install
- # create framebuffer blacklist
- install -d -m755 ${pkgdir}/lib/modprobe.d/
- for mod in $(find /lib/modules/*/kernel/drivers/video -name '*fb.ko.gz' -exec basename {} .ko.gz \;); do
- echo "blacklist $mod"
- done | sort -u > $pkgdir/lib/modprobe.d/framebuffer_blacklist.conf
-
# /dev/loop0 is created for convenience, to autoload the module if necessary
# this is no longer needed when util-linux-2.21 is released as /dev/loop-control
- # will be used instead. In that case move this to udev-compat
+ # will be used instead. Support for this will go away in a future version of udev
install -d -m755 ${pkgdir}/lib/udev/devices/
mknod ${pkgdir}/lib/udev/devices/loop0 b 7 0
chgrp disk ${pkgdir}/lib/udev/devices/loop0
# udevd moved, symlink to make life easy for restarting udevd manually
- ln -s /lib/udev/udevd ${pkgdir}/sbin/udevd
+ ln -s /lib/udev/udevd ${pkgdir}/usr/bin/udevd
# Replace dialout/tape/cdrom group in rules with uucp/storage/optical group
for i in $pkgdir/lib/udev/rules.d/*.rules; do
@@ -63,40 +55,11 @@ package_udev() {
s#GROUP="tape"#GROUP="storage"#g;
s#GROUP="cdrom"#GROUP="optical"#g' $i
done
-}
-
-package_udev-compat() {
- pkgdesc="The userspace dev tools (udev) - additional rules for older kernels"
- depends=('udev')
- groups=('')
- install -d -m755 ${pkgdir}/lib/udev/rules.d
- install -D -m644 ${srcdir}/${pkgbase}-${pkgver}/rules/misc/30-kernel-compat.rules ${pkgdir}/lib/udev/rules.d/30-kernel-compat.rules
-
- # create static nodes to be compatible with on-demand module
- # loading in the most recent kernel
- #
- # the list of nodes is generated from /lib/modules/`most recent kernel`/modprobe.devname
- # excluding any devices not included in the LTS kernel and any entries in the
- # modprobe.devname file of the LTS kernel (if it exists).
- install -d -m755 ${pkgdir}/lib/udev/devices
- cd ${pkgdir}/lib/udev/devices
-
- install -d -m755 net
- mknod net/tun c 10 200
- mknod ppp c 108 0
-# mknod loop-control c 10 237 -- does not exist in old kernels
- mknod uinput c 10 223
- install -d -m755 mapper
- mknod mapper/control c 10 236
- install -d -m755 snd
- mknod snd/timer c 116 33
- mknod snd/seq c 116 1
- mknod btrfs-control c 10 234
- mknod autofs c 10 235
- mknod fuse c 10 229
- install -d -m755 cpu
- mknod cpu/microcode c 10 184
-
+ # install the mkinitpcio hook
+ install -D -m644 ../initcpio-hooks-udev ${pkgdir}/lib/initcpio/hooks/udev
+ install -D -m644 ../initcpio-install-udev ${pkgdir}/lib/initcpio/install/udev
}
-md5sums=('1cf124ab5a124ea35d4748ea414926ec')
+md5sums=('0d7af750702620a871b9f9b98d8ad859'
+ 'a4dd853050bf2e0ae6b2e3d2c75499c2'
+ 'ee0bfe91a20fff12cc25ab1d1e024853')
diff --git a/core/udev/initcpio-hooks-udev b/core/udev/initcpio-hooks-udev
new file mode 100644
index 000000000..87aa7960f
--- /dev/null
+++ b/core/udev/initcpio-hooks-udev
@@ -0,0 +1,9 @@
+# vim: set ft=sh:
+run_hook ()
+{
+ msg -n ":: Triggering uevents..."
+ udevadm trigger --action=add --type=subsystems
+ udevadm trigger --action=add --type=devices
+ udevadm settle
+ msg "done."
+}
diff --git a/core/udev/initcpio-install-udev b/core/udev/initcpio-install-udev
new file mode 100644
index 000000000..e7e2c0f60
--- /dev/null
+++ b/core/udev/initcpio-install-udev
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+build() {
+ FILES="/etc/udev/udev.conf"
+ SCRIPT="udev"
+
+ add_binary /lib/udev/udevd
+ add_binary /usr/bin/udevadm
+
+ for rules in 50-udev-default.rules 60-persistent-storage.rules 80-drivers.rules; do
+ add_file "/lib/udev/rules.d/$rules"
+ done
+ for tool in ata_id scsi_id; do
+ add_file "/lib/udev/$tool"
+ done
+}
+
+help() {
+ cat <<HELPEOF
+This hook will use udev to create your root device node and detect the needed
+modules for your root device. It is also required for firmware loading in
+initramfs. It is recommended to use this hook.
+HELPEOF
+}
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/core/udev/udev.install b/core/udev/udev.install
index c49c5006f..7c866c2a3 100644
--- a/core/udev/udev.install
+++ b/core/udev/udev.install
@@ -2,7 +2,7 @@
# arg 2: the old package version
post_upgrade() {
- if [ "$(vercmp $2 175)" -lt 0 ]; then
+ if [ "$(vercmp $2 181)" -lt 0 ]; then
echo "ATTENTION UDEV:"
echo "----------"
if [ "$(vercmp $2 168)" -lt 0 ]; then
@@ -58,8 +58,16 @@ post_upgrade() {
echo "where devtmpfs is not mounted by the kernel, this only affects fresh installs."
echo " --"
fi
- echo "devtmpfs support is now a hard requirement. Users of the official Arch kernels"
- echo "have this enabled."
+ if [ "$(vercmp $2 175)" -lt 0 ]; then
+ echo "devtmpfs support is now a hard requirement. Users of the official Arch kernels"
+ echo "have this enabled."
+ echo " --"
+ fi
+ echo "udev-compat has been removed, and should be uninstalled."
+ echo " --"
+ echo "Framebuffers are no longer blacklisted by default."
+ echo " --"
+ echo "binaries moved from /sbin to /usr/bin"
echo "---------------"
fi
}
diff --git a/extra/systemd/PKGBUILD b/extra/systemd/PKGBUILD
new file mode 100644
index 000000000..7409bba10
--- /dev/null
+++ b/extra/systemd/PKGBUILD
@@ -0,0 +1,86 @@
+# $Id: PKGBUILD 150113 2012-02-12 16:04:12Z dreisner $
+# Maintainer: Dave Reisner <dreisner@archlinux.org>
+
+pkgname=systemd
+pkgver=42
+pkgrel=1
+pkgdesc="Session and Startup manager"
+arch=('i686' 'x86_64')
+url="http://www.freedesktop.org/wiki/Software/systemd"
+license=('GPL2')
+depends=('acl' 'dbus-core' 'kbd' 'kmod' 'libcap' 'util-linux' 'udev' 'xz')
+makedepends=('gperf' 'cryptsetup' 'docbook-xsl' 'intltool' 'libxslt' 'linux-api-headers')
+optdepends=('cryptsetup: required for encrypted block devices'
+ 'dbus-python: systemd-analyze'
+ 'initscripts: legacy support for hostname and vconsole setup'
+ 'initscripts-systemd: native boot and initialization scripts'
+ 'python2-cairo: systemd-analyze'
+ 'systemd-arch-units: collection of native unit files for Arch daemon/init scripts')
+options=('!libtool')
+backup=(etc/dbus-1/system.d/org.freedesktop.systemd1.conf
+ etc/dbus-1/system.d/org.freedesktop.hostname1.conf
+ etc/dbus-1/system.d/org.freedesktop.login1.conf
+ etc/dbus-1/system.d/org.freedesktop.locale1.conf
+ etc/dbus-1/system.d/org.freedesktop.timedate1.conf
+ etc/systemd/system.conf
+ etc/systemd/user.conf
+ etc/systemd/systemd-logind.conf
+ etc/systemd/systemd-journald.conf)
+install="$pkgname.install"
+source=("http://www.freedesktop.org/software/$pkgname/$pkgname-$pkgver.tar.xz"
+ "os-release")
+md5sums=('7686b44e368d2523901d3e903ed4dcea'
+ '752636def0db3c03f121f8b4f44a63cd')
+
+build() {
+ cd "$pkgname-$pkgver"
+
+ # Don't unset locale in getty
+ # https://bugzilla.redhat.com/show_bug.cgi?id=663900
+ sed -i -e '/^Environ.*LANG/s/^/#/' \
+ -e '/^ExecStart/s/agetty/& -8/' units/getty@.service.m4
+
+ ./configure --sysconfdir=/etc \
+ --libexecdir=/usr/lib \
+ --libdir=/usr/lib \
+ --localstatedir=/var \
+ --with-rootprefix= \
+ --with-rootlibdir=/lib
+
+ make
+
+ # fix .so links in manpages
+ sed -i 's|\.so halt\.8|.so man8/systemd.halt.8|' man/{halt,poweroff}.8
+ sed -i 's|\.so systemd\.1|.so man1/systemd.1|' man/init.1
+}
+
+package() {
+ cd "$pkgname-$pkgver"
+
+ make DESTDIR="$pkgdir" install
+
+ install -Dm644 "$srcdir/os-release" "$pkgdir/etc/os-release"
+ printf "d /run/console 755 root root\n" > "$pkgdir/usr/lib/tmpfiles.d/console.conf"
+
+ # symlink to /bin/systemd for compat and sanity
+ ln -s ../lib/systemd/systemd "$pkgdir"/bin/systemd
+
+ # fix systemd-analyze for python2
+ sed -i '1s/python$/python2/' "$pkgdir/usr/bin/systemd-analyze"
+
+ # rename man pages to avoid conflicts with sysvinit and initscripts
+ cd "$pkgdir/usr/share/man"
+
+ # not building this with systemd
+ rm -f "man1/systemadm.1"
+
+ manpages=(man8/{telinit,halt,reboot,poweroff,runlevel,shutdown}.8
+ man5/{hostname,{vconsole,locale}.conf}.5)
+
+ for manpage in "${manpages[@]}"; do
+ IFS='/' read section page <<< "$manpage"
+ mv "$manpage" "$section/systemd.$page"
+ done
+}
+
+# vim: ft=sh syn=sh et
diff --git a/extra/systemd/os-release b/extra/systemd/os-release
new file mode 100644
index 000000000..5e24a6031
--- /dev/null
+++ b/extra/systemd/os-release
@@ -0,0 +1,5 @@
+NAME="Arch Linux"
+ID=arch
+PRETTY_NAME="Arch Linux"
+ANSI_COLOR="1;36"
+
diff --git a/extra/systemd/systemd.install b/extra/systemd/systemd.install
new file mode 100644
index 000000000..f31642e13
--- /dev/null
+++ b/extra/systemd/systemd.install
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+checkgroups() {
+ if ! getent group lock >/dev/null; then
+ groupadd -g 54 lock
+ fi
+}
+
+sd_booted() {
+ [ -e sys/fs/cgroups/systemd ]
+}
+
+post_install() {
+ checkgroups
+
+ if [ ! -f etc/machine-id ]; then
+ systemd-machine-id-setup
+ fi
+
+ echo "systemd has been installed to /bin/systemd. Please ensure you append"
+ echo "init=/bin/systemd to your kernel command line in your bootloader."
+}
+
+post_upgrade() {
+ checkgroups
+
+ if [ ! -f etc/machine-id ]; then
+ systemd-machine-id-setup
+ fi
+
+ if sd_booted; then
+ systemctl daemon-reexec >/dev/null
+ fi
+
+ newpkgver=${1%-*}
+ oldpkgver=${2%-*}
+
+ # catch v31 need for restarting systemd-logind.service
+ if [ "$newpkgver" -ge 31 ] && [ "$oldpkgver" -lt 31 ]; then
+ # but only if systemd is running
+ if sd_booted; then
+ systemctl try-restart systemd-logind.service
+ fi
+ fi
+}
+
+post_remove() {
+ if getent group lock >/dev/null; then
+ groupdel lock
+ fi
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/extra/twisted/PKGBUILD b/extra/twisted/PKGBUILD
index 956000619..b20220a6f 100644
--- a/extra/twisted/PKGBUILD
+++ b/extra/twisted/PKGBUILD
@@ -1,10 +1,10 @@
-# $Id: PKGBUILD 145135 2011-12-17 16:20:46Z ibiru $
+# $Id: PKGBUILD 150115 2012-02-12 18:51:16Z eric $
# Maintainer : Ionut Biru <ibiru@archlinux.org>
# Contributor: Juergen Hoetzel <juergen@archlinux.org>
# Contributor: Douglas Soares de Andrade <douglas@archlinux.org>
pkgname=twisted
-pkgver=11.1.0
+pkgver=12.0.0
pkgrel=1
pkgdesc="Asynchronous networking framework written in Python."
arch=('i686' 'x86_64')
@@ -12,10 +12,10 @@ url="http://twistedmatrix.com/"
license=('MIT')
depends=('python2' 'pycrypto' 'zope-interface')
optdepends=('python2-pyopenssl'
- 'python-soappy:for twisted.web.soap')
+ 'python-soappy: for twisted.web.soap')
install=twisted.install
source=(http://twistedmatrix.com/Releases/Twisted/${pkgver%.*}/Twisted-$pkgver.tar.bz2)
-md5sums=('972f3497e6e19318c741bf2900ffe31c')
+md5sums=('cf49a8676c21c50faf1b42b528049471')
build() {
cd "$srcdir/Twisted-$pkgver"
diff --git a/extra/xfce4-timer-plugin/PKGBUILD b/extra/xfce4-timer-plugin/PKGBUILD
index 44daac145..4aaa96ed7 100644
--- a/extra/xfce4-timer-plugin/PKGBUILD
+++ b/extra/xfce4-timer-plugin/PKGBUILD
@@ -1,9 +1,9 @@
-# $Id: PKGBUILD 149457 2012-02-08 03:29:26Z eric $
+# $Id: PKGBUILD 150121 2012-02-12 22:43:39Z eric $
# Maintainer: AndyRTR <andyrtr@archlinux.org>
# Contributor: Tobias Kieslich <tobias (at) archlinux.org>
pkgname=xfce4-timer-plugin
-pkgver=0.6.2
+pkgver=0.6.4
pkgrel=1
pkgdesc="plugin to track time for the Xfce4 panel"
arch=('i686' 'x86_64')
@@ -13,8 +13,9 @@ groups=('xfce4-goodies')
depends=('xfce4-panel' 'libxfcegui4')
makedepends=('intltool')
options=('!libtool')
-source=(http://archive.xfce.org/src/panel-plugins/${pkgname}/0.6/${pkgname}-${pkgver}.tar.bz2)
-md5sums=('688fe2dde9645bee1855e6a6c9579161')
+install=xfce4-timer-plugin.install
+source=(http://archive.xfce.org/src/panel-plugins/${pkgname}/${pkgver%.*}/${pkgname}-${pkgver}.tar.bz2)
+md5sums=('c2f9e113dcda742cd1559129b79f609b')
build() {
cd "${srcdir}/${pkgname}-${pkgver}"
diff --git a/extra/xfce4-timer-plugin/xfce4-timer-plugin.install b/extra/xfce4-timer-plugin/xfce4-timer-plugin.install
new file mode 100644
index 000000000..17ca8f78a
--- /dev/null
+++ b/extra/xfce4-timer-plugin/xfce4-timer-plugin.install
@@ -0,0 +1,11 @@
+post_install() {
+ gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+post_remove() {
+ post_install $1
+}
diff --git a/libre/kdelibs-libre/PKGBUILD b/libre/kdelibs-libre/PKGBUILD
index 19cdc41a6..0ebd5b60e 100644
--- a/libre/kdelibs-libre/PKGBUILD
+++ b/libre/kdelibs-libre/PKGBUILD
@@ -5,7 +5,7 @@
_pkgname=kdelibs
pkgname=kdelibs-libre
pkgver=4.8.0
-pkgrel=3
+pkgrel=3.1
pkgdesc="KDE Core Libraries"
arch=('i686' 'x86_64' 'mips64el')
url='http://www.kde.org'
diff --git a/libre/metalog/PKGBUILD b/libre/metalog/PKGBUILD
index dee52d986..41a570b7c 100644
--- a/libre/metalog/PKGBUILD
+++ b/libre/metalog/PKGBUILD
@@ -4,7 +4,7 @@
pkgname=metalog
pkgver=2.0
-pkgrel=2
+pkgrel=3
pkgdesc="Metalog is a modern replacement for syslogd and klogd"
url="http://metalog.sourceforge.net"
license=('GPL')
diff --git a/libre/thunderbird-libre/PKGBUILD b/libre/thunderbird-libre/PKGBUILD
index 6a517c112..a622204f9 100644
--- a/libre/thunderbird-libre/PKGBUILD
+++ b/libre/thunderbird-libre/PKGBUILD
@@ -1,16 +1,16 @@
-# $Id: PKGBUILD 145619 2011-12-24 12:00:02Z ibiru $
+# $Id: PKGBUILD 150116 2012-02-12 20:58:54Z ibiru $
# Contributor: Alexander Baldeck <alexander@archlinux.org>
# Contributor: Dale Blount <dale@archlinux.org>
# Contributor: Anders Bostrom <anders.bostrom@home.se>
pkgname=thunderbird-libre
-pkgver=9.0.1
+pkgver=10.0.1
pkgrel=1
pkgdesc="Standalone Mail/News reader"
arch=('i686' 'x86_64')
license=('MPL' 'GPL')
url="http://www.mozilla.org/thunderbird/"
depends=('alsa-lib' 'dbus-glib' 'desktop-file-utils' 'gtk2' 'hicolor-icon-theme' 'hunspell' 'libevent' 'libnotify' 'libvpx' 'libxt' 'mime-types' 'mozilla-common' 'nss' 'sqlite3' 'startup-notification')
-makedepends=('unzip' 'zip' 'pkg-config' 'python2' 'wireless_tools' 'yasm' 'mesa')
+makedepends=('unzip' 'zip' 'pkg-config' 'python2' 'wireless_tools' 'yasm' 'mesa' 'autoconf2.13')
optdepends=('libcanberra: for sound support')
replaces=('thunderbird')
conflicts=('thunderbird')
@@ -21,17 +21,20 @@ source=(ftp://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/$pkgver/sourc
thunderbird.desktop
thunderbird-install-dir.patch
channel-prefs.js
- vendor.js)
-md5sums=('a5904751dbd33074682b438b732fdbab'
+ vendor.js
+ libvpx.patch)
+md5sums=('623c32d9deae370383e1422b1ea48061'
'ca98c2bf1017b33e19dae22fdcef2e73'
'af3e5b344d2edf1c7d61bb0a5a96de9a'
'aea906acf72c43dd82ead2fabcc1c6db'
'476ec205162340fb0679f522c9d31c3b'
- '5a53179d14ae9631b7afe5e4d0fc0b25')
+ '5a53179d14ae9631b7afe5e4d0fc0b25'
+ '5b2aaff7dfe7f1f94ad965905b20e782')
build() {
cd "$srcdir/comm-release"
patch -Np1 -i "$srcdir/thunderbird-install-dir.patch"
+ patch -Np1 -i "$srcdir/libvpx.patch"
cp "$srcdir/mozconfig" .mozconfig
diff --git a/libre/thunderbird-libre/libvpx.patch b/libre/thunderbird-libre/libvpx.patch
new file mode 100644
index 000000000..d0f9a0f4c
--- /dev/null
+++ b/libre/thunderbird-libre/libvpx.patch
@@ -0,0 +1,12 @@
+diff -Nur comm-release.orig/mozilla/configure.in comm-release/mozilla/configure.in
+--- comm-release.orig/mozilla/configure.in 2012-02-05 18:02:17.376830377 +0000
++++ comm-release/mozilla/configure.in 2012-02-05 18:03:25.246274275 +0000
+@@ -5629,7 +5629,7 @@
+ dnl v0.9.6 one to check for.
+ AC_TRY_COMPILE([
+ #include <vpx/vpx_decoder.h>
+- #if !defined(VPX_CODEC_USE_INPUT_PARTITION)
++ #if !defined(VPX_CODEC_USE_INPUT_FRAGMENTS)
+ #error "test failed."
+ #endif
+ ],
diff --git a/multilib/lib32-libjpeg-turbo/PKGBUILD b/multilib/lib32-libjpeg-turbo/PKGBUILD
index 09102ad96..7404c4a80 100644
--- a/multilib/lib32-libjpeg-turbo/PKGBUILD
+++ b/multilib/lib32-libjpeg-turbo/PKGBUILD
@@ -1,10 +1,10 @@
-# $Id: PKGBUILD 48100 2011-05-28 16:27:44Z bluewind $
+# $Id: PKGBUILD 64376 2012-02-12 09:31:17Z bluewind $
# Maintainer: Allan McRae <allan@archlinux.org>
# Contributor: Simone Sclavi 'Ito' <darkhado@gmail.com>
_pkgbasename=libjpeg-turbo
pkgname=lib32-$_pkgbasename
-pkgver=1.1.1
+pkgver=1.2.0
pkgrel=1
pkgdesc="libjpeg derivative with accelerated baseline JPEG compression and decompression (32-bit)"
arch=('x86_64')
@@ -17,7 +17,7 @@ conflicts=('lib32-libjpeg')
replaces=('lib32-libjpeg')
options=('!libtool')
source=(http://sourceforge.net/projects/$_pkgbasename/files/$pkgver/$_pkgbasename-$pkgver.tar.gz)
-md5sums=('03b9c1406c7bfdc204313c2917ce6962')
+md5sums=('5329fa80953938cb4f097afae55059e2')
build() {
cd "$srcdir/$_pkgbasename-$pkgver"
diff --git a/testing/libpciaccess/PKGBUILD b/testing/libpciaccess/PKGBUILD
new file mode 100644
index 000000000..963cc6e28
--- /dev/null
+++ b/testing/libpciaccess/PKGBUILD
@@ -0,0 +1,28 @@
+# $Id: PKGBUILD 356 2008-04-18 22:56:27Z aaron $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+# Contributor: Alexander Baldeck <alexander@archlinux.org>
+
+pkgname=libpciaccess
+pkgver=0.12.902
+pkgrel=1
+pkgdesc="X11 PCI access library"
+arch=(i686 x86_64)
+license=('custom')
+url="http://xorg.freedesktop.org/"
+depends=('glibc')
+makedepends=('pkgconfig' 'xorg-util-macros')
+options=('!libtool')
+source=(${url}/releases/individual/lib/${pkgname}-${pkgver}.tar.bz2)
+sha1sums=('e605bb4f12ba16246567dc4eae654ec0ed6c3324')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr --sysconfdir=/etc
+ make
+}
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/libx11/PKGBUILD b/testing/libx11/PKGBUILD
new file mode 100644
index 000000000..3e1d87dc0
--- /dev/null
+++ b/testing/libx11/PKGBUILD
@@ -0,0 +1,41 @@
+# $Id: PKGBUILD 149995 2012-02-12 09:43:51Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=libx11
+pkgver=1.4.99.1
+pkgrel=1
+pkgdesc="X11 client-side library"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+depends=('libxcb' 'xproto' 'kbproto')
+makedepends=('xorg-util-macros' 'xextproto' 'xtrans' 'inputproto')
+options=('!libtool')
+license=('custom')
+source=(${url}/releases/individual/lib/libX11-${pkgver}.tar.bz2
+ xorg.sh
+ xorg.csh)
+sha1sums=('317e0112926926a52c13f56f71c1ec9e4540cf4d '
+ '4b756387426afb2a5bb7a155631ec42348abf5c1'
+ '45b0b310776cf5d9a94b4a18a5c63ddad9de6ba8')
+
+build() {
+ cd "${srcdir}/libX11-${pkgver}"
+ ./configure --prefix=/usr --disable-static --disable-xf86bigfont
+ make
+}
+
+package() {
+ cd "${srcdir}/libX11-${pkgver}"
+ make check
+}
+
+package() {
+ cd "${srcdir}/libX11-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/etc/profile.d"
+ install -m755 "${srcdir}/"xorg.{sh,csh} "${pkgdir}/etc/profile.d/"
+
+ install -d -m755 "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/libx11/xorg.csh b/testing/libx11/xorg.csh
new file mode 100644
index 000000000..26c49a222
--- /dev/null
+++ b/testing/libx11/xorg.csh
@@ -0,0 +1,15 @@
+setenv XDG_DATA_HOME ${HOME}/.local/share
+setenv XDG_CONFIG_HOME ${HOME}/.config
+setenv XDG_CACHE_HOME ${HOME}/.cache
+
+if (! ($?XDG_DATA_DIRS) ) then
+ setenv XDG_DATA_DIRS /usr/share/:/usr/local/share/
+else
+ setenv XDG_DATA_DIRS /usr/share/:/usr/local/share/:${XDG_DATA_DIRS}
+endif
+
+if (! ($?XDG_CONFIG_DIRS) ) then
+ setenv XDG_CONFIG_DIRS /etc/xdg
+else
+ setenv XDG_CONFIG_DIRS /etc/xdg:${XDG_CONFIG_DIRS}
+endif
diff --git a/testing/libx11/xorg.sh b/testing/libx11/xorg.sh
new file mode 100644
index 000000000..e1de6866c
--- /dev/null
+++ b/testing/libx11/xorg.sh
@@ -0,0 +1,15 @@
+export XDG_DATA_HOME=$HOME/.local/share
+export XDG_CONFIG_HOME=$HOME/.config
+export XDG_CACHE_HOME=$HOME/.cache
+
+if [ -z $XDG_DATA_DIRS ]; then
+ export XDG_DATA_DIRS=/usr/share/:/usr/local/share/
+else
+ export XDG_DATA_DIRS=/usr/share/:/usr/local/share/:$XDG_DATA_DIRS
+fi
+
+if [ -z $XDG_CONFIG_DIRS ]; then
+ export XDG_CONFIG_DIRS=/etc/xdg
+else
+ export XDG_CONFIG_DIRS=/etc/xdg:$XDG_CONFIG_DIRS
+fi
diff --git a/testing/libxcb/PKGBUILD b/testing/libxcb/PKGBUILD
new file mode 100644
index 000000000..e57c9be0b
--- /dev/null
+++ b/testing/libxcb/PKGBUILD
@@ -0,0 +1,32 @@
+# $Id: PKGBUILD 149997 2012-02-12 09:43:54Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+# Contributor: Alexander Baldeck <alexander@archlinux.org>
+
+pkgname=libxcb
+pkgver=1.8
+pkgrel=2
+pkgdesc="X11 client-side library"
+arch=(i686 x86_64)
+url="http://xcb.freedesktop.org/"
+depends=('xcb-proto>=1.7' 'libxdmcp' 'libxau')
+makedepends=('pkgconfig' 'libxslt' 'python2')
+options=('!libtool')
+license=('custom')
+source=($url/dist/$pkgname-$pkgver.tar.bz2
+ libxcb-1.1-no-pthread-stubs.patch)
+sha1sums=('18b76759d5bbb863777f37bf3aec23ebaa31d5be'
+ '3455e84642283bc91c8313af319002a20bbcbdf4')
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ patch -Np1 -i "$srcdir/libxcb-1.1-no-pthread-stubs.patch"
+ PYTHON=/usr/bin/python2 ./autogen.sh --prefix=/usr --enable-xinput
+ make
+}
+
+package() {
+ cd "$srcdir/$pkgname-$pkgver"
+ make DESTDIR="$pkgdir" install
+ install -m755 -d "$pkgdir/usr/share/licenses/$pkgname"
+ install -m644 COPYING "$pkgdir/usr/share/licenses/$pkgname"
+}
diff --git a/testing/libxcb/libxcb-1.1-no-pthread-stubs.patch b/testing/libxcb/libxcb-1.1-no-pthread-stubs.patch
new file mode 100644
index 000000000..f17de1b1d
--- /dev/null
+++ b/testing/libxcb/libxcb-1.1-no-pthread-stubs.patch
@@ -0,0 +1,12 @@
+diff -up libxcb-1.1/configure.ac.pthread-stubs libxcb-1.1/configure.ac
+--- libxcb-1.1/configure.ac.pthread-stubs 2007-11-04 18:17:11.000000000 -0500
++++ libxcb-1.1/configure.ac 2007-11-12 10:27:06.000000000 -0500
+@@ -31,7 +31,7 @@ AC_SUBST(HTML_CHECK_RESULT)
+
+ # Checks for pkg-config packages
+ PKG_CHECK_MODULES(XCBPROTO, xcb-proto >= 1.6)
+-NEEDED="pthread-stubs xau >= 0.99.2"
++NEEDED="xau >= 0.99.2"
+ PKG_CHECK_MODULES(NEEDED, $NEEDED)
+
+ have_xdmcp="no"
diff --git a/testing/libxi/PKGBUILD b/testing/libxi/PKGBUILD
new file mode 100644
index 000000000..e77d7c3d5
--- /dev/null
+++ b/testing/libxi/PKGBUILD
@@ -0,0 +1,29 @@
+# $Id: PKGBUILD 149999 2012-02-12 09:43:58Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=libxi
+pkgver=1.5.99.3
+pkgrel=1
+pkgdesc="X11 Input extension library"
+arch=('i686' 'x86_64')
+url="http://xorg.freedesktop.org"
+depends=('libxext' 'inputproto')
+makedepends=('pkgconfig' 'xorg-util-macros')
+options=(!libtool)
+license=('custom')
+source=(${url}/releases/individual/lib/libXi-${pkgver}.tar.bz2)
+sha1sums=('55de70d18b20341f307b80da035400ed0467c920')
+
+build() {
+ cd "${srcdir}/libXi-${pkgver}"
+ ./configure --prefix=/usr --sysconfdir=/etc --disable-static
+ make
+}
+
+package() {
+ cd "${srcdir}/libXi-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/mesa/LICENSE b/testing/mesa/LICENSE
new file mode 100644
index 000000000..ae33d2709
--- /dev/null
+++ b/testing/mesa/LICENSE
@@ -0,0 +1,82 @@
+Disclaimer
+
+Mesa is a 3-D graphics library with an API which is very similar to
+that of OpenGL*
+To the extent that Mesa utilizes the OpenGL command syntax or state
+machine, it is being used with authorization from Silicon Graphics,
+Inc.(SGI). However, the author does not possess an OpenGL license
+from SGI, and makes no claim that Mesa is in any way a compatible
+replacement for OpenGL or associated with SGI. Those who want a
+licensed implementation of OpenGL should contact a licensed
+vendor.
+
+Please do not refer to the library as MesaGL (for legal
+reasons). It's just Mesa or The Mesa 3-D graphics
+library
+
+* OpenGL is a trademark of Silicon Graphics Incorporated.
+
+License / Copyright Information
+
+The Mesa distribution consists of several components. Different copyrights
+and licenses apply to different components. For example, GLUT is copyrighted
+by Mark Kilgard, some demo programs are copyrighted by SGI, some of the Mesa
+device drivers are copyrighted by their authors. See below for a list of
+Mesa's main components and the license for each.
+
+The core Mesa library is licensed according to the terms of the MIT license.
+This allows integration with the XFree86, Xorg and DRI projects.
+
+The default Mesa license is as follows:
+
+Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
+
+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 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
+BRIAN PAUL 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.
+
+Attention, Contributors
+
+When contributing to the Mesa project you must agree to the licensing terms
+of the component to which you're contributing.
+The following section lists the primary components of the Mesa distribution
+and their respective licenses.
+
+
+Mesa Component Licenses
+
+Component Location Primary Author License
+----------------------------------------------------------------------------
+Main Mesa code src/mesa/ Brian Paul Mesa (MIT)
+
+Device drivers src/mesa/drivers/* See drivers See drivers
+
+Ext headers include/GL/glext.h SGI SGI Free B
+ include/GL/glxext.h
+
+GLUT src/glut/ Mark Kilgard Mark's copyright
+
+Mesa GLU library src/glu/mesa/ Brian Paul GNU-LGPL
+
+SGI GLU library src/glu/sgi/ SGI SGI Free B
+
+demo programs progs/demos/ various see source files
+
+X demos progs/xdemos/ Brian Paul see source files
+
+SGI demos progs/samples/ SGI SGI copyright
+
+RedBook demos progs/redbook/ SGI SGI copyright
diff --git a/testing/mesa/PKGBUILD b/testing/mesa/PKGBUILD
new file mode 100644
index 000000000..08190dedf
--- /dev/null
+++ b/testing/mesa/PKGBUILD
@@ -0,0 +1,301 @@
+# $Id: PKGBUILD 149991 2012-02-12 09:43:44Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+# Maintainer: Andreas Radke <andyrtr@archlinux.org>
+
+pkgbase=mesa
+#pkgname=('mesa' 'libgl' 'libglapi' 'libgles' 'libegl' 'khrplatform-devel' 'ati-dri' 'intel-dri' 'unichrome-dri' 'mach64-dri' 'mga-dri' 'r128-dri' 'savage-dri' 'sis-dri' 'tdfx-dri' 'nouveau-dri') # 'llvm-dri')
+# prepare 7.12/8.0
+pkgname=('mesa' 'libgl' 'libglapi' 'libgles' 'libegl' 'khrplatform-devel' 'ati-dri' 'intel-dri' 'nouveau-dri')
+
+#_git=true
+_gitdate=20111031
+_git=false
+
+if [ "${_git}" = "true" ]; then
+ pkgver=7.10.99.git20110709
+ #pkgver=7.11
+ else
+ pkgver=8.0
+fi
+pkgrel=1
+arch=('i686' 'x86_64')
+makedepends=('glproto>=1.4.15' 'libdrm>=2.4.30' 'libxxf86vm>=1.1.1' 'libxdamage>=1.1.3' 'expat>=2.0.1' 'libx11>=1.4.99.1' 'libxt>=1.1.1'
+ 'gcc-libs>=4.6.1' 'dri2proto>=2.6' 'python2' 'libxml2' 'imake' 'llvm' 'udev')
+url="http://mesa3d.sourceforge.net"
+license=('custom')
+source=(LICENSE)
+if [ "${_git}" = "true" ]; then
+ # mesa git shot from 7.11 branch - see for state: http://cgit.freedesktop.org/mesa/mesa/commit/?h=7.11&id=1ae00c5960af83bea9545a18a1754bad83d5cbd0
+ #source=(${source[@]} 'ftp://ftp.archlinux.org/other/mesa/mesa-1ae00c5960af83bea9545a18a1754bad83d5cbd0.tar.bz2')
+ source=(${source[@]} "MesaLib-git${_gitdate}.zip"::"http://cgit.freedesktop.org/mesa/mesa/snapshot/mesa-ef9f16f6322a89fb699fbe3da868b10f9acaef98.tar.bz2")
+ else
+ source=(${source[@]} "ftp://ftp.freedesktop.org/pub/mesa/${pkgver}/MesaLib-${pkgver}.tar.bz2"
+ #source=(${source[@]} "ftp://ftp.freedesktop.org/pub/mesa/8.0/MesaLib-8.0-rc2.tar.bz2"
+ #source=(${source[@]} "MesaLib-git${_gitdate}.zip"::"http://cgit.freedesktop.org/mesa/mesa/snapshot/mesa-4464ee1a9aa3745109cee23531e3fb2323234d07.tar.bz2"
+)
+fi
+md5sums=('5c65a0fe315dd347e09b1f2826a1df5a'
+ '1a5668fe72651a670611164cefc703b2')
+
+build() {
+ cd ${srcdir}/?esa-*
+
+if [ "${_git}" = "true" ]; then
+ autoreconf -vfi
+ ./autogen.sh --prefix=/usr \
+ --with-dri-driverdir=/usr/lib/xorg/modules/dri \
+ --with-gallium-drivers=r300,r600,nouveau,swrast \
+ --enable-gallium-llvm \
+ --enable-gallium-egl --enable-shared-glapi\
+ --enable-glx-tls \
+ --with-driver=dri \
+ --enable-gles1 \
+ --enable-gles2 \
+ --enable-egl \
+ --enable-texture-float \
+ --enable-shared-dricore
+
+ # --enable-gallium-svga \
+
+ else
+ autoreconf -vfi
+ ./configure --prefix=/usr \
+ --with-dri-driverdir=/usr/lib/xorg/modules/dri \
+ --with-gallium-drivers=r300,r600,nouveau,swrast \
+ --enable-gallium-llvm \
+ --enable-gallium-egl --enable-shared-glapi\
+ --enable-glx-tls \
+ --with-driver=dri \
+ --enable-gles1 \
+ --enable-gles2 \
+ --enable-egl \
+ --enable-texture-float \
+ --enable-shared-dricore
+fi
+
+ make
+}
+
+package_libgl() {
+ depends=('libdrm>=2.4.31' 'libxxf86vm>=1.1.1' 'libxdamage>=1.1.3' 'expat>=2.0.1' 'libglapi' 'gcc-libs')
+ pkgdesc="Mesa 3-D graphics library and DRI software rasterizer"
+ replaces=('unichrome-dri' 'mach64-dri' 'mga-dri' 'r128-dri' 'savage-dri' 'sis-dri' 'tdfx-dri')
+
+ cd ${srcdir}/?esa-*
+ install -m755 -d "${pkgdir}/usr/lib"
+ install -m755 -d "${pkgdir}/usr/lib/xorg/modules/extensions"
+
+ bin/minstall lib/libGL.so* "${pkgdir}/usr/lib/"
+ bin/minstall lib/libdricore.so* "${pkgdir}/usr/lib/"
+ bin/minstall lib/libglsl.so* "${pkgdir}/usr/lib/"
+
+ cd src/mesa/drivers/dri
+ make -C ${srcdir}/?esa-*/src/gallium/targets/dri-swrast DESTDIR="${pkgdir}" install
+
+# ln -s swrastg_dri.so "${pkgdir}/usr/lib/xorg/modules/dri/swrast_dri.so" # gallium is now default so this is obsolete in 8.0
+ ln -s libglx.xorg "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so"
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/libgl"
+ install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/libgl/"
+}
+
+package_libglapi() {
+ depends=('glibc')
+ pkgdesc="free implementation of the GL API -- shared library. The Mesa GL API module is responsible for dispatching all the gl* functions"
+
+ cd ${srcdir}/?esa-*
+ install -m755 -d "${pkgdir}/usr/lib"
+ bin/minstall lib/libglapi.so* "${pkgdir}/usr/lib/"
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/libglapi"
+ install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/libglapi/"
+}
+
+package_libgles() {
+ depends=('libglapi' 'khrplatform-devel')
+ pkgdesc="Mesa GLES libraries and headers"
+
+ cd ${srcdir}/?esa-*
+ install -m755 -d "${pkgdir}/usr/lib"
+ install -m755 -d "${pkgdir}/usr/lib/pkgconfig"
+ install -m755 -d "${pkgdir}/usr/include"
+ install -m755 -d "${pkgdir}/usr/include/GLES"
+ install -m755 -d "${pkgdir}/usr/include/GLES2"
+ bin/minstall lib/libGLESv* "${pkgdir}/usr/lib/"
+ bin/minstall src/mapi/es1api/glesv1_cm.pc "${pkgdir}/usr/lib/pkgconfig/"
+ bin/minstall src/mapi/es2api/glesv2.pc "${pkgdir}/usr/lib/pkgconfig/"
+ bin/minstall include/GLES/* "${pkgdir}/usr/include/GLES/"
+ bin/minstall include/GLES2/* "${pkgdir}/usr/include/GLES2/"
+ bin/minstall include/GLES2/* "${pkgdir}/usr/include/GLES2/"
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/libgles"
+ install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/libgles/"
+}
+
+package_libegl() {
+ depends=('libglapi' 'libdrm' 'libxext' 'libxfixes' 'udev' 'khrplatform-devel')
+ pkgdesc="Mesa EGL libraries and headers"
+
+ cd ${srcdir}/?esa-*
+ make -C src/gallium/targets/egl-static DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/lib"
+ install -m755 -d "${pkgdir}/usr/lib/pkgconfig"
+ install -m755 -d "${pkgdir}/usr/include"
+ install -m755 -d "${pkgdir}/usr/include/"
+ install -m755 -d "${pkgdir}/usr/include/EGL"
+ install -m755 -d "${pkgdir}/usr/share"
+ install -m755 -d "${pkgdir}/usr/share/doc"
+ install -m755 -d "${pkgdir}/usr/share/doc/libegl"
+ bin/minstall lib/libEGL.so* "${pkgdir}/usr/lib/"
+ install -m755 -d "${pkgdir}/usr/lib/egl"
+ bin/minstall lib/egl/* "${pkgdir}/usr/lib/egl/"
+ bin/minstall src/egl/main/egl.pc "${pkgdir}/usr/lib/pkgconfig/"
+ bin/minstall include/EGL/* "${pkgdir}/usr/include/EGL/"
+ bin/minstall docs/egl.html "${pkgdir}/usr/share/doc/libegl/"
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/libegl"
+ install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/libegl/"
+}
+
+package_khrplatform-devel() {
+ #depends=('')
+ pkgdesc="Khronos platform development package"
+
+ cd ${srcdir}/?esa-*
+ install -m755 -d "${pkgdir}/usr/include/KHR"
+ bin/minstall include/KHR/khrplatform.h "${pkgdir}/usr/include/KHR/"
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/khrplatform-devel"
+ install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/khrplatform-devel/"
+}
+
+package_mesa() {
+ depends=('libgl' 'libx11>=1.4.3' 'libxt>=1.1.1' 'gcc-libs>=4.6' 'dri2proto>=2.6' 'glproto>=1.4.14') #dri2proto + glproto needed for gl.pc
+ optdepends=('opengl-man-pages: for the OpenGL API man pages')
+ pkgdesc="Mesa 3-D graphics libraries and include files"
+
+ cd ${srcdir}/?esa-*
+ make DESTDIR="${pkgdir}" install
+
+ rm -f "${pkgdir}/usr/lib/libGL.so"*
+ rm -f "${pkgdir}/usr/lib/libglapi.so"*
+ rm -f "${pkgdir}/usr/lib/libGLESv"*
+ rm -f "${pkgdir}/usr/lib/libEGL"*
+ rm -rf "${pkgdir}/usr/lib/egl"
+ rm -f ${pkgdir}/usr/lib/pkgconfig/{glesv1_cm.pc,glesv2.pc,egl.pc}
+ rm -rf "${pkgdir}/usr/lib/xorg"
+ rm -f "${pkgdir}/usr/include/GL/glew.h"
+ rm -f "${pkgdir}/usr/include/GL/glxew.h"
+ rm -f "${pkgdir}/usr/include/GL/wglew.h"
+ rm -f "${pkgdir}/usr/include/GL/glut.h"
+ rm -rf ${pkgdir}/usr/include/{GLES,GLES2,EGL,KHR}
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/mesa"
+ install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/mesa/"
+}
+
+package_ati-dri() {
+ depends=("libgl=${pkgver}")
+ pkgdesc="Mesa DRI radeon/r200 + Gallium3D r300,r600 drivers for AMD/ATI Radeon"
+ conflicts=('xf86-video-ati<6.9.0-6')
+
+ # classic mesa drivers for radeon,r200
+ make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/radeon DESTDIR="${pkgdir}" install
+ make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/r200 DESTDIR="${pkgdir}" install
+ # gallium3D driver for r300,r600
+ make -C ${srcdir}/?esa-*/src/gallium/targets/dri-r300 DESTDIR="${pkgdir}" install
+ make -C ${srcdir}/?esa-*/src/gallium/targets/dri-r600 DESTDIR="${pkgdir}" install
+}
+
+package_intel-dri() {
+ depends=("libgl=${pkgver}")
+ pkgdesc="Mesa DRI drivers for Intel"
+
+# make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/i810 DESTDIR="${pkgdir}" install # dead in 8.0
+ make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/i915 DESTDIR="${pkgdir}" install
+ make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/i965 DESTDIR="${pkgdir}" install
+}
+
+package_unichrome-dri() {
+ depends=("libgl=${pkgver}")
+ pkgdesc="Mesa DRI drivers for S3 Graphics/VIA Unichrome"
+
+ make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/unichrome DESTDIR="${pkgdir}" install
+}
+
+package_mach64-dri() {
+ depends=("libgl=${pkgver}")
+ pkgdesc="Mesa DRI drivers for ATI Mach64"
+ conflicts=('xf86-video-mach64<6.8.2')
+
+ make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/mach64 DESTDIR="${pkgdir}" install
+}
+
+package_mga-dri() {
+ depends=("libgl=${pkgver}")
+ pkgdesc="Mesa DRI drivers for Matrox"
+ conflicts=('xf86-video-mga<1.4.11')
+
+ make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/mga DESTDIR="${pkgdir}" install
+}
+
+package_r128-dri() {
+ depends=("libgl=${pkgver}")
+ pkgdesc="Mesa DRI drivers for ATI Rage128"
+ conflicts=('xf86-video-r128<6.8.1')
+
+ make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/r128 DESTDIR="${pkgdir}" install
+}
+
+package_savage-dri() {
+ depends=("libgl=${pkgver}")
+ pkgdesc="Mesa DRI drivers for S3 Sraphics/VIA Savage"
+ conflicts=('xf86-video-savage<2.3.1')
+
+ make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/savage DESTDIR="${pkgdir}" install
+}
+
+package_sis-dri() {
+ depends=("libgl=${pkgver}")
+ pkgdesc="Mesa DRI drivers for SiS"
+ conflicts=('xf86-video-sis<0.10.2')
+
+ make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/sis DESTDIR="${pkgdir}" install
+}
+
+package_tdfx-dri() {
+ depends=("libgl=${pkgver}")
+ pkgdesc="Mesa DRI drivers for 3dfx"
+ conflicts=('xf86-video-tdfx<1.4.3')
+
+ make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/tdfx DESTDIR="${pkgdir}" install
+}
+
+package_nouveau-dri() {
+ depends=("libgl=${pkgver}")
+ pkgdesc="Mesa classic DRI + Gallium3D drivers for Nouveau"
+
+ # classic mesa driver for nv10 , nv20 nouveau_vieux_dri.so
+ make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/nouveau DESTDIR="${pkgdir}" install
+ # gallium3D driver for nv30 - nv40 - nv50 nouveau_dri.so
+ make -C ${srcdir}/?esa-*/src/gallium/targets/dri-nouveau DESTDIR="${pkgdir}" install
+}
+
+#package_llvm-dri() {
+# depends=("libgl=${pkgver}")
+# pkgdesc="Mesa common LLVM support"
+
+#if [ "${_git}" = "true" ]; then
+# cd ${srcdir}/mesa-*/src/gallium
+# else
+# cd "${srcdir}/Mesa-${pkgver}/src/gallium"
+#fi
+
+ # gallium llvmpipe
+#if [ "${_git}" = "true" ]; then
+# make -C drivers/llvmpipe DESTDIR="${pkgdir}" install
+# #make -C targets/dri-swrast DESTDIR="${pkgdir}" install
+# else
+# make -C ${srcdir}/Mesa-${pkgver}/src/gallium/targets/dri-nouveau DESTDIR="${pkgdir}" install
+#fi
+#}
diff --git a/testing/xf86-input-acecad/PKGBUILD b/testing/xf86-input-acecad/PKGBUILD
new file mode 100644
index 000000000..6a1a53766
--- /dev/null
+++ b/testing/xf86-input-acecad/PKGBUILD
@@ -0,0 +1,35 @@
+# $Id: PKGBUILD 150002 2012-02-12 09:44:03Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-input-acecad
+pkgver=1.5.0
+pkgrel=3
+pkgdesc="X.Org acecad tablet input driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('sysfsutils')
+makedepends=('xorg-server-devel>=1.11.99.902')
+conflicts=('xorg-server<1.11.99.902')
+options=('!libtool')
+groups=('xorg-drivers' 'xorg')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ assign-local-private-after-allocating.patch)
+sha1sums=('410cee68e4435dc95774fb389fcefae1b2ffe3d1'
+ '9301020b0ef3c6f2081e957481a88d2e187a7973')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i "${srcdir}/assign-local-private-after-allocating.patch"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-input-acecad/assign-local-private-after-allocating.patch b/testing/xf86-input-acecad/assign-local-private-after-allocating.patch
new file mode 100644
index 000000000..e3e635a6f
--- /dev/null
+++ b/testing/xf86-input-acecad/assign-local-private-after-allocating.patch
@@ -0,0 +1,24 @@
+From ec2c4ead497133ef20d5ef5a9b481b38e1e0f7a2 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Mon, 27 Jun 2011 03:13:54 +0000
+Subject: Assign local->private after allocating.
+
+It is detrimental to the user experience when the driver tries to derefernce
+null pointers.
+
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+---
+diff --git a/src/acecad.c b/src/acecad.c
+index ad6d793..604fe91 100644
+--- a/src/acecad.c
++++ b/src/acecad.c
+@@ -343,6 +343,7 @@ AceCadPreInit(InputDriverPtr drv, InputInfoPtr local, int flags)
+ return BadAlloc;
+
+ memset(priv, 0, sizeof(AceCadPrivateRec));
++ local->private = priv;
+
+ local->device_control = DeviceControl;
+
+--
+cgit v0.8.3-6-g21f6
diff --git a/testing/xf86-input-aiptek/PKGBUILD b/testing/xf86-input-aiptek/PKGBUILD
new file mode 100644
index 000000000..a317aafb6
--- /dev/null
+++ b/testing/xf86-input-aiptek/PKGBUILD
@@ -0,0 +1,32 @@
+# $Id: PKGBUILD 150004 2012-02-12 09:44:04Z andyrtr $
+#Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-input-aiptek
+pkgver=1.4.1
+pkgrel=3
+pkgdesc="X.Org Aiptek USB Digital Tablet input driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('pkgconfig' 'xorg-server-devel>=1.11.99.902')
+conflicts=('xorg-server<1.11.99.902')
+options=('!libtool')
+groups=('xorg-drivers' 'xorg')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2)
+sha1sums=('55ea7d12d3e24fd72eacc966a59262864dce7769')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-input-evdev/PKGBUILD b/testing/xf86-input-evdev/PKGBUILD
new file mode 100644
index 000000000..c1acfe13f
--- /dev/null
+++ b/testing/xf86-input-evdev/PKGBUILD
@@ -0,0 +1,31 @@
+# $Id: PKGBUILD 150006 2012-02-12 09:44:07Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+# Contributor: Alexander Baldeck <Alexander@archlinux.org
+
+pkgname=xf86-input-evdev
+pkgver=2.6.99.901
+pkgrel=1
+pkgdesc="X.org evdev input driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.902')
+conflicts=('xorg-server<1.11.99.902')
+options=('!libtool' '!makeflags')
+groups=('xorg-drivers' 'xorg')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2)
+sha1sums=('fb978b06cfb7a6a6b99dc9f9bca4362abdf79f20')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-input-joystick/50-joystick.conf b/testing/xf86-input-joystick/50-joystick.conf
new file mode 100644
index 000000000..95a295ab0
--- /dev/null
+++ b/testing/xf86-input-joystick/50-joystick.conf
@@ -0,0 +1,6 @@
+Section "InputClass"
+ Identifier "joystick catchall"
+ MatchIsJoystick "on"
+ MatchDevicePath "/dev/input/event*"
+ Driver "joystick"
+EndSection
diff --git a/testing/xf86-input-joystick/PKGBUILD b/testing/xf86-input-joystick/PKGBUILD
new file mode 100644
index 000000000..13b8dacd0
--- /dev/null
+++ b/testing/xf86-input-joystick/PKGBUILD
@@ -0,0 +1,40 @@
+# $Id: PKGBUILD 150008 2012-02-12 09:44:09Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-input-joystick
+pkgver=1.6.0
+pkgrel=4
+pkgdesc="X.Org Joystick input driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.902')
+conflicts=('xorg-server<1.11.99.902')
+groups=('xorg-drivers' 'xorg')
+options=('!libtool')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ git-fixes.patch
+ 50-joystick.conf)
+sha1sums=('3b9aed1b8128e1fbd947fdcdd5e16efccad1c780'
+ '7812a34013a2333641bd7c5d044c46179490cb32'
+ 'e1ff3699a0470c6bb78a53f718df9d8521621e11')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i "${srcdir}/git-fixes.patch"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/etc/X11/xorg.conf.d"
+ install -m644 "${srcdir}/50-joystick.conf" "${pkgdir}/etc/X11/xorg.conf.d/"
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-input-joystick/git-fixes.patch b/testing/xf86-input-joystick/git-fixes.patch
new file mode 100644
index 000000000..b3afa06cc
--- /dev/null
+++ b/testing/xf86-input-joystick/git-fixes.patch
@@ -0,0 +1,399 @@
+From 204dcb86368b011824fc5006f87b9e394d03a394 Mon Sep 17 00:00:00 2001
+From: Terry Lambert <tlambert@chromium.org>
+Date: Sat, 16 Jul 2011 00:23:22 +0000
+Subject: Return proper default for unknown values in pInfo->device_control.
+
+Signed-off-by: Terry Lambert <tlambert@chromium.org>
+Reviewed-by: Stephane Marchesin <marcheu@chromium.org>
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+---
+diff --git a/src/jstk.c b/src/jstk.c
+index ec6b79a..6db0e7c 100644
+--- a/src/jstk.c
++++ b/src/jstk.c
+@@ -419,8 +419,7 @@ jstkDeviceControlProc(DeviceIntPtr pJstk,
+
+ default:
+ ErrorF("unsupported mode=%d\n", what);
+- return !Success;
+- break;
++ return BadValue;
+ } /* switch (what) */
+ return Success;
+ }
+diff --git a/src/jstk_key.c b/src/jstk_key.c
+index 3c471ce..d699dcd 100644
+--- a/src/jstk_key.c
++++ b/src/jstk_key.c
+@@ -169,6 +169,8 @@ jstkKeyboardDeviceControlProc(DeviceIntPtr dev,
+ DBG(2, ErrorF("jstkKeyboardDeviceControlProc what=DEVICE_CLOSE\n"));
+ dev->public.on = FALSE;
+ break;
++ default:
++ return BadValue;
+ }
+
+ return Success;
+--
+cgit v0.9.0.2-2-gbebe
+From b3b62328cf3f36c20c54a298f8a921e6eef42c4d Mon Sep 17 00:00:00 2001
+From: Devin J. Pohly <djpohly+xorg@gmail.com>
+Date: Sat, 03 Sep 2011 23:00:07 +0000
+Subject: unify capitalization of joystick properties
+
+the axis keys high/low properties were inconsistently capitalized,
+leading to potential confusion as to why one works but not the other.
+
+Signed-off-by: Devin J. Pohly <djpohly+xorg@gmail.com>
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+---
+diff --git a/include/joystick-properties.h b/include/joystick-properties.h
+index 49ef800..36f4082 100644
+--- a/include/joystick-properties.h
++++ b/include/joystick-properties.h
+@@ -99,7 +99,7 @@ typedef enum _JSTK_MAPPING {
+
+ /** Scancodes for axis in high position */
+ /* 8 bit, 4 per axis */
+-#define JSTK_PROP_AXIS_KEYS_HIGH "Axis keys (high)"
++#define JSTK_PROP_AXIS_KEYS_HIGH "Axis Keys (high)"
+
+ /** Set the mapping of each button to
+ none, x, y, zx, zy, button, key, speed_multiply,
+--
+cgit v0.9.0.2-2-gbebe
+From b607c4ebeea4122694f02ba87f06e4cdb23114f1 Mon Sep 17 00:00:00 2001
+From: Sascha Hlusiak <saschahlusiak@arcor.de>
+Date: Sat, 15 Oct 2011 22:47:52 +0000
+Subject: label buttons and axes
+
+Buttons are labeled "Button %d", starting with 0 and representing the button in X _after_ mapping.
+Mapping can be changed while running so the labels will be constant.
+
+Axes are labeled "Axis %d", starting with 1, representing the _physical_ axis that reports the valuator
+data. The raw valuators can't be dynamically mapped, the first two valuators always are labeled "Rel X"
+and "Rel Y", representing the aggregated post-calculation data from all axes.
+
+Signed-off-by: Sascha Hlusiak <saschahlusiak@arcor.de>
+---
+diff --git a/man/joystick.man b/man/joystick.man
+index da92ceb..b401de5 100644
+--- a/man/joystick.man
++++ b/man/joystick.man
+@@ -140,7 +140,11 @@ Neither
+ .B mode
+ nor
+ .B axis
+-needs to be set to generate extra valuator events.
++needs to be set to generate extra valuator events. The axis will be labelled according to it's physical axis number, beginning with
++.I 1
++, i.e.
++.I \*qAxis 1\*q
++for the first axis (being the 3rd valuator).
+ Default: not set.
+ .TP 7
+ .BI "\*qaxis="[<factor>]<axis> \*q
+@@ -318,6 +322,28 @@ and the second and fourth axis to the arrow keys
+ The keys for the first two axes will be generated in an interval according to the value of the axis. The autorepeat speed of the first axis will be half the speed of that of the second axis.
+ The keys for the third and fourth axis are generated once when the axis moves out of the deadzone and when it moves back into the deadzone. X.Org will autorepeat those keys according to current keyboard settings.
+
++.SH "XI2 Events"
++If you only care about raw events instead of using the joystick as a mouse replacement, don't forget to unmap and add valuators to all axes and map the remaining buttons:
++
++.nf
++.BI " Option \*qMapAxis1\*q \*q" "mode=none valuator" \*q
++.BI " Option \*qMapAxis2\*q \*q" "mode=none valuator" \*q
++.BI " Option \*qMapAxis3\*q \*q" "mode=none valuator" \*q
++.BI " Option \*qMapAxis4\*q \*q" "mode=none valuator" \*q
++\ \ ...
++.BI " Option \*qMapButton1\*q \*q" "button=1" \*q
++.BI " Option \*qMapButton2\*q \*q" "button=2" \*q
++.BI " Option \*qMapButton3\*q \*q" "button=3" \*q
++.BI " Option \*qMapButton4\*q \*q" "button=4" \*q
++.BI " Option \*qMapButton5\*q \*q" "button=5" \*q
++\ \ ...
++.fi
++
++You might also want to set the device "floating" to stop it from reporting core events:
++.nf
++.BI " Option \*qFloating\*q \*q" "true" \*q
++.fi
++
+ .SH "NOTES"
+ Configuration through
+ .I InputClass
+diff --git a/src/jstk.c b/src/jstk.c
+index 6db0e7c..772683f 100644
+--- a/src/jstk.c
++++ b/src/jstk.c
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright 2007-2009 by Sascha Hlusiak. <saschahlusiak@freedesktop.org>
++ * Copyright 2007-2011 by Sascha Hlusiak. <saschahlusiak@freedesktop.org>
+ * Copyright 1995-1999 by Frederic Lepied, France. <Lepied@XFree86.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+@@ -21,7 +21,6 @@
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+-
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+@@ -300,6 +299,7 @@ jstkDeviceControlProc(DeviceIntPtr pJstk,
+ switch (what) {
+ case DEVICE_INIT: {
+ int m;
++ char str[32];
+ CARD8 buttonmap[BUTTONMAP_SIZE+1];
+ DBG(1, ErrorF("jstkDeviceControlProc what=INIT\n"));
+ /* Probe device and return if error */
+@@ -312,11 +312,14 @@ jstkDeviceControlProc(DeviceIntPtr pJstk,
+ }
+
+ for (m=0; m<=BUTTONMAP_SIZE; m++) {
++ sprintf(str, "Button %d", m);
++
+ buttonmap[m] = m;
+- }
++ btn_labels[m] = MakeAtom(str, strlen(str), TRUE);
++ }
++
++
+
+-
+-
+ if (InitButtonClassDeviceStruct(pJstk, BUTTONMAP_SIZE,
+ btn_labels,
+ buttonmap) == FALSE) {
+@@ -331,7 +334,9 @@ jstkDeviceControlProc(DeviceIntPtr pJstk,
+ if (priv->axis[i].valuator != -1)
+ {
+ DBG(3, ErrorF("Axis %d will be valuator %d\n", i, m));
++ sprintf(str, "Axis %d", i + 1);
+ priv->axis[i].valuator = m++;
++ axes_labels[i] = MakeAtom(str, strlen(str), TRUE);
+ }
+
+ if (InitValuatorClassDeviceStruct(pJstk, m, axes_labels,
+@@ -719,7 +724,6 @@ static XF86ModuleVersionInfo jstkVersionRec =
+ /* a tool */
+ };
+
+-
+ /*
+ ***************************************************************************
+ *
+@@ -732,3 +736,6 @@ _X_EXPORT XF86ModuleData joystickModuleData = {
+ jstkDriverPlug,
+ jstkDriverUnplug
+ };
++
++/* vim: set filetype=c.doxygen ts=4 et: */
++
+--
+cgit v0.9.0.2-2-gbebe
+From e0193debf8f5a72b0a06977d5dea3365ad9cafbe Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Mon, 31 Oct 2011 04:27:22 +0000
+Subject: Fix option type for option duplication
+
+xf86OptionListDuplicate() duplicates an XF86Option list, not an InputOption
+list.
+
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
+---
+diff --git a/src/jstk_key.c b/src/jstk_key.c
+index d699dcd..e842941 100644
+--- a/src/jstk_key.c
++++ b/src/jstk_key.c
+@@ -253,26 +253,26 @@ jstkKeyboardHotplug(InputInfoPtr pInfo, int flags)
+ int rc;
+ char name[512] = {0};
+ InputAttributes *attrs = NULL;
+- InputOption *options;
+ InputOption *iopts = NULL, *tmp;
+ DeviceIntPtr dev;
++ XF86OptionPtr opts;
+
+ /* duplicate option list, append to name */
+- options = xf86OptionListDuplicate(pInfo->options);
++ opts = xf86OptionListDuplicate(pInfo->options);
+ strcpy(name, pInfo->name);
+ strcat(name, " (keys)");
+- options = xf86ReplaceStrOption(options, "Name", name);
+- options = xf86ReplaceStrOption(options, "_source", "_driver/joystick");
++ opts = xf86ReplaceStrOption(opts, "Name", name);
++ opts = xf86ReplaceStrOption(opts, "_source", "_driver/joystick");
+
+- while(options)
++ while(opts)
+ {
+ tmp = calloc(1, sizeof(InputOption));
+
+- tmp->key = xf86OptionName(options);
+- tmp->value = xf86OptionValue(options);
++ tmp->key = xf86OptionName(opts);
++ tmp->value = xf86OptionValue(opts);
+ tmp->next = iopts;
+ iopts = tmp;
+- options = xf86NextOption(options);
++ opts = xf86NextOption(opts);
+ }
+
+ /* duplicate attribute list */
+--
+cgit v0.9.0.2-2-gbebe
+From 7ccf3a75292d71104c976bf6afb389cccaac1a7d Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Mon, 31 Oct 2011 04:33:08 +0000
+Subject: Deal with opaque input option types.
+
+ABI 14 made the InputOption type opaque, move the existing code to ifdefs
+and use the new function calls otherwise.
+
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
+Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
+---
+diff --git a/src/jstk_key.c b/src/jstk_key.c
+index e842941..a71275a 100644
+--- a/src/jstk_key.c
++++ b/src/jstk_key.c
+@@ -247,13 +247,46 @@ int jstkKeyboardPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
+ return Success;
+ }
+
++#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 14
++static InputOption*
++input_option_new(InputOption* list, char *key, char *value)
++{
++ InputOption *tmp;
++
++ tmp = calloc(1, sizeof(*tmp));
++ tmp->key = key;
++ tmp->value = value;
++ tmp->next = list;
++
++ return tmp;
++}
++
++static void
++input_option_free_list(InputOption **list)
++{
++ InputOption *iopts = *list;
++
++ while(iopts)
++ {
++ InputOption *tmp = iopts->next;
++ free(iopts->key);
++ free(iopts->value);
++ free(iopts);
++ iopts = tmp;
++ }
++
++ *list = NULL;
++}
++
++#endif
++
+ InputInfoPtr
+ jstkKeyboardHotplug(InputInfoPtr pInfo, int flags)
+ {
+ int rc;
+ char name[512] = {0};
+ InputAttributes *attrs = NULL;
+- InputOption *iopts = NULL, *tmp;
++ InputOption *iopts = NULL;
+ DeviceIntPtr dev;
+ XF86OptionPtr opts;
+
+@@ -266,12 +299,9 @@ jstkKeyboardHotplug(InputInfoPtr pInfo, int flags)
+
+ while(opts)
+ {
+- tmp = calloc(1, sizeof(InputOption));
+-
+- tmp->key = xf86OptionName(opts);
+- tmp->value = xf86OptionValue(opts);
+- tmp->next = iopts;
+- iopts = tmp;
++ iopts = input_option_new(iopts,
++ xf86OptionName(opts),
++ xf86OptionValue(opts));
+ opts = xf86NextOption(opts);
+ }
+
+@@ -280,14 +310,7 @@ jstkKeyboardHotplug(InputInfoPtr pInfo, int flags)
+
+ rc = NewInputDeviceRequest(iopts, attrs, &dev);
+
+- while(iopts)
+- {
+- tmp = iopts->next;
+- free(iopts->key);
+- free(iopts->value);
+- free(iopts);
+- iopts = tmp;
+- }
++ input_option_free_list(&iopts);
+
+ FreeInputAttributes(attrs);
+
+--
+cgit v0.9.0.2-2-gbebe
+From 411c1838456c055d3f911c54ed58bb11a6bf0da3 Mon Sep 17 00:00:00 2001
+From: Sascha Hlusiak <saschahlusiak@arcor.de>
+Date: Sun, 13 Nov 2011 17:04:25 +0000
+Subject: man: valuators are not added automatically
+
+---
+diff --git a/man/joystick.man b/man/joystick.man
+index b401de5..9f38ceb 100644
+--- a/man/joystick.man
++++ b/man/joystick.man
+@@ -129,9 +129,6 @@ can be one of:
+
+ .B none, relative, accelerated, absolute
+
+-Every axis which's mode is not
+-.B none
+-will be reported as an additional valuator.
+ .TP 7
+ .B \*qvaluator\*q
+ Send extra valuator events for this axis. The valuators will be numbered ascending, starting with 2 (valuator 0 and 1 are reserved for pointer movement). The range of the valuators is always
+--
+cgit v0.9.0.2-2-gbebe
+From b217fabdef1714ed4898e08de4c2a6b9cc8d4f0f Mon Sep 17 00:00:00 2001
+From: Sascha Hlusiak <saschahlusiak@arcor.de>
+Date: Sun, 13 Nov 2011 19:36:07 +0000
+Subject: Copy pInfo->driver to option list to fix hotplugging of keyboard device
+
+udev does copy the Driver line to the list of options, but when manually
+specifying the driver in xorg.conf, the option "Driver" is unset. Because we
+do hotplug a sub-device from within the core device, we need the "Driver"
+option to be present in the list.
+
+This should fix archlinux bug #23577:
+ https://bugs.archlinux.org/task/23577
+
+Thanks to Malek for coming up with a fix.
+
+Signed-off-by: Sascha Hlusiak <contact@saschahlusiak.de>
+---
+diff --git a/src/jstk_key.c b/src/jstk_key.c
+index a71275a..241b15d 100644
+--- a/src/jstk_key.c
++++ b/src/jstk_key.c
+@@ -296,6 +296,7 @@ jstkKeyboardHotplug(InputInfoPtr pInfo, int flags)
+ strcat(name, " (keys)");
+ opts = xf86ReplaceStrOption(opts, "Name", name);
+ opts = xf86ReplaceStrOption(opts, "_source", "_driver/joystick");
++ opts = xf86AddNewOption(opts, "Driver", pInfo->driver);
+
+ while(opts)
+ {
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/testing/xf86-input-keyboard/PKGBUILD b/testing/xf86-input-keyboard/PKGBUILD
new file mode 100644
index 000000000..aed5d63c3
--- /dev/null
+++ b/testing/xf86-input-keyboard/PKGBUILD
@@ -0,0 +1,30 @@
+# $Id: PKGBUILD 150010 2012-02-12 09:44:11Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-input-keyboard
+pkgver=1.6.1
+pkgrel=2
+pkgdesc="X.Org keyboard input driver"
+arch=(i686 x86_64)
+license=('custom')
+url="http://xorg.freedesktop.org/"
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.902')
+conflicts=('xorg-server<1.11.99.902')
+options=('!libtool')
+groups=('xorg-drivers' 'xorg')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2)
+sha1sums=('ef30fecb9e846a5268ae339846401489a785e413')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-input-mouse/PKGBUILD b/testing/xf86-input-mouse/PKGBUILD
new file mode 100644
index 000000000..c61c24faf
--- /dev/null
+++ b/testing/xf86-input-mouse/PKGBUILD
@@ -0,0 +1,30 @@
+# $Id: PKGBUILD 150012 2012-02-12 09:44:14Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-input-mouse
+pkgver=1.7.1
+pkgrel=3
+pkgdesc="X.org mouse input driver"
+arch=(i686 x86_64)
+license=('custom')
+url="http://xorg.freedesktop.org/"
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.902')
+conflicts=('xorg-server<1.11.99.902')
+options=('!libtool')
+groups=('xorg-drivers' 'xorg')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2)
+sha1sums=('11a6402e82d65bda5fb559c5e9bc72f3fd7af2ed')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -d -m755 "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-input-synaptics/10-synaptics.conf b/testing/xf86-input-synaptics/10-synaptics.conf
new file mode 100644
index 000000000..81a90fb81
--- /dev/null
+++ b/testing/xf86-input-synaptics/10-synaptics.conf
@@ -0,0 +1,9 @@
+Section "InputClass"
+ Identifier "touchpad catchall"
+ Driver "synaptics"
+ MatchIsTouchpad "on"
+ MatchDevicePath "/dev/input/event*"
+ Option "TapButton1" "1"
+ Option "TapButton2" "2"
+ Option "TapButton3" "3"
+EndSection
diff --git a/testing/xf86-input-synaptics/PKGBUILD b/testing/xf86-input-synaptics/PKGBUILD
new file mode 100644
index 000000000..095c34a3e
--- /dev/null
+++ b/testing/xf86-input-synaptics/PKGBUILD
@@ -0,0 +1,48 @@
+# $Id: PKGBUILD 150014 2012-02-12 09:44:16Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+# Contributor: Tobias Powalowski <tpowa@archlinux.org>
+# Contributor: Thomas Bächler <thomas@archlinux.org>
+# Contributor: Alexander Baldeck <alexander@archlinux.org>
+
+pkgname=xf86-input-synaptics
+pkgver=1.5.99
+pkgrel=0.1
+_gitver=e6032c34515a19ebac09090028f806d82ddfb62d
+pkgdesc="Synaptics driver for notebook touchpads"
+arch=('i686' 'x86_64')
+license=('custom')
+url="http://xorg.freedesktop.org/"
+depends=('libxtst')
+makedepends=('xorg-server-devel>=1.11.99.902' 'libxi' 'libx11')
+conflicts=('xorg-server<1.11.99.902')
+replaces=('synaptics')
+provides=('synaptics')
+conflicts=('synaptics')
+groups=('xorg-drivers' 'xorg')
+options=(!libtool)
+backup=('etc/X11/xorg.conf.d/10-synaptics.conf')
+source=(#http://xorg.freedesktop.org/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ http://cgit.freedesktop.org/xorg/driver/xf86-input-synaptics/snapshot/xf86-input-synaptics-${_gitver}.tar.gz
+ 10-synaptics.conf)
+md5sums=('82556d741fe2bc45c4ab4648cb77700d'
+ '3b81a81b958dfe3cac3cdef7ee85f1ce')
+
+build() {
+# cd "${srcdir}/${pkgname}-${pkgver}"
+ cd ${srcdir}/${pkgname}*
+ autoreconf -fi
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ #cd "${srcdir}/${pkgname}-${pkgver}"
+ cd ${srcdir}/${pkgname}*
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/etc/X11/xorg.conf.d"
+ install -m644 "${srcdir}/10-synaptics.conf" "${pkgdir}/etc/X11/xorg.conf.d/"
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+
+ rm -rf "${pkgdir}/usr/share/X11"
+}
diff --git a/testing/xf86-input-void/PKGBUILD b/testing/xf86-input-void/PKGBUILD
new file mode 100644
index 000000000..d6505b833
--- /dev/null
+++ b/testing/xf86-input-void/PKGBUILD
@@ -0,0 +1,33 @@
+# $Id: PKGBUILD 150018 2012-02-12 09:44:20Z andyrtr $
+#Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-input-void
+pkgver=1.4.0
+pkgrel=3
+pkgdesc="X.org void input driver"
+arch=(i686 x86_64)
+license=('custom')
+url="http://xorg.freedesktop.org/"
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.902')
+conflicts=('xorg-server<1.11.99.902')
+groups=('xorg-drivers' 'xorg')
+options=('!libtool')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2)
+sha1sums=('49b462d3acb16337eaf78202d4074f19d5e20b29')
+
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-input-wacom/70-wacom.rules b/testing/xf86-input-wacom/70-wacom.rules
new file mode 100644
index 000000000..f6aa20835
--- /dev/null
+++ b/testing/xf86-input-wacom/70-wacom.rules
@@ -0,0 +1,12 @@
+ACTION!="add|change", GOTO="wacom_end"
+
+# Match all serial wacom tablets with a serial ID starting with WACf
+# Notes: We assign NAME though we shouldn't, but currently the server requires it
+# We assign the lot to subsystem pnp too because server reads NAME from
+# the parent device. Once all that's fixed, as simple SUBSYSTEM="tty"
+# will do and the ENV{NAME} can be removed.
+SUBSYSTEM=="tty|pnp", SUBSYSTEMS=="pnp", ATTRS{id}=="WACf*", ENV{ID_MODEL}="Serial Wacom Tablet $attr{id}", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1", ENV{NAME}="Serial Wacom Tablet $attr{id}"
+SUBSYSTEM=="tty|pnp", SUBSYSTEMS=="pnp", ATTRS{id}=="FUJ*", ENV{ID_MODEL}="Serial Wacom Tablet $attr{id}", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1", ENV{NAME}="Serial Wacom Tablet $attr{id}"
+
+LABEL="wacom_end"
+
diff --git a/testing/xf86-input-wacom/PKGBUILD b/testing/xf86-input-wacom/PKGBUILD
new file mode 100644
index 000000000..be24f3781
--- /dev/null
+++ b/testing/xf86-input-wacom/PKGBUILD
@@ -0,0 +1,35 @@
+# $Id: PKGBUILD 150020 2012-02-12 09:44:23Z andyrtr $
+# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
+# Contributor: Jan de Groot <jgc@archlinux.org>
+# Contributor: M Rawash <mrawash@gmail.com>
+
+pkgname=xf86-input-wacom
+pkgver=0.13.0
+pkgrel=2
+pkgdesc="X.Org Wacom tablet driver"
+arch=('i686' 'x86_64')
+url="http://linuxwacom.sourceforge.net/"
+license=('GPL')
+backup=('etc/X11/xorg.conf.d/50-wacom.conf')
+depends=('libxi' 'libxrandr' 'libxinerama')
+makedepends=('xorg-server-devel>=1.11.99.902' 'libxext')
+conflicts=('xorg-server<1.11.99.902')
+options=(!libtool)
+source=(http://downloads.sourceforge.net/project/linuxwacom/${pkgname}/${pkgname}-${pkgver}.tar.bz2
+ 70-wacom.rules)
+md5sums=('4a426535989e84c4161e3607ea851654'
+ '10db4f8272286690255c1bcc18bfdd92')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr --with-xorg-conf-dir=/etc/X11/xorg.conf.d
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/lib/udev/rules.d"
+ install -m644 "${srcdir}/70-wacom.rules" "${pkgdir}/lib/udev/rules.d/"
+}
diff --git a/testing/xf86-video-apm/PKGBUILD b/testing/xf86-video-apm/PKGBUILD
new file mode 100644
index 000000000..9f7234691
--- /dev/null
+++ b/testing/xf86-video-apm/PKGBUILD
@@ -0,0 +1,33 @@
+# $Id: PKGBUILD 150022 2012-02-12 09:44:25Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-apm
+pkgver=1.2.3
+pkgrel=5
+pkgdesc="X.org Alliance ProMotion video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.902')
+conflicts=('xorg-server<1.11.99.902')
+groups=('xorg-drivers' 'xorg')
+options=('!libtool')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ apm-1.2.3-git.patch)
+sha1sums=('1fa7180cf985a74132f8d5b39a0bf9df08713fac'
+ 'ad9468519eb959bb879ba4e4993d6a83848d5c6f')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i ${srcdir}/apm-1.2.3-git.patch
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-apm/apm-1.2.3-git.patch b/testing/xf86-video-apm/apm-1.2.3-git.patch
new file mode 100644
index 000000000..1c6afb29d
--- /dev/null
+++ b/testing/xf86-video-apm/apm-1.2.3-git.patch
@@ -0,0 +1,34 @@
+diff --git a/src/apm.h b/src/apm.h
+index bc66714..86c7663 100644
+--- a/src/apm.h
++++ b/src/apm.h
+@@ -109,7 +109,7 @@ typedef struct {
+ char *MemMap;
+ pointer BltMap;
+ Bool UnlockCalled;
+- IOADDRESS iobase, xport, xbase;
++ unsigned long iobase, xport, xbase;
+ unsigned char savedSR10;
+ CARD8 MiscOut;
+ CARD8 c9, d9, db, Rush;
+diff --git a/src/apm_driver.c b/src/apm_driver.c
+index f172bab..f77bb2b 100644
+--- a/src/apm_driver.c
++++ b/src/apm_driver.c
+@@ -418,8 +418,14 @@ ApmPreInit(ScrnInfoPtr pScrn, int flags)
+
+ hwp = VGAHWPTR(pScrn);
+ vgaHWGetIOBase(hwp);
+- pApm->iobase = hwp->PIOOffset;
+- pApm->xport = hwp->PIOOffset + 0x3C4;
++#if ABI_VIDEODRV_VERSION < 12
++#define PIOOFFSET hwp->PIOOffset
++#else
++/* FIXME reintroduce domain support */
++#define PIOOFFSET 0
++#endif
++ pApm->iobase = PIOOFFSET;
++ pApm->xport = PIOOFFSET + 0x3C4;
+
+ /* Set pScrn->monitor */
+ pScrn->monitor = pScrn->confScreen->monitor;
diff --git a/testing/xf86-video-ark/PKGBUILD b/testing/xf86-video-ark/PKGBUILD
new file mode 100644
index 000000000..97370566a
--- /dev/null
+++ b/testing/xf86-video-ark/PKGBUILD
@@ -0,0 +1,34 @@
+# $Id: PKGBUILD 150024 2012-02-12 09:44:29Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-ark
+pkgver=0.7.4
+pkgrel=1
+pkgdesc="X.org ark video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.902')
+conflicts=('xorg-server<1.11.99.902')
+options=('!libtool')
+groups=('xorg-drivers' 'xorg')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ #git-fixes.patch
+ )
+sha1sums=('d95cb9aa56e7db542b3ac8fed9cb519b11f77556')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ #patch -Np1 -i "${srcdir}/git-fixes.patch"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-ark/git-fixes.patch b/testing/xf86-video-ark/git-fixes.patch
new file mode 100644
index 000000000..2de0f64be
--- /dev/null
+++ b/testing/xf86-video-ark/git-fixes.patch
@@ -0,0 +1,118 @@
+From 9d3769bed020e9796e51411c63de337da5073bb4 Mon Sep 17 00:00:00 2001
+From: Ondrej Zary <linux@rainbow-software.org>
+Date: Sat, 04 Dec 2010 00:23:51 +0000
+Subject: Don't assume that FB address registers are initialized properly
+
+https://bugs.freedesktop.org/show_bug.cgi?id=28249
+
+ark driver does not work with Hercules Stingray 64 card (ark2000pv).
+X fails to start with:
+
+[...]
+(II) ark(0): vgaHWGetIOBase: hwp->IOBase is 0x03d0, hwp->PIOOffset is
+0x0000
+(II) ark(0): Creating default Display subsection in Screen section
+ "Default Screen Section" for depth/fbbpp 24/32
+(==) ark(0): Depth 24, (--) framebuffer bpp 32
+(==) ark(0): RGB weight 888
+(==) ark(0): Default visual is TrueColor
+(**) ark(0): Chipset: "ark2000pv"
+(--) ark(0): Framebuffer @ 0xe5e50000
+(==) ark(0): Using gamma correction (1.0, 1.0, 1.0)
+(--) ark(0): Detected 2048 bytes video ram
+[...]
+Fatal server error:
+AddScreen/ScreenInit failed for driver 0
+
+Comparing with lspci, the framebuffer address is wrong:
+00:0f.0 VGA compatible controller: ARK Logic Inc 2000PV [Stingray] (prog-if 00 [VGA controller])
+ Flags: medium devsel
+ Memory at e5000000 (32-bit, prefetchable) [size=4M]
+ [virtual] Expansion ROM at 1c000000 [disabled] [size=64K]
+
+Reviewed-by: Adam Jackson <ajax@redhat.com>
+---
+diff --git a/src/ark.h b/src/ark.h
+index de301dc..077f93b 100644
+--- a/src/ark.h
++++ b/src/ark.h
+@@ -34,7 +34,6 @@ typedef struct _ARKRec {
+ #endif
+ EntityInfoPtr pEnt;
+ CARD32 IOAddress;
+- CARD32 FBAddress;
+ unsigned char * FBBase;
+ unsigned char * MMIOBase;
+ unsigned long videoRam;
+diff --git a/src/ark_driver.c b/src/ark_driver.c
+index 5de3b9a..fec3e1a 100644
+--- a/src/ark_driver.c
++++ b/src/ark_driver.c
+@@ -363,14 +363,14 @@ static Bool ARKPreInit(ScrnInfoPtr pScrn, int flags)
+ outb(hwp->PIOOffset + hwp->IOBase + 5, tmp & 0x7f);
+ modinx(hwp->PIOOffset + 0x3c4, 0x1d, 0x01, 0x01);
+
+- /* use membase's later on ??? */
+- pARK->FBAddress = (rdinx(hwp->PIOOffset + 0x3c4, 0x13) << 16) +
+- (rdinx(hwp->PIOOffset + 0x3c4, 0x14) << 24);
+-
+- pScrn->memPhysBase = pARK->FBAddress;
++#ifndef XSERVER_LIBPCIACCESS
++ pScrn->memPhysBase = pARK->PciInfo->memBase[0];
++#else
++ pScrn->memPhysBase = pARK->PciInfo->regions[0].base_addr;
++#endif
+
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Framebuffer @ 0x%lx\n",
+- (unsigned long)pARK->FBAddress);
++ (unsigned long)pScrn->memPhysBase);
+
+ if (!xf86SetGamma(pScrn, gzeros))
+ return FALSE;
+@@ -748,8 +748,13 @@ static Bool ARKModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ new->sr10 = rdinx(isaIOBase + 0x3c4, 0x10) & ~0x1f;
+ new->sr10 |= 0x1f;
+
+- new->sr13 = pARK->FBAddress >> 16;
+- new->sr14 = pARK->FBAddress >> 24;
++#ifndef XSERVER_LIBPCIACCESS
++ new->sr13 = pARK->PciInfo->memBase[0] >> 16;
++ new->sr14 = pARK->PciInfo->memBase[0] >> 24;
++#else
++ new->sr13 = pARK->PciInfo->regions[0].base_addr >> 16;
++ new->sr14 = pARK->PciInfo->regions[0].base_addr >> 24;
++#endif
+
+ new->sr12 = rdinx(isaIOBase + 0x3c4, 0x12) & ~0x03;
+ switch (pScrn->videoRam) {
+@@ -1022,7 +1027,7 @@ static Bool ARKMapMem(ScrnInfoPtr pScrn)
+ pARK->PciTag, 0xb8000, 0x8000);
+
+ pARK->FBBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
+- pARK->PciTag, pARK->FBAddress,
++ pARK->PciTag, pARK->PciInfo->memBase[0],
+ pScrn->videoRam * 1024);
+ #else
+
+@@ -1032,14 +1037,17 @@ static Bool ARKMapMem(ScrnInfoPtr pScrn)
+ {
+ void** result = (void**)&pARK->FBBase;
+ int err = pci_device_map_range(pARK->PciInfo,
+- pARK->FBAddress,
++ pARK->PciInfo->regions[0].base_addr,
+ pScrn->videoRam * 1024,
+ PCI_DEV_MAP_FLAG_WRITABLE |
+ PCI_DEV_MAP_FLAG_WRITE_COMBINE,
+ result);
+
+- if (err)
++ if (err) {
++ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
++ "Cound not map framebuffer: %d\n", err);
+ return FALSE;
++ }
+ }
+ #endif
+
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/testing/xf86-video-ast/PKGBUILD b/testing/xf86-video-ast/PKGBUILD
new file mode 100644
index 000000000..c2bc925cc
--- /dev/null
+++ b/testing/xf86-video-ast/PKGBUILD
@@ -0,0 +1,33 @@
+# $Id: PKGBUILD 150026 2012-02-12 09:44:33Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-ast
+pkgver=0.93.9
+pkgrel=2
+pkgdesc="X.org ASPEED AST Graphics video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.902')
+conflicts=('xorg-server<1.11.99.902')
+options=('!libtool')
+groups=('xorg-drivers' 'xorg')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ ast-0.93.9-vga.patch)
+md5sums=('e25c6a55e9d07cc6054d6affc1231296'
+ '9aa9ea4c568b6563389fa634cb0f7cf0')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i ${srcdir}/ast-0.93.9-vga.patch
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-ast/ast-0.93.9-vga.patch b/testing/xf86-video-ast/ast-0.93.9-vga.patch
new file mode 100644
index 000000000..e05a78f56
--- /dev/null
+++ b/testing/xf86-video-ast/ast-0.93.9-vga.patch
@@ -0,0 +1,38 @@
+From 4a7eda24050b42072c77d527257609e743e8dc78 Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Wed, 16 Nov 2011 20:09:40 +0000
+Subject: Adapt to domain changes in videoabi 12
+
+This is a blind change, I don't have this hardware handy to test with.
+It probably wants the same new API that tdfx wants.
+
+Signed-off-by: Adam Jackson <ajax@redhat.com>
+---
+diff --git a/src/ast_driver.c b/src/ast_driver.c
+index bd3d338..128538f 100644
+--- a/src/ast_driver.c
++++ b/src/ast_driver.c
+@@ -498,11 +498,20 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
+ (pScrn->chipset != NULL) ? pScrn->chipset : "Unknown ast");
+
+ /* Resource Allocation */
++#if ABI_VIDEODRV_VERSION < 12
+ pAST->IODBase = pScrn->domainIOBase;
++#else
++ pAST->IODBase = 0;
++#endif
+ /* "Patch" the PIOOffset inside vgaHW in order to force
+ * the vgaHW module to use our relocated i/o ports.
+ */
+- VGAHWPTR(pScrn)->PIOOffset = pAST->PIOOffset = pAST->IODBase + PCI_REGION_BASE(pAST->PciInfo, 2, REGION_IO) - 0x380;
++
++#if ABI_VIDEODRV_VERSION < 12
++ VGAHWPTR(pScrn)->PIOOffset = /* ... */
++#endif
++ pAST->PIOOffset =
++ pAST->IODBase + PCI_REGION_BASE(pAST->PciInfo, 2, REGION_IO) - 0x380;
+
+ pAST->RelocateIO = (IOADDRESS)(PCI_REGION_BASE(pAST->PciInfo, 2, REGION_IO) + pAST->IODBase);
+
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/testing/xf86-video-ati/PKGBUILD b/testing/xf86-video-ati/PKGBUILD
new file mode 100644
index 000000000..8d6cd0d84
--- /dev/null
+++ b/testing/xf86-video-ati/PKGBUILD
@@ -0,0 +1,31 @@
+# $Id: PKGBUILD 150028 2012-02-12 09:44:37Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+# Contributor: Alexander Baldeck <alexander@archlinux.org>
+
+pkgname=xf86-video-ati
+pkgver=6.14.3
+pkgrel=2
+pkgdesc="X.org ati video driver"
+arch=('i686' 'x86_64')
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=(libpciaccess libdrm udev pixman ati-dri)
+makedepends=('xorg-server-devel>=1.11.99.902' 'libdrm' 'xf86driproto' 'mesa' 'glproto')
+conflicts=('xorg-server<1.11.99.902')
+groups=('xorg-drivers' 'xorg')
+options=('!libtool')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2)
+sha1sums=('db635e2e2858d5db90362f546ac0adad85474bad')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr --enable-dri
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make "DESTDIR=${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-chips/PKGBUILD b/testing/xf86-video-chips/PKGBUILD
new file mode 100644
index 000000000..b4db68965
--- /dev/null
+++ b/testing/xf86-video-chips/PKGBUILD
@@ -0,0 +1,35 @@
+# $Id: PKGBUILD 150030 2012-02-12 09:44:42Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+# Contributor: Alexander Baldeck <alexander@archlinux.org>
+
+pkgname=xf86-video-chips
+pkgver=1.2.4
+pkgrel=4
+pkgdesc="X.org Chips and Technologies video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=(glibc)
+makedepends=('xorg-server-devel>=1.11.99.902')
+conflicts=('xorg-server<1.11.99.902')
+groups=('xorg-drivers' 'xorg')
+options=('!libtool')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ chips-1.2.4-git.patch)
+sha1sums=('71f474335d05f93b2451a7a0750c4409669641a4'
+ 'b13ff000e3f6f06c1a7fd55e9e0ad6078f1b4e5b')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i ${srcdir}/chips-1.2.4-git.patch
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-chips/chips-1.2.4-git.patch b/testing/xf86-video-chips/chips-1.2.4-git.patch
new file mode 100644
index 000000000..9d8e856a3
--- /dev/null
+++ b/testing/xf86-video-chips/chips-1.2.4-git.patch
@@ -0,0 +1,912 @@
+diff --git a/configure.ac b/configure.ac
+index 225e516..c0ed508 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -44,9 +44,6 @@ XORG_DEFAULT_OPTIONS
+ AC_DISABLE_STATIC
+ AC_PROG_LIBTOOL
+
+-# Checks for programs.
+-AM_PROG_CC_C_O
+-
+ AH_TOP([#include "xorg-server.h"])
+
+ # Define a configure option for an alternate module directory
+diff --git a/man/chips.man b/man/chips.man
+index 740af38..0c022ee 100644
+--- a/man/chips.man
++++ b/man/chips.man
+@@ -165,9 +165,6 @@ Force the use of memory mapped IO where it can be used. Default: off
+ Force driver to leave centering and stretching registers alone. This
+ can fix some laptop suspend/resume problems. Default: off
+ .TP
+-.BI "Option \*qOverlay\*q"
+-Enable 8+24 overlay mode. Only appropriate for depth 24. Default: off.
+-.TP
+ .BI "Option \*qColorKey\*q \*q" integer \*q
+ Set the colormap index used for the transparency key for the depth 8 plane
+ when operating in 8+16 overlay mode. The value must be in the range
+diff --git a/src/ct_accel.c b/src/ct_accel.c
+index 3920b0a..4b5776a 100644
+--- a/src/ct_accel.c
++++ b/src/ct_accel.c
+@@ -428,19 +428,7 @@ chips_imagewrite:
+ infoPtr->ImageWriteFlags |= NO_PLANEMASK;
+ #endif
+
+-
+-#ifdef CHIPS_HIQV
+- if (XAAInit(pScreen, infoPtr)) {
+- if (cPtr->Flags & ChipsOverlay8plus16)
+- return(XAAInitDualFramebufferOverlay(pScreen,
+- CTNAME(DepthChange)));
+- else
+- return TRUE;
+- } else
+- return FALSE;
+-#else
+ return(XAAInit(pScreen, infoPtr));
+-#endif
+ }
+
+ #ifdef CHIPS_HIQV
+@@ -1243,11 +1231,6 @@ CTNAME(SubsequentScreenToScreenColorExpandFill)(ScrnInfoPtr pScrn,
+ #endif
+ w *= cAcl->BytesPerPixel;
+ ctBLTWAIT;
+-#ifdef CHIPS_HIQV
+- if ((y >= pScrn->virtualY) && (cPtr->Flags & ChipsOverlay8plus16) &&
+- (pScrn->depth == 8))
+- ctSETPITCH(cAcl->PitchInBytes << 1, cAcl->PitchInBytes);
+-#endif
+ ctSETSRCADDR(srcaddr);
+ ctSETDSTADDR(destaddr);
+ #ifdef CHIPS_HIQV
+@@ -1271,10 +1254,6 @@ CTNAME(SetupForColor8x8PatternFill)(ScrnInfoPtr pScrn, int patx, int paty,
+ patternaddr = (paty * pScrn->displayWidth +
+ (patx & ~0x3F)) * cAcl->BytesPerPixel;
+ cAcl->patternyrot = (patx & 0x3F) >> 3;
+-#ifdef CHIPS_HIQV
+- if (cPtr->Flags & ChipsOverlay8plus16)
+- patternaddr += cPtr->FbOffset16;
+-#endif
+
+ ctBLTWAIT;
+ ctSETPATSRCADDR(patternaddr);
+@@ -1338,10 +1317,7 @@ CTNAME(SetupForMono8x8PatternFill)(ScrnInfoPtr pScrn, int patx, int paty,
+
+ #ifdef CHIPS_HIQV
+ patternaddr = paty * pScrn->displayWidth + patx;
+- if (cPtr->Flags & ChipsOverlay8plus16)
+- patternaddr = patternaddr * 2 + cPtr->FbOffset16;
+- else
+- patternaddr *= cAcl->BytesPerPixel;
++ patternaddr *= cAcl->BytesPerPixel;
+ #else
+ patternaddr = (paty * pScrn->displayWidth + patx) * cAcl->BytesPerPixel;
+ #endif
+@@ -1593,10 +1569,7 @@ CTNAME(WritePixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ dwords = (((skipleft + bytesPerLine + 0x7) & ~0x7)) >> 2;
+ destaddr = (y * pScrn->displayWidth + x) * (bpp >> 3);
+ destpitch = pScrn->displayWidth * (bpp >> 3);
+- if ((y >= pScrn->virtualY) && (cPtr->Flags & ChipsOverlay8plus16))
+- destaddr += cPtr->FbOffset16;
+- else
+- destaddr += cAcl->FbOffset;
++ destaddr += cAcl->FbOffset;
+
+ ctBLTWAIT;
+
+@@ -1681,10 +1654,7 @@ CTNAME(WritePixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ y++;
+
+ destaddr = (y * pScrn->displayWidth + x) * (bpp >> 3);
+- if ((y >= pScrn->virtualY) && (cPtr->Flags & ChipsOverlay8plus16))
+- destaddr += cPtr->FbOffset16;
+- else
+- destaddr += cAcl->FbOffset;
++ destaddr += cAcl->FbOffset;
+
+ ctBLTWAIT;
+ ctSETDSTADDR(destaddr);
+@@ -1717,10 +1687,7 @@ CTNAME(ReadPixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ dwords = (((bytesPerLine + 0x7) & ~0x7)) >> 2;
+ srcaddr = (y * pScrn->displayWidth + x) * (bpp >> 3);
+ srcpitch = pScrn->displayWidth * (bpp >> 3);
+- if ((y >= pScrn->virtualY) && (cPtr->Flags & ChipsOverlay8plus16))
+- srcaddr += cPtr->FbOffset16;
+- else
+- srcaddr += cAcl->FbOffset;
++ srcaddr += cAcl->FbOffset;
+
+ ctBLTWAIT;
+ ctSETROP( ctDSTSYSTEM | ctLEFT2RIGHT | ctTOP2BOTTOM |
+@@ -1755,10 +1722,7 @@ CTNAME(ReadPixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ dst += dstwidth;
+ y++;
+ srcaddr = (y * pScrn->displayWidth + x) * (bpp >> 3);
+- if ((y >= pScrn->virtualY) && (cPtr->Flags & ChipsOverlay8plus16))
+- srcaddr += cPtr->FbOffset16;
+- else
+- srcaddr += cAcl->FbOffset;
++ srcaddr += cAcl->FbOffset;
+ ctBLTWAIT;
+ ctSETSRCADDR(srcaddr);
+ ctSETHEIGHTWIDTHGO(h, bytesPerLine);
+diff --git a/src/ct_driver.c b/src/ct_driver.c
+index 6624b79..a2e5c94 100644
+--- a/src/ct_driver.c
++++ b/src/ct_driver.c
+@@ -949,7 +949,7 @@ CHIPSProbe(DriverPtr drv, int flags)
+ }
+
+ }
+- xfree(usedChips);
++ free(usedChips);
+ }
+ }
+
+@@ -981,12 +981,12 @@ CHIPSProbe(DriverPtr drv, int flags)
+ pScrn->ValidMode = CHIPSValidMode;
+ foundScreen = TRUE;
+ }
+- xfree(usedChips);
++ free(usedChips);
+ }
+ }
+ #endif
+
+- xfree(devSections);
++ free(devSections);
+ return foundScreen;
+ }
+ #endif
+@@ -1446,7 +1446,12 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags)
+
+ hwp = VGAHWPTR(pScrn);
+ vgaHWGetIOBase(hwp);
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+ cPtr->PIOBase = hwp->PIOOffset;
++#else
++ cPtr->PIOBase = 0;
++#endif
++
+ /*
+ * Must allow ensure that storage for the 2nd set of vga registers is
+ * allocated for dual channel cards
+@@ -1639,55 +1644,15 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags)
+ }
+ }
+
+- if ((s = xf86GetOptValString(cPtr->Options, OPTION_OVERLAY))) {
+- if (!*s || !xf86NameCmp(s, "8,16") || !xf86NameCmp(s, "16,8")) {
+- if (pScrn->bitsPerPixel == 16) {
+- if (cPtr->Flags & ChipsLinearSupport) {
+- cPtr->Flags |= ChipsOverlay8plus16;
+- if(!xf86GetOptValInteger(
+- cPtr->Options, OPTION_COLOR_KEY, &(pScrn->colorKey)))
+- pScrn->colorKey = TRANSPARENCY_KEY;
+- pScrn->overlayFlags = OVERLAY_8_16_DUALFB;
+- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+- "PseudoColor overlay enabled.\n");
+- if (!xf86IsOptionSet(cPtr->Options, OPTION_LCD_STRETCH))
+- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+- " - Forcing option \"Stretch\" \"ON\".\n");
+- if (!xf86IsOptionSet(cPtr->Options, OPTION_LCD_CENTER))
+- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+- " - Forcing option \"LcdCenter\" \"OFF\".\n");
+- if (cPtr->Flags & ChipsShadowFB) {
+- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+- " - Disabling \"Shadow Framebuffer\".\n");
+- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+- " Not support with option \"8Plus16\".\n");
+- cPtr->Flags &= ~ChipsShadowFB;
+- cPtr->Rotate = 0;
+- }
+- } else {
+- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Option \"Overlay\" ignored. Not supported without linear addressing\n");
+- }
+- } else {
+- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+- "Option \"Overlay\" is not supported in this configuration\n");
+- }
+- } else {
+- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+- "\"%s\" is not a valid value for Option \"Overlay\"\n", s);
+- }
+- }
+-
+- if (!(cPtr->Flags & ChipsOverlay8plus16)) {
+- if(xf86GetOptValInteger(cPtr->Options, OPTION_VIDEO_KEY,
+- &(cPtr->videoKey))) {
+- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n",
++ if(xf86GetOptValInteger(cPtr->Options, OPTION_VIDEO_KEY,
++ &(cPtr->videoKey))) {
++ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n",
+ cPtr->videoKey);
+- } else {
+- cPtr->videoKey = (1 << pScrn->offset.red) |
++ } else {
++ cPtr->videoKey = (1 << pScrn->offset.red) |
+ (1 << pScrn->offset.green) |
+ (((pScrn->mask.blue >> pScrn->offset.blue) - 1)
+ << pScrn->offset.blue);
+- }
+ }
+
+ if (cPtr->Flags & ChipsShadowFB) {
+@@ -2335,28 +2300,16 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags)
+ /* and 32bits on the others. Thus multiply by a suitable factor */
+ if (cPtr->Flags & Chips64BitMemory) {
+ if (cPtr->FrameBufferSize && (cPtr->PanelType & ChipsLCD))
+- if (cPtr->Flags & ChipsOverlay8plus16 )
+- cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 8 * 0.7 / 4);
+- else
+ cPtr->MaxClock = min(cPtr->MaxClock,
+ MemClk->Clk * 8 * 0.7 / (bytesPerPixel + 1));
+ else
+- if (cPtr->Flags & ChipsOverlay8plus16)
+- cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 8 * 0.7 / 3);
+- else
+ cPtr->MaxClock = min(cPtr->MaxClock,
+ MemClk->Clk * 8 * 0.7 / bytesPerPixel);
+ } else {
+ if (cPtr->FrameBufferSize && (cPtr->PanelType & ChipsLCD))
+- if (cPtr->Flags & ChipsOverlay8plus16 )
+- cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 4 * 0.7 / 4);
+- else
+ cPtr->MaxClock = min(cPtr->MaxClock,
+ MemClk->Clk * 4 * 0.7 / (bytesPerPixel + 1));
+ else
+- if (cPtr->Flags & ChipsOverlay8plus16)
+- cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 4 * 0.7 / 3);
+- else
+ cPtr->MaxClock = min(cPtr->MaxClock,
+ MemClk->Clk * 4 * 0.7 / bytesPerPixel);
+ }
+@@ -3736,8 +3689,7 @@ CHIPSEnterVT(int scrnIndex, int flags)
+ /* Should we re-save the text mode on each VT enter? */
+ if(!chipsModeInit(pScrn, pScrn->currentMode))
+ return FALSE;
+- if ((!(cPtr->Flags & ChipsOverlay8plus16))
+- && (cPtr->Flags & ChipsVideoSupport)
++ if ((cPtr->Flags & ChipsVideoSupport)
+ && (cPtr->Flags & ChipsLinearSupport))
+ CHIPSResetVideo(pScrn);
+
+@@ -3788,8 +3740,7 @@ chipsLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
+ int i, index, shift ;
+ CHIPSEntPtr cPtrEnt;
+
+- shift = ((pScrn->depth == 15) &&
+- (!(cPtr->Flags & ChipsOverlay8plus16))) ? 3 : 0;
++ shift = (pScrn->depth == 15) ? 3 : 0;
+
+ if (cPtr->UseDualChannel) {
+ cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0],
+@@ -3895,18 +3846,6 @@ chipsLoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices,
+ hwp->disablePalette(hwp);
+ }
+
+-static Bool
+-cfb8_16ScreenInit(ScreenPtr pScreen, pointer pbits16, pointer pbits8,
+- int xsize, int ysize, int dpix, int dpiy,
+- int width16, int width8)
+-{
+- return
+- (fbOverlaySetupScreen(pScreen, pbits16, pbits8, xsize, ysize,
+- dpix, dpiy, width16, width8, 16, 8) &&
+- fbOverlayFinishScreenInit(pScreen, pbits16, pbits8, xsize, ysize,
+- dpix, dpiy, width16, width8, 16, 8, 16, 8));
+-}
+-
+ /* Mandatory */
+ static Bool
+ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+@@ -3947,22 +3886,6 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ if (!chipsMapMem(pScrn))
+ return FALSE;
+
+- /* Setup a pointer to the overlay if needed */
+- if (cPtr->Flags & ChipsOverlay8plus16) {
+- cPtr->FbOffset16 = pScrn->displayWidth * pScrn->virtualY;
+- cPtr->FbSize16 = (pScrn->displayWidth << 1) * pScrn->virtualY;
+- if (cPtr->FbSize16 > (cPtr->FbMapSize - cPtr->FrameBufferSize)) {
+- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+- "Too little memory for overlay. Disabling.\n");
+- cPtr->Flags &= ~ChipsOverlay8plus16;
+- }
+- if ((pScrn->displayWidth > 1024) || (pScrn->virtualY > 1024)) {
+- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+- "Max overlay Width/Height 1024 pixels. Disabling.\n");
+- cPtr->Flags &= ~ChipsOverlay8plus16;
+- }
+- }
+-
+ /* Setup the MMIO register access functions if need */
+ if (cPtr->UseFullMMIO && cPtr->MMIOBaseVGA) {
+ CHIPSSetMmioExtFuncs(cPtr);
+@@ -4035,18 +3958,10 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ miClearVisualTypes();
+
+ /* Setup the visuals we support. */
+- if ((pScrn->bitsPerPixel == 16) && (cPtr->Flags & ChipsOverlay8plus16)){
+- if (!miSetVisualTypes(8, PseudoColorMask | GrayScaleMask,
+- pScrn->rgbBits, PseudoColor))
+- return FALSE;
+- if (!miSetVisualTypes(16, TrueColorMask, pScrn->rgbBits, TrueColor))
+- return FALSE;
+- } else {
+- if (!miSetVisualTypes(pScrn->depth,
++ if (!miSetVisualTypes(pScrn->depth,
+ miGetDefaultVisualMask(pScrn->depth),
+ pScrn->rgbBits, pScrn->defaultVisual))
+- return FALSE;
+- }
++ return FALSE;
+ miSetPixmapDepths ();
+
+ /*
+@@ -4090,13 +4005,6 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ break;
+ #endif
+ case 16:
+- if (cPtr->Flags & ChipsOverlay8plus16) {
+- ret = cfb8_16ScreenInit(pScreen, (unsigned char *)FBStart +
+- cPtr->FbOffset16, FBStart, width,
+- height, pScrn->xDpi, pScrn->yDpi,
+- displayWidth, displayWidth);
+- break;
+- }
+ default:
+ ret = fbScreenInit(pScreen, FBStart,
+ width,height,
+@@ -4223,7 +4131,7 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ }
+ if (!miInitializeBanking(pScreen, pScrn->virtualX, pScrn->virtualY,
+ pScrn->displayWidth, pBankInfo)) {
+- xfree(pBankInfo);
++ free(pBankInfo);
+ pBankInfo = NULL;
+ return FALSE;
+ }
+@@ -4244,9 +4152,6 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ if (pScrn->bitsPerPixel < 8)
+ freespace = allocatebase - pScrn->displayWidth *
+ pScrn->virtualY / 2;
+- else if ((pScrn->bitsPerPixel == 16) && (cPtr->Flags & ChipsOverlay8plus16))
+- freespace = allocatebase - pScrn->displayWidth *
+- pScrn->virtualY - cPtr->FbSize16;
+ else
+ freespace = allocatebase - pScrn->displayWidth *
+ pScrn->virtualY * (pScrn->bitsPerPixel >> 3);
+@@ -4369,9 +4274,7 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ AvailFBArea.y2 = cAcl->CacheEnd /
+ (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3));
+
+- if (!(cPtr->Flags & ChipsOverlay8plus16)) {
+- xf86InitFBManager(pScreen, &AvailFBArea);
+- }
++ xf86InitFBManager(pScreen, &AvailFBArea);
+ }
+ if (cPtr->Flags & ChipsAccelSupport) {
+ if (IS_HiQV(cPtr)) {
+@@ -4425,16 +4328,10 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ if (!miCreateDefColormap(pScreen))
+ return FALSE;
+
+- if ((cPtr->Flags & ChipsOverlay8plus16) && (pScrn->bitsPerPixel == 16)) {
+- if(!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, chipsLoadPalette,
+- NULL, CMAP_RELOAD_ON_MODE_SWITCH))
+- return FALSE;
+- } else {
+- if(!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits,
++ if(!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits,
+ (pScrn->depth == 16 ? chipsLoadPalette16 : chipsLoadPalette),
+ NULL, CMAP_RELOAD_ON_MODE_SWITCH | CMAP_PALETTED_TRUECOLOR))
+- return FALSE;
+- }
++ return FALSE;
+
+ #ifndef XSERVER_LIBPCIACCESS
+ racflag = RAC_COLORMAP;
+@@ -4448,8 +4345,7 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ xf86SetSilkenMouse(pScreen);
+ #endif
+
+- if ((!(cPtr->Flags & ChipsOverlay8plus16))
+- && (cPtr->Flags & ChipsVideoSupport)
++ if ((cPtr->Flags & ChipsVideoSupport)
+ && (cPtr->Flags & ChipsLinearSupport)) {
+ CHIPSInitVideo(pScreen);
+ }
+@@ -4522,10 +4418,7 @@ CHIPSAdjustFrame(int scrnIndex, int x, int y, int flags)
+ Base >>= 3;
+ break;
+ case 16:
+- if (!(cPtr->Flags & ChipsOverlay8plus16))
+- Base >>= 1;
+- else
+- Base >>= 2;
++ Base >>= 1;
+ break;
+ case 24:
+ if (!IS_HiQV(cPtr))
+@@ -4581,14 +4474,6 @@ CHIPSAdjustFrame(int scrnIndex, int x, int y, int flags)
+ cPtr->writeMSS(cPtr, hwp, MSS);
+ }
+
+- if (cPtr->Flags & ChipsOverlay8plus16) {
+- Base = (Base << 3) & ~(unsigned long)0xF;
+-
+- cPtr->writeMR(cPtr, 0x22, (cPtr->FbOffset16 + Base) & 0xF8);
+- cPtr->writeMR(cPtr, 0x23, ((cPtr->FbOffset16 + Base) >> 8) & 0xFF);
+- cPtr->writeMR(cPtr, 0x24, ((cPtr->FbOffset16 + Base) >> 16) & 0xFF);
+- }
+-
+ }
+
+ /* Mandatory */
+@@ -4652,13 +4537,6 @@ CHIPSValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ CHIPSPtr cPtr = CHIPSPTR(pScrn);
+
+- if (flags & MODECHECK_FINAL) {
+- /* Don't subtract FrambufferSize here as it should be subtracted already */
+- if ((cPtr->Flags & ChipsOverlay8plus16)
+- && ((pScrn->videoRam<<10) - pScrn->displayWidth * 3 * pScrn->virtualY
+- < 0))
+- return MODE_MEM;
+- }
+ /* The tests here need to be expanded */
+ if ((mode->Flags & V_INTERLACE) && (cPtr->PanelType & ChipsLCD))
+ return MODE_NO_INTERLACE;
+@@ -5544,12 +5422,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ } else {
+ ChipsStd->Attribute[0x10] = 0x01; /* mode */
+ }
+- if ((pScrn->bitsPerPixel == 16) && (cPtr->Flags & ChipsOverlay8plus16)) {
+- /* Make sure that the overlay isn't visible in the overscan region */
+- if (ChipsStd->Attribute[0x11] == pScrn->colorKey)
+- ChipsStd->Attribute[0x11] = pScrn->colorKey - 1;
+- } else
+- ChipsStd->Attribute[0x11] = 0x00; /* overscan (border) color */
++ ChipsStd->Attribute[0x11] = 0x00; /* overscan (border) color */
+ ChipsStd->Attribute[0x12] = 0x0F; /* enable all color planes */
+ ChipsStd->Attribute[0x13] = 0x00; /* horiz pixel panning 0 */
+
+@@ -5558,8 +5431,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ /* set virtual screen width */
+ tmp = pScrn->displayWidth >> 3;
+ if (pScrn->bitsPerPixel == 16) {
+- if (!(cPtr->Flags & ChipsOverlay8plus16))
+- tmp <<= 1; /* double the width of the buffer */
++ tmp <<= 1; /* double the width of the buffer */
+ } else if (pScrn->bitsPerPixel == 24) {
+ tmp += tmp << 1;
+ } else if (pScrn->bitsPerPixel == 32) {
+@@ -5688,8 +5560,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
+
+ /* centering/stretching */
+ if (!xf86ReturnOptValBool(cPtr->Options, OPTION_SUSPEND_HACK, FALSE)) {
+- if (!xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_STRETCH, FALSE) ||
+- (cPtr->Flags & ChipsOverlay8plus16)) {
++ if (!xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_STRETCH, FALSE)) {
+ ChipsNew->FR[0x40] &= 0xDF; /* Disable Horizontal stretching */
+ ChipsNew->FR[0x48] &= 0xFB; /* Disable vertical stretching */
+ ChipsNew->XR[0xA0] = 0x10; /* Disable cursor stretching */
+@@ -5709,8 +5580,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ }
+ }
+
+- if ((xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_CENTER, TRUE))
+- || (cPtr->Flags & ChipsOverlay8plus16)) {
++ if (xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_CENTER, TRUE)) {
+ ChipsNew->FR[0x40] |= 0x3; /* Enable Horizontal centering */
+ ChipsNew->FR[0x48] |= 0x3; /* Enable Vertical centering */
+ } else {
+@@ -5723,8 +5593,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ ChipsNew->XR[0x82] |=0x02;
+
+ /* software mode flag */
+- ChipsNew->XR[0xE2] = chipsVideoMode(((cPtr->Flags & ChipsOverlay8plus16) ?
+- 8 : pScrn->depth), (cPtr->PanelType & ChipsLCD) ?
++ ChipsNew->XR[0xE2] = chipsVideoMode((pScrn->depth), (cPtr->PanelType & ChipsLCD) ?
+ min(mode->CrtcHDisplay, cPtr->PanelSize.HDisplay) :
+ mode->CrtcHDisplay, mode->CrtcVDisplay);
+ #ifdef DEBUG
+@@ -5762,7 +5631,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ }
+ }
+ /* bpp depend */
+- if ((pScrn->bitsPerPixel == 16) && (!(cPtr->Flags & ChipsOverlay8plus16))) {
++ if (pScrn->bitsPerPixel == 16) {
+ ChipsNew->XR[0x81] = (ChipsNew->XR[0x81] & 0xF0) | 0x4;
+ if (cPtr->Flags & ChipsGammaSupport)
+ ChipsNew->XR[0x82] |= 0x0C;
+@@ -5915,60 +5784,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ /* Turn off multimedia by default as it degrades performance */
+ ChipsNew->XR[0xD0] &= 0x0f;
+
+- /* Setup the video/overlay */
+- if (cPtr->Flags & ChipsOverlay8plus16) {
+- ChipsNew->XR[0xD0] |= 0x10; /* Force the Multimedia engine on */
+-#ifdef SAR04
+- ChipsNew->XR[0x4F] = 0x2A; /* SAR04 >352 pixel overlay width */
+-#endif
+- ChipsNew->MR[0x1E] &= 0xE0; /* Set Zoom and Direction */
+- if ((!(cPtr->PanelType & ChipsLCD)) && (mode->Flags & V_INTERLACE))
+- ChipsNew->MR[0x1E] |= 0x10; /* Interlace */
+- ChipsNew->MR[0x1F] &= 0x14; /* Mask reserved bits */
+- ChipsNew->MR[0x1F] |= 0x08; /* RGB 16bpp */
+- if (pScrn->weight.green == 5)
+- ChipsNew->MR[0x1F] |= 0x01; /* RGB 15bpp */
+-
+- ChipsNew->MR[0x20] &= 0x03; /* Mask reserved bits */
+- ChipsNew->MR[0x20] |= 0x80; /* Auto Centre, Use mem ptr1 */
+- ChipsNew->MR[0x22] = cPtr->FbOffset16 & 0xF8; /* Setup Pointer 1 */
+- ChipsNew->MR[0x23] = (cPtr->FbOffset16 >> 8) & 0xFF;
+- ChipsNew->MR[0x24] = (cPtr->FbOffset16 >> 16) & 0xFF;
+- ChipsNew->MR[0x25] = cPtr->FbOffset16 & 0xF8; /* Setup Pointer 2 */
+- ChipsNew->MR[0x26] = (cPtr->FbOffset16 >> 8) & 0xFF;
+- ChipsNew->MR[0x27] = (cPtr->FbOffset16 >> 16) & 0xFF;
+- ChipsNew->MR[0x28] = (pScrn->displayWidth >> 2) - 1; /* Width */
+- ChipsNew->MR[0x34] = (pScrn->displayWidth >> 2) - 1;
+-
+- /* Left Edge of Overlay */
+- ChipsNew->MR[0x2A] = cPtr->OverlaySkewX;
+- ChipsNew->MR[0x2B] &= 0xF8; /* Mask reserved bits */
+- ChipsNew->MR[0x2B] |= ((cPtr->OverlaySkewX >> 8) & 0x7);
+- /* Right Edge of Overlay */
+- ChipsNew->MR[0x2C] = (cPtr->OverlaySkewX + pScrn->displayWidth -
+- 1) & 0xFF;
+- ChipsNew->MR[0x2D] &= 0xF8; /* Mask reserved bits */
+- ChipsNew->MR[0x2D] |= ((cPtr->OverlaySkewX + pScrn->displayWidth -
+- 1) >> 8) & 0x07;
+- /* Top Edge of Overlay */
+- ChipsNew->MR[0x2E] = cPtr->OverlaySkewY;
+- ChipsNew->MR[0x2F] &= 0xF8;
+- ChipsNew->MR[0x2F] |= ((cPtr->OverlaySkewY >> 8) & 0x7);
+- /* Bottom Edge of Overlay*/
+- ChipsNew->MR[0x30] = (cPtr->OverlaySkewY + pScrn->virtualY - 1 )& 0xFF;
+- ChipsNew->MR[0x31] &= 0xF8; /* Mask reserved bits */
+- ChipsNew->MR[0x31] |= ((cPtr->OverlaySkewY + pScrn->virtualY -
+- 1 ) >> 8) & 0x07;
+-
+- ChipsNew->MR[0x3C] &= 0x18; /* Mask reserved bits */
+- ChipsNew->MR[0x3C] |= 0x07; /* Enable keyed overlay window */
+- ChipsNew->MR[0x3D] = 0x00;
+- ChipsNew->MR[0x3E] = 0x00;
+- ChipsNew->MR[0x3F] = pScrn->colorKey; /* 8bpp transparency key */
+- ChipsNew->MR[0x40] = 0xFF;
+- ChipsNew->MR[0x41] = 0xFF;
+- ChipsNew->MR[0x42] = 0x00;
+- } else if (cPtr->Flags & ChipsVideoSupport) {
++ if (cPtr->Flags & ChipsVideoSupport) {
+ #if 0 /* if we do this even though video isn't playing we kill performance */
+ ChipsNew->XR[0xD0] |= 0x10; /* Force the Multimedia engine on */
+ #endif
+@@ -6877,8 +6693,7 @@ chipsRestoreExtendedRegs(ScrnInfoPtr pScrn, CHIPSRegPtr Regs)
+ }
+
+ /* Set SAR04 multimedia register correctly */
+- if ((cPtr->Flags & ChipsOverlay8plus16)
+- || (cPtr->Flags & ChipsVideoSupport)) {
++ if ((cPtr->Flags & ChipsVideoSupport)) {
+ #ifdef SAR04
+ cPtr->writeXR(cPtr, 0x4E, 0x04);
+ if (cPtr->readXR(cPtr, 0x4F) != Regs->XR[0x4F])
+diff --git a/src/ct_driver.h b/src/ct_driver.h
+index d8ce228..9033867 100644
+--- a/src/ct_driver.h
++++ b/src/ct_driver.h
+@@ -114,7 +114,6 @@ typedef struct {
+ /* Options flags for the C&T chipsets */
+ #define ChipsHWCursor 0x00001000
+ #define ChipsShadowFB 0x00002000
+-#define ChipsOverlay8plus16 0x00004000
+ #define ChipsUseNewFB 0x00008000
+
+ /* Architecture type flags */
+@@ -272,11 +271,13 @@ typedef struct {
+
+ typedef struct _CHIPSRec {
+ pciVideoPtr PciInfo;
++#ifndef XSERVER_LIBPCIACCESS
+ PCITAG PciTag;
++#endif
+ int Chipset;
+ EntityInfoPtr pEnt;
+- IOADDRESS PIOBase;
+- CARD32 IOAddress;
++ unsigned long PIOBase;
++ unsigned long IOAddress;
+ unsigned long FbAddress;
+ unsigned int IOBase;
+ unsigned char * FbBase;
+diff --git a/src/ct_video.c b/src/ct_video.c
+index a68acb9..c9e5bb4 100644
+--- a/src/ct_video.c
++++ b/src/ct_video.c
+@@ -56,8 +56,7 @@ CHIPSInitVideo(ScreenPtr pScreen)
+ CHIPSPtr cPtr = CHIPSPTR(pScrn);
+ int num_adaptors;
+
+- if (!(cPtr->Flags & ChipsOverlay8plus16) &&
+- (cPtr->Flags & ChipsVideoSupport)) {
++ if ((cPtr->Flags & ChipsVideoSupport)) {
+ newAdaptor = CHIPSSetupImageVideo(pScreen);
+ CHIPSInitOffscreenImages(pScreen);
+ }
+diff --git a/util/dRegs.c b/util/dRegs.c
+index b7edc8f..0d2f0cb 100644
+--- a/util/dRegs.c
++++ b/util/dRegs.c
+@@ -1,63 +1,8 @@
+-
+-
+-
+-
+-
+-
+-#ifdef __NetBSD__
+-# include <sys/types.h>
+-# include <machine/pio.h>
+-# include <machine/sysarch.h>
+-#else
+-# if defined(SVR4) && defined(i386)
+-# include <sys/types.h>
+-# ifdef NCR
+- /* broken NCR <sys/sysi86.h> */
+-# define __STDC
+-# include <sys/sysi86.h>
+-# undef __STDC
+-# else
+-# include <sys/sysi86.h>
+-# endif
+-# ifdef SVR4
+-# if !defined(sun)
+-# include <sys/seg.h>
+-# endif
+-# endif
+-# include <sys/v86.h>
+-# if defined(sun)
+-# include <sys/psw.h>
+-# endif
+-# endif
+-# include "AsmMacros.h"
+-#endif /* NetBSD */
+-
+ #include <unistd.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+
+-#ifdef __NetBSD__
+-# define SET_IOPL() i386_iopl(3)
+-# define RESET_IOPL() i386_iopl(0)
+-#else
+-# if defined(SVR4) && defined(i386)
+-# ifndef SI86IOPL
+-# define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
+-# define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
+-# else
+-# define SET_IOPL() sysi86(SI86IOPL,3)
+-# define RESET_IOPL() sysi86(SI86IOPL,0)
+-# endif
+-# else
+-# ifdef linux
+-# define SET_IOPL() iopl(3)
+-# define RESET_IOPL() iopl(0)
+-# else
+-# define SET_IOPL() (void)0
+-# define RESET_IOPL() (void)0
+-# endif
+-# endif
+-#endif
++#include "iopl.h"
+
+ int main(void)
+ {
+diff --git a/util/iopl.h b/util/iopl.h
+new file mode 100644
+index 0000000..e08207c
+--- /dev/null
++++ b/util/iopl.h
+@@ -0,0 +1,60 @@
++#ifdef __NetBSD__
++# include <sys/types.h>
++# include <machine/pio.h>
++# include <machine/sysarch.h>
++#else
++# if defined(__linux__)
++/* Can't because <sys/iopl.h> provides conflicting inb, outb, etc
++ * # include <sys/io.h>
++ */
++int iopl(int level);
++# endif
++# if defined(SVR4) && defined(i386)
++# include <sys/types.h>
++# ifdef NCR
++ /* broken NCR <sys/sysi86.h> */
++# define __STDC
++# include <sys/sysi86.h>
++# undef __STDC
++# else
++# include <sys/sysi86.h>
++# endif
++# ifdef SVR4
++# if !defined(sun)
++# include <sys/seg.h>
++# endif
++# endif
++# include <sys/v86.h>
++# if defined(sun)
++# include <sys/psw.h>
++# endif
++# endif
++# include "AsmMacros.h"
++#endif /* NetBSD */
++
++#include <unistd.h>
++#include <stdio.h>
++#include <stdlib.h>
++
++#ifdef __NetBSD__
++# define SET_IOPL() i386_iopl(3)
++# define RESET_IOPL() i386_iopl(0)
++#else
++# if defined(SVR4) && defined(i386)
++# ifndef SI86IOPL
++# define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
++# define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
++# else
++# define SET_IOPL() sysi86(SI86IOPL,3)
++# define RESET_IOPL() sysi86(SI86IOPL,0)
++# endif
++# else
++# ifdef linux
++# define SET_IOPL() iopl(3)
++# define RESET_IOPL() iopl(0)
++# else
++# define SET_IOPL() (void)0
++# define RESET_IOPL() (void)0
++# endif
++# endif
++#endif
+diff --git a/util/mRegs.c b/util/mRegs.c
+index f359738..843d01d 100644
+--- a/util/mRegs.c
++++ b/util/mRegs.c
+@@ -1,63 +1,8 @@
+-
+-
+-
+-
+-
+-
+-#ifdef __NetBSD__
+-# include <sys/types.h>
+-# include <machine/pio.h>
+-# include <machine/sysarch.h>
+-#else
+-# if defined(SVR4) && defined(i386)
+-# include <sys/types.h>
+-# ifdef NCR
+- /* broken NCR <sys/sysi86.h> */
+-# define __STDC
+-# include <sys/sysi86.h>
+-# undef __STDC
+-# else
+-# include <sys/sysi86.h>
+-# endif
+-# ifdef SVR4
+-# if !defined(sun)
+-# include <sys/seg.h>
+-# endif
+-# endif
+-# include <sys/v86.h>
+-# if defined(sun)
+-# include <sys/psw.h>
+-# endif
+-# endif
+-# include "AsmMacros.h"
+-#endif /* NetBSD */
+-
+ #include <unistd.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+
+-#ifdef __NetBSD__
+-# define SET_IOPL() i386_iopl(3)
+-# define RESET_IOPL() i386_iopl(0)
+-#else
+-# if defined(SVR4) && defined(i386)
+-# ifndef SI86IOPL
+-# define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
+-# define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
+-# else
+-# define SET_IOPL() sysi86(SI86IOPL,3)
+-# define RESET_IOPL() sysi86(SI86IOPL,0)
+-# endif
+-# else
+-# ifdef linux
+-# define SET_IOPL() iopl(3)
+-# define RESET_IOPL() iopl(0)
+-# else
+-# define SET_IOPL() (void)0
+-# define RESET_IOPL() (void)0
+-# endif
+-# endif
+-#endif
++#include "iopl.h"
+
+ int hex2int(char* str);
+
+diff --git a/util/modClock.c b/util/modClock.c
+index 89a291a..45af19b 100644
+--- a/util/modClock.c
++++ b/util/modClock.c
+@@ -1,61 +1,12 @@
+-
+-#ifdef __NetBSD__
+-# include <sys/types.h>
+-# include <machine/pio.h>
+-# include <machine/sysarch.h>
+-#else
+-# if defined(SVR4) && defined(i386)
+-# include <sys/types.h>
+-# ifdef NCR
+- /* broken NCR <sys/sysi86.h> */
+-# define __STDC
+-# include <sys/sysi86.h>
+-# undef __STDC
+-# else
+-# include <sys/sysi86.h>
+-# endif
+-# ifdef SVR4
+-# if !defined(sun)
+-# include <sys/seg.h>
+-# endif
+-# endif
+-# include <sys/v86.h>
+-# if defined(sun)
+-# include <sys/psw.h>
+-# endif
+-# endif
+-# include "AsmMacros.h"
+-#endif /* NetBSD */
+-
+ #include <unistd.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++
+ #ifndef Lynx
+ #include <fnmatch.h>
+ #endif
+
+-#ifdef __NetBSD__
+-# define SET_IOPL() i386_iopl(3)
+-# define RESET_IOPL() i386_iopl(0)
+-#else
+-# if defined(SVR4) && defined(i386)
+-# ifndef SI86IOPL
+-# define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
+-# define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
+-# else
+-# define SET_IOPL() sysi86(SI86IOPL,3)
+-# define RESET_IOPL() sysi86(SI86IOPL,0)
+-# endif
+-# else
+-# ifdef linux
+-# define SET_IOPL() iopl(3)
+-# define RESET_IOPL() iopl(0)
+-# else
+-# define SET_IOPL() (void)0
+-# define RESET_IOPL() (void)0
+-# endif
+-# endif
+-#endif
++#include "iopl.h"
+
+ #define tolerance 0.01 /* +/- 1% */
+
diff --git a/testing/xf86-video-cirrus/PKGBUILD b/testing/xf86-video-cirrus/PKGBUILD
new file mode 100644
index 000000000..89c58466b
--- /dev/null
+++ b/testing/xf86-video-cirrus/PKGBUILD
@@ -0,0 +1,33 @@
+# $Id: PKGBUILD 150032 2012-02-12 09:44:48Z andyrtr $
+#Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-cirrus
+pkgver=1.3.2
+pkgrel=8
+pkgdesc="X.org Cirrus Logic video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903')
+conflicts=('xorg-server<1.11.99.903')
+groups=('xorg-drivers' 'xorg')
+options=('!libtool')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ cirrus-1.3.2-git.patch)
+md5sums=('8195d03ed0be0975c03441e66a9f53b3'
+ '3e3677f330f1c24ce0f570c81f2b9de2')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i ${srcdir}/cirrus-1.3.2-git.patch
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-cirrus/cirrus-1.3.2-git.patch b/testing/xf86-video-cirrus/cirrus-1.3.2-git.patch
new file mode 100644
index 000000000..5701a8473
--- /dev/null
+++ b/testing/xf86-video-cirrus/cirrus-1.3.2-git.patch
@@ -0,0 +1,846 @@
+diff --git a/Makefile.am b/Makefile.am
+index aa89732..7bd8873 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -18,17 +18,18 @@
+ # 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.
+
+-AUTOMAKE_OPTIONS = foreign
+ SUBDIRS = src man
++MAINTAINERCLEANFILES = ChangeLog INSTALL
+
+-EXTRA_DIST = README.multihead ChangeLog
++EXTRA_DIST = README.multihead
+
+-MAINTAINERCLEANFILES=ChangeLog
++.PHONY: ChangeLog INSTALL
+
+-.PHONY: ChangeLog
++INSTALL:
++ $(INSTALL_CMD)
+
+ ChangeLog:
+ $(CHANGELOG_CMD)
+
+-dist-hook: ChangeLog
++dist-hook: ChangeLog INSTALL
+
+diff --git a/configure.ac b/configure.ac
+index d205eb3..68c3eb3 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -20,47 +20,47 @@
+ #
+ # Process this file with autoconf to produce a configure script
+
+-AC_PREREQ(2.57)
++# Initialize Autoconf
++AC_PREREQ([2.60])
+ AC_INIT([xf86-video-cirrus],
+- 1.3.2,
++ [1.3.2],
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
+- xf86-video-cirrus)
+-
++ [xf86-video-cirrus])
+ AC_CONFIG_SRCDIR([Makefile.am])
+-AM_CONFIG_HEADER([config.h])
++AC_CONFIG_HEADERS([config.h])
+ AC_CONFIG_AUX_DIR(.)
+
+-AM_INIT_AUTOMAKE([dist-bzip2])
+-
++# Initialize Automake
++AM_INIT_AUTOMAKE([foreign dist-bzip2])
+ AM_MAINTAINER_MODE
+
+-# Require xorg-macros: XORG_CWARNFLAGS, XORG_CHANGELOG
+-m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])])
+-XORG_MACROS_VERSION(1.2)
++# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
++m4_ifndef([XORG_MACROS_VERSION],
++ [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
++XORG_MACROS_VERSION(1.8)
++XORG_DEFAULT_OPTIONS
+
+-# Checks for programs.
++# Initialize libtool
+ AC_DISABLE_STATIC
+ AC_PROG_LIBTOOL
+-AC_PROG_CC
+-XORG_CWARNFLAGS
+
+ AH_TOP([#include "xorg-server.h"])
+
++# Define a configure option for an alternate module directory
+ AC_ARG_WITH(xorg-module-dir,
+- AC_HELP_STRING([--with-xorg-module-dir=DIR],
++ AS_HELP_STRING([--with-xorg-module-dir=DIR],
+ [Default xorg module directory [[default=$libdir/xorg/modules]]]),
+ [moduledir="$withval"],
+ [moduledir="$libdir/xorg/modules"])
+
+-# Checks for extensions
++# Store the list of server defined optional extensions in REQUIRED_MODULES
+ XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
+ XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
+ XORG_DRIVER_CHECK_EXT(XV, videoproto)
+ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
+
+-# Checks for pkg-config packages
++# Obtain compiler/linker options for the driver dependencies
+ PKG_CHECK_MODULES(XORG, [xorg-server >= 1.4 xproto fontsproto $REQUIRED_MODULES])
+-sdkdir=$(pkg-config --variable=sdkdir xorg-server)
+
+ # Checks for libraries.
+ SAVE_CPPFLAGS="$CPPFLAGS"
+@@ -78,21 +78,15 @@ if test "x$XSERVER_LIBPCIACCESS" = xyes; then
+ fi
+ AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
+
+-# Checks for header files.
+-AC_HEADER_STDC
+
+-AC_SUBST([XORG_CFLAGS])
+ AC_SUBST([moduledir])
+
+ DRIVER_NAME=cirrus
+ AC_SUBST([DRIVER_NAME])
+
+-XORG_MANPAGE_SECTIONS
+-XORG_RELEASE_VERSION
+-XORG_CHANGELOG
+-
+-AC_OUTPUT([
+- Makefile
+- src/Makefile
+- man/Makefile
++AC_CONFIG_FILES([
++ Makefile
++ src/Makefile
++ man/Makefile
+ ])
++AC_OUTPUT
+diff --git a/man/Makefile.am b/man/Makefile.am
+index f0eb29b..1ea26b3 100644
+--- a/man/Makefile.am
++++ b/man/Makefile.am
+@@ -1,28 +1,25 @@
+ #
+-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+-#
+-# Permission to use, copy, modify, distribute, and sell this software and its
+-# documentation for any purpose is hereby granted without fee, provided that
+-# the above copyright notice appear in all copies and that both that
+-# copyright notice and this permission notice appear in supporting
+-# documentation.
+-#
+-# The above copyright notice and this permission notice 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 OPEN GROUP 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.
+-#
+-# Except as contained in this notice, the name of the copyright holders shall
+-# not be used in advertising or otherwise to promote the sale, use or
+-# other dealings in this Software without prior written authorization
+-# from the copyright holders.
+-#
++# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
++#
++# 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.
++#
+
+ drivermandir = $(DRIVER_MAN_DIR)
+
+@@ -34,25 +31,11 @@ EXTRA_DIST = @DRIVER_NAME@.man
+
+ CLEANFILES = $(driverman_DATA)
+
+-SED = sed
+
+-# Strings to replace in man pages
+-XORGRELSTRING = @PACKAGE_STRING@
+- XORGMANNAME = X Version 11
++# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+
+-MAN_SUBSTS = \
+- -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+- -e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+- -e 's|__xservername__|Xorg|g' \
+- -e 's|__xconfigfile__|xorg.conf|g' \
+- -e 's|__projectroot__|$(prefix)|g' \
+- -e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \
+- -e 's|__drivermansuffix__|$(DRIVER_MAN_SUFFIX)|g' \
+- -e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \
+- -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \
+- -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g'
+
+ SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
+
+ .man.$(DRIVER_MAN_SUFFIX):
+- sed $(MAN_SUBSTS) < $< > $@
++ $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+diff --git a/man/cirrus.man b/man/cirrus.man
+index 009011e..af46248 100644
+--- a/man/cirrus.man
++++ b/man/cirrus.man
+@@ -1,4 +1,3 @@
+-.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cirrus.man,v 1.2 2001/01/27 18:20:47 dawes Exp $
+ .\" shorthand for double quote that works everywhere.
+ .ds q \N'34'
+ .TH CIRRUS __drivermansuffix__ __vendorversion__
+diff --git a/src/CirrusClk.c b/src/CirrusClk.c
+index a3590c9..6fd6270 100644
+--- a/src/CirrusClk.c
++++ b/src/CirrusClk.c
+@@ -1,5 +1,3 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/CirrusClk.c,v 1.8 1998/12/06 06:08:28 dawes Exp $ */
+-
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+diff --git a/src/alp.h b/src/alp.h
+index 01c5301..a182d0c 100644
+--- a/src/alp.h
++++ b/src/alp.h
+@@ -1,5 +1,3 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h,v 1.8 2001/10/01 13:44:05 eich Exp $ */
+-
+ /* (c) Itai Nahshon */
+
+ #ifndef ALP_H
+diff --git a/src/alp_driver.c b/src/alp_driver.c
+index fe81757..d3d8e4f 100644
+--- a/src/alp_driver.c
++++ b/src/alp_driver.c
+@@ -15,8 +15,6 @@
+ #include "config.h"
+ #endif
+
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.35 2003/11/03 05:11:09 tsi Exp $ */
+-
+ /* All drivers should typically include these */
+ #include "xf86.h"
+ #include "xf86_OSproc.h"
+@@ -29,6 +27,10 @@
+ /* Drivers for PCI hardware need this */
+ #include "xf86PciInfo.h"
+
++#ifndef PCI_CHIP_GD7556 /* for old xf86PciInfo.h */
++#define PCI_CHIP_GD7556 0x004C
++#endif
++
+ /* Drivers that need to access the PCI config space directly need this */
+ #include "xf86Pci.h"
+
+@@ -119,6 +121,11 @@ static void AlpOffscreenAccelInit(ScrnInfoPtr pScrn);
+ static void AlpDisplayPowerManagementSet(ScrnInfoPtr pScrn,
+ int PowerManagementMode, int flags);
+
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
++static void PC98CIRRUS755xEnable(ScrnInfoPtr pScrn);
++static void PC98CIRRUS755xDisable(ScrnInfoPtr pScrn);
++#endif
++
+ /*
+ * This is intentionally screen-independent. It indicates the binding
+ * choice made in the first PreInit.
+@@ -153,6 +160,8 @@ static int gd5430_MaxClocks[] = { 85500, 85500, 50000, 28500, 0 };
+ static int gd5446_MaxClocks[] = { 135100, 135100, 85500, 85500, 0 };
+ static int gd5480_MaxClocks[] = { 135100, 200000, 200000, 135100, 135100 };
+ static int gd7548_MaxClocks[] = { 80100, 80100, 80100, 80100, 80100 };
++static int gd7555_MaxClocks[] = { 80100, 80100, 80100, 80100, 80100 };
++static int gd7556_MaxClocks[] = { 80100, 80100, 80100, 80100, 80100 };
+
+ #ifdef XFree86LOADER
+
+@@ -248,7 +257,7 @@ AlpFreeRec(ScrnInfoPtr pScrn)
+ {
+ if (pScrn->driverPrivate == NULL)
+ return;
+- xfree(pScrn->driverPrivate);
++ free(pScrn->driverPrivate);
+ pScrn->driverPrivate = NULL;
+ }
+
+@@ -385,6 +394,11 @@ AlpCountRam(ScrnInfoPtr pScrn)
+ break;
+ }
+ break;
++
++ case PCI_CHIP_GD7555:
++ case PCI_CHIP_GD7556:
++ videoram = 2048; /* for PC-9821 La13 etc. */
++ break;
+ }
+
+ /* UNMap the Alp memory and MMIO areas */
+@@ -407,6 +421,8 @@ GetAccelPitchValues(ScrnInfoPtr pScrn)
+ {
+ int *linePitches = NULL;
+ int i, n = 0;
++ int max_pitch;
++
+ CirPtr pCir = CIRPTR(pScrn);
+
+ /* XXX ajv - 512, 576, and 1536 may not be supported
+@@ -423,8 +439,21 @@ GetAccelPitchValues(ScrnInfoPtr pScrn)
+ 1280, 1536, 1600, 1920, 2048, 0 };
+ #endif
+
++ switch (pCir->Chipset) {
++ case PCI_CHIP_GD5436:
++ case PCI_CHIP_GD5446:
++ max_pitch = 0x1ff << 3;
++ break;
++
++ default:
++ /* FIXME max_pitch for other chipsets? */
++ max_pitch = (pScrn->bitsPerPixel / 8) * 2048;
++ break;
++ }
++
+ for (i = 0; accelWidths[i] != 0; i++) {
+- if (accelWidths[i] % pCir->Rounding == 0) {
++ if ((accelWidths[i] % pCir->Rounding == 0)
++ && ((accelWidths[i] * pScrn->bitsPerPixel / 8) <= max_pitch)) {
+ n++;
+ linePitches = xnfrealloc(linePitches, n * sizeof(int));
+ linePitches[n - 1] = accelWidths[i];
+@@ -482,12 +511,17 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
+
+ pCir = CIRPTR(pScrn);
+ pCir->pScrn = pScrn;
++
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+ pCir->PIOReg = hwp->PIOOffset + 0x3CE;
++#else
++ pCir->PIOReg = 0x3CE;
++#endif
+
+ /* Get the entity, and make sure it is PCI. */
+ pCir->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
+ if (pCir->pEnt->location.type != BUS_PCI) {
+- xfree(pCir->pEnt);
++ free(pCir->pEnt);
+ return FALSE;
+ }
+
+@@ -498,7 +532,8 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
+ PCI_DEV_DEV(pCir->PciInfo),
+ PCI_DEV_FUNC(pCir->PciInfo));
+
+- if (xf86LoadSubModule(pScrn, "int10")) {
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
++ if (!xf86IsPc98() && xf86LoadSubModule(pScrn, "int10")) {
+ xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n");
+ pInt = xf86InitInt10(pCir->pEnt->index);
+ xf86FreeInt10(pInt);
+@@ -509,8 +544,8 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
+
+ PCI_WRITE_LONG(pCir->PciInfo, PCI_REGION_BASE(pCir->PciInfo, 0, REGION_MEM), 0x10);
+ PCI_WRITE_LONG(pCir->PciInfo, PCI_REGION_BASE(pCir->PciInfo, 1, REGION_MEM), 0x14);
+-
+ }
++#endif
+
+ /* Set pScrn->monitor */
+ pScrn->monitor = pScrn->confScreen->monitor;
+@@ -574,7 +609,7 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
+ xf86CollectOptions(pScrn, NULL);
+
+ /* Process the options */
+- if (!(pCir->Options = xalloc(sizeof(CirOptions))))
++ if (!(pCir->Options = malloc(sizeof(CirOptions))))
+ return FALSE;
+ memcpy(pCir->Options, CirOptions, sizeof(CirOptions));
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pCir->Options);
+@@ -589,6 +624,16 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
+
+ from = X_DEFAULT;
+ pCir->HWCursor = FALSE;
++
++ switch (pCir->Chipset) {
++ case PCI_CHIP_GD7555:
++ case PCI_CHIP_GD7556:
++ pCir->HWCursor = TRUE;
++ break;
++ default:
++ break;
++ }
++
+ if (xf86GetOptValBool(pCir->Options, OPTION_HW_CURSOR, &pCir->HWCursor))
+ from = X_CONFIG;
+
+@@ -863,10 +908,10 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
+ case PCI_CHIP_GD5430:
+ case PCI_CHIP_GD5434_4:
+ case PCI_CHIP_GD5434_8:
+- case PCI_CHIP_GD5436:
+ /* case PCI_CHIP_GD5440: */
+ p = gd5430_MaxClocks;
+ break;
++ case PCI_CHIP_GD5436:
+ case PCI_CHIP_GD5446:
+ p = gd5446_MaxClocks;
+ break;
+@@ -876,6 +921,12 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
+ case PCI_CHIP_GD7548:
+ p = gd7548_MaxClocks;
+ break;
++ case PCI_CHIP_GD7555:
++ p = gd7555_MaxClocks;
++ break;
++ case PCI_CHIP_GD7556:
++ p = gd7556_MaxClocks;
++ break;
+ }
+ if (!p)
+ return FALSE;
+@@ -1360,6 +1411,11 @@ AlpModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
+
+ vgaHWProtect(pScrn, FALSE);
+
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
++ if (xf86IsPc98())
++ PC98CIRRUS755xEnable(pScrn);
++#endif
++
+ return TRUE;
+ }
+
+@@ -1489,7 +1545,7 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+
+ if(pCir->shadowFB) {
+ pCir->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width);
+- pCir->ShadowPtr = xalloc(pCir->ShadowPitch * height);
++ pCir->ShadowPtr = malloc(pCir->ShadowPitch * height);
+ displayWidth = pCir->ShadowPitch / (pScrn->bitsPerPixel >> 3);
+ FbBase = pCir->ShadowPtr;
+ } else {
+@@ -1782,6 +1838,11 @@ AlpLeaveVT(int scrnIndex, int flags)
+
+ AlpRestore(pScrn);
+ vgaHWLock(hwp);
++
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
++ if (xf86IsPc98())
++ PC98CIRRUS755xDisable(pScrn);
++#endif
+ }
+
+
+@@ -1813,12 +1874,17 @@ AlpCloseScreen(int scrnIndex, ScreenPtr pScreen)
+ xf86DestroyCursorInfoRec(pCir->CursorInfoRec);
+ pCir->CursorInfoRec = NULL;
+ if (pCir->DGAModes)
+- xfree(pCir->DGAModes);
++ free(pCir->DGAModes);
+ pCir->DGAnumModes = 0;
+ pCir->DGAModes = NULL;
+
+ pScrn->vtSema = FALSE;
+
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
++ if (xf86IsPc98())
++ PC98CIRRUS755xDisable(pScrn);
++#endif
++
+ pScreen->CloseScreen = pCir->CloseScreen;
+ return (*pScreen->CloseScreen)(scrnIndex, pScreen);
+ }
+@@ -2081,3 +2147,53 @@ AlpOffscreenAccelInit(ScrnInfoPtr pScrn)
+ box.y2 - pScrn->virtualY);
+ }
+ }
++
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
++static void
++PC98CIRRUS755xEnable(ScrnInfoPtr pScrn) /* enter_aile() */
++{
++ unsigned int index,data;
++ vgaHWPtr hwp = VGAHWPTR(pScrn);
++
++ outb(0xfac, 0x02);
++
++ outb(0x68, 0x0e);
++ outb(0x6a, 0x07);
++ outb(0x6a, 0x8f);
++ outb(0x6a, 0x06);
++
++ outw(VGA_SEQ_INDEX, 0x1206); /* unlock cirrus special */
++
++ index = hwp->IOBase + VGA_CRTC_INDEX_OFFSET;
++ data = hwp->IOBase + VGA_CRTC_DATA_OFFSET;
++ outb(index, 0x3c);
++ outb(data, inb(data) & 0xef);
++ outb(index, 0x1a);
++ outb(data, inb(data) & 0xf3);
++}
++
++static void
++PC98CIRRUS755xDisable(ScrnInfoPtr pScrn) /* leave_aile() */
++{
++ unsigned int index,data;
++ vgaHWPtr hwp = VGAHWPTR(pScrn);
++
++ outw(VGA_SEQ_INDEX, 0x1206); /* unlock cirrus special */
++
++ index = hwp->IOBase + VGA_CRTC_INDEX_OFFSET;
++ data = hwp->IOBase + VGA_CRTC_DATA_OFFSET;
++ outb(index, 0x3c);
++ outb(data, 0x71);
++ outb(index, 0x1a);
++ outb(data, inb(data) | 0x0c);
++
++ outb(0xfac,0x00);
++
++ outb(0x68, 0x0f);
++ outb(0x6a, 0x07);
++ outb(0x6a, 0x8e);
++ outb(0x6a, 0x21);
++ outb(0x6a, 0x69);
++ outb(0x6a, 0x06);
++}
++#endif
+diff --git a/src/alp_hwcurs.c b/src/alp_hwcurs.c
+index 79dfce7..9891eb4 100644
+--- a/src/alp_hwcurs.c
++++ b/src/alp_hwcurs.c
+@@ -1,5 +1,3 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_hwcurs.c,v 1.4 2000/12/06 15:35:15 eich Exp $ */
+-
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+diff --git a/src/alp_i2c.c b/src/alp_i2c.c
+index 9e6ae67..7365215 100644
+--- a/src/alp_i2c.c
++++ b/src/alp_i2c.c
+@@ -4,8 +4,6 @@
+ #include "config.h"
+ #endif
+
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_i2c.c,v 1.6 1999/02/28 11:19:38 dawes Exp $ */
+-
+ #include "xf86.h"
+ #include "xf86_OSproc.h"
+ #include "compiler.h"
+diff --git a/src/alp_xaa.c b/src/alp_xaa.c
+index 95741fc..7a96e1a 100644
+--- a/src/alp_xaa.c
++++ b/src/alp_xaa.c
+@@ -4,8 +4,6 @@
+ #include "config.h"
+ #endif
+
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c,v 1.7 2001/10/01 13:44:05 eich Exp $ */
+-
+ #include "xf86.h"
+ #include "xf86_OSproc.h"
+ #include "compiler.h"
+diff --git a/src/alp_xaam.c b/src/alp_xaam.c
+index 0193a43..3ecc7de 100644
+--- a/src/alp_xaam.c
++++ b/src/alp_xaam.c
+@@ -1,6 +1,5 @@
+ /* (c) Itai Nahshon */
+ /* #define DEBUG */
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c,v 1.7 2001/10/01 13:44:05 eich Exp $ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+diff --git a/src/cir.h b/src/cir.h
+index 904d9cc..861966d 100644
+--- a/src/cir.h
++++ b/src/cir.h
+@@ -1,5 +1,3 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h,v 1.20 2002/01/04 21:26:54 tsi Exp $ */
+-
+ /* (c) Itai Nahshon */
+
+ #ifndef CIR_H
+@@ -23,7 +21,7 @@ typedef struct {
+ CARD32 properties;
+ pciVideoPtr PciInfo;
+ PCITAG PciTag;
+- IOADDRESS PIOReg;
++ unsigned long PIOReg;
+ union {
+ struct lgRec *lg;
+ struct alpRec *alp;
+diff --git a/src/cir_dga.c b/src/cir_dga.c
+index bc98df6..f930231 100644
+--- a/src/cir_dga.c
++++ b/src/cir_dga.c
+@@ -1,4 +1,3 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c,v 1.5 2001/02/15 17:39:27 eich Exp $ */
+ /*
+ * Copyright 2000 by Egbert Eich
+ *
+@@ -83,9 +82,9 @@ CirDGAInit(ScreenPtr pScreen)
+ if (!pCir->DGAnumModes) {
+ pMode = firstMode = pScrn->modes;
+ while (pMode) {
+- newmodes = xrealloc(modes, (num + 1) * sizeof (DGAModeRec));
++ newmodes = realloc(modes, (num + 1) * sizeof (DGAModeRec));
+ if (!newmodes) {
+- xfree(modes);
++ free(modes);
+ return FALSE;
+ }
+ modes = newmodes;
+diff --git a/src/cir_driver.c b/src/cir_driver.c
+index 5466c48..7e470bb 100644
+--- a/src/cir_driver.c
++++ b/src/cir_driver.c
+@@ -15,8 +15,6 @@
+ #include "config.h"
+ #endif
+
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c,v 1.67 2001/05/15 10:19:37 eich Exp $ */
+-
+ /* All drivers should typically include these */
+ #include "xf86.h"
+ #include "xf86_OSproc.h"
+@@ -29,6 +27,10 @@
+ /* Drivers for PCI hardware need this */
+ #include "xf86PciInfo.h"
+
++#ifndef PCI_CHIP_GD7556 /* for old xf86PciInfo.h */
++#define PCI_CHIP_GD7556 0x004C
++#endif
++
+ /* Drivers that need to access the PCI config space directly need this */
+ #include "xf86Pci.h"
+
+@@ -90,6 +92,8 @@ SymTabRec CIRChipsets[] = {
+ { PCI_CHIP_GD5464BD, "CL-GD5464BD" },
+ { PCI_CHIP_GD5465, "CL-GD5465" },
+ { PCI_CHIP_GD7548, "CL-GD7548" },
++ { PCI_CHIP_GD7555, "CL-GD7555" },
++ { PCI_CHIP_GD7556, "CL-GD7556" },
+ {-1, NULL }
+ };
+
+@@ -107,6 +111,8 @@ _X_EXPORT PciChipsets CIRPciChipsets[] = {
+ { PCI_CHIP_GD5464BD,PCI_CHIP_GD5464BD, RES_SHARED_VGA },
+ { PCI_CHIP_GD5465, PCI_CHIP_GD5465, RES_SHARED_VGA },
+ { PCI_CHIP_GD7548, PCI_CHIP_GD7548, RES_SHARED_VGA },
++ { PCI_CHIP_GD7555, PCI_CHIP_GD7555, RES_SHARED_VGA },
++ { PCI_CHIP_GD7556, PCI_CHIP_GD7556, RES_SHARED_VGA },
+ { -1, -1, RES_UNDEFINED}
+ };
+
+@@ -238,7 +244,7 @@ CIRProbe(DriverPtr drv, int flags)
+ CIRChipsets, CIRPciChipsets, devSections,
+ numDevSections, drv, &usedChips);
+ /* Free it since we don't need that list after this */
+- xfree(devSections);
++ free(devSections);
+ if (numUsed <= 0)
+ return FALSE;
+ if (flags & PROBE_DETECT)
+@@ -280,7 +286,7 @@ CIRProbe(DriverPtr drv, int flags)
+ pScrn->Probe = NULL;
+ }
+ }
+- xfree(usedChips);
++ free(usedChips);
+
+ return foundScreen;
+ }
+diff --git a/src/cir_pcirename.h b/src/cir_pcirename.h
+index f0f5cf8..669b8fe 100644
+--- a/src/cir_pcirename.h
++++ b/src/cir_pcirename.h
+@@ -34,6 +34,33 @@ enum region_type {
+ REGION_IO
+ };
+
++#include "xf86Module.h"
++
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 12
++
++#if (defined(__alpha__) || defined(__ia64__)) && defined (linux)
++#define PCI_DOM_MASK 0x01fful
++#else
++#define PCI_DOM_MASK 0x0ffu
++#endif
++
++#ifndef PCI_DOM_MASK
++# define PCI_DOM_MASK 0x0ffu
++#endif
++#define PCI_DOMBUS_MASK (((PCI_DOM_MASK) << 8) | 0x0ffu)
++
++static inline uint32_t
++pciTag(int busnum, int devnum, int funcnum)
++{
++ uint32_t tag;
++ tag = (busnum & (PCI_DOMBUS_MASK)) << 16;
++ tag |= (devnum & 0x00001fu) << 11;
++ tag |= (funcnum & 0x000007u) << 8;
++
++ return tag;
++}
++#endif /* GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 12 */
++
+ #ifndef XSERVER_LIBPCIACCESS
+
+ /* pciVideoPtr */
+diff --git a/src/cir_shadow.c b/src/cir_shadow.c
+index b89890a..0716a64 100644
+--- a/src/cir_shadow.c
++++ b/src/cir_shadow.c
+@@ -1,5 +1,3 @@
+-/* $XFree86: Exp $ */
+-
+ /*
+ Copyright (c) 1999,2000 The XFree86 Project Inc.
+ based on code written by Mark Vojkovich <markv@valinux.com>
+diff --git a/src/lg.h b/src/lg.h
+index 9d91053..985f634 100644
+--- a/src/lg.h
++++ b/src/lg.h
+@@ -10,8 +10,6 @@
+ * Inspired by cir.h
+ */
+
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg.h,v 1.12 2001/05/04 19:05:36 dawes Exp $ */
+-
+ #ifndef LG_H
+ #define LG_H
+ #define LG_DEBUG
+diff --git a/src/lg_driver.c b/src/lg_driver.c
+index cfc3e65..fc864f8 100644
+--- a/src/lg_driver.c
++++ b/src/lg_driver.c
+@@ -13,7 +13,6 @@
+ * David Dawes, Andrew E. Mileski, Leonard N. Zubkoff,
+ * Guy DESBIEF, Itai Nahshon.
+ */
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c,v 1.49 2003/11/03 05:11:09 tsi Exp $ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+@@ -259,7 +258,7 @@ LgFreeRec(ScrnInfoPtr pScrn)
+ {
+ if (pScrn->driverPrivate == NULL)
+ return;
+- xfree(pScrn->driverPrivate);
++ free(pScrn->driverPrivate);
+ pScrn->driverPrivate = NULL;
+ }
+
+@@ -373,7 +372,12 @@ LgPreInit(ScrnInfoPtr pScrn, int flags)
+
+ pCir = CIRPTR(pScrn);
+ pCir->pScrn = pScrn;
++
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+ pCir->PIOReg = hwp->PIOOffset + 0x3CE;
++#else
++ pCir->PIOReg = 0x3CE;
++#endif
+
+ /* Get the entity, and make sure it is PCI. */
+ pCir->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
+@@ -454,7 +458,7 @@ LgPreInit(ScrnInfoPtr pScrn, int flags)
+ xf86CollectOptions(pScrn, NULL);
+
+ /* Process the options */
+- if (!(pCir->Options = xalloc(sizeof(LgOptions))))
++ if (!(pCir->Options = malloc(sizeof(LgOptions))))
+ return FALSE;
+ memcpy(pCir->Options, LgOptions, sizeof(LgOptions));
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pCir->Options);
+@@ -1314,7 +1318,7 @@ LgScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+
+ if(pCir->shadowFB) {
+ pCir->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width);
+- pCir->ShadowPtr = xalloc(pCir->ShadowPitch * height);
++ pCir->ShadowPtr = malloc(pCir->ShadowPitch * height);
+ displayWidth = pCir->ShadowPitch / (pScrn->bitsPerPixel >> 3);
+ FbBase = pCir->ShadowPtr;
+ } else {
+@@ -1617,7 +1621,7 @@ LgCloseScreen(int scrnIndex, ScreenPtr pScreen)
+ xf86DestroyCursorInfoRec(pCir->CursorInfoRec);
+ pCir->CursorInfoRec = NULL;
+ if (pCir->DGAModes)
+- xfree(pCir->DGAModes);
++ free(pCir->DGAModes);
+ pCir->DGAnumModes = 0;
+ pCir->DGAModes = NULL;
+
+diff --git a/src/lg_hwcurs.c b/src/lg_hwcurs.c
+index b41b79a..381db1c 100644
+--- a/src/lg_hwcurs.c
++++ b/src/lg_hwcurs.c
+@@ -10,7 +10,6 @@
+ * Much of this code is inspired by the HW cursor code from XFree86
+ * 3.3.3.
+ */
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_hwcurs.c,v 1.4 2000/12/06 15:35:17 eich Exp $ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+diff --git a/src/lg_i2c.c b/src/lg_i2c.c
+index 05e083c..145cc2e 100644
+--- a/src/lg_i2c.c
++++ b/src/lg_i2c.c
+@@ -1,7 +1,5 @@
+ /* (c) Itai Nahshon */
+
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_i2c.c,v 1.1 1998/11/15 04:30:25 dawes Exp $ */
+-
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+diff --git a/src/lg_xaa.c b/src/lg_xaa.c
+index fd8c70a..8bab365 100644
+--- a/src/lg_xaa.c
++++ b/src/lg_xaa.c
+@@ -10,7 +10,6 @@
+ * Much of this code is inspired by the XAA acceleration from XFree86
+ * 3.3.3, laguna_acl.c
+ */
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_xaa.c,v 1.4 2000/12/06 15:35:17 eich Exp $ */
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+diff --git a/src/lg_xaa.h b/src/lg_xaa.h
+index 7359a49..162aa5d 100644
+--- a/src/lg_xaa.h
++++ b/src/lg_xaa.h
+@@ -13,7 +13,6 @@
+ * This header file draws much from the file cir_blitLG.h in version 3.3.3
+ * of XFree86.
+ */
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_xaa.h,v 1.3 2000/02/08 13:13:15 eich Exp $ */
+
+ /* This header file defines the necessary structures, contstants, and
+ variables for using the bitBLT engine on a Laguna family graphics
diff --git a/testing/xf86-video-dummy/PKGBUILD b/testing/xf86-video-dummy/PKGBUILD
new file mode 100644
index 000000000..13906ed33
--- /dev/null
+++ b/testing/xf86-video-dummy/PKGBUILD
@@ -0,0 +1,30 @@
+# $Id: PKGBUILD 150034 2012-02-12 09:44:52Z andyrtr $
+#Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-dummy
+pkgver=0.3.5
+pkgrel=1
+pkgdesc="X.org dummy video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903' 'xf86dgaproto')
+conflicts=('xorg-server<1.11.99.903')
+groups=('xorg-drivers' 'xorg')
+options=('!libtool')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2)
+sha1sums=('41cfcaec986ab13e931d260953c5a3f626fd1d2b')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-fbdev/PKGBUILD b/testing/xf86-video-fbdev/PKGBUILD
new file mode 100644
index 000000000..8fe5012b9
--- /dev/null
+++ b/testing/xf86-video-fbdev/PKGBUILD
@@ -0,0 +1,30 @@
+# $Id: PKGBUILD 150036 2012-02-12 09:44:56Z andyrtr $
+#Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-fbdev
+pkgver=0.4.2
+pkgrel=6
+pkgdesc="X.org framebuffer video driver"
+arch=(i686 x86_64)
+license=('custom')
+url="http://xorg.freedesktop.org/"
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903')
+conflicts=('xorg-server<1.11.99.903')
+groups=('xorg-drivers' 'xorg')
+options=('!libtool')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2)
+sha1sums=('c8562f997d56c9fec50df6ca9892f39f43ff4c2c')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-glint/PKGBUILD b/testing/xf86-video-glint/PKGBUILD
new file mode 100644
index 000000000..e01cd44c7
--- /dev/null
+++ b/testing/xf86-video-glint/PKGBUILD
@@ -0,0 +1,30 @@
+# $Id: PKGBUILD 150039 2012-02-12 09:45:00Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-glint
+pkgver=1.2.6
+pkgrel=2
+pkgdesc="X.org GLINT/Permedia video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903' 'xf86dgaproto')
+conflicts=('xorg-server<1.11.99.903')
+options=('!libtool')
+groups=('xorg-drivers' 'xorg')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2)
+sha256sums=('d43350ed3c149576db1dbcacf5e9a30a3268a3f49742724c9151b6f1e4bd21a7')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-i128/PKGBUILD b/testing/xf86-video-i128/PKGBUILD
new file mode 100644
index 000000000..ae2d800e9
--- /dev/null
+++ b/testing/xf86-video-i128/PKGBUILD
@@ -0,0 +1,33 @@
+# $Id: PKGBUILD 150041 2012-02-12 09:45:03Z andyrtr $
+# Maintainer:Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-i128
+pkgver=1.3.4
+pkgrel=5
+pkgdesc="X.org Number 9 I128 video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903')
+conflicts=('xorg-server<1.11.99.903')
+groups=('xorg-drivers' 'xorg')
+options=('!libtool')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ i128-1.3.4-git.patch)
+sha1sums=('d5f755dc964eaa067b4efcafafd00814a60df775'
+ 'c282f9de94ef7225f03034c9c07f40f46bd44bdc')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i ${srcdir}/i128-1.3.4-git.patch
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-i128/i128-1.3.4-git.patch b/testing/xf86-video-i128/i128-1.3.4-git.patch
new file mode 100644
index 000000000..581ed7bb7
--- /dev/null
+++ b/testing/xf86-video-i128/i128-1.3.4-git.patch
@@ -0,0 +1,173 @@
+diff --git a/man/i128.man b/man/i128.man
+index 920d2ab..a8e2e54 100644
+--- a/man/i128.man
++++ b/man/i128.man
+@@ -1,4 +1,3 @@
+-.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128.man,v 1.2 2001/01/27 18:20:48 dawes Exp $
+ .\" shorthand for double quote that works everywhere.
+ .ds q \N'34'
+ .TH I128 __drivermansuffix__ __vendorversion__
+diff --git a/src/i128_driver.c b/src/i128_driver.c
+index 903a3a8..92f9d58 100644
+--- a/src/i128_driver.c
++++ b/src/i128_driver.c
+@@ -304,13 +304,13 @@ I128Probe(DriverPtr drv, int flags)
+ numDevSections, drv, &usedChips);
+
+ /* Free it since we don't need that list after this */
+- xfree(devSections);
++ free(devSections);
+
+ if (numUsed <= 0)
+ return FALSE;
+
+ if (flags & PROBE_DETECT) {
+- xfree(usedChips);
++ free(usedChips);
+ return FALSE;
+ }
+
+@@ -340,7 +340,7 @@ I128Probe(DriverPtr drv, int flags)
+ foundScreen = TRUE;
+ }
+
+- xfree(usedChips);
++ free(usedChips);
+
+ return foundScreen;
+ }
+@@ -446,7 +446,7 @@ I128PreInit(ScrnInfoPtr pScrn, int flags)
+ int i;
+ ClockRangePtr clockRanges;
+ MessageType from;
+- IOADDRESS iobase;
++ unsigned long iobase;
+ char *ramdac = NULL;
+ CARD32 tmpl, tmph, tmp;
+ unsigned char n, m, p, mdc, df;
+@@ -558,7 +558,7 @@ I128PreInit(ScrnInfoPtr pScrn, int flags)
+ xf86CollectOptions(pScrn, NULL);
+
+ /* Process the options */
+- if (!(pI128->Options = xalloc(sizeof(I128Options))))
++ if (!(pI128->Options = malloc(sizeof(I128Options))))
+ return FALSE;
+ memcpy(pI128->Options, I128Options, sizeof(I128Options));
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pI128->Options);
+@@ -650,7 +650,10 @@ I128PreInit(ScrnInfoPtr pScrn, int flags)
+ xf86DrvMsg(pScrn->scrnIndex, from, "Subsystem Vendor: \"%x\"\n",
+ PCI_SUB_VENDOR_ID(pI128->PciInfo));
+
+- iobase = (PCI_REGION_BASE(pI128->PciInfo, 5, REGION_IO) & 0xFFFFFF00) + hwp->PIOOffset;
++ iobase = (PCI_REGION_BASE(pI128->PciInfo, 5, REGION_IO) & 0xFFFFFF00);
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
++ iobase += hwp->PIOOffset;
++#endif
+ pI128->RegRec.iobase = iobase;
+
+ pI128->io.rbase_g = inl(iobase) & 0xFFFFFF00;
+@@ -1157,7 +1160,7 @@ I128FreeRec(ScrnInfoPtr pScrn)
+ {
+ if (pScrn->driverPrivate == NULL)
+ return;
+- xfree(pScrn->driverPrivate);
++ free(pScrn->driverPrivate);
+ pScrn->driverPrivate = NULL;
+ }
+
+@@ -1704,12 +1707,12 @@ I128CloseScreen(int scrnIndex, ScreenPtr pScreen)
+ XAADestroyInfoRec(pI128->XaaInfoRec);
+ if (pI128->ExaDriver) {
+ exaDriverFini(pScreen);
+- xfree(pI128->ExaDriver);
++ free(pI128->ExaDriver);
+ }
+ if (pI128->CursorInfoRec)
+ xf86DestroyCursorInfoRec(pI128->CursorInfoRec);
+ if (pI128->DGAModes)
+- xfree(pI128->DGAModes);
++ free(pI128->DGAModes);
+ pScrn->vtSema = FALSE;
+
+ pScreen->CloseScreen = pI128->CloseScreen;
+@@ -1804,7 +1807,7 @@ I128DDC1Read(ScrnInfoPtr pScrn)
+ I128Ptr pI128 = I128PTR(pScrn);
+ unsigned char val;
+ unsigned long tmp, ddc;
+- IOADDRESS iobase;
++ unsigned long iobase;
+
+ iobase = pI128->RegRec.iobase;
+ ddc = inl(iobase + 0x2C);
+@@ -1839,7 +1842,7 @@ I128I2CGetBits(I2CBusPtr b, int *clock, int *data)
+ {
+ I128Ptr pI128 = I128PTR(xf86Screens[b->scrnIndex]);
+ unsigned long ddc;
+- IOADDRESS iobase;
++ unsigned long iobase;
+ #if 0
+ static int lastclock = -1, lastdata = -1;
+ #endif
+@@ -1867,7 +1870,7 @@ I128I2CPutBits(I2CBusPtr b, int clock, int data)
+ unsigned char drv, val;
+ unsigned long ddc;
+ unsigned long tmp;
+- IOADDRESS iobase;
++ unsigned long iobase;
+
+ iobase = pI128->RegRec.iobase;
+ ddc = inl(iobase + 0x2C);
+@@ -1889,7 +1892,7 @@ I128I2CInit(ScrnInfoPtr pScrn)
+ {
+ I128Ptr pI128 = I128PTR(pScrn);
+ I2CBusPtr I2CPtr;
+- IOADDRESS iobase;
++ unsigned long iobase;
+ unsigned long soft_sw, ddc;
+
+ I2CPtr = xf86CreateI2CBusRec();
+@@ -2102,7 +2105,7 @@ void
+ I128DumpActiveRegisters(ScrnInfoPtr pScrn)
+ {
+ I128Ptr pI128 = I128PTR(pScrn);
+- IOADDRESS iobase;
++ unsigned long iobase;
+ unsigned long rbase_g, rbase_w, rbase_a, rbase_b, rbase_i, rbase_e;
+ unsigned long id, config1, config2, sgram, soft_sw, ddc, vga_ctl;
+ volatile CARD32 *vrba, *vrbg, *vrbw;
+diff --git a/src/i128dga.c b/src/i128dga.c
+index 48823aa..8bc2fcb 100644
+--- a/src/i128dga.c
++++ b/src/i128dga.c
+@@ -59,15 +59,15 @@ I128DGAInit(ScreenPtr pScreen)
+ while(pMode) {
+
+ if(0 /*pScrn->displayWidth != pMode->HDisplay*/) {
+- newmodes = xrealloc(modes, (num + 2) * sizeof(DGAModeRec));
++ newmodes = realloc(modes, (num + 2) * sizeof(DGAModeRec));
+ oneMore = TRUE;
+ } else {
+- newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec));
++ newmodes = realloc(modes, (num + 1) * sizeof(DGAModeRec));
+ oneMore = FALSE;
+ }
+
+ if(!newmodes) {
+- xfree(modes);
++ free(modes);
+ return FALSE;
+ }
+ modes = newmodes;
+diff --git a/src/i128reg.h b/src/i128reg.h
+index 56b9c33..a72b525 100644
+--- a/src/i128reg.h
++++ b/src/i128reg.h
+@@ -75,7 +75,7 @@ struct i128mem {
+
+ /* save the registers needed for restoration in this structure */
+ typedef struct {
+- IOADDRESS iobase; /* saved only for iobase indexing */
++ unsigned long iobase; /* saved only for iobase indexing */
+ CARD32 config1; /* iobase+0x1C register */
+ CARD32 config2; /* iobase+0x20 register */
+ CARD32 sgram; /* iobase+0x24 register */
diff --git a/testing/xf86-video-i740/PKGBUILD b/testing/xf86-video-i740/PKGBUILD
new file mode 100644
index 000000000..24edf52e9
--- /dev/null
+++ b/testing/xf86-video-i740/PKGBUILD
@@ -0,0 +1,30 @@
+# $Id: PKGBUILD 150043 2012-02-12 09:45:06Z andyrtr $
+#Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-i740
+pkgver=1.3.2
+pkgrel=8
+pkgdesc="X.org Intel i740 video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903')
+conflicts=('xorg-server<1.11.99.903')
+groups=('xorg-drivers' 'xorg')
+options=('!libtool')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2)
+sha1sums=('aadd2168153f780c487778e5fdda5473ed4b243d')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-intel/PKGBUILD b/testing/xf86-video-intel/PKGBUILD
new file mode 100644
index 000000000..cf3469c9d
--- /dev/null
+++ b/testing/xf86-video-intel/PKGBUILD
@@ -0,0 +1,30 @@
+# $Id: PKGBUILD 150045 2012-02-12 09:45:09Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-intel
+pkgver=2.17.0
+pkgrel=3
+pkgdesc="X.org Intel i810/i830/i915/945G/G965+ video drivers"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('intel-dri' 'libxvmc' 'libpciaccess' 'libdrm' 'xcb-util>=0.3.8' 'libxfixes' 'udev')
+makedepends=('xorg-server-devel>=1.11.99.903' 'libx11' 'libdrm' 'xf86driproto' 'glproto' 'mesa' 'libxvmc' 'libxrender')
+conflicts=('xorg-server<1.11.99.903' 'xf86-video-i810' 'xf86-video-intel-legacy')
+options=('!libtool')
+groups=('xorg-drivers' 'xorg')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2)
+sha1sums=('04ad9fa1f4c4e0a90f48752a709bf14700c864af')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr --enable-dri
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-mach64/PKGBUILD b/testing/xf86-video-mach64/PKGBUILD
new file mode 100644
index 000000000..4341bcce1
--- /dev/null
+++ b/testing/xf86-video-mach64/PKGBUILD
@@ -0,0 +1,30 @@
+# $Id: PKGBUILD 150047 2012-02-12 09:45:12Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-mach64
+pkgver=6.9.0
+pkgrel=3
+pkgdesc="X.org mach64 video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903' 'libdrm' 'xf86driproto' 'mesa>=8.0') # 'glproto')
+conflicts=('xorg-server<1.11.99.903')
+groups=('xorg-drivers' 'xorg')
+options=('!libtool')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2)
+sha1sums=('95a7ec9761fe11dadbcd9078c55148198a91b2f1')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr #--enable-dri
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-mga/PKGBUILD b/testing/xf86-video-mga/PKGBUILD
new file mode 100644
index 000000000..0514fff2c
--- /dev/null
+++ b/testing/xf86-video-mga/PKGBUILD
@@ -0,0 +1,34 @@
+# $Id: PKGBUILD 150049 2012-02-12 09:45:15Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-mga
+pkgver=1.4.13
+pkgrel=5
+pkgdesc="X.org mga video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903' 'libdrm' 'xf86driproto' 'mesa>=8.0') # 'glproto')
+conflicts=('xorg-server<1.11.99.903')
+options=('!libtool')
+groups=('xorg-drivers' 'xorg')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ git-fixes.patch)
+sha1sums=('55aa185cf381def4b5905c8b93694b8dfbd5c378'
+ '74782a39533ef475bd02b8b4645775879494e568')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i "${srcdir}/git-fixes.patch"
+ ./configure --prefix=/usr #--enable-dri
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-mga/git-fixes.patch b/testing/xf86-video-mga/git-fixes.patch
new file mode 100644
index 000000000..3534342e6
--- /dev/null
+++ b/testing/xf86-video-mga/git-fixes.patch
@@ -0,0 +1,800 @@
+diff --git a/man/Makefile.am b/man/Makefile.am
+index b3688ce..1ea26b3 100644
+--- a/man/Makefile.am
++++ b/man/Makefile.am
+@@ -1,5 +1,5 @@
+ #
+-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
++# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ #
+ # Permission is hereby granted, free of charge, to any person obtaining a
+ # copy of this software and associated documentation files (the "Software"),
+@@ -19,7 +19,7 @@
+ # 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.
+-#
++#
+
+ drivermandir = $(DRIVER_MAN_DIR)
+
+diff --git a/man/mga.man b/man/mga.man
+index 3a7a9f8..e1e674f 100644
+--- a/man/mga.man
++++ b/man/mga.man
+@@ -1,4 +1,3 @@
+-.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man,v 1.7 2003/04/03 07:11:03 herrb Exp $
+ .\" shorthand for double quote that works everywhere.
+ .ds q \N'34'
+ .TH mga __drivermansuffix__ __vendorversion__
+diff --git a/src/binding.h b/src/binding.h
+index 6dcd1e9..57e9b92 100644
+--- a/src/binding.h
++++ b/src/binding.h
+@@ -13,7 +13,6 @@
+ @end
+
+ ***************************************************************************************/
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/HALlib/binding.h,v 1.3 2000/10/24 22:45:08 dawes Exp $ */
+
+ #ifndef _BINDING
+ #define _BINDING
+diff --git a/src/mga.h b/src/mga.h
+index 2cb3d88..c520e86 100644
+--- a/src/mga.h
++++ b/src/mga.h
+@@ -1,4 +1,3 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.87tsi Exp $ */
+ /*
+ * MGA Millennium (MGA2064W) functions
+ *
+@@ -137,6 +136,10 @@ void MGAdbg_outreg32(ScrnInfoPtr, int,int, char*);
+ #define PCI_CHIP_MGAG200_EH_PCI 0x0533
+ #endif
+
++#ifndef PCI_CHIP_MGAG200_ER_PCI
++#define PCI_CHIP_MGAG200_ER_PCI 0x0534
++#endif
++
+ /*
+ * Read/write to the DAC via MMIO
+ */
+@@ -200,7 +203,9 @@ void MGAdbg_outreg32(ScrnInfoPtr, int,int, char*);
+ typedef struct {
+ unsigned char ExtVga[6];
+ unsigned char DacClk[6];
+- unsigned char * DacRegs;
++ unsigned char ExtVga_Index24;
++ unsigned char Dac_Index90;
++ unsigned char * DacRegs;
+ unsigned long crtc2[0x58];
+ unsigned char dac2[0x21];
+ CARD32 Option;
+@@ -479,6 +484,7 @@ typedef struct {
+ int is_G200WB:1;
+ int is_G200EV:1;
+ int is_G200EH:1;
++ int is_G200ER:1;
+
+ int KVM;
+
+diff --git a/src/mga_common.h b/src/mga_common.h
+index 90f6b37..81be2bc 100644
+--- a/src/mga_common.h
++++ b/src/mga_common.h
+@@ -25,8 +25,6 @@
+ * Converted to common header format:
+ * Jens Owen <jens@tungstengraphics.com>
+ *
+- * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_common.h,v 1.2 2002/12/16 16:19:18 dawes Exp $
+- *
+ */
+
+ #ifndef _MGA_COMMON_H_
+diff --git a/src/mga_dacG.c b/src/mga_dacG.c
+index df00765..fca1031 100644
+--- a/src/mga_dacG.c
++++ b/src/mga_dacG.c
+@@ -444,6 +444,116 @@ MGAG200WBPIXPLLSET(ScrnInfoPtr pScrn, MGARegPtr mgaReg)
+ outMGAdac(MGA1064_REMHEADCTL, ucTempByte);
+ }
+
++#define G200ER_PLLREF 48000
++#define G200ER_VCOMIN 1056000
++#define G200ER_VCOMAX 1488000
++
++static void MGAG200ERComputePLLParam(ScrnInfoPtr pScrn, long lFo, int *piM, int *piN, int *piP)
++{
++
++ int ulM;
++ int ulN;
++ int ulO;
++ int ulR;
++
++ CARD32 ulComputedFo;
++ CARD32 ulVco;
++ CARD32 ulFDelta;
++ CARD32 ulFTmpDelta;
++
++ CARD32 aulMDivValue[] = {1, 2, 4, 8};
++
++ CARD32 ulFo = lFo;
++
++ ulFDelta = 0xFFFFFFFF;
++
++ for (ulR = 0; ulR < 4; ulR++)
++ {
++ if(ulFDelta==0) break;
++ for (ulN = 5; (ulN <= 128) ; ulN++)
++ {
++ if(ulFDelta==0) break;
++ for (ulM = 3; ulM >= 0; ulM--)
++ {
++ if(ulFDelta==0) break;
++ for (ulO = 5; ulO <= 32; ulO++)
++ {
++ ulVco = (G200ER_PLLREF * (ulN+1)) / (ulR+1);
++ // Validate vco
++ if (ulVco < G200ER_VCOMIN) continue;
++ if (ulVco > G200ER_VCOMAX) continue;
++ ulComputedFo = ulVco / (aulMDivValue[ulM] * (ulO+1));
++
++ if (ulComputedFo > ulFo)
++ {
++ ulFTmpDelta = ulComputedFo - ulFo;
++ }
++ else
++ {
++ ulFTmpDelta = ulFo - ulComputedFo;
++ }
++
++ if (ulFTmpDelta < ulFDelta)
++ {
++ ulFDelta = ulFTmpDelta;
++ // XG200ERPIXPLLCM M<1:0> O<7:3>
++ *piM = (CARD8)ulM | (CARD8)(ulO<<3);
++ //
++ // XG200ERPIXPLLCN N<6:0>
++ *piN = (CARD8)ulN;
++ //
++ // XG200ERPIXPLLCP R<1:0> cg<7:4> (Use R value)
++ *piP = (CARD8)ulR | (CARD8)(ulR<<3);
++
++ // Test
++ int ftest = (G200ER_PLLREF * (ulN+1)) / ((ulR+1) * aulMDivValue[ulM] * (ulO+1));
++ ftest=ftest;
++ }
++ } // End O Loop
++ } // End M Loop
++ } // End N Loop
++ } // End R Loop
++}
++
++static void
++MGAG200ERPIXPLLSET(ScrnInfoPtr pScrn, MGARegPtr mgaReg)
++{
++ //TODO G200ER Validate sequence
++ CARD8 ucPixCtrl, ucTempByte;
++ MGAPtr pMga = MGAPTR(pScrn);
++
++
++ // Set pixclkdis to 1
++ ucPixCtrl = inMGAdac(MGA1064_PIX_CLK_CTL);
++ ucPixCtrl |= MGA1064_PIX_CLK_CTL_CLK_DIS;
++ outMGAdac(MGA1064_PIX_CLK_CTL, ucPixCtrl);
++
++ ucTempByte = inMGAdac(MGA1064_REMHEADCTL);
++ ucTempByte |= MGA1064_REMHEADCTL_CLKDIS;
++ outMGAdac(MGA1064_REMHEADCTL, ucTempByte);
++
++ // Select PLL Set C
++ ucTempByte = INREG8(MGAREG_MEM_MISC_READ);
++ ucTempByte |= (0x3<<2) | 0xc0; //select MGA pixel clock
++ OUTREG8(MGAREG_MEM_MISC_WRITE, ucTempByte);
++
++ ucPixCtrl &= ~MGA1064_PIX_CLK_CTL_CLK_DIS;
++ ucPixCtrl |= MGA1064_PIX_CLK_CTL_CLK_POW_DOWN;
++ outMGAdac(MGA1064_PIX_CLK_CTL, ucPixCtrl);
++
++ // Wait 500 us
++ usleep(500);
++
++ // Program the Pixel PLL Register
++ outMGAdac(MGA1064_ER_PIX_PLLC_N, mgaReg->PllN);
++ outMGAdac(MGA1064_ER_PIX_PLLC_M, mgaReg->PllM);
++ outMGAdac(MGA1064_ER_PIX_PLLC_P, mgaReg->PllP);
++
++ // Wait 50 us
++ usleep(50);
++
++}
++
+ static void
+ MGAG200WBPrepareForModeSwitch(ScrnInfoPtr pScrn)
+ {
+@@ -768,8 +878,13 @@ MGAGSetPCLK( ScrnInfoPtr pScrn, long f_out )
+
+ pReg->PllM = m;
+ pReg->PllN = n;
+- pReg->PllP = p;
+- } else {
++ pReg->PllP = p;
++ } else if (pMga->is_G200ER) {
++ MGAG200ERComputePLLParam(pScrn, f_out, &m, &n, &p);
++ pReg->PllM = m;
++ pReg->PllN = n;
++ pReg->PllP = p;
++ } else {
+ /* Do the calculations for m, n, p and s */
+ MGAGCalcClock( pScrn, f_out, &m, &n, &p, &s );
+
+@@ -966,6 +1081,10 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ pReg->Option2 = 0x0000b000;
+ break;
+
++ case PCI_CHIP_MGAG200_ER_PCI:
++ pReg->Dac_Index90 = 0;
++ break;
++
+ case PCI_CHIP_MGAG200_EH_PCI:
+ pReg->DacRegs[MGA1064_MISC_CTL] =
+ MGA1064_MISC_CTL_VGA8 |
+@@ -1088,6 +1207,7 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ if (pMga->is_G200WB){
+ pReg->ExtVga[1] |= 0x88;
+ }
++ pReg->ExtVga_Index24 = 0x05;
+
+ pVga->CRTC[0] = ht - 4;
+ pVga->CRTC[1] = hd;
+@@ -1327,10 +1447,15 @@ MGA_NOT_HAL(
+ if ( (pMga->is_G200EV || pMga->is_G200WB || pMga->is_G200EH) &&
+ (i >= 0x44) && (i <= 0x4E))
+ continue;
+-
++
+ outMGAdac(i, mgaReg->DacRegs[i]);
+ }
+
++ if (pMga->is_G200ER)
++ {
++ outMGAdac(0x90, mgaReg->Dac_Index90);
++ }
++
+ if (!MGAISGx50(pMga)) {
+ /* restore pci_option register */
+ #ifdef XSERVER_LIBPCIACCESS
+@@ -1361,7 +1486,9 @@ MGA_NOT_HAL(
+ #endif
+ }
+
+- if (pMga->is_G200EV) {
++ if (pMga->is_G200ER) {
++ MGAG200ERPIXPLLSET(pScrn, mgaReg);
++ } else if (pMga->is_G200EV) {
+ MGAG200EVPIXPLLSET(pScrn, mgaReg);
+ } else if (pMga->is_G200WB) {
+ MGAG200WBPIXPLLSET(pScrn, mgaReg);
+@@ -1388,6 +1515,11 @@ MGA_NOT_HAL(
+ for (i = 0; i < 6; i++)
+ OUTREG16(MGAREG_CRTCEXT_INDEX, (mgaReg->ExtVga[i] << 8) | i);
+
++ if (pMga->is_G200ER) {
++ OUTREG8(MGAREG_CRTCEXT_INDEX, 0x24);
++ OUTREG8(MGAREG_CRTCEXT_DATA, mgaReg->ExtVga_Index24);
++ }
++
+ /* This handles restoring the generic VGA registers. */
+ if (pMga->is_G200SE) {
+ MGAG200SERestoreMode(pScrn, vgaReg);
+@@ -1404,7 +1536,7 @@ MGA_NOT_HAL(
+ OUTREG16(MGAREG_CRTCEXT_INDEX, 6);
+ OUTREG16(MGAREG_CRTCEXT_DATA, 0);
+ }
+-
++
+ /*
+ * this is needed to properly restore start address
+ */
+@@ -1555,6 +1687,11 @@ MGAGSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
+ mgaReg->PllM = inMGAdac(MGA1064_EH_PIX_PLLC_M);
+ mgaReg->PllN = inMGAdac(MGA1064_EH_PIX_PLLC_N);
+ mgaReg->PllP = inMGAdac(MGA1064_EH_PIX_PLLC_P);
++ } else if (pMga->is_G200ER) {
++ mgaReg->PllM = inMGAdac(MGA1064_ER_PIX_PLLC_M);
++ mgaReg->PllN = inMGAdac(MGA1064_ER_PIX_PLLC_N);
++ mgaReg->PllP = inMGAdac(MGA1064_ER_PIX_PLLC_P);
++ mgaReg->Dac_Index90 = inMGAdac(0x90);
+ }
+
+ mgaReg->PIXPLLCSaved = TRUE;
+@@ -1583,6 +1720,11 @@ MGAGSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
+ OUTREG8(MGAREG_CRTCEXT_INDEX, i);
+ mgaReg->ExtVga[i] = INREG8(MGAREG_CRTCEXT_DATA);
+ }
++ if (pMga->is_G200ER)
++ {
++ OUTREG8(MGAREG_CRTCEXT_INDEX, 0x24);
++ mgaReg->ExtVga_Index24 = INREG8(MGAREG_CRTCEXT_DATA);
++ }
+
+ #ifdef DEBUG
+ ErrorF("Saved values:\nDAC:");
+@@ -1737,7 +1879,7 @@ static const struct mgag_i2c_private {
+ { (1 << 0), (1 << 2) },
+ { (1 << 4), (1 << 5) },
+ { (1 << 0), (1 << 1) }, /* G200SE, G200EV and G200WB I2C bits */
+- { (1 << 1), (1 << 0) }, /* G200EH I2C bits */
++ { (1 << 1), (1 << 0) }, /* G200EH, G200ER I2C bits */
+ };
+
+
+@@ -1750,7 +1892,7 @@ MGAG_ddc1Read(ScrnInfoPtr pScrn)
+
+ if (pMga->is_G200SE || pMga->is_G200WB || pMga->is_G200EV)
+ i2c_index = 3;
+- else if (pMga->is_G200EH)
++ else if (pMga->is_G200EH || pMga->is_G200ER)
+ i2c_index = 4;
+ else
+ i2c_index = 0;
+@@ -1851,7 +1993,7 @@ MGAG_i2cInit(ScrnInfoPtr pScrn)
+
+ if (pMga->is_G200SE || pMga->is_G200WB || pMga->is_G200EV)
+ i2c_index = 3;
+- else if (pMga->is_G200EH)
++ else if (pMga->is_G200EH || pMga->is_G200ER)
+ i2c_index = 4;
+ else
+ i2c_index = 0;
+@@ -1976,7 +2118,7 @@ void MGAGSetupFuncs(ScrnInfoPtr pScrn)
+ pMga->Save = MGAGSave;
+ pMga->Restore = MGAGRestore;
+ pMga->ModeInit = MGAGInit;
+- if (!pMga->is_G200WB){
++ if ((!pMga->is_G200WB) && (!pMga->is_G200ER)) {
+ pMga->ddc1Read = MGAG_ddc1Read;
+ /* vgaHWddc1SetSpeed will only work if the card is in VGA mode */
+ pMga->DDC1SetSpeed = vgaHWddc1SetSpeedWeak();
+diff --git a/src/mga_dri.c b/src/mga_dri.c
+index 3fda623..14f342f 100644
+--- a/src/mga_dri.c
++++ b/src/mga_dri.c
+@@ -32,7 +32,6 @@
+
+ #include "xf86.h"
+ #include "xf86_OSproc.h"
+-#include "xf86Priv.h"
+
+ #include "xf86PciInfo.h"
+ #include "xf86Pci.h"
+diff --git a/src/mga_dri.h b/src/mga_dri.h
+index f1afb5d..1984b9c 100644
+--- a/src/mga_dri.h
++++ b/src/mga_dri.h
+@@ -1,5 +1,3 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h,v 1.6 2001/04/10 16:08:01 dawes Exp $ */
+-
+ /*
+ * Copyright 2000 VA Linux Systems Inc., Fremont, California.
+ * All Rights Reserved.
+diff --git a/src/mga_dripriv.h b/src/mga_dripriv.h
+index 3ddd133..feca134 100644
+--- a/src/mga_dripriv.h
++++ b/src/mga_dripriv.h
+@@ -1,5 +1,3 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h,v 1.4 2001/04/10 16:08:01 dawes Exp $ */
+-
+ /*
+ * Copyright 2000 VA Linux Systems Inc., Fremont, California.
+ * All Rights Reserved.
+diff --git a/src/mga_driver.c b/src/mga_driver.c
+index 5a1e9b4..b140013 100644
+--- a/src/mga_driver.c
++++ b/src/mga_driver.c
+@@ -1,4 +1,3 @@
+-/* $XConsortium: mga_driver.c /main/12 1996/10/28 05:13:26 kaleb $ */
+ /*
+ * MGA Millennium (MGA2064W) with Ti3026 RAMDAC driver v.1.1
+ *
+@@ -404,6 +403,21 @@ static const struct mga_device_attributes attribs[] = {
+ 8192, 0x4000, /* Memory probe size & offset values */
+ },
+
++ /* G200ER */
++ [15] = { 0, 1, 0, 0, 1, 0, 0, 0, new_BARs,
++ (TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND | USE_LINEAR_EXPANSION),
++ {
++ { 50000, 230000 }, /* System VCO frequencies */
++ { 50000, 203400 }, /* Pixel VCO frequencies */
++ { 0, 0 }, /* Video VCO frequencies */
++ 45000, /* Memory clock */
++ 27050, /* PLL reference frequency */
++ 0, /* Supports fast bitblt? */
++ MGA_HOST_PCI /* Host interface */
++ },
++
++ 16384, 0x4000, /* Memory probe size & offset values */
++ }
+ };
+
+ #ifdef XSERVER_LIBPCIACCESS
+@@ -433,6 +447,8 @@ static const struct pci_id_match mga_device_match[] = {
+
+ MGA_DEVICE_MATCH( PCI_CHIP_MGAG200_EH_PCI, 14 ),
+
++ MGA_DEVICE_MATCH(PCI_CHIP_MGAG200_ER_PCI, 15 ),
++
+ { 0, 0, 0 },
+ };
+ #endif
+@@ -450,6 +466,7 @@ static SymTabRec MGAChipsets[] = {
+ { PCI_CHIP_MGAG200_SE_A_PCI, "mgag200 SE A PCI" },
+ { PCI_CHIP_MGAG200_SE_B_PCI, "mgag200 SE B PCI" },
+ { PCI_CHIP_MGAG200_EV_PCI, "mgag200 EV Maxim" },
++ { PCI_CHIP_MGAG200_ER_PCI, "mgag200 ER SH7757" },
+ { PCI_CHIP_MGAG200_WINBOND_PCI, "mgag200 eW Nuvoton" },
+ { PCI_CHIP_MGAG200_EH_PCI, "mgag200eH" },
+ { PCI_CHIP_MGAG400, "mgag400" },
+@@ -472,6 +489,8 @@ static PciChipsets MGAPciChipsets[] = {
+ RES_SHARED_VGA },
+ { PCI_CHIP_MGAG200_EV_PCI, PCI_CHIP_MGAG200_EV_PCI,
+ RES_SHARED_VGA },
++ { PCI_CHIP_MGAG200_ER_PCI, PCI_CHIP_MGAG200_ER_PCI,
++ RES_SHARED_VGA },
+ { PCI_CHIP_MGAG200_WINBOND_PCI, PCI_CHIP_MGAG200_WINBOND_PCI,
+ RES_SHARED_VGA },
+ { PCI_CHIP_MGAG200_EH_PCI, PCI_CHIP_MGAG200_EH_PCI,
+@@ -913,6 +932,11 @@ MGAProbe(DriverPtr drv, int flags)
+ case PCI_CHIP_MGAG200_EH_PCI:
+ attrib_no = 14;
+ break;
++
++ case PCI_CHIP_MGAG200_ER_PCI:
++ attrib_no = 15;
++ break;
++
+
+ default:
+ return FALSE;
+@@ -1081,7 +1105,7 @@ MGACountRam(ScrnInfoPtr pScrn)
+
+ if (pMga->is_G200SE)
+ pMga->reg_1e24 = INREG(0x1e24); /* stash the model for later */
+- if (pMga->reg_1e24 == 0x01) {
++ if (pMga->reg_1e24 >= 0x01) {
+ MGAUnmapMem(pScrn);
+ ProbeSize = 16384;
+ ProbeSizeOffset = 0x10000;
+@@ -1286,6 +1310,11 @@ MGAdoDDC(ScrnInfoPtr pScrn)
+ MGASave(pScrn);
+
+ /* It is now safe to talk to the card */
++ /* Allow access to DDC */
++ if (pMga->is_G200ER) {
++ CARD8 ucData = inMGAdac(MGA1064_GEN_IO_CTL2);
++ outMGAdac(MGA1064_GEN_IO_CTL2, ucData | 1);
++ }
+
+ /* Initialize I2C buses - used by DDC if available */
+ if (pMga->i2cInit) {
+@@ -1327,6 +1356,12 @@ MGAdoDDC(ScrnInfoPtr pScrn)
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of monitor info\n");
+ }
+
++ /* Remove access to DDC */
++ if (pMga->is_G200ER) {
++ CARD8 ucData = inMGAdac(MGA1064_GEN_IO_CTL2);
++ outMGAdac(MGA1064_GEN_IO_CTL2, ucData & ~1);
++ }
++
+ /* Restore previous state and unmap MGA memory and MMIO areas */
+ MGARestore(pScrn);
+ MGAUnmapMem(pScrn);
+@@ -1620,6 +1655,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
+ pMga->is_G200EV = (pMga->Chipset == PCI_CHIP_MGAG200_EV_PCI);
+ pMga->is_G200WB = (pMga->Chipset == PCI_CHIP_MGAG200_WINBOND_PCI);
+ pMga->is_G200EH = (pMga->Chipset == PCI_CHIP_MGAG200_EH_PCI);
++ pMga->is_G200ER = (pMga->Chipset == PCI_CHIP_MGAG200_ER_PCI);
+
+ #ifdef USEMGAHAL
+ if (pMga->chip_attribs->HAL_chipset) {
+@@ -1780,15 +1816,9 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
+ #ifndef XSERVER_LIBPCIACCESS
+ /*
+ * Find the BIOS base. Get it from the PCI config if possible. Otherwise
+- * use the VGA default. Allow the config file to override this.
++ * use the VGA default.
+ */
+
+- pMga->BiosFrom = X_NONE;
+- if (pMga->device->BiosBase != 0) {
+- /* XXX This isn't used */
+- pMga->BiosAddress = pMga->device->BiosBase;
+- pMga->BiosFrom = X_CONFIG;
+- } else {
+ /* details: rombase sdk pp 4-15 */
+ if (pMga->PciInfo->biosBase != 0) {
+ pMga->BiosAddress = pMga->PciInfo->biosBase & 0xffff0000;
+@@ -1797,7 +1827,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
+ pMga->BiosAddress = 0xc0000;
+ pMga->BiosFrom = X_DEFAULT;
+ }
+- }
+ if (pMga->BiosAddress) {
+ xf86DrvMsg(pScrn->scrnIndex, pMga->BiosFrom, "BIOS at 0x%lX\n",
+ (unsigned long)pMga->BiosAddress);
+@@ -2142,6 +2171,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
+ case PCI_CHIP_MGAG200_WINBOND_PCI:
+ case PCI_CHIP_MGAG200_EV_PCI:
+ case PCI_CHIP_MGAG200_EH_PCI:
++ case PCI_CHIP_MGAG200_ER_PCI:
+ case PCI_CHIP_MGAG400:
+ case PCI_CHIP_MGAG550:
+ MGAGSetupFuncs(pScrn);
+@@ -2255,6 +2285,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
+ case PCI_CHIP_MGAG200_WINBOND_PCI:
+ case PCI_CHIP_MGAG200_EV_PCI:
+ case PCI_CHIP_MGAG200_EH_PCI:
++ case PCI_CHIP_MGAG200_ER_PCI:
+ pMga->SrcOrg = 0;
+ pMga->DstOrg = 0;
+ break;
+@@ -2432,16 +2463,17 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
+ maxPitch = 2048;
+ break;
+ case PCI_CHIP_MGAG200_SE_A_PCI:
+- if (pScrn->videoRam < 2048){
++ if (pScrn->videoRam < 2048){
+ maxPitch = 1280;
+- }
+- break;
++ }
++ break;
+ case PCI_CHIP_MGAG200:
+ case PCI_CHIP_MGAG200_PCI:
+ case PCI_CHIP_MGAG200_SE_B_PCI:
+ case PCI_CHIP_MGAG200_WINBOND_PCI:
+ case PCI_CHIP_MGAG200_EV_PCI:
+ case PCI_CHIP_MGAG200_EH_PCI:
++ case PCI_CHIP_MGAG200_ER_PCI:
+ case PCI_CHIP_MGAG400:
+ case PCI_CHIP_MGAG550:
+ maxPitch = 4096;
+@@ -3250,15 +3282,71 @@ MGA_HAL(
+ outb(0xfac, 0x02);
+ }
+
+- MGA_NOT_HAL(
+- if (pMga->is_G200SE) {
++ /*
++ This function optimize the Priority Request control
++ Higher HiPriLvl will reduce drawing performance
++ We need to give enough bandwith to crtc to avoid visual artifact
++ */
++ if (pMga->is_G200SE)
++ {
++ if (pMga->reg_1e24 >= 0x02)
++ {
++ /* Calulate CRTC Priority value */
++ CARD8 ucHiPriLvl;
++ CARD32 ulBitsPerPixel;
++ CARD32 ulMemoryBandwidth;
++
++ /* uiBitsPerPixel can only be 8,16 or32 */
++ if (pScrn->bitsPerPixel > 16)
++ {
++ ulBitsPerPixel = 32;
++ }
++ else if (pScrn->bitsPerPixel > 8)
++ {
++ ulBitsPerPixel = 16;
++ }
++ else
++ {
++ ulBitsPerPixel = 8;
++ }
++
++
++ ulMemoryBandwidth = (mode->Clock * ulBitsPerPixel) / 1000;
++
++ if (ulMemoryBandwidth > 3100) ucHiPriLvl = 0;
++ else if (ulMemoryBandwidth > 2600) ucHiPriLvl = 1;
++ else if (ulMemoryBandwidth > 1900) ucHiPriLvl = 2;
++ else if (ulMemoryBandwidth > 1160) ucHiPriLvl = 3;
++ else if (ulMemoryBandwidth > 440) ucHiPriLvl = 4;
++ else ucHiPriLvl = 5;
++
+ OUTREG8(0x1FDE, 0x06);
+- if (pMga->reg_1e24 == 0x01)
+- OUTREG8(0x1FDF, 0x03);
+- else
+- OUTREG8(0x1FDF, 0x14);
++ OUTREG8(0x1FDF, ucHiPriLvl);
++
++ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock == %d\n", mode->Clock);
++ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BitsPerPixel == %d\n", pScrn->bitsPerPixel);
++ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "MemoryBandwidth == %d\n", ulMemoryBandwidth);
++ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "HiPriLvl == %02X\n", ucHiPriLvl);
+ }
+- );
++ else
++ {
++ MGA_NOT_HAL(
++ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock == %d\n", mode->Clock);
++ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BitsPerPixel == %d\n", pScrn->bitsPerPixel);
++ OUTREG8(0x1FDE, 0x06);
++ if (pMga->reg_1e24 >= 0x01)
++ {
++ OUTREG8(0x1FDF, 0x03);
++ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "HiPriLvl == 03\n");
++ }
++ else
++ {
++ OUTREG8(0x1FDF, 0x14);
++ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "HiPriLvl == 14h\n");
++ }
++ );
++ }
++ }
+
+ pMga->CurrentLayout.mode = mode;
+
+@@ -4322,13 +4410,23 @@ MGAValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
+ MGAPtr pMga = MGAPTR(pScrn);
+
+ if (pMga->Chipset == PCI_CHIP_MGAG200_SE_A_PCI) {
+- if (mode->HDisplay > 1600)
+- return MODE_VIRTUAL_X;
+- if (mode->VDisplay > 1200)
+- return MODE_VIRTUAL_Y;
+- if (pMga->reg_1e24 == 0x01 &&
+- xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 244)
+- return MODE_BANDWIDTH;
++ if (pMga->reg_1e24 == 0x01) {
++ if (mode->HDisplay > 1600)
++ return MODE_VIRTUAL_X;
++ if (mode->VDisplay > 1200)
++ return MODE_VIRTUAL_Y;
++ if (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 244)
++ return MODE_BANDWIDTH;
++ } else {
++ if (pMga->reg_1e24 >= 0x02) {
++ if (mode->HDisplay > 1920)
++ return MODE_VIRTUAL_X;
++ if (mode->VDisplay > 1200)
++ return MODE_VIRTUAL_Y;
++ if (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 301)
++ return MODE_BANDWIDTH;
++ }
++ }
+ } else if (pMga->is_G200WB){
+ if (mode->Flags & V_DBLSCAN)
+ return MODE_NO_DBLESCAN;
+@@ -4340,10 +4438,13 @@ MGAValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
+ return MODE_BANDWIDTH;
+ } else if (pMga->is_G200EV
+ && (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 327)) {
+- return MODE_BANDWIDTH;
++ return MODE_BANDWIDTH;
+ } else if (pMga->is_G200EH
+ && (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 375)) {
+ return MODE_BANDWIDTH;
++ } else if (pMga->is_G200ER
++ && (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 550)) {
++ return MODE_BANDWIDTH;
+ }
+
+ lace = 1 + ((mode->Flags & V_INTERLACE) != 0);
+diff --git a/src/mga_macros.h b/src/mga_macros.h
+index 69dc8e3..bffd063 100644
+--- a/src/mga_macros.h
++++ b/src/mga_macros.h
+@@ -1,5 +1,3 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h,v 1.21 2001/09/26 12:59:17 alanh Exp $ */
+-
+ #ifndef _MGA_MACROS_H_
+ #define _MGA_MACROS_H_
+
+diff --git a/src/mga_merge.c b/src/mga_merge.c
+index 753f752..1fd0572 100644
+--- a/src/mga_merge.c
++++ b/src/mga_merge.c
+@@ -363,6 +363,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
+ case PCI_CHIP_MGAG200_WINBOND_PCI:
+ case PCI_CHIP_MGAG200_EV_PCI:
+ case PCI_CHIP_MGAG200_EH_PCI:
++ case PCI_CHIP_MGAG200_ER_PCI:
+ case PCI_CHIP_MGAG400:
+ case PCI_CHIP_MGAG550:
+ MGAGSetupFuncs(pScrn);
+@@ -518,6 +519,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
+ case PCI_CHIP_MGAG200_WINBOND_PCI:
+ case PCI_CHIP_MGAG200_EV_PCI:
+ case PCI_CHIP_MGAG200_EH_PCI:
++ case PCI_CHIP_MGAG200_ER_PCI:
+ case PCI_CHIP_MGAG400:
+ case PCI_CHIP_MGAG550:
+ maxPitch = 4096;
+diff --git a/src/mga_reg.h b/src/mga_reg.h
+index 6251976..5a37db6 100644
+--- a/src/mga_reg.h
++++ b/src/mga_reg.h
+@@ -1,11 +1,3 @@
+-/* $XConsortium: mgareg.h /main/2 1996/10/25 10:33:21 kaleb $ */
+-
+-
+-
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h,v 1.18 2001/09/26 12:59:18 alanh Exp $ */
+-
+-
+-
+ /*
+ * MGA Millennium (MGA2064W) functions
+ * MGA Mystique (MGA1064SG) functions
+@@ -377,6 +369,7 @@
+ #define MGA1064_MISC_CTL_VGA8 ( 0x01 << 3 )
+ #define MGA1064_MISC_CTL_DAC_RAM_CS ( 0x01 << 4 )
+
++#define MGA1064_GEN_IO_CTL2 0x29
+ #define MGA1064_GEN_IO_CTL 0x2a
+ #define MGA1064_GEN_IO_DATA 0x2b
+ #define MGA1064_SYS_PLL_M 0x2c
+@@ -437,6 +430,10 @@
+ #define MGA1064_EH_PIX_PLLC_N 0xb7
+ #define MGA1064_EH_PIX_PLLC_P 0xb8
+
++/* Modified PLL for G200 Maxim (G200ER) */
++#define MGA1064_ER_PIX_PLLC_M 0xb7
++#define MGA1064_ER_PIX_PLLC_N 0xb6
++#define MGA1064_ER_PIX_PLLC_P 0xb8
+
+ #define MGA1064_DISP_CTL 0x8a
+ #define MGA1064_DISP_CTL_DAC1OUTSEL_MASK 0x01
+diff --git a/src/mga_sarea.h b/src/mga_sarea.h
+index c5ffbbc..16fc9ce 100644
+--- a/src/mga_sarea.h
++++ b/src/mga_sarea.h
+@@ -1,5 +1,3 @@
+-/* $XFree86$ */
+-
+ /*
+ * Copyright 2000 Gareth Hughes
+ * All Rights Reserved.
+diff --git a/src/mga_storm.c b/src/mga_storm.c
+index 87473c8..db7fae7 100644
+--- a/src/mga_storm.c
++++ b/src/mga_storm.c
+@@ -1131,6 +1131,7 @@ void MGAStormEngineInit( ScrnInfoPtr pScrn )
+ case PCI_CHIP_MGAG200_WINBOND_PCI:
+ case PCI_CHIP_MGAG200_EV_PCI:
+ case PCI_CHIP_MGAG200_EH_PCI:
++ case PCI_CHIP_MGAG200_ER_PCI:
+ pMga->SrcOrg = 0;
+ OUTREG(MGAREG_SRCORG, pMga->realSrcOrg);
+ OUTREG(MGAREG_DSTORG, pMga->DstOrg);
+diff --git a/src/mgareg_flags.h b/src/mgareg_flags.h
+index 69050fc..548af86 100644
+--- a/src/mgareg_flags.h
++++ b/src/mgareg_flags.h
+@@ -19,7 +19,6 @@
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mgareg_flags.h,v 1.2 2003/01/12 03:55:47 tsi Exp $ */
+
+ #ifndef _MGAREGS_H_
+ #define _MGAREGS_H_
+diff --git a/util/stormdwg.c b/util/stormdwg.c
+index 99f76cc..b43cc32 100644
+--- a/util/stormdwg.c
++++ b/util/stormdwg.c
+@@ -1,8 +1,3 @@
+-/* $XConsortium: dwg.c /main/2 1996/10/28 06:57:55 kaleb $ */
+-
+-
+-
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/util/stormdwg.c,v 1.1 1997/04/12 14:11:29 hohndel Exp $ */
+
+ #include <stdio.h>
+ #include <stdlib.h>
diff --git a/testing/xf86-video-neomagic/PKGBUILD b/testing/xf86-video-neomagic/PKGBUILD
new file mode 100644
index 000000000..2e67396b5
--- /dev/null
+++ b/testing/xf86-video-neomagic/PKGBUILD
@@ -0,0 +1,30 @@
+# $Id: PKGBUILD 150051 2012-02-12 09:45:17Z andyrtr $
+#Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-neomagic
+pkgver=1.2.5
+pkgrel=6
+pkgdesc="X.org neomagic video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903' 'xf86dgaproto')
+conflicts=('xorg-server<1.11.99.903')
+groups=('xorg-drivers' 'xorg')
+options=('!libtool')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2)
+sha1sums=('02c994e2eae191b50a8cd556e5b52d82725073b3')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -d -m755 "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-nouveau/PKGBUILD b/testing/xf86-video-nouveau/PKGBUILD
new file mode 100644
index 000000000..2bba90438
--- /dev/null
+++ b/testing/xf86-video-nouveau/PKGBUILD
@@ -0,0 +1,41 @@
+# $Id: PKGBUILD 150053 2012-02-12 09:45:20Z andyrtr $
+# Maintainer: Andreas Radke <andyrtr@archlinux.org>
+# Contributor: buddabrod <buddabrod@gmail.com>
+
+pkgname=xf86-video-nouveau
+_gitdate=20120210
+pkgver=0.0.16_git${_gitdate} # see configure.ac
+pkgrel=1
+pkgdesc="Open Source 3D acceleration driver for nVidia cards (experimental)"
+arch=('i686' 'x86_64')
+url="http://nouveau.freedesktop.org/wiki/"
+license=('GPL') #and MIT, not yet a license file, see http://nouveau.freedesktop.org/wiki/FAQ#head-09f75d03eb30011c754038a3893119a70745de4e
+depends=('libdrm' 'udev')
+optdepends=('nouveau-dri: experimental gallium3d features')
+makedepends=('xorg-server-devel' 'libdrm' 'xf86driproto')
+conflicts=('xorg-server<1.11.99.902')
+options=('!libtool')
+install=$pkgname.install
+source=(ftp://ftp.archlinux.org/other/$pkgname/xf86-video-nouveau-${_gitdate}.tar.bz2)
+md5sums=('f35c12d64542d0ea792a9e5af63a2e5a')
+
+# source PKGBUILD && mksource
+mksource() {
+ mkdir /tmp/$pkgname-${_gitdate}
+ pushd /tmp/$pkgname-${_gitdate}
+ git clone -v --depth 1 git://anongit.freedesktop.org/nouveau/xf86-video-nouveau
+ cd xf86-video-nouveau
+ git archive --prefix=xf86-video-nouveau-${_gitdate}/ --format=tar HEAD | bzip2 > /tmp/$pkgname-${_gitdate}/$pkgname-${_gitdate}.tar.bz2
+ popd
+}
+
+build() {
+ cd $srcdir/xf86-video-nouveau-${_gitdate}
+ ./autogen.sh --prefix=/usr
+ make
+}
+
+package() {
+ cd $srcdir/xf86-video-nouveau-${_gitdate}
+ make DESTDIR=$pkgdir install
+}
diff --git a/testing/xf86-video-nouveau/xf86-video-nouveau.install b/testing/xf86-video-nouveau/xf86-video-nouveau.install
new file mode 100644
index 000000000..027154ff3
--- /dev/null
+++ b/testing/xf86-video-nouveau/xf86-video-nouveau.install
@@ -0,0 +1,16 @@
+post_install () {
+ cat << _EOF
+ ==> make sure you use KernelModeSetting (KMS)
+ ==> see http://wiki.archlinux.org/index.php/Nouveau#KMS for more
+_EOF
+}
+
+post_upgrade() {
+ if [ "`vercmp $2 0.0.15_git20100117-1`" -lt 0 ]; then
+ cat << _EOF
+ ==> ATTENTION: Usermode support has been dropped
+ ==> make sure you use KernelModeSetting (KMS)
+ ==> see http://wiki.archlinux.org/index.php/Nouveau#KMS for more
+_EOF
+ fi
+}
diff --git a/testing/xf86-video-nv/PKGBUILD b/testing/xf86-video-nv/PKGBUILD
new file mode 100644
index 000000000..dea94d6d5
--- /dev/null
+++ b/testing/xf86-video-nv/PKGBUILD
@@ -0,0 +1,31 @@
+# $Id: PKGBUILD 150055 2012-02-12 09:45:22Z andyrtr $
+# Maintainer:Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-nv
+pkgver=2.1.18
+pkgrel=5
+pkgdesc="X.org nv video driver"
+arch=(i686 x86_64)
+license=('custom')
+url="http://xorg.freedesktop.org/"
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903')
+conflicts=('xorg-server<1.11.99.903')
+options=('!libtool')
+groups=('xorg-drivers' 'xorg')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2)
+sha1sums=('d35b2fa5a26a507a9cc95b69243d9fd0c0f32aa2')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-openchrome/PKGBUILD b/testing/xf86-video-openchrome/PKGBUILD
new file mode 100644
index 000000000..e12cf975d
--- /dev/null
+++ b/testing/xf86-video-openchrome/PKGBUILD
@@ -0,0 +1,31 @@
+# $Id: PKGBUILD 150057 2012-02-12 09:45:24Z andyrtr $
+# Contributor: Paul Mattal <paul@mattal.com>
+# Maintainer: Juergen Hoetzel <juergen@hoetzel.info>
+
+pkgname=xf86-video-openchrome
+pkgver=0.2.905
+pkgrel=1
+pkgdesc="X.Org Openchrome drivers"
+arch=(i686 x86_64)
+license=('custom')
+url="http://www.openchrome.org"
+depends=('libdrm' 'libxvmc')
+makedepends=('xorg-server-devel>=1.11.99.902' 'libx11' 'xf86driproto' 'mesa') #'glproto' 'libgl')
+replaces=('openchrome' 'xf86-video-via')
+options=('!libtool' '!emptydirs' '!makeflags')
+conflicts=('xf86-video-via' 'xf86-video-unichrome' 'openchrome' 'xorg-server<1.11.99.902' 'unichrome-dri')
+source=(http://xorg.freedesktop.org/archive/individual/driver/${pkgname}-${pkgver}.tar.bz2)
+md5sums=('51871431a4a9204ab8ec79335c0cc041')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr # --disable-dri
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-r128/PKGBUILD b/testing/xf86-video-r128/PKGBUILD
new file mode 100644
index 000000000..85d09171a
--- /dev/null
+++ b/testing/xf86-video-r128/PKGBUILD
@@ -0,0 +1,36 @@
+# $Id: PKGBUILD 150059 2012-02-12 09:45:26Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-r128
+pkgver=6.8.1
+pkgrel=8
+pkgdesc="X.org ati Rage128 video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903' 'xf86driproto' 'libdrm' 'mesa') # 'glproto')
+conflicts=('xorg-server<1.11.99.903')
+groups=('xorg-drivers' 'xorg')
+options=('!libtool')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ git-fixes.patch)
+md5sums=('2b90854a62a4d45d652062f582dc8d13'
+ '3937776d4427861d0797e47119ac327d')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i "${srcdir}/git-fixes.patch"
+
+ autoreconf -fi
+ ./configure --prefix=/usr #--enable-dri
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-r128/git-fixes.patch b/testing/xf86-video-r128/git-fixes.patch
new file mode 100644
index 000000000..933e8fb2a
--- /dev/null
+++ b/testing/xf86-video-r128/git-fixes.patch
@@ -0,0 +1,842 @@
+diff --git a/COPYING b/COPYING
+index 7f33cbf..05bcb74 100644
+--- a/COPYING
++++ b/COPYING
+@@ -1,12 +1,91 @@
+-This is a stub file. This package has not yet had its complete licensing
+-information compiled. Please see the individual source files for details on
+-your rights to use and modify this software.
++Copyright 2007 George Sapountzis
+
+-Please submit updated COPYING files to the Xorg bugzilla:
++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:
+
+-https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
++The above copyright notice and this permission notice (including the next
++paragraph) shall be included in all copies or substantial portions of the
++Software.
+
+-All licensing questions regarding this software should be directed at the
+-Xorg mailing list:
++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.
++
++Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
++ Precision Insight, Inc., Cedar Park, Texas, and
++ VA Linux Systems Inc., Fremont, California.
++
++All Rights Reserved.
++
++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 on 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
++NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
++SYSTEMS AND/OR THEIR SUPPLIERS 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.
++
++Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
++Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
++All Rights Reserved.
++
++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
++PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
++
++Copyright 2000 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
++
++Permission to use, copy, modify, distribute, and sell this software and its
++documentation for any purpose is hereby granted without fee, provided that
++the above copyright notice appear in all copies and that both that copyright
++notice and this permission notice appear in supporting documentation, and
++that the name of Marc Aurele La France not be used in advertising or
++publicity pertaining to distribution of the software without specific,
++written prior permission. Marc Aurele La France makes no representations
++about the suitability of this software for any purpose. It is provided
++"as-is" without express or implied warranty.
++
++MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
++INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
++EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
++CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
++DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
++TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
++PERFORMANCE OF THIS SOFTWARE.
+
+-http://lists.freedesktop.org/mailman/listinfo/xorg
+diff --git a/Makefile.am b/Makefile.am
+index 1f4c3c4..4c278ba 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -18,21 +18,15 @@
+ # 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.
+
+-AUTOMAKE_OPTIONS = foreign
+ SUBDIRS = src man
++MAINTAINERCLEANFILES = ChangeLog INSTALL
+
+-if BUILD_LINUXDOC
+-README.r128: README.r128.sgml
+- $(MAKE_TEXT) README.r128.sgml && mv README.r128.txt README.r128
++.PHONY: ChangeLog INSTALL
+
+-endif
+-
+-EXTRA_DIST = README.r128 README.r128.sgml ChangeLog
+-CLEANFILES = ChangeLog
+-
+-.PHONY: ChangeLog
++INSTALL:
++ $(INSTALL_CMD)
+
+ ChangeLog:
+ $(CHANGELOG_CMD)
+
+-dist-hook: ChangeLog
++dist-hook: ChangeLog INSTALL
+diff --git a/README b/README
+index cb61870..5c6f59d 100644
+--- a/README
++++ b/README
+@@ -1,4 +1,161 @@
+-xf86-video-r128 - ATI Rage 128 video driver for the Xorg X server
++ Information for ATI Rage 128 Users
++ Precision Insight, Inc., SuSE GmbH
++ 13 June 2000
++ ____________________________________________________________
++
++ Table of Contents
++
++
++ 1. Supported Hardware
++ 2. Features
++ 3. Technical Notes
++ 4. Reported Working Video Cards
++ 5. Configuration
++ 6. Driver Options
++ 7. Known Limitations
++ 8. Authors
++
++
++ ______________________________________________________________________
++
++ 1. Supported Hardware
++
++
++ o ATI Rage 128 based cards
++
++
++
++ 2. Features
++
++
++ o Full support (including hardware accelerated 2D drawing) for 8, 15,
++ 16, 24 bit pixel depths.
++
++ o Hardware cursor support to reduce sprite flicker.
++
++ o Support for high resolution video modes up to 1800x1440 @ 70Hz.
++
++ o Support for doublescan video modes (e.g., 320x200 and 320x240).
++
++ o Support for gamma correction at all pixel depths.
++
++ o Fully programmable clock supported.
++
++ o Robust text mode restore for VT switching.
++
++
++
++ 3. Technical Notes
++
++
++ o None
++
++
++
++ 4. Reported Working Video Cards
++
++
++ o Rage Fury AGP 32MB
++
++ o XPERT 128 AGP 16MB
++
++ o XPERT 99 AGP 8MB
++
++
++
++ 5. Configuration
++
++ The driver auto-detects all device information necessary to initialize
++ the card. The only lines you need in the "Device" section of your
++ xorg.conf file are:
++
++ Section "Device"
++ Identifier "Rage 128"
++ Driver "r128"
++ EndSection
++
++
++ or let xorgconfig do this for you.
++
++ However, if you have problems with auto-detection, you can specify:
++
++ o VideoRam - in kilobytes
++
++ o MemBase - physical address of the linear framebuffer
++
++ o IOBase - physical address of the memory mapped IO registers
++
++ o ChipID - PCI DEVICE ID
++
++
++
++ 6. Driver Options
++
++
++ o "hw_cursor" - request hardware cursor (default)
++
++ o "sw_cursor" - software cursor only
++
++ o "no_accel" - software rendering only
++
++ o "dac_8_bit" - use color weight 888 in 8 bpp mode (default)
++
++ o "dac_6_bit" - use color weight 666 in 8 bpp mode (VGA emulation)
++
++
++
++ 7. Known Limitations
++
++
++ o None
++
++
++
++ 8. Authors
++
++ The X11R7.5 driver was originally part of XFree86 4.4 rc2.
++
++ The XFree86 4 driver was ported from XFree86 3.3.x and enhanced by:
++
++ o Rickard E. (Rik) Faith <mailto:faith@precisioninsight.com>
++
++ o Kevin E. Martin <mailto:kevin@precisioninsight.com>
++
++ The XFree86 4 driver was funded by ATI and was donated to The XFree86
++ Project by:
++
++ Precision Insight, Inc.
++ Cedar Park, TX
++ USA
++
++
++ The XFree86 3.3.x driver used for the port was written by:
++
++ o Rickard E. (Rik) Faith <mailto:faith@precisioninsight.com>
++
++ o Kevin E. Martin <mailto:kevin@precisioninsight.com>
++
++ The XFree86 3.3.x driver was funded by ATI and was donated to The
++ XFree86 Project by Precision Insight, Inc. It was based in part on
++ an earlier driver that was written by:
++
++ o Alan Hourihane <mailto:alanh@fairlite.demon.co.uk>
++
++ o Dirk Hohndel <mailto:hohndel@suse.de>
++
++ This early driver was funded and donated to The XFree86 Project by:
++
++ SuSE GmbH
++ Schanzaekerstr. 10
++ 90443 Nuernberg
++ Germany
++
++
++
++ http://www.precisioninsight.com
++
++ http://www.suse.com
++
+
+ Please submit bugs & patches to the Xorg bugzilla:
+
+diff --git a/README.r128 b/README.r128
+deleted file mode 100644
+index dcc2715..0000000
+--- a/README.r128
++++ /dev/null
+@@ -1,160 +0,0 @@
+- Information for ATI Rage 128 Users
+- Precision Insight, Inc., SuSE GmbH
+- 13 June 2000
+- ____________________________________________________________
+-
+- Table of Contents
+-
+-
+- 1. Supported Hardware
+- 2. Features
+- 3. Technical Notes
+- 4. Reported Working Video Cards
+- 5. Configuration
+- 6. Driver Options
+- 7. Known Limitations
+- 8. Authors
+-
+-
+- ______________________________________________________________________
+-
+- 1. Supported Hardware
+-
+-
+- +o ATI Rage 128 based cards
+-
+-
+-
+- 2. Features
+-
+-
+- +o Full support (including hardware accelerated 2D drawing) for 8, 15,
+- 16, 24 bit pixel depths.
+-
+- +o Hardware cursor support to reduce sprite flicker.
+-
+- +o Support for high resolution video modes up to 1800x1440 @ 70Hz.
+-
+- +o Support for doublescan video modes (e.g., 320x200 and 320x240).
+-
+- +o Support for gamma correction at all pixel depths.
+-
+- +o Fully programmable clock supported.
+-
+- +o Robust text mode restore for VT switching.
+-
+-
+-
+- 3. Technical Notes
+-
+-
+- +o None
+-
+-
+-
+- 4. Reported Working Video Cards
+-
+-
+- +o Rage Fury AGP 32MB
+-
+- +o XPERT 128 AGP 16MB
+-
+- +o XPERT 99 AGP 8MB
+-
+-
+-
+- 5. Configuration
+-
+- The driver auto-detects all device information necessary to initialize
+- the card. The only lines you need in the "Device" section of your
+- xorg.conf file are:
+-
+- Section "Device"
+- Identifier "Rage 128"
+- Driver "r128"
+- EndSection
+-
+-
+- or let xorgconfig do this for you.
+-
+- However, if you have problems with auto-detection, you can specify:
+-
+- +o VideoRam - in kilobytes
+-
+- +o MemBase - physical address of the linear framebuffer
+-
+- +o IOBase - physical address of the memory mapped IO registers
+-
+- +o ChipID - PCI DEVICE ID
+-
+-
+-
+- 6. Driver Options
+-
+-
+- +o "hw_cursor" - request hardware cursor (default)
+-
+- +o "sw_cursor" - software cursor only
+-
+- +o "no_accel" - software rendering only
+-
+- +o "dac_8_bit" - use color weight 888 in 8 bpp mode (default)
+-
+- +o "dac_6_bit" - use color weight 666 in 8 bpp mode (VGA emulation)
+-
+-
+-
+- 7. Known Limitations
+-
+-
+- +o None
+-
+-
+-
+- 8. Authors
+-
+- The X11R6.8 driver was originally part of XFree86 4.4 rc2.
+-
+- The XFree86 4 driver was ported from XFree86 3.3.x and enhanced by:
+-
+- +o Rickard E. (Rik) Faith <faith@precisioninsight.com>
+-
+- +o Kevin E. Martin <kevin@precisioninsight.com>
+-
+- The XFree86 4 driver was funded by ATI and was donated to The XFree86
+- Project by:
+-
+- Precision Insight, Inc.
+- Cedar Park, TX
+- USA
+-
+-
+- The XFree86 3.3.x driver used for the port was written by:
+-
+- +o Rickard E. (Rik) Faith <faith@precisioninsight.com>
+-
+- +o Kevin E. Martin <kevin@precisioninsight.com>
+-
+- The XFree86 3.3.x driver was funded by ATI and was donated to The
+- XFree86 Project by Precision Insight, Inc. It was based in part on
+- an earlier driver that was written by:
+-
+- +o Alan Hourihane <alanh@fairlite.demon.co.uk>
+-
+- +o Dirk Hohndel <hohndel@suse.de>
+-
+- This early driver was funded and donated to The XFree86 Project by:
+-
+- SuSE GmbH
+- Schanzaekerstr. 10
+- 90443 Nuernberg
+- Germany
+-
+-
+-
+- http://www.precisioninsight.com
+-
+- http://www.suse.com
+-
+-
+-
+diff --git a/README.r128.sgml b/README.r128.sgml
+deleted file mode 100644
+index 8d7f448..0000000
+--- a/README.r128.sgml
++++ /dev/null
+@@ -1,138 +0,0 @@
+-<!DOCTYPE linuxdoc PUBLIC "-//Xorg//DTD linuxdoc//EN"[
+-<!ENTITY % defs SYSTEM "defs.ent"> %defs;
+-]>
+-
+-<article>
+-<title>Information for ATI Rage 128 Users
+-<author>Precision Insight, Inc., SuSE GmbH
+-<date>13 June 2000
+-
+-<ident>
+-</ident>
+-
+-<toc>
+-
+-<sect>Supported Hardware
+-<p>
+-<itemize>
+- <item>ATI Rage 128 based cards
+-</itemize>
+-
+-
+-<sect>Features
+-<p>
+-<itemize>
+- <item>Full support (including hardware accelerated 2D drawing) for 8, 15,
+- 16, 24 bit pixel depths.
+- <item>Hardware cursor support to reduce sprite flicker.
+- <item>Support for high resolution video modes up to 1800x1440 @ 70Hz.
+- <item>Support for doublescan video modes (e.g., 320x200 and 320x240).
+- <item>Support for gamma correction at all pixel depths.
+- <item>Fully programmable clock supported.
+- <item>Robust text mode restore for VT switching.
+-</itemize>
+-
+-
+-<sect>Technical Notes
+-<p>
+-<itemize>
+- <item>None
+-</itemize>
+-
+-
+-<sect>Reported Working Video Cards
+-<p>
+-<itemize>
+- <item>Rage Fury AGP 32MB
+- <item>XPERT 128 AGP 16MB
+- <item>XPERT 99 AGP 8MB
+-</itemize>
+-
+-
+-<sect>Configuration
+-<p>
+-The driver auto-detects all device information necessary to
+-initialize the card. The only lines you need in the "Device"
+-section of your xorg.conf file are:
+-<verb>
+- Section "Device"
+- Identifier "Rage 128"
+- Driver "r128"
+- EndSection
+-</verb>
+-or let <tt>xorgconfig</tt> do this for you.
+-
+-However, if you have problems with auto-detection, you can specify:
+-<itemize>
+- <item>VideoRam - in kilobytes
+- <item>MemBase - physical address of the linear framebuffer
+- <item>IOBase - physical address of the memory mapped IO registers
+- <item>ChipID - PCI DEVICE ID
+-</itemize>
+-
+-
+-<sect>Driver Options
+-<p>
+-<itemize>
+- <item>"hw_cursor" - request hardware cursor (default)
+- <item>"sw_cursor" - software cursor only
+- <item>"no_accel" - software rendering only
+- <item>"dac_8_bit" - use color weight 888 in 8 bpp mode (default)
+- <item>"dac_6_bit" - use color weight 666 in 8 bpp mode (VGA emulation)
+-</itemize>
+-
+-
+-<sect>Known Limitations
+-<p>
+-<itemize>
+- <item>None
+-</itemize>
+-
+-
+-<sect>Authors
+-<p>
+-The X11R&relvers; driver was originally part of XFree86 4.4 rc2.
+-
+-The XFree86 4 driver was ported from XFree86 3.3.x and enhanced by:
+-<itemize>
+- <item>Rickard E. (Rik) Faith <email>faith@precisioninsight.com</email>
+- <item>Kevin E. Martin <email>kevin@precisioninsight.com</email>
+-</itemize>
+-<p>
+-The XFree86 4 driver was funded by ATI and was donated to The XFree86
+-Project by:
+-<verb>
+- Precision Insight, Inc.
+- Cedar Park, TX
+- USA
+-</verb>
+-<p>
+-The XFree86 3.3.x driver used for the port was written by:
+-<itemize>
+- <item>Rickard E. (Rik) Faith <email>faith@precisioninsight.com</email>
+- <item>Kevin E. Martin <email>kevin@precisioninsight.com</email>
+-</itemize>
+-The XFree86 3.3.x driver was funded by ATI and was donated to The XFree86
+-Project by Precision Insight, Inc. It was based in part on an earlier
+-driver that was written by:
+-<itemize>
+- <item>Alan Hourihane <email>alanh@fairlite.demon.co.uk</email>
+- <item>Dirk Hohndel <email>hohndel@suse.de</email>
+-</itemize>
+-<p>This early driver was funded and donated to The XFree86 Project by:
+-<verb>
+- SuSE GmbH
+- Schanzaekerstr. 10
+- 90443 Nuernberg
+- Germany
+-</verb>
+-
+-<p>
+-<htmlurl name="http://www.precisioninsight.com"
+- url="http://www.precisioninsight.com">
+-<p>
+-<htmlurl name="http://www.suse.com"
+- url="http://www.suse.com">
+-
+-
+-</article>
+diff --git a/configure.ac b/configure.ac
+index 4e0f463..d5a0821 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -20,28 +20,30 @@
+ #
+ # Process this file with autoconf to produce a configure script
+
+-AC_PREREQ(2.57)
++# Initialize Autoconf
++AC_PREREQ([2.60])
+ AC_INIT([xf86-video-r128],
+- 6.8.1,
++ [6.8.1],
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
+- xf86-video-r128)
+-
++ [xf86-video-r128])
+ AC_CONFIG_SRCDIR([Makefile.am])
+-AM_CONFIG_HEADER([config.h])
++AC_CONFIG_HEADERS([config.h])
+ AC_CONFIG_AUX_DIR(.)
+
+-AM_INIT_AUTOMAKE([dist-bzip2])
++# Initialize Automake
++AM_INIT_AUTOMAKE([foreign dist-bzip2])
+
+-# Require xorg-macros: XORG_CWARNFLAGS, XORG_CHANGELOG
+-m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])])
+-XORG_MACROS_VERSION(1.2)
++# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
++m4_ifndef([XORG_MACROS_VERSION],
++ [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
++XORG_MACROS_VERSION(1.8)
++XORG_DEFAULT_OPTIONS
+
+ AM_MAINTAINER_MODE
+
+-# Checks for programs.
++# Initialize libtool
+ AC_DISABLE_STATIC
+ AC_PROG_LIBTOOL
+-AC_PROG_CC
+
+ if test "x$GCC" = "xyes"; then
+ CPPFLAGS="$CPPFLAGS -Wall"
+@@ -49,38 +51,35 @@ fi
+
+ AH_TOP([#include "xorg-server.h"])
+
++# Define a configure option for an alternate module directory
+ AC_ARG_WITH(xorg-module-dir,
+- AC_HELP_STRING([--with-xorg-module-dir=DIR],
++ AS_HELP_STRING([--with-xorg-module-dir=DIR],
+ [Default xorg module directory [[default=$libdir/xorg/modules]]]),
+ [moduledir="$withval"],
+ [moduledir="$libdir/xorg/modules"])
+
+-AC_ARG_ENABLE(dri, AC_HELP_STRING([--disable-dri],
++AC_ARG_ENABLE(dri, AS_HELP_STRING([--disable-dri],
+ [Disable DRI support [[default=auto]]]),
+ [DRI="$enableval"],
+ [DRI=auto])
+
+-# Checks for extensions
+-XORG_DRIVER_CHECK_EXT(XINERAMA, xineramaproto)
++# Store the list of server defined optional extensions in REQUIRED_MODULES
+ XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
+ XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
+ XORG_DRIVER_CHECK_EXT(XV, videoproto)
+ XORG_DRIVER_CHECK_EXT(XF86MISC, xf86miscproto)
+ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
+
+-# Checks for pkg-config packages
++# Obtain compiler/linker options for the driver dependencies
+ PKG_CHECK_MODULES(XORG, [xorg-server >= 1.2 xproto fontsproto $REQUIRED_MODULES])
+ PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
+ HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
+ HAVE_XEXTPROTO_71="no")
+ AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ])
+-sdkdir=$(pkg-config --variable=sdkdir xorg-server)
++sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
+
+ # Checks for libraries.
+
+-# Checks for header files.
+-AC_HEADER_STDC
+-
+ if test "$DRI" != no; then
+ AC_CHECK_FILE([${sdkdir}/dri.h],
+ [have_dri_h="yes"], [have_dri_h="no"])
+@@ -126,26 +125,20 @@ if test "x$XSERVER_LIBPCIACCESS" = xyes; then
+ fi
+ AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
+
+-AC_SUBST([XORG_CFLAGS])
+-AC_SUBST([DRI_CFLAGS])
+ AC_SUBST([moduledir])
+
+ DRIVER_NAME=r128
+ AC_SUBST([DRIVER_NAME])
+
+-XORG_MANPAGE_SECTIONS
+-XORG_RELEASE_VERSION
+-XORG_CHECK_LINUXDOC
+-XORG_CHANGELOG
+-
+ AC_MSG_NOTICE(
+ [Please change the Driver line in xorg.conf from "ati" to "r128" or install]
+ [the ati wrapper as well:]
+ [ git://anongit.freedesktop.org/git/xorg/driver/xf86-video-ati]
+ )
+
+-AC_OUTPUT([
+- Makefile
+- src/Makefile
+- man/Makefile
++AC_CONFIG_FILES([
++ Makefile
++ src/Makefile
++ man/Makefile
+ ])
++AC_OUTPUT
+diff --git a/man/Makefile.am b/man/Makefile.am
+index 858ba62..4e22d61 100644
+--- a/man/Makefile.am
++++ b/man/Makefile.am
+@@ -1,27 +1,24 @@
+ #
+ # Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+-#
+-# Permission to use, copy, modify, distribute, and sell this software and its
+-# documentation for any purpose is hereby granted without fee, provided that
+-# the above copyright notice appear in all copies and that both that
+-# copyright notice and this permission notice appear in supporting
+-# documentation.
+-#
+-# The above copyright notice and this permission notice 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 OPEN GROUP 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.
+-#
+-# Except as contained in this notice, the name of the copyright holders shall
+-# not be used in advertising or otherwise to promote the sale, use or
+-# other dealings in this Software without prior written authorization
+-# from the copyright holders.
++#
++# 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.
+ #
+
+ drivermandir = $(DRIVER_MAN_DIR)
+@@ -34,25 +31,11 @@ EXTRA_DIST = r128.man
+
+ CLEANFILES = $(driverman_DATA)
+
+-SED = sed
+
+-# Strings to replace in man pages
+-XORGRELSTRING = @PACKAGE_STRING@
+- XORGMANNAME = X Version 11
++# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+
+-MAN_SUBSTS = \
+- -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+- -e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+- -e 's|__xservername__|Xorg|g' \
+- -e 's|__xconfigfile__|xorg.conf|g' \
+- -e 's|__projectroot__|$(prefix)|g' \
+- -e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \
+- -e 's|__drivermansuffix__|$(DRIVER_MAN_SUFFIX)|g' \
+- -e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \
+- -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \
+- -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g'
+
+ SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
+
+ .man.$(DRIVER_MAN_SUFFIX):
+- sed $(MAN_SUBSTS) < $< > $@
++ $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+diff --git a/man/r128.man b/man/r128.man
+index 5c7c4fe..4ba933d 100644
+--- a/man/r128.man
++++ b/man/r128.man
+@@ -1,4 +1,3 @@
+-.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man,v 1.3 2001/06/01 02:10:05 dawes Exp $
+ .\" shorthand for double quote that works everywhere.
+ .ds q \N'34'
+ .TH R128 __drivermansuffix__ __vendorversion__
+diff --git a/src/r128_driver.c b/src/r128_driver.c
+index d6448b6..9d08d77 100644
+--- a/src/r128_driver.c
++++ b/src/r128_driver.c
+@@ -938,14 +938,6 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
+ /* BIOS */
+ from = X_PROBED;
+ info->BIOSAddr = info->PciInfo->biosBase & 0xfffe0000;
+- if (dev->BiosBase) {
+- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+- "BIOS address override, using 0x%08lx instead of 0x%08lx\n",
+- dev->BiosBase,
+- info->BIOSAddr);
+- info->BIOSAddr = dev->BiosBase;
+- from = X_CONFIG;
+- }
+ if (info->BIOSAddr) {
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "BIOS at 0x%08lx\n", info->BIOSAddr);
diff --git a/testing/xf86-video-rendition/PKGBUILD b/testing/xf86-video-rendition/PKGBUILD
new file mode 100644
index 000000000..d0c6ed8cc
--- /dev/null
+++ b/testing/xf86-video-rendition/PKGBUILD
@@ -0,0 +1,35 @@
+# $Id: PKGBUILD 150061 2012-02-12 09:45:29Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-rendition
+pkgver=4.2.4
+pkgrel=6
+pkgdesc="X.org Rendition video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903')
+conflicts=('xorg-server<1.11.99.903')
+options=('!libtool' '!strip')
+groups=('xorg-drivers' 'xorg')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ rendition-4.2.4-git.patch)
+sha1sums=('16148c25183f7829c22bc9dfdb588c1a16bf4565'
+ 'e023650fa418be9a92d159acd8ac0bc23704dfb3')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i ${srcdir}/rendition-4.2.4-git.patch
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+
+ strip --strip-unneeded "${pkgdir}/usr/lib/xorg/modules/drivers/rendition_drv.so"
+}
diff --git a/testing/xf86-video-rendition/rendition-4.2.4-git.patch b/testing/xf86-video-rendition/rendition-4.2.4-git.patch
new file mode 100644
index 000000000..26cff2fd3
--- /dev/null
+++ b/testing/xf86-video-rendition/rendition-4.2.4-git.patch
@@ -0,0 +1,809 @@
+diff --git a/configure.ac b/configure.ac
+index 5091e50..f74b912 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -20,45 +20,45 @@
+ #
+ # Process this file with autoconf to produce a configure script
+
+-AC_PREREQ(2.57)
++# Initialize Autoconf
++AC_PREREQ([2.60])
+ AC_INIT([xf86-video-rendition],
+- 4.2.4,
++ [4.2.4],
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
+- xf86-video-rendition)
+-
++ [xf86-video-rendition])
+ AC_CONFIG_SRCDIR([Makefile.am])
+-AM_CONFIG_HEADER([config.h])
++AC_CONFIG_HEADERS([config.h])
+ AC_CONFIG_AUX_DIR(.)
+
++# Initialize Automake
+ AM_INIT_AUTOMAKE([foreign dist-bzip2])
+-
+ AM_MAINTAINER_MODE
+
+-# Require xorg-macros: XORG_DEFAULT_OPTIONS
++# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
+ m4_ifndef([XORG_MACROS_VERSION],
+- [m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])])
+-XORG_MACROS_VERSION(1.3)
++ [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
++XORG_MACROS_VERSION(1.8)
+ XORG_DEFAULT_OPTIONS
+
+-# Checks for programs.
++# Initialize libtool
+ AC_DISABLE_STATIC
+ AC_PROG_LIBTOOL
+-AC_PROG_CC
+
+ AH_TOP([#include "xorg-server.h"])
+
++# Define a configure option for an alternate module directory
+ AC_ARG_WITH(xorg-module-dir,
+- AC_HELP_STRING([--with-xorg-module-dir=DIR],
++ AS_HELP_STRING([--with-xorg-module-dir=DIR],
+ [Default xorg module directory [[default=$libdir/xorg/modules]]]),
+ [moduledir="$withval"],
+ [moduledir="$libdir/xorg/modules"])
+
+-# Checks for extensions
++# Store the list of server defined optional extensions in REQUIRED_MODULES
+ XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
+ XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
+ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
+
+-# Checks for pkg-config packages
++# Obtain compiler/linker options for the driver dependencies
+ PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES])
+
+ # Checks for libraries.
+@@ -78,17 +78,16 @@ fi
+ AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
+
+ # Checks for header files.
+-AC_HEADER_STDC
+ AC_CHECK_HEADERS([elf.h] [elf_abi.h])
+
+-AC_SUBST([XORG_CFLAGS])
+ AC_SUBST([moduledir])
+
+ DRIVER_NAME=rendition
+ AC_SUBST([DRIVER_NAME])
+
+-AC_OUTPUT([
+- Makefile
+- src/Makefile
+- man/Makefile
++AC_CONFIG_FILES([
++ Makefile
++ src/Makefile
++ man/Makefile
+ ])
++AC_OUTPUT
+diff --git a/man/Makefile.am b/man/Makefile.am
+index 8f2454b..b3688ce 100644
+--- a/man/Makefile.am
++++ b/man/Makefile.am
+@@ -31,25 +31,11 @@ EXTRA_DIST = @DRIVER_NAME@.man
+
+ CLEANFILES = $(driverman_DATA)
+
+-SED = sed
+-
+-# Strings to replace in man pages
+-XORGRELSTRING = @PACKAGE_STRING@
+- XORGMANNAME = X Version 11
+-
+-MAN_SUBSTS = \
+- -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+- -e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+- -e 's|__xservername__|Xorg|g' \
+- -e 's|__xconfigfile__|xorg.conf|g' \
+- -e 's|__projectroot__|$(prefix)|g' \
+- -e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \
+- -e 's|__drivermansuffix__|$(DRIVER_MAN_SUFFIX)|g' \
+- -e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \
+- -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \
+- -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g'
++
++# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
++
+
+ SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
+
+ .man.$(DRIVER_MAN_SUFFIX):
+- sed $(MAN_SUBSTS) < $< > $@
++ $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+diff --git a/man/rendition.man b/man/rendition.man
+index 3658ab0..afeee91 100644
+--- a/man/rendition.man
++++ b/man/rendition.man
+@@ -1,4 +1,3 @@
+-.\" $__xservername__: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.man,v 1.3 2003/06/18 16:17:39 eich Exp $
+ .\" shorthand for double quote that works everywhere.
+ .ds q \N'34'
+ .TH RENDITION __drivermansuffix__ __vendorversion__
+diff --git a/src/accelX.c b/src/accelX.c
+index a499c56..ed4964e 100644
+--- a/src/accelX.c
++++ b/src/accelX.c
+@@ -289,7 +289,7 @@ int
+ RENDITIONInitUcode(ScrnInfoPtr pScreenInfo)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+- IOADDRESS iob = pRendition->board.io_base;
++ unsigned long iob = pRendition->board.io_base;
+
+ if (0 == verite_getstride(pScreenInfo, NULL,
+ &pRendition->board.mode.stride0,
+@@ -367,7 +367,7 @@ void
+ RENDITIONRestoreUcode(ScrnInfoPtr pScreenInfo)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+- IOADDRESS iob = pRendition->board.io_base;
++ unsigned long iob = pRendition->board.io_base;
+
+ vu8 memend;
+
+@@ -410,7 +410,7 @@ void
+ RENDITIONSaveUcode(ScrnInfoPtr pScreenInfo)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+- IOADDRESS iob = pRendition->board.io_base;
++ unsigned long iob = pRendition->board.io_base;
+ vu8 memend;
+
+ #ifdef DEBUG
+@@ -445,7 +445,7 @@ void
+ RENDITIONSyncV1000(ScrnInfoPtr pScreenInfo)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+- IOADDRESS iob = pRendition->board.io_base;
++ unsigned long iob = pRendition->board.io_base;
+
+ int c;
+
+@@ -555,7 +555,7 @@ RENDITIONSubsequentScreenToScreenCopy(ScrnInfoPtr pScreenInfo,
+ int w, int h)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+- IOADDRESS iob = pRendition->board.io_base;
++ unsigned long iob = pRendition->board.io_base;
+
+
+ #ifdef DEBUG
+@@ -607,7 +607,7 @@ RENDITIONSubsequentSolidFillRect(ScrnInfoPtr pScreenInfo,
+ int x, int y, int w, int h)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+- IOADDRESS iob = pRendition->board.io_base;
++ unsigned long iob = pRendition->board.io_base;
+
+
+ #ifdef DEBUG
+@@ -639,7 +639,7 @@ RENDITIONSubsequentTwoPointLine(ScrnInfoPtr pScreenInfo,
+ int bias)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+- IOADDRESS iob = pRendition->board.io_base;
++ unsigned long iob = pRendition->board.io_base;
+
+
+ #ifdef DEBUG
+diff --git a/src/rendition.c b/src/rendition.c
+index 7a9e18b..3202b49 100644
+--- a/src/rendition.c
++++ b/src/rendition.c
+@@ -330,7 +330,7 @@ renditionProbe(DriverPtr drv, int flags)
+ renditionChipsets, renditionPCIchipsets,
+ devSections, numDevSections, drv, &usedChips);
+
+- xfree(devSections);
++ free(devSections);
+ if (numUsed <= 0)
+ return FALSE;
+
+@@ -359,7 +359,7 @@ renditionProbe(DriverPtr drv, int flags)
+ foundScreen=TRUE;
+ }
+ }
+- xfree(usedChips);
++ free(usedChips);
+ }
+ return foundScreen;
+ }
+@@ -400,7 +400,7 @@ renditionGetRec(ScrnInfoPtr pScreenInfo)
+ sleep(1);
+ #endif
+ if (!pScreenInfo->driverPrivate)
+- pScreenInfo->driverPrivate=xcalloc(sizeof(renditionRec), 1);
++ pScreenInfo->driverPrivate=calloc(sizeof(renditionRec), 1);
+
+ /* perhaps some initialization? <ml> */
+
+@@ -421,7 +421,7 @@ renditionFreeRec(ScrnInfoPtr pScreenInfo)
+ #endif
+ if (xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
+ vgaHWFreeHWRec(pScreenInfo);
+- xfree(pScreenInfo->driverPrivate);
++ free(pScreenInfo->driverPrivate);
+ pScreenInfo->driverPrivate=NULL;
+
+ #ifdef DEBUG
+@@ -596,7 +596,7 @@ renditionPreInit(ScrnInfoPtr pScreenInfo, int flags)
+ /* collect all of the options flags and process them */
+
+ xf86CollectOptions(pScreenInfo, NULL);
+- if (!(pRendition->Options = xalloc(sizeof(renditionOptions))))
++ if (!(pRendition->Options = malloc(sizeof(renditionOptions))))
+ return FALSE;
+ memcpy(pRendition->Options, renditionOptions, sizeof(renditionOptions));
+ xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options,
+@@ -663,7 +663,11 @@ renditionPreInit(ScrnInfoPtr pScreenInfo, int flags)
+ vgaHWGetIOBase(pvgaHW); /* Get VGA I/O base */
+
+ pRendition->board.accel=0;
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+ pRendition->board.vgaio_base = pvgaHW->PIOOffset;
++#else
++ pRendition->board.vgaio_base = 0;
++#endif
+ pRendition->board.io_base = pRendition->board.vgaio_base
+ #ifdef XSERVER_LIBPCIACCESS
+ + pRendition->PciInfo->regions[1].base_addr;
+@@ -1167,7 +1171,7 @@ renditionScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ pRendition->board.shadowPitch
+ = BitmapBytePad(pScreenInfo->bitsPerPixel * width);
+ pRendition->board.shadowPtr
+- = xalloc(pRendition->board.shadowPitch * height);
++ = malloc(pRendition->board.shadowPitch * height);
+ displayWidth = pRendition->board.shadowPitch
+ / (pScreenInfo->bitsPerPixel >> 3);
+ FBBase = pRendition->board.shadowPtr;
+@@ -1484,7 +1488,7 @@ static xf86MonPtr
+ renditionDDC (ScrnInfoPtr pScreenInfo)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+- IOADDRESS iob=pRendition->board.io_base;
++ unsigned long iob=pRendition->board.io_base;
+ vu32 temp;
+
+ xf86MonPtr MonInfo = NULL;
+@@ -1517,7 +1521,7 @@ static unsigned int
+ renditionDDC1Read (ScrnInfoPtr pScreenInfo)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+- IOADDRESS iob=pRendition->board.io_base;
++ unsigned long iob=pRendition->board.io_base;
+ vu32 value = 0;
+
+ /* wait for Vsync */
+diff --git a/src/v1krisc.c b/src/v1krisc.c
+index 2554263..9b7b4e2 100644
+--- a/src/v1krisc.c
++++ b/src/v1krisc.c
+@@ -83,20 +83,20 @@
+ * local function prototypes
+ */
+
+-static void verite_iopoll(IOADDRESS port, vu32 data, vu32 mask);
+-static void verite_iopoll8(IOADDRESS port, vu8 data, vu8 mask);
++static void verite_iopoll(unsigned long port, vu32 data, vu32 mask);
++static void verite_iopoll8(unsigned long port, vu8 data, vu8 mask);
+
+-static vu32 readRF(IOADDRESS io_base, vu8 index);
+-static void writeRF(IOADDRESS io_base, vu8 index, vu32 data);
++static vu32 readRF(unsigned long io_base, vu8 index);
++static void writeRF(unsigned long io_base, vu8 index, vu32 data);
+
+-static vu32 risc_readmem(IOADDRESS io_base, vu32 addr, vu8 read_type);
+-static void risc_writemem(IOADDRESS io_base, vu32 addr, vu32 data, vu8 write_type);
++static vu32 risc_readmem(unsigned long io_base, vu32 addr, vu8 read_type);
++static void risc_writemem(unsigned long io_base, vu32 addr, vu32 data, vu8 write_type);
+
+ #if 0
+-static void risc_step(IOADDRESS io_base, vu32 count);
++static void risc_step(unsigned long io_base, vu32 count);
+ #endif
+-static void risc_forcestep(IOADDRESS io_base, vu32 instruction);
+-static void risc_continue(IOADDRESS io_base);
++static void risc_forcestep(unsigned long io_base, vu32 instruction);
++static void risc_continue(unsigned long io_base);
+
+
+
+@@ -113,7 +113,7 @@ void
+ v1k_start(ScrnInfoPtr pScreenInfo, vu32 pc)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+- IOADDRESS io_base=pRendition->board.io_base;
++ unsigned long io_base=pRendition->board.io_base;
+
+ v1k_stop(pScreenInfo);
+ risc_forcestep(io_base, NOP_INSTR);
+@@ -152,7 +152,7 @@ v1k_stop(ScrnInfoPtr pScreenInfo)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+ vu8 debugreg, statusreg;
+- IOADDRESS io_base=pRendition->board.io_base;
++ unsigned long io_base=pRendition->board.io_base;
+ vu16 STATUS = 0x4A; /* v2x00 io register offset */
+ int c;
+
+@@ -207,7 +207,7 @@ v1k_flushicache(ScrnInfoPtr pScreenInfo)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+ vu32 c, p1, p2;
+- IOADDRESS io_base=pRendition->board.io_base;
++ unsigned long io_base=pRendition->board.io_base;
+
+ /* first flush store accumulation buffers so data is all in memory */
+ p1=risc_readmem(io_base, 0, READ_WORD);
+@@ -255,7 +255,7 @@ void
+ v1k_softreset(ScrnInfoPtr pScreenInfo)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+- IOADDRESS io_base=pRendition->board.io_base;
++ unsigned long io_base=pRendition->board.io_base;
+
+ verite_out8(io_base+DEBUGREG, SOFTRESET|HOLDRISC);
+ verite_out8(io_base+STATEINDEX, STATEINDEX_PC);
+@@ -300,12 +300,12 @@ v1k_getriscprocs(verite_board_desc *boardDesc)
+ */
+
+ /*
+- * static void verite_iopoll(IOADDRESS port, vu32 data, vu32 mask)
++ * static void verite_iopoll(unsigned long port, vu32 data, vu32 mask)
+ *
+ * Loop on IO read until expected data is read or VERITE_MAX_POLLS is reached.
+ */
+ static void
+-verite_iopoll(IOADDRESS port, vu32 data, vu32 mask)
++verite_iopoll(unsigned long port, vu32 data, vu32 mask)
+ {
+ vu32 c;
+
+@@ -320,12 +320,12 @@ verite_iopoll(IOADDRESS port, vu32 data, vu32 mask)
+
+
+ /*
+- * static void verite_iopoll8(IOADDRESS port, vu8 data, vu8 mask)
++ * static void verite_iopoll8(unsigned long port, vu8 data, vu8 mask)
+ *
+ * Loop on IO read until expected data is read or VERITE_MAX_POLLS is reached.
+ */
+ static void
+-verite_iopoll8(IOADDRESS port, vu8 data, vu8 mask)
++verite_iopoll8(unsigned long port, vu8 data, vu8 mask)
+ {
+ vu32 c;
+
+@@ -340,12 +340,12 @@ verite_iopoll8(IOADDRESS port, vu8 data, vu8 mask)
+
+
+ /*
+- * static vu32 readRF(IOADDRESS io_base, vu8 index)
++ * static vu32 readRF(unsigned long io_base, vu8 index)
+ *
+ * Reads data from register file.
+ */
+ static vu32
+-readRF(IOADDRESS io_base, vu8 index)
++readRF(unsigned long io_base, vu8 index)
+ {
+ vu32 data, instr;
+ vu8 debug, stateindex;
+@@ -378,12 +378,12 @@ readRF(IOADDRESS io_base, vu8 index)
+
+
+ /*
+- * static void writeRF(IOADDRESS io_base, vu8 index, vu32 data)
++ * static void writeRF(unsigned long io_base, vu8 index, vu32 data)
+ *
+ * Set RF register, being careful on how to set regs below 64.
+ */
+ static void
+-writeRF(IOADDRESS io_base, vu8 index, vu32 data)
++writeRF(unsigned long io_base, vu8 index, vu32 data)
+ {
+ vu8 special=0;
+
+@@ -417,12 +417,12 @@ writeRF(IOADDRESS io_base, vu8 index, vu32 data)
+
+
+ /*
+- * static vu32 risc_readmem(IOADDRESS io_base, vu32 addr, vu8 read_type)
++ * static vu32 risc_readmem(unsigned long io_base, vu32 addr, vu8 read_type)
+ *
+ * NOTE: Assumes RISC is in hold mode.
+ */
+ static vu32
+-risc_readmem(IOADDRESS io_base, vu32 addr, vu8 read_type)
++risc_readmem(unsigned long io_base, vu32 addr, vu8 read_type)
+ {
+ vu32 data;
+
+@@ -445,12 +445,12 @@ risc_readmem(IOADDRESS io_base, vu32 addr, vu8 read_type)
+
+
+ /*
+- * static vu32 risc_writemem(IOADDRESS io_base, vu32 addr, vu32 data, vu8 write_type)
++ * static vu32 risc_writemem(unsigned long io_base, vu32 addr, vu32 data, vu8 write_type)
+ *
+ * NOTE: Assumes RISC is in hold mode.
+ */
+ static void
+-risc_writemem(IOADDRESS io_base, vu32 addr, vu32 data, vu8 write_type)
++risc_writemem(unsigned long io_base, vu32 addr, vu32 data, vu8 write_type)
+ {
+ writeRF(io_base, RISC_RA, addr); /* point to memory */
+ writeRF(io_base, RISC_FP, data); /* set data */
+@@ -466,12 +466,12 @@ risc_writemem(IOADDRESS io_base, vu32 addr, vu32 data, vu8 write_type)
+
+ #if 0
+ /*
+- * static void risc_step(IOADDRESS io_base, vu32 count)
++ * static void risc_step(unsigned long io_base, vu32 count)
+ *
+ * Single step the RISC. NOTE: Do not force instruction into RISCIR!
+ */
+ static void
+-risc_step(IOADDRESS io_base, vu32 count)
++risc_step(unsigned long io_base, vu32 count)
+ {
+ vu32 c, d;
+ vu8 debugreg;
+@@ -494,12 +494,12 @@ risc_step(IOADDRESS io_base, vu32 count)
+
+
+ /*
+- * static void risc_forcestep(IOADDRESS io_base, vu32 instruction)
++ * static void risc_forcestep(unsigned long io_base, vu32 instruction)
+ *
+ * Single step RISC; force instruction; assumes RISC held.
+ */
+ static void
+-risc_forcestep(IOADDRESS io_base, vu32 instruction)
++risc_forcestep(unsigned long io_base, vu32 instruction)
+ {
+ vu32 c;
+ vu8 debugreg, stateindex;
+@@ -525,12 +525,12 @@ risc_forcestep(IOADDRESS io_base, vu32 instruction)
+
+
+ /*
+- * static void risc_continue(IOADDRESS io_base)
++ * static void risc_continue(unsigned long io_base)
+ *
+ * Turn off hold bit.
+ */
+ static void
+-risc_continue(IOADDRESS io_base)
++risc_continue(unsigned long io_base)
+ {
+ vu8 debugreg;
+
+diff --git a/src/vboard.c b/src/vboard.c
+index 49499e2..622715f 100644
+--- a/src/vboard.c
++++ b/src/vboard.c
+@@ -38,7 +38,7 @@ verite_initboard(ScrnInfoPtr pScreenInfo)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+
+- IOADDRESS iob=pRendition->board.io_base;
++ unsigned long iob=pRendition->board.io_base;
+ vu8 *vmb;
+ vu32 offset;
+ vu8 memendian;
+@@ -207,7 +207,7 @@ void
+ verite_check_csucode(ScrnInfoPtr pScreenInfo)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+- IOADDRESS iob=pRendition->board.io_base;
++ unsigned long iob=pRendition->board.io_base;
+ vu8 *vmb;
+ vu32 offset;
+ int c;
+diff --git a/src/vgafont-std.data b/src/vgafont-std.data
+index db63ea8..c47983f 100644
+--- a/src/vgafont-std.data
++++ b/src/vgafont-std.data
+@@ -1,4 +1,3 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vgafont-std.data,v 1.3 1999/10/13 04:21:22 dawes Exp $ */
+ #ifndef __VGAFONT_STD__
+ #define __VGAFONT_STD__
+
+diff --git a/src/vgafont-vrx.data b/src/vgafont-vrx.data
+index ad34582..23b5908 100644
+--- a/src/vgafont-vrx.data
++++ b/src/vgafont-vrx.data
+@@ -1,4 +1,3 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vgafont-vrx.data,v 1.3 1999/10/13 04:21:23 dawes Exp $ */
+ #ifndef __VGAFONT_VRX__
+ #define __VGAFONT_VRX__
+
+diff --git a/src/vgapalette.data b/src/vgapalette.data
+index 5267608..106028d 100644
+--- a/src/vgapalette.data
++++ b/src/vgapalette.data
+@@ -1,4 +1,3 @@
+-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vgapalette.data,v 1.3 1999/10/13 04:21:23 dawes Exp $ */
+ #ifndef __VGAPALETTE__
+ #define __VGAPALETTE__
+
+diff --git a/src/vloaduc.c b/src/vloaduc.c
+index 67bf901..5c6aab0 100644
+--- a/src/vloaduc.c
++++ b/src/vloaduc.c
+@@ -103,7 +103,7 @@ verite_load_ucfile(ScrnInfoPtr pScreenInfo, char *file_name)
+ sz=SW16(ehdr.e_phentsize);
+ num=SW16(ehdr.e_phnum);
+ if (0!=sz && 0!=num) {
+- orig_pphdr=pphdr=(Elf32_Phdr *)xalloc(sz*num);
++ orig_pphdr=pphdr=(Elf32_Phdr *)malloc(sz*num);
+ if (!pphdr) {
+ ErrorF("RENDITION: Cannot allocate global memory (1)\n");
+ close(fd);
+@@ -125,7 +125,7 @@ verite_load_ucfile(ScrnInfoPtr pScreenInfo, char *file_name)
+ sz=SW16(ehdr.e_shentsize);
+ num=SW16(ehdr.e_shnum);
+ if (0!=sz && 0!=num) {
+- orig_pshdr=pshdr=(Elf32_Shdr *)xalloc(sz*num);
++ orig_pshdr=pshdr=(Elf32_Shdr *)malloc(sz*num);
+ if (!pshdr) {
+ ErrorF("RENDITION: Cannot allocate global memory (2)\n");
+ close(fd);
+@@ -148,7 +148,7 @@ verite_load_ucfile(ScrnInfoPtr pScreenInfo, char *file_name)
+ loadSegment2board(pScreenInfo, fd, pphdr);
+ pphdr=(Elf32_Phdr *)(((char *)pphdr)+sz);
+ } while (--num);
+- xfree(orig_pphdr);
++ free(orig_pphdr);
+ }
+ else {
+ do {
+@@ -158,7 +158,7 @@ verite_load_ucfile(ScrnInfoPtr pScreenInfo, char *file_name)
+ loadSection2board(pScreenInfo, fd, pshdr);
+ pshdr=(Elf32_Shdr *)(((char *)pshdr)+sz);
+ } while (--num) ;
+- xfree(orig_pshdr);
++ free(orig_pshdr);
+ }
+ close(fd);
+
+@@ -195,7 +195,7 @@ loadSegment2board(ScrnInfoPtr pScreenInfo, int fd, Elf32_Phdr *phdr)
+ return;
+ }
+
+- data=(vu8 *)xalloc(size);
++ data=(vu8 *)malloc(size);
+ if (NULL == data){
+ ErrorF("RENDITION: GlobalAllocPtr couldn't allocate %lx bytes",
+ (unsigned long)size);
+@@ -210,7 +210,7 @@ loadSegment2board(ScrnInfoPtr pScreenInfo, int fd, Elf32_Phdr *phdr)
+
+ mmve(pScreenInfo, size, data, physAddr);
+
+- xfree(data);
++ free(data);
+ }
+
+
+diff --git a/src/vmodes.c b/src/vmodes.c
+index c0bd0df..f2dae0b 100644
+--- a/src/vmodes.c
++++ b/src/vmodes.c
+@@ -20,6 +20,7 @@
+ #include "v1kregs.h"
+ #include "v2kregs.h"
+
++#include <unistd.h>
+
+ #undef DEBUG
+
+@@ -201,7 +202,7 @@ struct V1000ClocksStr {
+ * local function prototypes
+ */
+
+-static void set_PLL(IOADDRESS iob, vu32 value);
++static void set_PLL(unsigned long iob, vu32 value);
+ static double V1000CalcClock(double target, int *M, int *N, int *P);
+ static double V2200CalcClock(double target, int *m, int *n, int *p);
+
+@@ -509,13 +510,13 @@ verite_getstride(ScrnInfoPtr pScreenInfo, int *width,
+ */
+
+ /*
+- * void set_PLL(IOADDRESS iob, vu32 value)
++ * void set_PLL(unsigned long iob, vu32 value)
+ *
+ * Set PLL clock to desired frequency for the V1000.
+ */
+
+ void
+-set_PLL(IOADDRESS iob, vu32 value)
++set_PLL(unsigned long iob, vu32 value)
+ {
+ vu32 ulD;
+ int b;
+diff --git a/src/vos.h b/src/vos.h
+index 7b55f77..999c870 100644
+--- a/src/vos.h
++++ b/src/vos.h
+@@ -23,18 +23,18 @@
+ /*
+ * function prototypes
+ */
+-#define /*void*/ verite_out8(/*IOADDRESS*/ port, /*vu8*/ data) \
++#define /*void*/ verite_out8(/*unsigned long*/ port, /*vu8*/ data) \
+ outb(port, data)
+
+-#define /*void*/ verite_out16(/*IOADDRESS*/ port, /*vu16*/ data) \
++#define /*void*/ verite_out16(/*unsigned long*/ port, /*vu16*/ data) \
+ outw(port, data)
+
+-#define /*void*/ verite_out32(/*IOADDRESS*/ port, /*vu32*/ data) \
++#define /*void*/ verite_out32(/*unsigned long*/ port, /*vu32*/ data) \
+ outl(port, data)
+
+-#define /*vu8*/ verite_in8(/*IOADDRESS*/ io_base) ((vu8)inb(io_base))
+-#define /*vu16*/ verite_in16(/*IOADDRESS*/ io_base) ((vu16)inw(io_base))
+-#define /*vu32*/ verite_in32(/*IOADDRESS*/ io_base) ((vu32)inl(io_base))
++#define /*vu8*/ verite_in8(/*unsigned long*/ io_base) ((vu8)inb(io_base))
++#define /*vu16*/ verite_in16(/*unsigned long*/ io_base) ((vu16)inw(io_base))
++#define /*vu32*/ verite_in32(/*unsigned long*/ io_base) ((vu32)inl(io_base))
+
+ /* memory accesses */
+ #define verite_read_memory32(base, offset) MMIO_IN32(base, offset)
+diff --git a/src/vramdac.c b/src/vramdac.c
+index 7c8acbd..21c1df7 100644
+--- a/src/vramdac.c
++++ b/src/vramdac.c
+@@ -93,11 +93,11 @@
+ * local function prototypes
+ */
+
+-static void Bt485_write_masked(IOADDRESS port, vu8 reg, vu8 mask, vu8 data);
+-static void Bt485_write_cmd3_masked(IOADDRESS port, vu8 mask, vu8 data);
++static void Bt485_write_masked(unsigned long port, vu8 reg, vu8 mask, vu8 data);
++static void Bt485_write_cmd3_masked(unsigned long port, vu8 mask, vu8 data);
+ #if 0
+-static vu8 Bt485_read_masked(IOADDRESS port, vu8 reg, vu8 mask);
+-static vu8 Bt485_read_cmd3_masked(IOADDRESS port, vu8 mask);
++static vu8 Bt485_read_masked(unsigned long port, vu8 reg, vu8 mask);
++static vu8 Bt485_read_cmd3_masked(unsigned long port, vu8 mask);
+ #endif
+
+ /*
+@@ -159,7 +159,7 @@ int
+ verite_initdac(ScrnInfoPtr pScreenInfo, vu8 bpp, vu8 doubleclock)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+- IOADDRESS iob=pRendition->board.io_base+RAMDACBASEADDR;
++ unsigned long iob=pRendition->board.io_base+RAMDACBASEADDR;
+ vu8 cmd0,cmd1,cmd2;
+ vu8 cmd3_data=0;
+
+@@ -271,7 +271,7 @@ verite_enablecursor(ScrnInfoPtr pScreenInfo, int type, int size)
+ BT485_3_COLOR_CURSOR, BT485_X_WINDOW_CURSOR };
+ static vu8 csizes[]={ BT485_32_BY_32_CURSOR, BT485_64_BY_64_CURSOR };
+
+- IOADDRESS iob=pRendition->board.io_base+RAMDACBASEADDR;
++ unsigned long iob=pRendition->board.io_base+RAMDACBASEADDR;
+
+ #ifdef DEBUG
+ ErrorF ("Rendition: Debug verite_enablecursor called type=0x%x\n",type);
+@@ -304,7 +304,7 @@ void
+ verite_movecursor(ScrnInfoPtr pScreenInfo, vu16 x, vu16 y, vu8 xo, vu8 yo)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+- IOADDRESS iob=pRendition->board.io_base+RAMDACBASEADDR;
++ unsigned long iob=pRendition->board.io_base+RAMDACBASEADDR;
+
+ x+=Cursor_size-xo;
+ y+=Cursor_size-yo;
+@@ -327,7 +327,7 @@ void
+ verite_setcursorcolor(ScrnInfoPtr pScreenInfo, vu32 fg, vu32 bg)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+- IOADDRESS iob=pRendition->board.io_base+RAMDACBASEADDR;
++ unsigned long iob=pRendition->board.io_base+RAMDACBASEADDR;
+
+ #ifdef DEBUG
+ ErrorF ("Rendition: Debug verite_setcursorcolor called FG=0x%x BG=0x%x\n",
+@@ -374,7 +374,7 @@ verite_loadcursor(ScrnInfoPtr pScreenInfo, vu8 size, vu8 *cursorimage)
+ int c, bytes, row;
+ vu8 *src = cursorimage;
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+- IOADDRESS iob=pRendition->board.io_base+RAMDACBASEADDR;
++ unsigned long iob=pRendition->board.io_base+RAMDACBASEADDR;
+ vu8 tmp;
+ vu8 memend; /* Added for byte-swap fix */
+
+@@ -454,7 +454,7 @@ verite_setpalette(ScrnInfoPtr pScreenInfo, int numColors, int *indices,
+ LOCO *colors, VisualPtr pVisual)
+ {
+ renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
+- IOADDRESS iob=pRendition->board.io_base;
++ unsigned long iob=pRendition->board.io_base;
+ vu32 crtc_status;
+ int i, index;
+
+@@ -485,12 +485,12 @@ verite_setpalette(ScrnInfoPtr pScreenInfo, int numColors, int *indices,
+ */
+
+ /*
+- * static void Bt485_write_masked(IOADDRESS port, vu8 reg, vu8 mask, vu8 data)
++ * static void Bt485_write_masked(unsigned long port, vu8 reg, vu8 mask, vu8 data)
+ *
+ *
+ */
+ static void
+-Bt485_write_masked(IOADDRESS port, vu8 reg, vu8 mask, vu8 data)
++Bt485_write_masked(unsigned long port, vu8 reg, vu8 mask, vu8 data)
+ {
+ vu8 tmp;
+
+@@ -501,12 +501,12 @@ Bt485_write_masked(IOADDRESS port, vu8 reg, vu8 mask, vu8 data)
+
+
+ /*
+- * static void Bt485_write_cmd3_masked(IOADDRESS port, vu8 mask, vu8 data)
++ * static void Bt485_write_cmd3_masked(unsigned long port, vu8 mask, vu8 data)
+ *
+ *
+ */
+ static void
+-Bt485_write_cmd3_masked(IOADDRESS port, vu8 mask, vu8 data)
++Bt485_write_cmd3_masked(unsigned long port, vu8 mask, vu8 data)
+ {
+ /*
+ * Bt485_write_masked(port, BT485_COMMAND_REG_0, 0x7f, 0x80);
+@@ -522,24 +522,24 @@ Bt485_write_cmd3_masked(IOADDRESS port, vu8 mask, vu8 data)
+
+ #if 0
+ /*
+- * static vu8 Bt485_read_masked(IOADDRESS port, vu8 reg, vu8 mask)
++ * static vu8 Bt485_read_masked(unsigned long port, vu8 reg, vu8 mask)
+ *
+ *
+ */
+ static vu8
+-Bt485_read_masked(IOADDRESS port, vu8 reg, vu8 mask)
++Bt485_read_masked(unsigned long port, vu8 reg, vu8 mask)
+ {
+ return verite_in8(port+reg)&mask;
+ }
+
+
+ /*
+- * static vu8 Bt485_read_cmd3_masked(IOADDRESS port, vu8 mask)
++ * static vu8 Bt485_read_cmd3_masked(unsigned long port, vu8 mask)
+ *
+ *
+ */
+ static vu8
+-Bt485_read_cmd3_masked(IOADDRESS port, vu8 mask)
++Bt485_read_cmd3_masked(unsigned long port, vu8 mask)
+ {
+ vu8 value;
+
+diff --git a/src/vtypes.h b/src/vtypes.h
+index 257870b..e4ad468 100644
+--- a/src/vtypes.h
++++ b/src/vtypes.h
+@@ -123,7 +123,7 @@ struct verite_board_t {
+ vu16 chip;
+
+ /* */
+- IOADDRESS io_base, vgaio_base;
++ unsigned long io_base, vgaio_base;
+ vu32 mmio_base;
+ vu32 vmmio_base;
+ vu32 mem_size;
diff --git a/testing/xf86-video-s3/LICENSE b/testing/xf86-video-s3/LICENSE
new file mode 100644
index 000000000..a4c8d5dd4
--- /dev/null
+++ b/testing/xf86-video-s3/LICENSE
@@ -0,0 +1,25 @@
+This package was downloaded from
+http://xorg.freedesktop.org/releases/individual/driver/
+
+ Copyright 2001 Ani Joshi <ajoshi@unixbox.com>
+
+ XFree86 4.x driver for S3 chipsets
+
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting documentation and
+that the name of Ani Joshi not be used in advertising or
+publicity pertaining to distribution of the software without specific,
+written prior permission. Ani Joshi makes no representations
+about the suitability of this software for any purpose. It is provided
+"as-is" without express or implied warranty.
+
+ANI JOSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL ANI JOSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
diff --git a/testing/xf86-video-s3/PKGBUILD b/testing/xf86-video-s3/PKGBUILD
new file mode 100644
index 000000000..969a50529
--- /dev/null
+++ b/testing/xf86-video-s3/PKGBUILD
@@ -0,0 +1,35 @@
+# $Id: PKGBUILD 150063 2012-02-12 09:45:32Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-s3
+pkgver=0.6.3
+pkgrel=7
+pkgdesc="X.org S3 video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903')
+conflicts=('xorg-server<1.11.99.903')
+options=('!libtool')
+groups=('xorg-drivers' 'xorg')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ git-fixes.patch)
+md5sums=('5eb06d88533fb327d067928faeb20860'
+ '77a455ce7e254c73b1cbd408c7f4ecf4')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i "${srcdir}/git-fixes.patch"
+ autoreconf -fi
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+}
diff --git a/testing/xf86-video-s3/git-fixes.patch b/testing/xf86-video-s3/git-fixes.patch
new file mode 100644
index 000000000..712b3c9c0
--- /dev/null
+++ b/testing/xf86-video-s3/git-fixes.patch
@@ -0,0 +1,458 @@
+diff --git a/COPYING b/COPYING
+index 7f33cbf..458ab5f 100644
+--- a/COPYING
++++ b/COPYING
+@@ -1,12 +1,70 @@
+-This is a stub file. This package has not yet had its complete licensing
+-information compiled. Please see the individual source files for details on
+-your rights to use and modify this software.
++ Copyright 2001 Ani Joshi <ajoshi@unixbox.com>
+
+-Please submit updated COPYING files to the Xorg bugzilla:
++ XFree86 4.x driver for S3 chipsets
+
+-https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
+
+-All licensing questions regarding this software should be directed at the
+-Xorg mailing list:
++Permission to use, copy, modify, distribute, and sell this software and its
++documentation for any purpose is hereby granted without fee, provided that
++the above copyright notice appear in all copies and that both that copyright
++notice and this permission notice appear in supporting documentation and
++that the name of Ani Joshi not be used in advertising or
++publicity pertaining to distribution of the software without specific,
++written prior permission. Ani Joshi makes no representations
++about the suitability of this software for any purpose. It is provided
++"as-is" without express or implied warranty.
++
++ANI JOSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
++INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
++EVENT SHALL ANI JOSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR
++CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
++DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
++TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
++PERFORMANCE OF THIS SOFTWARE.
++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.
++
++Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
++
++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 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, FIT-
++NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
++XFREE86 PROJECT 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.
++
++Except as contained in this notice, the name of the XFree86 Project shall not
++be used in advertising or otherwise to promote the sale, use or other dealings
++in this Software without prior written authorization from the XFree86 Project.
++
++
++Copyright 1995-1997 The XFree86 Project, Inc.
++Copyright (c) 1999,2000 The XFree86 Project Inc.
+
+-http://lists.freedesktop.org/mailman/listinfo/xorg
+diff --git a/ChangeLog b/ChangeLog
+deleted file mode 100644
+index ad0b227..0000000
+--- a/ChangeLog
++++ /dev/null
+@@ -1,133 +0,0 @@
+-2009-06-25 Evgeny M. zubok <evgeny.zubok@tochka.ru>
+-
+- * src/s3_driver.c:
+- Revert the old behaviour when the BIOS settings are used for
+- intialization of DRAM/VRAM timings, i. e. we don't touch the
+- timings during initialization phase until any memory option (like
+- slow_edodram) is specified.
+-
+- Add manual page.
+-
+-2009-05-25 Evgeny M. Zubok <evgeny.zubok@tochka.ru>
+-
+- * src/s3_driver.c:
+- * src/s3_video.c:
+-
+- Enable Xv extension for Trio64V+ (thanks to Egor Ivanov for
+- testing on real hardware) and Trio64UV+ (Tested only on Trio64V2 by
+- overriding Chipset with "Trio64UV+" but not on real hardware).
+-
+- S3 Trio64V+ now using NewMMIO. Trio64V+ chips have the same ChipId
+- as Trio32/64 but only with chip revision greater or eq 0x40. So if
+- you have problems with NewMMIO, you may override ChipRev in "Device"
+- section of your xorg.conf: "ChipRev" 0x00. Note: disabling the NewMMIO
+- also disables overlay video (Xv) because it isn't implemented for
+- Old MMIO yet.
+-
+-2009-05-04 Evgeny M. Zubok <evgeny.zubok@tochka.ru>
+-
+- * src/s3_driver.c:
+- * src/s3_shadow.c:
+-
+- Add shadowFB option. It can be used to speedup drawing when
+- hardware acceleration is undesirable or unavailable (for colour depth
+- 24 with 24 bpp framebuffer, for example). shadowFB is disabled by
+- default. Enabling shadowFB option disables HW acceleration. Thanks
+- to Egor Ivanov for initial porting of shadowFB from s3virge.
+-
+- Interlace mode support.
+-
+- Close bug #14999.
+-
+-2008-07-06 Evgeny M. Zubok <evgeny.zubok@tochka.ru>
+-
+- * src/s3_video.c:
+-
+- Streams Processor initialization.
+-
+- XVideo support for 16, 24 and 32 bpp (only for TRIO64V2).
+-
+- * src/s3_driver.c:
+-
+- Add XVideo option (enabled by default).
+-
+- Replace "swcursor" by "hwcursor" option (HW cursor
+- not implemented yet for all chipsets).
+-
+- Close bug #5527: 24-bit colour depth support (24bpp and
+- 32bpp framebuffer) for TRIOs. Acceleration doesn't work
+- with packed colour mode (24 bpp FB) but works with 32bpp
+- framebuffer mode (hardware limitation? -- need data).
+-
+- Fix system hang-up when switching between console and X session.
+-
+- Some minor changes of driver messages.
+-
+-2008-02-23 Evgeny M. Zubok <evgeny.zubok@tochka.ru>
+-
+- * src/s3_driver.c: Add DPMS support for S3 Trio64V2 and possibly
+- others (need testing): S3 Trio64UV+. S3 Aurora64V+ and S3 Trio32/64
+- * src/s3_Trio64DAC: Change clocks for S3 Trio64V2 to make
+- the 1024x768@16bpp mode work.
+- Thanks to Richard Driscoll for these patches.
+-
+-2006-04-07 Adam Jackson <ajax@freedesktop.org>
+-
+- * configure.ac:
+- * src/s3.h:
+- Bump to 0.4.1 for Xv changes.
+-
+-2006-04-07 Aaron Plattner <aplattner@nvidia.com>
+-
+- * src/s3_video.c: (S3PutImage):
+- Add a DrawablePtr argument to the XV functions to pave the way for
+- redirected video.
+-
+-2006-04-07 Adam Jackson <ajax@freedesktop.org>
+-
+- * configure.ac:
+- * src/s3.h:
+- * src/s3_IBMRGB.c:
+- * src/s3_Ti.c:
+- * src/s3_Trio64DAC.c:
+- * src/s3_bios.c:
+- * src/s3_cursor.c:
+- * src/s3_dga.c:
+- * src/s3_driver.c:
+- * src/s3_video.c:
+- Unlibcwrap. Bump server version requirement. Bump to 0.4.0.
+-
+-2005-12-20 Kevin E. Martin <kem-at-freedesktop-dot-org>
+-
+- * configure.ac:
+- Update package version for X11R7 release.
+-
+-2005-12-14 Kevin E. Martin <kem-at-freedesktop-dot-org>
+-
+- * configure.ac:
+- Update package version number for final X11R7 release candidate.
+-
+-2005-12-03 Kevin E. Martin <kem-at-freedesktop-dot-org>
+-
+- * configure.ac:
+- Update package version number for X11R7 RC3 release.
+-
+-2005-12-01 Kevin E. Martin <kem-at-freedesktop-dot-org>
+-
+- * configure.ac:
+- Remove extraneous AC_MSG_RESULT.
+-
+-2005-11-29 Adam Jackson <ajax@freedesktop.org>
+-
+- * configure.ac:
+- Only build dlloader modules by default.
+-
+-2005-11-09 Kevin E. Martin <kem-at-freedesktop-dot-org>
+-
+- * configure.ac:
+- Update package version number for X11R7 RC2 release.
+-
+-2005-11-01 Kevin E. Martin <kem-at-freedesktop-dot-org>
+-
+- * configure.ac:
+- Update pkgcheck dependencies to work with separate build roots.
+diff --git a/Makefile.am b/Makefile.am
+index 7052905..4c278ba 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -18,5 +18,15 @@
+ # 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.
+
+-AUTOMAKE_OPTIONS = foreign
+ SUBDIRS = src man
++MAINTAINERCLEANFILES = ChangeLog INSTALL
++
++.PHONY: ChangeLog INSTALL
++
++INSTALL:
++ $(INSTALL_CMD)
++
++ChangeLog:
++ $(CHANGELOG_CMD)
++
++dist-hook: ChangeLog INSTALL
+diff --git a/configure.ac b/configure.ac
+index 0eecc87..0ac34f9 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -20,42 +20,50 @@
+ #
+ # Process this file with autoconf to produce a configure script
+
+-AC_PREREQ(2.57)
++# Initialize Autoconf
++AC_PREREQ([2.60])
+ AC_INIT([xf86-video-s3],
+- 0.6.3,
++ [0.6.3],
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
+- xf86-video-s3)
+-
++ [xf86-video-s3])
+ AC_CONFIG_SRCDIR([Makefile.am])
+-AM_CONFIG_HEADER([config.h])
++AC_CONFIG_HEADERS([config.h])
+ AC_CONFIG_AUX_DIR(.)
+
+-AM_INIT_AUTOMAKE([dist-bzip2])
+-
++# Initialize Automake
++AM_INIT_AUTOMAKE([foreign dist-bzip2])
+ AM_MAINTAINER_MODE
+
+-# Checks for programs.
++# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
++m4_ifndef([XORG_MACROS_VERSION],
++ [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
++XORG_MACROS_VERSION(1.8)
++XORG_DEFAULT_OPTIONS
++
++# Initialize libtool
+ AC_DISABLE_STATIC
+ AC_PROG_LIBTOOL
+-AC_PROG_CC
++
++# Checks for programs.
++AM_PROG_CC_C_O
+
+ AH_TOP([#include "xorg-server.h"])
+
++# Define a configure option for an alternate module directory
+ AC_ARG_WITH(xorg-module-dir,
+- AC_HELP_STRING([--with-xorg-module-dir=DIR],
++ AS_HELP_STRING([--with-xorg-module-dir=DIR],
+ [Default xorg module directory [[default=$libdir/xorg/modules]]]),
+ [moduledir="$withval"],
+ [moduledir="$libdir/xorg/modules"])
+
+-# Checks for extensions
++# Store the list of server defined optional extensions in REQUIRED_MODULES
+ XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
+ XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
+ XORG_DRIVER_CHECK_EXT(XV, videoproto)
+ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
+
+-# Checks for pkg-config packages
++# Obtain compiler/linker options for the driver dependencies
+ PKG_CHECK_MODULES(XORG, [xorg-server >= 1.4 xproto fontsproto $REQUIRED_MODULES])
+-sdkdir=$(pkg-config --variable=sdkdir xorg-server)
+
+ # Checks for libraries.
+ SAVE_CPPFLAGS="$CPPFLAGS"
+@@ -65,28 +73,20 @@ AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
+ [#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])
+
+ DRIVER_NAME=s3
+ AC_SUBST([DRIVER_NAME])
+
+-XORG_MANPAGE_SECTIONS
+-XORG_RELEASE_VERSION
+-
+-XORG_CHECK_LINUXDOC
+-
+-AC_OUTPUT([
+- Makefile
+- src/Makefile
+- man/Makefile
++AC_CONFIG_FILES([
++ Makefile
++ src/Makefile
++ man/Makefile
+ ])
++AC_OUTPUT
+diff --git a/man/Makefile.am b/man/Makefile.am
+index f0eb29b..b3688ce 100644
+--- a/man/Makefile.am
++++ b/man/Makefile.am
+@@ -1,27 +1,24 @@
+ #
+ # Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+-#
+-# Permission to use, copy, modify, distribute, and sell this software and its
+-# documentation for any purpose is hereby granted without fee, provided that
+-# the above copyright notice appear in all copies and that both that
+-# copyright notice and this permission notice appear in supporting
+-# documentation.
+-#
+-# The above copyright notice and this permission notice 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 OPEN GROUP 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.
+-#
+-# Except as contained in this notice, the name of the copyright holders shall
+-# not be used in advertising or otherwise to promote the sale, use or
+-# other dealings in this Software without prior written authorization
+-# from the copyright holders.
++#
++# 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.
+ #
+
+ drivermandir = $(DRIVER_MAN_DIR)
+@@ -34,25 +31,11 @@ EXTRA_DIST = @DRIVER_NAME@.man
+
+ CLEANFILES = $(driverman_DATA)
+
+-SED = sed
+
+-# Strings to replace in man pages
+-XORGRELSTRING = @PACKAGE_STRING@
+- XORGMANNAME = X Version 11
++# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+
+-MAN_SUBSTS = \
+- -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+- -e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+- -e 's|__xservername__|Xorg|g' \
+- -e 's|__xconfigfile__|xorg.conf|g' \
+- -e 's|__projectroot__|$(prefix)|g' \
+- -e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \
+- -e 's|__drivermansuffix__|$(DRIVER_MAN_SUFFIX)|g' \
+- -e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \
+- -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \
+- -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g'
+
+ SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
+
+ .man.$(DRIVER_MAN_SUFFIX):
+- sed $(MAN_SUBSTS) < $< > $@
++ $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+diff --git a/src/s3.h b/src/s3.h
+index 49b8a54..0875fc9 100644
+--- a/src/s3.h
++++ b/src/s3.h
+@@ -113,7 +113,6 @@ typedef struct _S3Rec {
+ XAAInfoRecPtr pXAA;
+ xf86CursorInfoPtr pCurs;
+ xf86Int10InfoPtr pInt10;
+- vbeInfoPtr pVBE;
+ XF86VideoAdaptorPtr adaptor;
+ S3PortPrivPtr portPrivate;
+
+diff --git a/src/s3_driver.c b/src/s3_driver.c
+index 29e343d..4519b33 100644
+--- a/src/s3_driver.c
++++ b/src/s3_driver.c
+@@ -309,6 +309,7 @@ static Bool S3PreInit(ScrnInfoPtr pScrn, int flags)
+ S3Ptr pS3;
+ vgaHWPtr hwp;
+ ClockRangePtr clockRanges;
++ vbeInfoPtr pVBE;
+ rgb zeros = {0, 0, 0};
+ Gamma gzeros = {0.0, 0.0, 0.0};
+ int i, vgaCRIndex, vgaCRReg;
+@@ -436,7 +437,8 @@ static Bool S3PreInit(ScrnInfoPtr pScrn, int flags)
+ }
+
+ if (xf86LoadSubModule(pScrn, "vbe")) {
+- pS3->pVBE = VBEInit(pS3->pInt10, pEnt->index);
++ pVBE = VBEInit(pS3->pInt10, pEnt->index);
++ vbeFree(pVBE);
+ }
+
+ if (pS3->shadowFB) {
diff --git a/testing/xf86-video-s3virge/PKGBUILD b/testing/xf86-video-s3virge/PKGBUILD
new file mode 100644
index 000000000..04d446f53
--- /dev/null
+++ b/testing/xf86-video-s3virge/PKGBUILD
@@ -0,0 +1,38 @@
+# $Id: PKGBUILD 150065 2012-02-12 09:45:34Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+# Contributor: Alexander Baldeck <alexander@archlinux.org>
+
+pkgname=xf86-video-s3virge
+pkgver=1.10.4
+pkgrel=7
+pkgdesc="X.org S3 Virge video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('pkgconfig' 'xorg-server-devel>=1.11.99.903')
+conflicts=('xorg-server<1.11.99.903')
+options=(!libtool)
+groups=('xorg-drivers' 'xorg')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ copyright.patch
+ s3virge-1.10.4-vga.patch)
+md5sums=('6517bbbf808c700502d51acdc44662f8'
+ 'f91fb259e3632fb9130fcbe69ecd9d6a'
+ '45c7d912734c9f7dfc1f42077827cb8e')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i "${srcdir}/copyright.patch"
+ patch -Np1 -i ${srcdir}/s3virge-1.10.4-vga.patch
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-s3virge/copyright.patch b/testing/xf86-video-s3virge/copyright.patch
new file mode 100644
index 000000000..ba988c6d6
--- /dev/null
+++ b/testing/xf86-video-s3virge/copyright.patch
@@ -0,0 +1,82 @@
+From c26da404906258951341c4c4ace793f2dfdc47f8 Mon Sep 17 00:00:00 2001
+From: Gaetan Nadon <memsize@videotron.ca>
+Date: Sun, 13 Jun 2010 14:26:32 +0000
+Subject: COPYING: update file with Copyright notices from source code.
+
+Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+---
+diff --git a/COPYING b/COPYING
+index 7f33cbf..727ca51 100644
+--- a/COPYING
++++ b/COPYING
+@@ -1,12 +1,60 @@
+-This is a stub file. This package has not yet had its complete licensing
+-information compiled. Please see the individual source files for details on
+-your rights to use and modify this software.
++Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+
+-Please submit updated COPYING files to the Xorg bugzilla:
++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:
+
+-https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
++The above copyright notice and this permission notice shall be included in all
++copies or substantial portions of the Software.
+
+-All licensing questions regarding this software should be directed at the
+-Xorg mailing list:
++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
++NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
++XFREE86 PROJECT 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.
++
++Except as contained in this notice, the name of the XFree86 Project shall not
++be used in advertising or otherwise to promote the sale, use or other dealings
++in this Software without prior written authorization from the XFree86 Project.
++
++Written by Jake Richter Copyright (c) 1989, 1990 Panacea Inc., Londonderry,
++NH - All Rights Reserved
++
++This code may be freely incorporated in any program without royalty, as long
++as the copyright notice stays intact.
++
++Additions by Kevin E. Martin (martin@cs.unc.edu)
++
++KEVIN E. MARTIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
++INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
++EVENT SHALL KEVIN E. MARTIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
++CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
++USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
++OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
++PERFORMANCE OF THIS SOFTWARE.
++
++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.
+
+-http://lists.freedesktop.org/mailman/listinfo/xorg
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/testing/xf86-video-s3virge/s3virge-1.10.4-vga.patch b/testing/xf86-video-s3virge/s3virge-1.10.4-vga.patch
new file mode 100644
index 000000000..3fb1fd6cf
--- /dev/null
+++ b/testing/xf86-video-s3virge/s3virge-1.10.4-vga.patch
@@ -0,0 +1,76 @@
+From 92b4671ca75022a56ad9e85b347f81c12157c98f Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Wed, 16 Nov 2011 19:58:29 +0000
+Subject: Adapt to missing PIOOffset in videoabi 12
+
+Signed-off-by: Adam Jackson <ajax@redhat.com>
+---
+diff --git a/src/s3v_driver.c b/src/s3v_driver.c
+index 2ced9ac..0f754dd 100644
+--- a/src/s3v_driver.c
++++ b/src/s3v_driver.c
+@@ -3516,11 +3516,17 @@ S3VEnableMmio(ScrnInfoPtr pScrn)
+ S3VPtr ps3v;
+ IOADDRESS vgaCRIndex, vgaCRReg;
+ unsigned char val;
+-
++ unsigned int PIOOffset = 0;
++
+ PVERB5(" S3VEnableMmio\n");
+
+ hwp = VGAHWPTR(pScrn);
+ ps3v = S3VPTR(pScrn);
++
++#if ABI_VIDEODRV_VERSION < 12
++ PIOOffset = hwp->PIOOffset;
++#endif
++
+ /*
+ * enable chipset (seen on uninitialized secondary cards)
+ * might not be needed once we use the VGA softbooter
+@@ -3533,17 +3539,17 @@ S3VEnableMmio(ScrnInfoPtr pScrn)
+ * to be set correctly already and MMIO _has_ to be
+ * enabled.
+ */
+- val = inb(hwp->PIOOffset + 0x3C3); /*@@@EE*/
+- outb(hwp->PIOOffset + 0x3C3, val | 0x01);
++ val = inb(PIOOffset + 0x3C3); /*@@@EE*/
++ outb(PIOOffset + 0x3C3, val | 0x01);
+ /*
+ * set CR registers to color mode
+ * in mono mode extended CR registers
+ * are not accessible. (EE 05/04/99)
+ */
+- val = inb(hwp->PIOOffset + VGA_MISC_OUT_R); /*@@@EE*/
+- outb(hwp->PIOOffset + VGA_MISC_OUT_W, val | 0x01);
++ val = inb(PIOOffset + VGA_MISC_OUT_R); /*@@@EE*/
++ outb(PIOOffset + VGA_MISC_OUT_W, val | 0x01);
+ vgaHWGetIOBase(hwp); /* Get VGA I/O base */
+- vgaCRIndex = hwp->PIOOffset + hwp->IOBase + 4;
++ vgaCRIndex = PIOOffset + hwp->IOBase + 4;
+ vgaCRReg = vgaCRIndex + 1;
+ #if 1
+ /*
+@@ -3562,7 +3568,7 @@ S3VEnableMmio(ScrnInfoPtr pScrn)
+ /* Enable new MMIO, if TRIO mmio is already */
+ /* enabled, then it stays enabled. */
+ outb(vgaCRReg, ps3v->EnableMmioCR53 | 0x08);
+- outb(hwp->PIOOffset + VGA_MISC_OUT_W, val);
++ outb(PIOOffset + VGA_MISC_OUT_W, val);
+ if (S3_TRIO_3D_SERIES(ps3v->Chipset)) {
+ outb(vgaCRIndex, 0x40);
+ val = inb(vgaCRReg);
+@@ -3584,7 +3590,10 @@ S3VDisableMmio(ScrnInfoPtr pScrn)
+ hwp = VGAHWPTR(pScrn);
+ ps3v = S3VPTR(pScrn);
+
+- vgaCRIndex = hwp->PIOOffset + hwp->IOBase + 4;
++ vgaCRIndex = hwp->IOBase + 4;
++#if ABI_VIDEODRV_VERSION < 12
++ vgaCRIndex += hwp->PIOOffset;
++#endif
+ vgaCRReg = vgaCRIndex + 1;
+ outb(vgaCRIndex, 0x53);
+ /* Restore register's original state */
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/testing/xf86-video-savage/PKGBUILD b/testing/xf86-video-savage/PKGBUILD
new file mode 100644
index 000000000..b09d8495b
--- /dev/null
+++ b/testing/xf86-video-savage/PKGBUILD
@@ -0,0 +1,31 @@
+# $Id: PKGBUILD 150067 2012-02-12 09:45:36Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-savage
+pkgver=2.3.3
+pkgrel=2
+pkgdesc="X.org savage video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903' 'libdrm' 'xf86driproto' 'mesa>=8.0') # 'glproto')
+conflicts=('xorg-server<1.11.99.903')
+options=(!libtool !makeflags)
+groups=('xorg-drivers' 'xorg')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2)
+sha256sums=('d3854d375dbf7d83bf90e30d72837ce60d808119c6fa4bb98088e68e7cc7e7b2')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr #--enable-dri
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -d -m755 "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-siliconmotion/PKGBUILD b/testing/xf86-video-siliconmotion/PKGBUILD
new file mode 100644
index 000000000..8780c4996
--- /dev/null
+++ b/testing/xf86-video-siliconmotion/PKGBUILD
@@ -0,0 +1,35 @@
+# $Id: PKGBUILD 150069 2012-02-12 09:45:39Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+# Contributor: Alexander Baldeck <alexander@archlinux.org>
+
+pkgname=xf86-video-siliconmotion
+pkgver=1.7.5
+pkgrel=4
+pkgdesc="X.org siliconmotion video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903')
+conflicts=('xorg-server<1.11.99.903')
+options=('!libtool')
+groups=('xorg-drivers' 'xorg')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ smi-1.7.5-vga.patch)
+sha1sums=('946acae0822d51da57abe8b7ed049691bd731589'
+ '50b0e4aa858d7f8eb6f7e826f62fde23f01afe48')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i ${srcdir}/smi-1.7.5-vga.patch
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-siliconmotion/smi-1.7.5-vga.patch b/testing/xf86-video-siliconmotion/smi-1.7.5-vga.patch
new file mode 100644
index 000000000..ef353f0df
--- /dev/null
+++ b/testing/xf86-video-siliconmotion/smi-1.7.5-vga.patch
@@ -0,0 +1,25 @@
+From 037b839c84ad6dcbe9aade420cf0d3bf06f23119 Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Wed, 16 Nov 2011 20:03:25 +0000
+Subject: Adapt to missing PIOOffset in videoabi 12
+
+Signed-off-by: Adam Jackson <ajax@redhat.com>
+---
+diff --git a/src/smi_driver.c b/src/smi_driver.c
+index 9c10e46..86644c7 100644
+--- a/src/smi_driver.c
++++ b/src/smi_driver.c
+@@ -442,7 +442,11 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags)
+ LEAVE(FALSE);
+
+ hwp = VGAHWPTR(pScrn);
++#if ABI_VIDEODRV_VERSION < 12
+ pSmi->PIOBase = hwp->PIOOffset;
++#else
++ pSmi->PIOBase = 0;
++#endif
+
+ xf86ErrorFVerb(VERBLEV, "\tSMI_PreInit vgaCRIndex=%x, vgaIOBase=%x, "
+ "MMIOBase=%p\n", hwp->IOBase + VGA_CRTC_INDEX_OFFSET,
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/testing/xf86-video-sis/PKGBUILD b/testing/xf86-video-sis/PKGBUILD
new file mode 100644
index 000000000..0795269e5
--- /dev/null
+++ b/testing/xf86-video-sis/PKGBUILD
@@ -0,0 +1,34 @@
+# $Id: PKGBUILD 150071 2012-02-12 09:45:41Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-sis
+pkgver=0.10.3
+pkgrel=6
+pkgdesc="X.org SiS video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903' 'xf86dgaproto' 'libdrm' 'xf86driproto' 'mesa>=8.0') # 'glproto')
+conflicts=('xorg-server<1.11.99.903')
+options=('!libtool')
+groups=('xorg-drivers' 'xorg')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ sis-0.10.3-git.patch)
+sha1sums=('158673747e240b0c33499685a32d46bdaead7cd5'
+ '9078c02e9d10384cafb75d675bade8644726c811')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i ${srcdir}/sis-0.10.3-git.patch
+ ./configure --prefix=/usr #--enable-dri
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-sis/sis-0.10.3-git.patch b/testing/xf86-video-sis/sis-0.10.3-git.patch
new file mode 100644
index 000000000..d355e15b1
--- /dev/null
+++ b/testing/xf86-video-sis/sis-0.10.3-git.patch
@@ -0,0 +1,1460 @@
+diff --git a/configure.ac b/configure.ac
+index 33c0d65..036a448 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -20,54 +20,53 @@
+ #
+ # Process this file with autoconf to produce a configure script
+
+-AC_PREREQ(2.57)
++# Initialize Autoconf
++AC_PREREQ([2.60])
+ AC_INIT([xf86-video-sis],
+- 0.10.3,
++ [0.10.3],
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
+- xf86-video-sis)
+-
++ [xf86-video-sis])
+ AC_CONFIG_SRCDIR([Makefile.am])
+-AM_CONFIG_HEADER([config.h])
++AC_CONFIG_HEADERS([config.h])
+ AC_CONFIG_AUX_DIR(.)
+
++# Initialize Automake
+ AM_INIT_AUTOMAKE([foreign dist-bzip2])
+-
+ AM_MAINTAINER_MODE
+
+-# Require xorg-macros: XORG_DEFAULT_OPTIONS
++# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
+ m4_ifndef([XORG_MACROS_VERSION],
+- [m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])])
+-XORG_MACROS_VERSION(1.3)
++ [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
++XORG_MACROS_VERSION(1.8)
+ XORG_DEFAULT_OPTIONS
+
+-# Checks for programs.
++# Initialize libtool
+ AC_DISABLE_STATIC
+ AC_PROG_LIBTOOL
+-AC_PROG_CC
+-XORG_PROG_RAWCPP
+
+ AH_TOP([#include "xorg-server.h"])
+
++# Define a configure option for an alternate module directory
+ AC_ARG_WITH(xorg-module-dir,
+- AC_HELP_STRING([--with-xorg-module-dir=DIR],
++ AS_HELP_STRING([--with-xorg-module-dir=DIR],
+ [Default xorg module directory [[default=$libdir/xorg/modules]]]),
+ [moduledir="$withval"],
+ [moduledir="$libdir/xorg/modules"])
+
+-AC_ARG_ENABLE(dri, AC_HELP_STRING([--disable-dri],
++AC_ARG_ENABLE(dri, AS_HELP_STRING([--disable-dri],
+ [Disable DRI support [[default=auto]]]),
+ [DRI="$enableval"],
+ [DRI=auto])
+
+-# Checks for extensions
++# Store the list of server defined optional extensions in REQUIRED_MODULES
+ XORG_DRIVER_CHECK_EXT(XINERAMA, xineramaproto)
+ XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
+ XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
+ XORG_DRIVER_CHECK_EXT(XV, videoproto)
+ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
+
+-# Checks for pkg-config packages
+-PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto xf86dgaproto $REQUIRED_MODULES])
++# Obtain compiler/linker options for the driver dependencies
++PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto xf86dgaproto >= 2.1 $REQUIRED_MODULES])
+ PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
+ HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
+ HAVE_XEXTPROTO_71="no")
+@@ -76,9 +75,6 @@ sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
+
+ # Checks for libraries.
+
+-# Checks for header files.
+-AC_HEADER_STDC
+-
+ if test "$DRI" != no; then
+ AC_CHECK_FILE([${sdkdir}/dri.h],
+ [have_dri_h="yes"], [have_dri_h="no"])
+@@ -118,20 +114,19 @@ AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
+ CPPFLAGS="$SAVE_CPPFLAGS"
+
+ if test "x$XSERVER_LIBPCIACCESS" = xyes; then
+- PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.10])
++ PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.12.901])
+ XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
+ fi
+ AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
+
+-AC_SUBST([DRI_CFLAGS])
+-AC_SUBST([XORG_CFLAGS])
+ AC_SUBST([moduledir])
+
+ DRIVER_NAME=sis
+ AC_SUBST([DRIVER_NAME])
+
+-AC_OUTPUT([
+- Makefile
+- src/Makefile
+- man/Makefile
++AC_CONFIG_FILES([
++ Makefile
++ src/Makefile
++ man/Makefile
+ ])
++AC_OUTPUT
+diff --git a/man/Makefile.am b/man/Makefile.am
+index 1b26ac2..9ceb36f 100644
+--- a/man/Makefile.am
++++ b/man/Makefile.am
+@@ -31,39 +31,9 @@ EXTRA_DIST = @DRIVER_NAME@.man
+
+ CLEANFILES = $(driverman_DATA)
+
+-SED = sed
+-
+-# Strings to replace in man pages
+-XORGRELSTRING = @PACKAGE_STRING@
+- XORGMANNAME = X Version 11
+-
+-MANDEFS = \
+- -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+- -D__appmansuffix__=$(APP_MAN_SUFFIX) \
+- -D__filemansuffix__=$(FILE_MAN_SUFFIX) \
+- -D__libmansuffix__=$(LIB_MAN_SUFFIX) \
+- -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
+- -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
+- -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
+- -D__xconfigfile__=xorg.conf \
+- -D__xservername__=Xorg
+-
+-# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+-# to cpp, because that trick does not work on all ANSI C preprocessors.
+-# Delete line numbers from the cpp output (-P is not portable, I guess).
+-# Allow XCOMM to be preceded by whitespace and provide a means of generating
+-# output lines with trailing backslashes.
+-# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+-
+-CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+- -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+- -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+- -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+- -e '/^[ ]*XHASH/s/XHASH/\#/' \
+- -e '/\@\@$$/s/\@\@$$/\\/'
+-
+ SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
+
++# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+ .man.$(DRIVER_MAN_SUFFIX):
+- $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
++ $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+
+diff --git a/man/sis.man b/man/sis.man
+index 9ae4a1b..578bb68 100644
+--- a/man/sis.man
++++ b/man/sis.man
+@@ -1,17 +1,5 @@
+-.\" $XFree86$
+-.\" $XdotOrg$
+ .\" shorthand for double quote that works everywhere.
+ .ds q \N'34'
+-#ifdef __xservername__
+-#define __myservername__ __xservername__
+-#else
+-#define __myservername__ XFree86
+-#endif
+-#ifdef __xconfigfile__
+-#define __myxconfigfile__ __xconfigfile__
+-#else
+-#define __myxconfigfile__ XF86Config
+-#endif
+ .TH SIS __drivermansuffix__ __vendorversion__
+ .SH NAME
+ sis \- SiS and XGI video driver
+@@ -25,7 +13,7 @@ sis \- SiS and XGI video driver
+ .fi
+ .SH DESCRIPTION
+ .B sis
+-is an __myservername__ driver for SiS (Silicon Integrated Systems) and XGI video
++is an __xservername__ driver for SiS (Silicon Integrated Systems) and XGI video
+ chips. The driver is accelerated and provides support for colordepths of 8, 16
+ and 24 bpp. XVideo, Render and other extensions are supported as well.
+ .SH SUPPORTED HARDWARE
+@@ -60,7 +48,7 @@ for SiS315, 55x, 330, 661/741/76x (plus M, FX, MX, GX variants thereof), 340
+ and all XGI chips.
+ .PP
+ .SH CONFIGURATION DETAILS
+-Please refer to __myxconfigfile__(__filemansuffix__) for general configuration
++Please refer to __xconfigfile__(__filemansuffix__) for general configuration
+ details. This section only covers configuration details specific to this
+ driver.
+ .PP
+@@ -428,11 +416,7 @@ The amount is to be specified in megabyte, the default is 8.
+ .SH "KNOWN BUGS"
+ none.
+ .SH "SEE ALSO"
+-#ifdef __xservername__
+ __xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
+-#else
+-XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__)
+-#endif
+ .PP
+ .B "http://www.winischhofer.eu/linuxsisvga.shtml"
+ for more information and updates
+diff --git a/src/initextx.c b/src/initextx.c
+index 5c00398..1e84d0f 100644
+--- a/src/initextx.c
++++ b/src/initextx.c
+@@ -238,10 +238,10 @@ SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfo
+ continue;
+ }
+
+- if(!(new = xalloc(sizeof(DisplayModeRec)))) return first;
++ if(!(new = malloc(sizeof(DisplayModeRec)))) return first;
+ memset(new, 0, sizeof(DisplayModeRec));
+- if(!(new->name = xalloc(10))) {
+- xfree(new);
++ if(!(new->name = malloc(10))) {
++ free(new);
+ return first;
+ }
+ if(!first) first = new;
+@@ -385,11 +385,11 @@ SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfo
+ }
+ }
+
+- if(!(new = xalloc(sizeof(DisplayModeRec)))) return first;
++ if(!(new = malloc(sizeof(DisplayModeRec)))) return first;
+
+ memset(new, 0, sizeof(DisplayModeRec));
+- if(!(new->name = xalloc(12))) {
+- xfree(new);
++ if(!(new->name = malloc(12))) {
++ free(new);
+ return first;
+ }
+ if(!first) first = new;
+@@ -470,11 +470,11 @@ SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfo
+
+ if(pSiS->SiS_Pr->CP_DataValid[i]) {
+
+- if(!(new = xalloc(sizeof(DisplayModeRec)))) return first;
++ if(!(new = malloc(sizeof(DisplayModeRec)))) return first;
+
+ memset(new, 0, sizeof(DisplayModeRec));
+- if(!(new->name = xalloc(10))) {
+- xfree(new);
++ if(!(new->name = malloc(10))) {
++ free(new);
+ return first;
+ }
+ if(!first) first = new;
+diff --git a/src/osdef.h b/src/osdef.h
+index cd6b907..5776910 100644
+--- a/src/osdef.h
++++ b/src/osdef.h
+@@ -110,12 +110,12 @@
+ #warning sisfb will not work!
+ #endif
+
+-#define OutPortByte(p,v) outb((u8)(v),(IOADDRESS)(p))
+-#define OutPortWord(p,v) outw((u16)(v),(IOADDRESS)(p))
+-#define OutPortLong(p,v) outl((u32)(v),(IOADDRESS)(p))
+-#define InPortByte(p) inb((IOADDRESS)(p))
+-#define InPortWord(p) inw((IOADDRESS)(p))
+-#define InPortLong(p) inl((IOADDRESS)(p))
++#define OutPortByte(p,v) outb((u8)(v),(unsigned long)(p))
++#define OutPortWord(p,v) outw((u16)(v),(unsigned long)(p))
++#define OutPortLong(p,v) outl((u32)(v),(unsigned long)(p))
++#define InPortByte(p) inb((unsigned long)(p))
++#define InPortWord(p) inw((unsigned long)(p))
++#define InPortLong(p) inl((unsigned long)(p))
+ #define SiS_SetMemory(MemoryAddress,MemorySize,value) memset_io(MemoryAddress, value, MemorySize)
+
+ #endif /* LINUX_KERNEL */
+@@ -129,12 +129,12 @@
+ #define SIS300
+ #define SIS315H
+
+-#define OutPortByte(p,v) outSISREG((IOADDRESS)(p),(CARD8)(v))
+-#define OutPortWord(p,v) outSISREGW((IOADDRESS)(p),(CARD16)(v))
+-#define OutPortLong(p,v) outSISREGL((IOADDRESS)(p),(CARD32)(v))
+-#define InPortByte(p) inSISREG((IOADDRESS)(p))
+-#define InPortWord(p) inSISREGW((IOADDRESS)(p))
+-#define InPortLong(p) inSISREGL((IOADDRESS)(p))
++#define OutPortByte(p,v) outSISREG((unsigned long)(p),(CARD8)(v))
++#define OutPortWord(p,v) outSISREGW((unsigned long)(p),(CARD16)(v))
++#define OutPortLong(p,v) outSISREGL((unsigned long)(p),(CARD32)(v))
++#define InPortByte(p) inSISREG((unsigned long)(p))
++#define InPortWord(p) inSISREGW((unsigned long)(p))
++#define InPortLong(p) inSISREGL((unsigned long)(p))
+ #define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize)
+
+ #endif /* XF86 */
+diff --git a/src/sis.h b/src/sis.h
+index 400b83f..9af31a5 100644
+--- a/src/sis.h
++++ b/src/sis.h
+@@ -86,6 +86,14 @@
+ #include "xf86cmap.h"
+ #include "vbe.h"
+
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
++#define _swapl(x, n) swapl(x,n)
++#define _swaps(x, n) swaps(x,n)
++#else
++#define _swapl(x, n) swapl(x)
++#define _swaps(x, n) swaps(x)
++#endif
++
+ #define SIS_HaveDriverFuncs 0
+
+ #undef SISISXORG6899900
+@@ -251,7 +259,6 @@
+ #endif
+
+ /* Need that for SiSCtrl and Pseudo-Xinerama */
+-#define NEED_REPLIES /* ? */
+ #define EXTENSION_PROC_ARGS void *
+ #include "extnsionst.h" /* required */
+ #include <X11/extensions/panoramiXproto.h> /* required */
+@@ -971,7 +978,7 @@ typedef struct {
+ void *RealFbBase; /* Real VRAM virtual linear address (for DHM and SiS76x UMA skipping) */
+ CARD32 IOAddress; /* MMIO physical address */
+ void *IOBase; /* MMIO linear address */
+- IOADDRESS IODBase; /* Base of PIO memory area */
++ unsigned long IODBase; /* Base of PIO memory area */
+ #ifdef __alpha__
+ void *IOBaseDense; /* MMIO for Alpha platform */
+ #endif
+@@ -1348,7 +1355,7 @@ typedef struct {
+ Bool skipswitchcheck;
+ unsigned int VBFlagsInit;
+ DisplayModePtr currentModeLast;
+- IOADDRESS MyPIOOffset;
++ unsigned long MyPIOOffset;
+ Bool OverruleRanges;
+ Bool BenchMemCpy;
+ Bool NeedCopyFastVidCpy;
+diff --git a/src/sis6326_video.c b/src/sis6326_video.c
+index c6b18e2..66352b7 100644
+--- a/src/sis6326_video.c
++++ b/src/sis6326_video.c
+@@ -170,7 +170,7 @@ void SIS6326InitVideo(ScreenPtr pScreen)
+ adaptors = &newAdaptor;
+ } else {
+ /* need to free this someplace */
+- newAdaptors = xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*));
++ newAdaptors = malloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*));
+ if(newAdaptors) {
+ memcpy(newAdaptors, adaptors, num_adaptors *
+ sizeof(XF86VideoAdaptorPtr));
+@@ -185,7 +185,7 @@ void SIS6326InitVideo(ScreenPtr pScreen)
+ xf86XVScreenInit(pScreen, adaptors, num_adaptors);
+
+ if(newAdaptors)
+- xfree(newAdaptors);
++ free(newAdaptors);
+ }
+
+ /* client libraries expect an encoding */
+@@ -531,7 +531,7 @@ SIS6326SetupImageVideo(ScreenPtr pScreen)
+ return NULL;
+ #endif
+
+- if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
++ if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
+ sizeof(SISPortPrivRec) +
+ sizeof(DevUnion))))
+ return NULL;
+diff --git a/src/sis_dga.c b/src/sis_dga.c
+index d358645..16b0ee4 100644
+--- a/src/sis_dga.c
++++ b/src/sis_dga.c
+@@ -150,18 +150,18 @@ SISSetupDGAMode(
+
+ if(pMode->HDisplay != otherPitch) {
+
+- newmodes = xrealloc(modes, (*num + 2) * sizeof(DGAModeRec));
++ newmodes = realloc(modes, (*num + 2) * sizeof(DGAModeRec));
+ oneMore = TRUE;
+
+ } else {
+
+- newmodes = xrealloc(modes, (*num + 1) * sizeof(DGAModeRec));
++ newmodes = realloc(modes, (*num + 1) * sizeof(DGAModeRec));
+ oneMore = FALSE;
+
+ }
+
+ if(!newmodes) {
+- xfree(modes);
++ free(modes);
+ return NULL;
+ }
+ modes = newmodes;
+diff --git a/src/sis_dri.c b/src/sis_dri.c
+index 3a476a2..97ed951 100644
+--- a/src/sis_dri.c
++++ b/src/sis_dri.c
+@@ -149,19 +149,19 @@ SISInitVisualConfigs(ScreenPtr pScreen)
+ case 32:
+ numConfigs = (useZ16) ? 8 : 16;
+
+- if(!(pConfigs = (__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig),
++ if(!(pConfigs = (__GLXvisualConfig*)calloc(sizeof(__GLXvisualConfig),
+ numConfigs))) {
+ return FALSE;
+ }
+- if(!(pSISConfigs = (SISConfigPrivPtr)xcalloc(sizeof(SISConfigPrivRec),
++ if(!(pSISConfigs = (SISConfigPrivPtr)calloc(sizeof(SISConfigPrivRec),
+ numConfigs))) {
+- xfree(pConfigs);
++ free(pConfigs);
+ return FALSE;
+ }
+- if(!(pSISConfigPtrs = (SISConfigPrivPtr*)xcalloc(sizeof(SISConfigPrivPtr),
++ if(!(pSISConfigPtrs = (SISConfigPrivPtr*)calloc(sizeof(SISConfigPrivPtr),
+ numConfigs))) {
+- xfree(pConfigs);
+- xfree(pSISConfigs);
++ free(pConfigs);
++ free(pSISConfigs);
+ return FALSE;
+ }
+ for(i=0; i<numConfigs; i++) pSISConfigPtrs[i] = &pSISConfigs[i];
+@@ -319,7 +319,7 @@ SISDRIScreenInit(ScreenPtr pScreen)
+ pDRIInfo->busIdString = DRICreatePCIBusID(pSIS->PciInfo);
+ } else {
+ #endif
+- pDRIInfo->busIdString = xalloc(64);
++ pDRIInfo->busIdString = malloc(64);
+ sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d",
+ pSIS->PciBus, pSIS->PciDevice, pSIS->PciFunc);
+ #ifdef SISHAVECREATEBUSID
+@@ -383,7 +383,7 @@ SISDRIScreenInit(ScreenPtr pScreen)
+ pDRIInfo->SAREASize = SAREA_MAX;
+ #endif
+
+- if(!(pSISDRI = (SISDRIPtr)xcalloc(sizeof(SISDRIRec), 1))) {
++ if(!(pSISDRI = (SISDRIPtr)calloc(sizeof(SISDRIRec), 1))) {
+ DRIDestroyInfoRec(pSIS->pDRIInfo);
+ pSIS->pDRIInfo = 0;
+ return FALSE;
+@@ -401,7 +401,7 @@ SISDRIScreenInit(ScreenPtr pScreen)
+
+ if(!DRIScreenInit(pScreen, pDRIInfo, &pSIS->drmSubFD)) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] DRIScreenInit failed. Disabling the DRI.\n");
+- xfree(pDRIInfo->devPrivate);
++ free(pDRIInfo->devPrivate);
+ pDRIInfo->devPrivate = 0;
+ DRIDestroyInfoRec(pSIS->pDRIInfo);
+ pSIS->pDRIInfo = 0;
+@@ -794,7 +794,7 @@ SISDRICloseScreen(ScreenPtr pScreen)
+
+ if(pSIS->pDRIInfo) {
+ if(pSIS->pDRIInfo->devPrivate) {
+- xfree(pSIS->pDRIInfo->devPrivate);
++ free(pSIS->pDRIInfo->devPrivate);
+ pSIS->pDRIInfo->devPrivate = NULL;
+ }
+ DRIDestroyInfoRec(pSIS->pDRIInfo);
+@@ -802,12 +802,12 @@ SISDRICloseScreen(ScreenPtr pScreen)
+ }
+
+ if(pSIS->pVisualConfigs) {
+- xfree(pSIS->pVisualConfigs);
++ free(pSIS->pVisualConfigs);
+ pSIS->pVisualConfigs = NULL;
+ }
+
+ if(pSIS->pVisualConfigsPriv) {
+- xfree(pSIS->pVisualConfigsPriv);
++ free(pSIS->pVisualConfigsPriv);
+ pSIS->pVisualConfigsPriv = NULL;
+ }
+
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index d95b5f1..7ac9487 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -74,8 +74,7 @@
+
+ #include "sis_driver.h"
+
+-#define _XF86DGA_SERVER_
+-#include <X11/extensions/xf86dgastr.h>
++#include <X11/extensions/xf86dgaproto.h>
+
+ #include "globals.h"
+
+@@ -91,6 +90,26 @@
+ #include "dri.h"
+ #endif
+
++/*
++ * LookupWindow was removed with video abi 11.
++ */
++#if (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 4)
++#ifndef DixGetAttrAccess
++#define DixGetAttrAccess (1<<4)
++#endif
++#endif
++
++#if (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 2)
++static inline int
++dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access)
++{
++ *pWin = LookupWindow(id, client);
++ if (!*pWin)
++ return BadWindow;
++ return Success;
++}
++#endif
++
+ /* Globals (yes, these ARE really required to be global) */
+
+ #ifdef SISUSEDEVPORT
+@@ -299,9 +318,9 @@ SISFreeRec(ScrnInfoPtr pScrn)
+ pSiSEnt = pSiS->entityPrivate;
+ #endif
+
+- if(pSiS->pstate) xfree(pSiS->pstate);
++ if(pSiS->pstate) free(pSiS->pstate);
+ pSiS->pstate = NULL;
+- if(pSiS->fonts) xfree(pSiS->fonts);
++ if(pSiS->fonts) free(pSiS->fonts);
+ pSiS->fonts = NULL;
+
+ #ifdef SISDUALHEAD
+@@ -312,11 +331,11 @@ SISFreeRec(ScrnInfoPtr pScrn)
+ * and we need the BIOS image and SiS_Private for the first
+ * head.
+ */
+- if(pSiSEnt->BIOS) xfree(pSiSEnt->BIOS);
++ if(pSiSEnt->BIOS) free(pSiSEnt->BIOS);
+ pSiSEnt->BIOS = pSiS->BIOS = NULL;
+- if(pSiSEnt->SiS_Pr) xfree(pSiSEnt->SiS_Pr);
++ if(pSiSEnt->SiS_Pr) free(pSiSEnt->SiS_Pr);
+ pSiSEnt->SiS_Pr = pSiS->SiS_Pr = NULL;
+- if(pSiSEnt->RenderAccelArray) xfree(pSiSEnt->RenderAccelArray);
++ if(pSiSEnt->RenderAccelArray) free(pSiSEnt->RenderAccelArray);
+ pSiSEnt->RenderAccelArray = pSiS->RenderAccelArray = NULL;
+ pSiSEnt->pScrn_1 = NULL;
+ } else {
+@@ -327,21 +346,21 @@ SISFreeRec(ScrnInfoPtr pScrn)
+ }
+ } else {
+ #endif
+- if(pSiS->BIOS) xfree(pSiS->BIOS);
++ if(pSiS->BIOS) free(pSiS->BIOS);
+ pSiS->BIOS = NULL;
+- if(pSiS->SiS_Pr) xfree(pSiS->SiS_Pr);
++ if(pSiS->SiS_Pr) free(pSiS->SiS_Pr);
+ pSiS->SiS_Pr = NULL;
+- if(pSiS->RenderAccelArray) xfree(pSiS->RenderAccelArray);
++ if(pSiS->RenderAccelArray) free(pSiS->RenderAccelArray);
+ pSiS->RenderAccelArray = NULL;
+ #ifdef SISDUALHEAD
+ }
+ #endif
+ #ifdef SISMERGED
+- if(pSiS->CRT2HSync) xfree(pSiS->CRT2HSync);
++ if(pSiS->CRT2HSync) free(pSiS->CRT2HSync);
+ pSiS->CRT2HSync = NULL;
+- if(pSiS->CRT2VRefresh) xfree(pSiS->CRT2VRefresh);
++ if(pSiS->CRT2VRefresh) free(pSiS->CRT2VRefresh);
+ pSiS->CRT2VRefresh = NULL;
+- if(pSiS->MetaModes) xfree(pSiS->MetaModes);
++ if(pSiS->MetaModes) free(pSiS->MetaModes);
+ pSiS->MetaModes = NULL;
+ if(pSiS->CRT2pScrn) {
+ if(pSiS->CRT2pScrn->modes) {
+@@ -353,10 +372,10 @@ SISFreeRec(ScrnInfoPtr pScrn)
+ while(pSiS->CRT2pScrn->monitor->Modes)
+ xf86DeleteMode(&pSiS->CRT2pScrn->monitor->Modes, pSiS->CRT2pScrn->monitor->Modes);
+ }
+- if(pSiS->CRT2pScrn->monitor->DDC) xfree(pSiS->CRT2pScrn->monitor->DDC);
+- xfree(pSiS->CRT2pScrn->monitor);
++ if(pSiS->CRT2pScrn->monitor->DDC) free(pSiS->CRT2pScrn->monitor->DDC);
++ free(pSiS->CRT2pScrn->monitor);
+ }
+- xfree(pSiS->CRT2pScrn);
++ free(pSiS->CRT2pScrn);
+ pSiS->CRT2pScrn = NULL;
+ }
+ if(pSiS->CRT1Modes) {
+@@ -366,8 +385,8 @@ SISFreeRec(ScrnInfoPtr pScrn)
+ do {
+ DisplayModePtr p = pScrn->currentMode->next;
+ if(pScrn->currentMode->Private)
+- xfree(pScrn->currentMode->Private);
+- xfree(pScrn->currentMode);
++ free(pScrn->currentMode->Private);
++ free(pScrn->currentMode);
+ pScrn->currentMode = p;
+ } while(pScrn->currentMode != pScrn->modes);
+ }
+@@ -380,7 +399,7 @@ SISFreeRec(ScrnInfoPtr pScrn)
+ #endif
+ while(pSiS->SISVESAModeList) {
+ sisModeInfoPtr mp = pSiS->SISVESAModeList->next;
+- xfree(pSiS->SISVESAModeList);
++ free(pSiS->SISVESAModeList);
+ pSiS->SISVESAModeList = mp;
+ }
+ if(pSiS->pVbe) vbeFree(pSiS->pVbe);
+@@ -392,7 +411,7 @@ SISFreeRec(ScrnInfoPtr pScrn)
+
+ if(pScrn->driverPrivate == NULL)
+ return;
+- xfree(pScrn->driverPrivate);
++ free(pScrn->driverPrivate);
+ pScrn->driverPrivate = NULL;
+ }
+
+@@ -501,7 +520,7 @@ SISProbe(DriverPtr drv, int flags)
+ numDevSections, drv, &usedChipsXGI);
+
+ /* Free it since we don't need that list after this */
+- xfree(devSections);
++ free(devSections);
+
+ numUsed = numUsedSiS + numUsedXGI;
+
+@@ -577,8 +596,8 @@ SISProbe(DriverPtr drv, int flags)
+
+ }
+
+- if(usedChipsSiS) xfree(usedChipsSiS);
+- if(usedChipsXGI) xfree(usedChipsXGI);
++ if(usedChipsSiS) free(usedChipsSiS);
++ if(usedChipsXGI) free(usedChipsXGI);
+
+ return foundScreen;
+ }
+@@ -642,10 +661,10 @@ SISCalculateGammaRamp(ScreenPtr pScreen, ScrnInfoPtr pScrn)
+ if(!(nramp = xf86GetGammaRampSize(pScreen))) return;
+
+ for(i=0; i<3; i++) {
+- ramp[i] = (UShort *)xalloc(nramp * sizeof(UShort));
++ ramp[i] = (UShort *)malloc(nramp * sizeof(UShort));
+ if(!ramp[i]) {
+- if(ramp[0]) { xfree(ramp[0]); ramp[0] = NULL; }
+- if(ramp[1]) { xfree(ramp[1]); ramp[1] = NULL; }
++ if(ramp[0]) { free(ramp[0]); ramp[0] = NULL; }
++ if(ramp[1]) { free(ramp[1]); ramp[1] = NULL; }
+ return;
+ }
+ }
+@@ -705,9 +724,9 @@ SISCalculateGammaRamp(ScreenPtr pScreen, ScrnInfoPtr pScrn)
+
+ xf86ChangeGammaRamp(pScreen, nramp, ramp[0], ramp[1], ramp[2]);
+
+- xfree(ramp[0]);
+- xfree(ramp[1]);
+- xfree(ramp[2]);
++ free(ramp[0]);
++ free(ramp[1]);
++ free(ramp[2]);
+ ramp[0] = ramp[1] = ramp[2] = NULL;
+ }
+ #endif
+@@ -1135,10 +1154,10 @@ SiSCopyModeNLink(ScrnInfoPtr pScrn, DisplayModePtr dest,
+ DisplayModePtr mode;
+ int dx = 0,dy = 0;
+
+- if(!((mode = xalloc(sizeof(DisplayModeRec))))) return dest;
++ if(!((mode = malloc(sizeof(DisplayModeRec))))) return dest;
+ memcpy(mode, i, sizeof(DisplayModeRec));
+- if(!((mode->Private = xalloc(sizeof(SiSMergedDisplayModeRec))))) {
+- xfree(mode);
++ if(!((mode->Private = malloc(sizeof(SiSMergedDisplayModeRec))))) {
++ free(mode);
+ return dest;
+ }
+ ((SiSMergedDisplayModePtr)mode->Private)->CRT1 = i;
+@@ -1223,8 +1242,8 @@ SiSCopyModeNLink(ScrnInfoPtr pScrn, DisplayModePtr dest,
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Skipped \"%s\" (%dx%d), not enough video RAM or beyond hardware specs\n",
+ mode->name, mode->HDisplay, mode->VDisplay);
+- xfree(mode->Private);
+- xfree(mode);
++ free(mode->Private);
++ free(mode);
+
+ return dest;
+ }
+@@ -2131,10 +2150,10 @@ SiSProcXineramaQueryVersion(ClientPtr client)
+ rep.majorVersion = SIS_XINERAMA_MAJOR_VERSION;
+ rep.minorVersion = SIS_XINERAMA_MINOR_VERSION;
+ if(client->swapped) {
+- swaps(&rep.sequenceNumber, n);
+- swapl(&rep.length, n);
+- swaps(&rep.majorVersion, n);
+- swaps(&rep.minorVersion, n);
++ _swaps(&rep.sequenceNumber, n);
++ _swapl(&rep.length, n);
++ _swaps(&rep.majorVersion, n);
++ _swaps(&rep.minorVersion, n);
+ }
+ WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+@@ -2147,19 +2166,20 @@ SiSProcXineramaGetState(ClientPtr client)
+ WindowPtr pWin;
+ xPanoramiXGetStateReply rep;
+ register int n;
++ int rc;
+
+ REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
+- pWin = LookupWindow(stuff->window, client);
+- if(!pWin) return BadWindow;
++ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
++ if (rc != Success)
++ return rc;
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.state = !SiSnoPanoramiXExtension;
+ if(client->swapped) {
+- swaps (&rep.sequenceNumber, n);
+- swapl (&rep.length, n);
+- swaps (&rep.state, n);
++ _swaps (&rep.sequenceNumber, n);
++ _swapl (&rep.length, n);
+ }
+ WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *)&rep);
+ return client->noClientException;
+@@ -2172,19 +2192,20 @@ SiSProcXineramaGetScreenCount(ClientPtr client)
+ WindowPtr pWin;
+ xPanoramiXGetScreenCountReply rep;
+ register int n;
++ int rc;
+
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
+- pWin = LookupWindow(stuff->window, client);
+- if(!pWin) return BadWindow;
++ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
++ if (rc != Success)
++ return rc;
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.ScreenCount = SiSXineramaNumScreens;
+ if(client->swapped) {
+- swaps(&rep.sequenceNumber, n);
+- swapl(&rep.length, n);
+- swaps(&rep.ScreenCount, n);
++ _swaps(&rep.sequenceNumber, n);
++ _swapl(&rep.length, n);
+ }
+ WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *)&rep);
+ return client->noClientException;
+@@ -2197,10 +2218,12 @@ SiSProcXineramaGetScreenSize(ClientPtr client)
+ WindowPtr pWin;
+ xPanoramiXGetScreenSizeReply rep;
+ register int n;
++ int rc;
+
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
+- pWin = LookupWindow (stuff->window, client);
+- if(!pWin) return BadWindow;
++ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
++ if (rc != Success)
++ return rc;
+
+ rep.type = X_Reply;
+ rep.length = 0;
+@@ -2208,10 +2231,10 @@ SiSProcXineramaGetScreenSize(ClientPtr client)
+ rep.width = SiSXineramadataPtr[stuff->screen].width;
+ rep.height = SiSXineramadataPtr[stuff->screen].height;
+ if(client->swapped) {
+- swaps(&rep.sequenceNumber, n);
+- swapl(&rep.length, n);
+- swaps(&rep.width, n);
+- swaps(&rep.height, n);
++ _swaps(&rep.sequenceNumber, n);
++ _swapl(&rep.length, n);
++ _swapl(&rep.width, n);
++ _swapl(&rep.height, n);
+ }
+ WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *)&rep);
+ return client->noClientException;
+@@ -2230,9 +2253,9 @@ SiSProcXineramaIsActive(ClientPtr client)
+ rep.state = !SiSnoPanoramiXExtension;
+ if(client->swapped) {
+ register int n;
+- swaps(&rep.sequenceNumber, n);
+- swapl(&rep.length, n);
+- swapl(&rep.state, n);
++ _swaps(&rep.sequenceNumber, n);
++ _swapl(&rep.length, n);
++ _swapl(&rep.state, n);
+ }
+ WriteToClient(client, sizeof(xXineramaIsActiveReply), (char *) &rep);
+ return client->noClientException;
+@@ -2251,9 +2274,9 @@ SiSProcXineramaQueryScreens(ClientPtr client)
+ rep.length = rep.number * sz_XineramaScreenInfo >> 2;
+ if(client->swapped) {
+ register int n;
+- swaps(&rep.sequenceNumber, n);
+- swapl(&rep.length, n);
+- swapl(&rep.number, n);
++ _swaps(&rep.sequenceNumber, n);
++ _swapl(&rep.length, n);
++ _swapl(&rep.number, n);
+ }
+ WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *)&rep);
+
+@@ -2268,10 +2291,10 @@ SiSProcXineramaQueryScreens(ClientPtr client)
+ scratch.height = SiSXineramadataPtr[i].height;
+ if(client->swapped) {
+ register int n;
+- swaps(&scratch.x_org, n);
+- swaps(&scratch.y_org, n);
+- swaps(&scratch.width, n);
+- swaps(&scratch.height, n);
++ _swaps(&scratch.x_org, n);
++ _swaps(&scratch.y_org, n);
++ _swaps(&scratch.width, n);
++ _swaps(&scratch.height, n);
+ }
+ WriteToClient(client, sz_XineramaScreenInfo, (char *)&scratch);
+ }
+@@ -2308,7 +2331,7 @@ SiSSProcXineramaQueryVersion (ClientPtr client)
+ {
+ REQUEST(xPanoramiXQueryVersionReq);
+ register int n;
+- swaps(&stuff->length,n);
++ _swaps(&stuff->length,n);
+ REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
+ return SiSProcXineramaQueryVersion(client);
+ }
+@@ -2318,7 +2341,7 @@ SiSSProcXineramaGetState(ClientPtr client)
+ {
+ REQUEST(xPanoramiXGetStateReq);
+ register int n;
+- swaps (&stuff->length, n);
++ _swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
+ return SiSProcXineramaGetState(client);
+ }
+@@ -2328,7 +2351,7 @@ SiSSProcXineramaGetScreenCount(ClientPtr client)
+ {
+ REQUEST(xPanoramiXGetScreenCountReq);
+ register int n;
+- swaps (&stuff->length, n);
++ _swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
+ return SiSProcXineramaGetScreenCount(client);
+ }
+@@ -2338,7 +2361,7 @@ SiSSProcXineramaGetScreenSize(ClientPtr client)
+ {
+ REQUEST(xPanoramiXGetScreenSizeReq);
+ register int n;
+- swaps (&stuff->length, n);
++ _swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
+ return SiSProcXineramaGetScreenSize(client);
+ }
+@@ -2348,7 +2371,7 @@ SiSSProcXineramaIsActive(ClientPtr client)
+ {
+ REQUEST(xXineramaIsActiveReq);
+ register int n;
+- swaps (&stuff->length, n);
++ _swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
+ return SiSProcXineramaIsActive(client);
+ }
+@@ -2358,7 +2381,7 @@ SiSSProcXineramaQueryScreens(ClientPtr client)
+ {
+ REQUEST(xXineramaQueryScreensReq);
+ register int n;
+- swaps (&stuff->length, n);
++ _swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
+ return SiSProcXineramaQueryScreens(client);
+ }
+@@ -2389,7 +2412,7 @@ SiSXineramaResetProc(ExtensionEntry* extEntry)
+ {
+ /* Called by CloseDownExtensions() */
+ if(SiSXineramadataPtr) {
+- Xfree(SiSXineramadataPtr);
++ free(SiSXineramadataPtr);
+ SiSXineramadataPtr = NULL;
+ }
+ }
+@@ -2454,7 +2477,7 @@ SiSXineramaExtensionInit(ScrnInfoPtr pScrn)
+ if(!pSiS->XineramaExtEntry) break;
+
+ if(!(SiSXineramadataPtr = (SiSXineramaData *)
+- xcalloc(SiSXineramaNumScreens, sizeof(SiSXineramaData)))) break;
++ calloc(SiSXineramaNumScreens, sizeof(SiSXineramaData)))) break;
+
+ SiSXineramaGeneration = serverGeneration;
+ success = TRUE;
+@@ -2493,10 +2516,10 @@ SiSFreeCRT2Structs(SISPtr pSiS)
+ while(pSiS->CRT2pScrn->monitor->Modes)
+ xf86DeleteMode(&pSiS->CRT2pScrn->monitor->Modes, pSiS->CRT2pScrn->monitor->Modes);
+ }
+- if(pSiS->CRT2pScrn->monitor->DDC) xfree(pSiS->CRT2pScrn->monitor->DDC);
+- xfree(pSiS->CRT2pScrn->monitor);
++ if(pSiS->CRT2pScrn->monitor->DDC) free(pSiS->CRT2pScrn->monitor->DDC);
++ free(pSiS->CRT2pScrn->monitor);
+ }
+- xfree(pSiS->CRT2pScrn);
++ free(pSiS->CRT2pScrn);
+ pSiS->CRT2pScrn = NULL;
+ }
+ }
+@@ -2902,22 +2925,22 @@ SiS_CheckKernelFB(ScrnInfoPtr pScrn)
+ Bool gotit = FALSE;
+
+ if(!ioctl(fd, SISFB_GET_INFO_SIZE, &sisfbinfosize)) {
+- if((mysisfbinfo = xalloc(sisfbinfosize))) {
++ if((mysisfbinfo = malloc(sisfbinfosize))) {
+ if(!ioctl(fd, (SISFB_GET_INFO | (sisfbinfosize << 16)), mysisfbinfo)) {
+ gotit = TRUE;
+ } else {
+- xfree(mysisfbinfo);
++ free(mysisfbinfo);
+ mysisfbinfo = NULL;
+ }
+ }
+ } else {
+- if((mysisfbinfo = xalloc(sizeof(*mysisfbinfo) + 16))) {
++ if((mysisfbinfo = malloc(sizeof(*mysisfbinfo) + 16))) {
+ if(!ioctl(fd, SISFB_GET_INFO_OLD, mysisfbinfo)) {
+ gotit = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Possibly old version of sisfb detected. Please update.\n");
+ } else {
+- xfree(mysisfbinfo);
++ free(mysisfbinfo);
+ mysisfbinfo = NULL;
+ }
+ }
+@@ -3056,7 +3079,7 @@ SiS_CheckKernelFB(ScrnInfoPtr pScrn)
+ }
+ }
+ }
+- xfree(mysisfbinfo);
++ free(mysisfbinfo);
+ mysisfbinfo = NULL;
+ }
+ close (fd);
+@@ -3216,7 +3239,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ pSiS->pInt = NULL;
+
+ /* Save PCI Domain Base */
+-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
++#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) || GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 12
+ pSiS->IODBase = 0;
+ #else
+ pSiS->IODBase = pScrn->domainIOBase;
+@@ -4078,7 +4101,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ }
+ #endif
+ if(!pSiS->BIOS) {
+- if(!(pSiS->BIOS = xcalloc(1, BIOS_SIZE))) {
++ if(!(pSiS->BIOS = calloc(1, BIOS_SIZE))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Could not allocate memory for video BIOS image\n");
+ } else {
+@@ -4173,7 +4196,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Could not find/read video BIOS\n");
+- xfree(pSiS->BIOS);
++ free(pSiS->BIOS);
+ pSiS->BIOS = NULL;
+ }
+ }
+@@ -5559,7 +5582,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ /* Do some MergedFB mode initialisation */
+ #ifdef SISMERGED
+ if(pSiS->MergedFB) {
+- pSiS->CRT2pScrn = xalloc(sizeof(ScrnInfoRec));
++ pSiS->CRT2pScrn = malloc(sizeof(ScrnInfoRec));
+ if(!pSiS->CRT2pScrn) {
+ SISErrorLog(pScrn, "Failed to allocate memory for 2nd pScrn, %s\n", mergeddisstr);
+ pSiS->MergedFB = FALSE;
+@@ -5592,7 +5615,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ } else {
+ SISErrorLog(pScrn, mergednocrt1, mergeddisstr);
+ }
+- if(pSiS->CRT2pScrn) xfree(pSiS->CRT2pScrn);
++ if(pSiS->CRT2pScrn) free(pSiS->CRT2pScrn);
+ pSiS->CRT2pScrn = NULL;
+ pSiS->MergedFB = FALSE;
+ }
+@@ -5639,7 +5662,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ } else {
+ SISErrorLog(pScrn, mergednocrt2, mergeddisstr);
+ }
+- if(pSiS->CRT2pScrn) xfree(pSiS->CRT2pScrn);
++ if(pSiS->CRT2pScrn) free(pSiS->CRT2pScrn);
+ pSiS->CRT2pScrn = NULL;
+ pSiS->MergedFB = FALSE;
+ }
+@@ -6016,7 +6039,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+
+ #ifdef SISMERGED
+ if(pSiS->MergedFB) {
+- pSiS->CRT2pScrn->monitor = xalloc(sizeof(MonRec));
++ pSiS->CRT2pScrn->monitor = malloc(sizeof(MonRec));
+ if(pSiS->CRT2pScrn->monitor) {
+ DisplayModePtr tempm = NULL, currentm = NULL, newm = NULL;
+ memcpy(pSiS->CRT2pScrn->monitor, pScrn->monitor, sizeof(MonRec));
+@@ -6025,10 +6048,10 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ pSiS->CRT2pScrn->monitor->id = (char *)crt2monname;
+ tempm = pScrn->monitor->Modes;
+ while(tempm) {
+- if(!(newm = xalloc(sizeof(DisplayModeRec)))) break;
++ if(!(newm = malloc(sizeof(DisplayModeRec)))) break;
+ memcpy(newm, tempm, sizeof(DisplayModeRec));
+- if(!(newm->name = xalloc(strlen(tempm->name) + 1))) {
+- xfree(newm);
++ if(!(newm->name = malloc(strlen(tempm->name) + 1))) {
++ free(newm);
+ break;
+ }
+ strcpy(newm->name, tempm->name);
+@@ -6070,7 +6093,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ } else {
+ SISErrorLog(pScrn, "Failed to allocate memory for CRT2 monitor, %s.\n",
+ mergeddisstr);
+- if(pSiS->CRT2pScrn) xfree(pSiS->CRT2pScrn);
++ if(pSiS->CRT2pScrn) free(pSiS->CRT2pScrn);
+ pSiS->CRT2pScrn = NULL;
+ pSiS->MergedFB = FALSE;
+ }
+@@ -7454,7 +7477,7 @@ SISVESASaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function)
+ (function == MODE_SAVE)) {
+ /* don't rely on the memory not being touched */
+ if(!pSiS->pstate) {
+- pSiS->pstate = xalloc(pSiS->stateSize);
++ pSiS->pstate = malloc(pSiS->stateSize);
+ }
+ memcpy(pSiS->pstate, pSiS->state, pSiS->stateSize);
+ }
+@@ -8675,7 +8698,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+
+ if(pSiS->ShadowFB) {
+ pSiS->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width);
+- pSiS->ShadowPtr = xalloc(pSiS->ShadowPitch * height);
++ pSiS->ShadowPtr = malloc(pSiS->ShadowPitch * height);
+ displayWidth = pSiS->ShadowPitch / (pScrn->bitsPerPixel >> 3);
+ FBStart = pSiS->ShadowPtr;
+ } else {
+@@ -8849,14 +8872,14 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+
+ pSiS->CRT2ColNum = 1 << pScrn->rgbBits;
+
+- if((pSiS->crt2gcolortable = xalloc(pSiS->CRT2ColNum * 2 * sizeof(LOCO)))) {
++ if((pSiS->crt2gcolortable = malloc(pSiS->CRT2ColNum * 2 * sizeof(LOCO)))) {
+ pSiS->crt2colors = &pSiS->crt2gcolortable[pSiS->CRT2ColNum];
+- if((pSiS->crt2cindices = xalloc(256 * sizeof(int)))) {
++ if((pSiS->crt2cindices = malloc(256 * sizeof(int)))) {
+ int i = pSiS->CRT2ColNum;
+ SISCalculateGammaRampCRT2(pScrn);
+ while(i--) pSiS->crt2cindices[i] = i;
+ } else {
+- xfree(pSiS->crt2gcolortable);
++ free(pSiS->crt2gcolortable);
+ pSiS->crt2gcolortable = NULL;
+ pSiS->CRT2SepGamma = FALSE;
+ }
+@@ -9941,7 +9964,7 @@ SISCloseScreen(int scrnIndex, ScreenPtr pScreen)
+ if(pSiS->useEXA) {
+ if(pSiS->EXADriverPtr) {
+ exaDriverFini(pScreen);
+- xfree(pSiS->EXADriverPtr);
++ free(pSiS->EXADriverPtr);
+ pSiS->EXADriverPtr = NULL;
+ pSiS->exa_scratch = NULL;
+ }
+@@ -9954,33 +9977,33 @@ SISCloseScreen(int scrnIndex, ScreenPtr pScreen)
+ }
+
+ if(pSiS->ShadowPtr) {
+- xfree(pSiS->ShadowPtr);
++ free(pSiS->ShadowPtr);
+ pSiS->ShadowPtr = NULL;
+ }
+
+ if(pSiS->DGAModes) {
+- xfree(pSiS->DGAModes);
++ free(pSiS->DGAModes);
+ pSiS->DGAModes = NULL;
+ }
+
+ if(pSiS->adaptor) {
+- xfree(pSiS->adaptor);
++ free(pSiS->adaptor);
+ pSiS->adaptor = NULL;
+ pSiS->ResetXv = pSiS->ResetXvGamma = pSiS->ResetXvDisplay = NULL;
+ }
+
+ if(pSiS->blitadaptor) {
+- xfree(pSiS->blitadaptor);
++ free(pSiS->blitadaptor);
+ pSiS->blitadaptor = NULL;
+ }
+
+ if(pSiS->crt2gcolortable) {
+- xfree(pSiS->crt2gcolortable);
++ free(pSiS->crt2gcolortable);
+ pSiS->crt2gcolortable = NULL;
+ }
+
+ if(pSiS->crt2cindices) {
+- xfree(pSiS->crt2cindices);
++ free(pSiS->crt2cindices);
+ pSiS->crt2cindices = NULL;
+ }
+
+diff --git a/src/sis_memcpy.c b/src/sis_memcpy.c
+index 6ad62e8..3634401 100644
+--- a/src/sis_memcpy.c
++++ b/src/sis_memcpy.c
+@@ -638,13 +638,13 @@ SiS_AllocBuffers(ScrnInfoPtr pScrn, UChar **buf1, UChar **buf2, UChar **buf3)
+ (*buf1) = (UChar *)pSiS->FbBase + offset;
+ (*buf1) = (UChar *)(((ULong)(*buf1) + 31) & ~31);
+
+- if(!((*buf2) = (UChar *)xalloc(BUFFERSIZE + 15))) {
++ if(!((*buf2) = (UChar *)malloc(BUFFERSIZE + 15))) {
+ SISFreeFBMemory(pScrn, &handle);
+ return NULL;
+ }
+
+- if(!((*buf3) = (UChar *)xalloc(BUFFERSIZE + 15))) {
+- xfree((*buf2));
++ if(!((*buf3) = (UChar *)malloc(BUFFERSIZE + 15))) {
++ free((*buf2));
+ SISFreeFBMemory(pScrn, &handle);
+ return NULL;
+ }
+@@ -1098,8 +1098,8 @@ SiSVidCopyInitGen(ScreenPtr pScreen, SISMCFuncData *MCFunctions, vidCopyFunc *UM
+
+ /* Free buffers */
+ SISFreeFBMemory(pScrn, &fbhandle);
+- xfree(buf2);
+- xfree(buf3);
++ free(buf2);
++ free(buf3);
+
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Using %s method for aligned data transfers %s video RAM\n",
+diff --git a/src/sis_opt.c b/src/sis_opt.c
+index 3517549..d39ff6e 100644
+--- a/src/sis_opt.c
++++ b/src/sis_opt.c
+@@ -448,7 +448,7 @@ SiSOptions(ScrnInfoPtr pScrn)
+ xf86CollectOptions(pScrn, NULL);
+
+ /* Process the options */
+- if(!(pSiS->Options = xalloc(sizeof(SISOptions)))) return;
++ if(!(pSiS->Options = malloc(sizeof(SISOptions)))) return;
+
+ memcpy(pSiS->Options, SISOptions, sizeof(SISOptions));
+
+@@ -888,7 +888,7 @@ SiSOptions(ScrnInfoPtr pScrn)
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2POS))) {
+ int result;
+ Bool valid = FALSE;
+- char *tempstr = xalloc(strlen(strptr) + 1);
++ char *tempstr = malloc(strlen(strptr) + 1);
+ result = sscanf(strptr, "%s %d", tempstr, &ival);
+ if(result >= 1) {
+ if(!xf86NameCmp(tempstr,"LeftOf")) {
+@@ -946,18 +946,18 @@ SiSOptions(ScrnInfoPtr pScrn)
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Except for \"Clone\", the parameter may be followed by an integer.\n");
+ }
+- xfree(tempstr);
++ free(tempstr);
+ }
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_METAMODES))) {
+- pSiS->MetaModes = xalloc(strlen(strptr) + 1);
++ pSiS->MetaModes = malloc(strlen(strptr) + 1);
+ if(pSiS->MetaModes) memcpy(pSiS->MetaModes, strptr, strlen(strptr) + 1);
+ }
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2HSYNC))) {
+- pSiS->CRT2HSync = xalloc(strlen(strptr) + 1);
++ pSiS->CRT2HSync = malloc(strlen(strptr) + 1);
+ if(pSiS->CRT2HSync) memcpy(pSiS->CRT2HSync, strptr, strlen(strptr) + 1);
+ }
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2VREFRESH))) {
+- pSiS->CRT2VRefresh = xalloc(strlen(strptr) + 1);
++ pSiS->CRT2VRefresh = malloc(strlen(strptr) + 1);
+ if(pSiS->CRT2VRefresh) memcpy(pSiS->CRT2VRefresh, strptr, strlen(strptr) + 1);
+ }
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_MERGEDDPI))) {
+diff --git a/src/sis_utility.c b/src/sis_utility.c
+index a9bcd2b..eda194f 100644
+--- a/src/sis_utility.c
++++ b/src/sis_utility.c
+@@ -34,8 +34,6 @@
+ #endif
+
+ #include "sis.h"
+-#define NEED_REPLIES
+-#define NEED_EVENTS
+ #include <X11/X.h>
+ #include "dixstruct.h"
+
+@@ -1882,10 +1880,10 @@ SiSProcSiSCtrlQueryVersion(ClientPtr client)
+ rep.majorVersion = SISCTRL_MAJOR_VERSION;
+ rep.minorVersion = SISCTRL_MINOR_VERSION;
+ if(client->swapped) {
+- swaps(&rep.sequenceNumber, n);
+- swapl(&rep.length, n);
+- swaps(&rep.majorVersion, n);
+- swaps(&rep.minorVersion, n);
++ _swaps(&rep.sequenceNumber, n);
++ _swapl(&rep.length, n);
++ _swaps(&rep.majorVersion, n);
++ _swaps(&rep.minorVersion, n);
+ }
+ WriteToClient(client, sizeof(xSiSCtrlQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+@@ -1926,15 +1924,15 @@ SiSProcSiSCtrlCommand(ClientPtr client)
+ rep.sequenceNumber = client->sequence;
+
+ if(client->swapped) {
+- swaps(&rep.sequenceNumber, n);
+- swapl(&rep.length, n);
+- swapl(&rep.screen, n);
+- swapl(&rep.sdc_id, n);
+- swapl(&rep.sdc_command, n);
+- swapl(&rep.sdc_result_header, n);
++ _swaps(&rep.sequenceNumber, n);
++ _swapl(&rep.length, n);
++ _swapl(&rep.screen, n);
++ _swapl(&rep.sdc_id, n);
++ _swapl(&rep.sdc_command, n);
++ _swapl(&rep.sdc_result_header, n);
+ for(i = 0; i < SDC_NUM_PARM_RESULT; i++) {
+- swapl(&rep.sdc_parm[i], n);
+- swapl(&rep.sdc_result[i], n);
++ _swapl(&rep.sdc_parm[i], n);
++ _swapl(&rep.sdc_result[i], n);
+ }
+ }
+ WriteToClient(client, sizeof(xSiSCtrlCommandReply), (char *)&rep);
+@@ -1961,7 +1959,7 @@ SiSSProcSiSCtrlQueryVersion(ClientPtr client)
+ {
+ REQUEST(xSiSCtrlQueryVersionReq);
+ register int n;
+- swaps(&stuff->length, n);
++ _swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xSiSCtrlQueryVersionReq);
+ return SiSProcSiSCtrlQueryVersion(client);
+ }
+@@ -1972,14 +1970,14 @@ SiSSProcSiSCtrlCommand(ClientPtr client)
+ REQUEST(xSiSCtrlCommandReq);
+ register int n;
+ int i;
+- swaps(&stuff->length, n);
+- swapl(&stuff->screen, n);
+- swapl(&stuff->sdc_id, n);
+- swapl(&stuff->sdc_command, n);
+- swapl(&stuff->sdc_result_header, n);
++ _swaps(&stuff->length, n);
++ _swapl(&stuff->screen, n);
++ _swapl(&stuff->sdc_id, n);
++ _swapl(&stuff->sdc_command, n);
++ _swapl(&stuff->sdc_result_header, n);
+ for(i = 0; i < SDC_NUM_PARM_RESULT; i++) {
+- swapl(&stuff->sdc_parm[i], n);
+- swapl(&stuff->sdc_result[i], n);
++ _swapl(&stuff->sdc_parm[i], n);
++ _swapl(&stuff->sdc_result[i], n);
+ }
+ REQUEST_SIZE_MATCH(xSiSCtrlCommandReq);
+ return SiSProcSiSCtrlCommand(client);
+@@ -2007,7 +2005,7 @@ SiSCtrlResetProc(ExtensionEntry* extEntry)
+ * in SiSCtrlExtUnregister())
+ */
+ if(extEntry->extPrivate) {
+- xfree(extEntry->extPrivate);
++ free(extEntry->extPrivate);
+ extEntry->extPrivate = NULL;
+ }
+ }
+@@ -2028,7 +2026,7 @@ SiSCtrlExtInit(ScrnInfoPtr pScrn)
+
+ if(!(myext = CheckExtension(SISCTRL_PROTOCOL_NAME))) {
+
+- if(!(myctrl = xcalloc(sizeof(xSiSCtrlScreenTable), 1)))
++ if(!(myctrl = calloc(sizeof(xSiSCtrlScreenTable), 1)))
+ return;
+
+ if(!(myext = AddExtension(SISCTRL_PROTOCOL_NAME, 0, 0,
+@@ -2038,7 +2036,7 @@ SiSCtrlExtInit(ScrnInfoPtr pScrn)
+ StandardMinorOpcode))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to add SISCTRL extension\n");
+- xfree(myctrl);
++ free(myctrl);
+ return;
+ }
+
+diff --git a/src/sis_vga.c b/src/sis_vga.c
+index 3f6219b..4c887b8 100644
+--- a/src/sis_vga.c
++++ b/src/sis_vga.c
+@@ -1429,7 +1429,7 @@ SiSVGASaveFonts(ScrnInfoPtr pScrn)
+ attr10 = SiS_ReadAttr(pSiS, 0x10);
+ if(attr10 & 0x01) return;
+
+- if(!(pSiS->fonts = xalloc(SIS_FONTS_SIZE * 2))) {
++ if(!(pSiS->fonts = malloc(SIS_FONTS_SIZE * 2))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Could not save console fonts, mem allocation failed\n");
+ return;
+@@ -1716,8 +1716,8 @@ SiSVGAMapMem(ScrnInfoPtr pScrn)
+
+ #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0)
+ #if XSERVER_LIBPCIACCESS
+- pSiS->VGAMemBase = xf86MapDomainMemory(pScrn->scrnIndex, VIDMEM_MMIO_32BIT,
+- pSiS->PciInfo, pSiS->VGAMapPhys, pSiS->VGAMapSize);
++ (void) pci_device_map_legacy(pSiS->PciInfo, pSiS->VGAMapPhys, pSiS->VGAMapSize,
++ PCI_DEV_MAP_FLAG_WRITABLE, &pSiS->VGAMemBase);
+ #else
+ pSiS->VGAMemBase = xf86MapDomainMemory(pScrn->scrnIndex, VIDMEM_MMIO_32BIT,
+ pSiS->PciTag, pSiS->VGAMapPhys, pSiS->VGAMapSize);
+@@ -1737,7 +1737,12 @@ SiSVGAUnmapMem(ScrnInfoPtr pScrn)
+
+ if(pSiS->VGAMemBase == NULL) return;
+
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(pSiS->PciInfo, pSiS->VGAMemBase, pSiS->VGAMapSize);
++#else
+ xf86UnMapVidMem(pScrn->scrnIndex, pSiS->VGAMemBase, pSiS->VGAMapSize);
++#endif
++
+ pSiS->VGAMemBase = NULL;
+ }
+ #endif
+diff --git a/src/sis_video.c b/src/sis_video.c
+index 7322efb..2006858 100644
+--- a/src/sis_video.c
++++ b/src/sis_video.c
+@@ -326,7 +326,7 @@ SISInitVideo(ScreenPtr pScreen)
+ if(newAdaptor) size++;
+ if(newBlitAdaptor) size++;
+
+- newAdaptors = xalloc(size * sizeof(XF86VideoAdaptorPtr*));
++ newAdaptors = malloc(size * sizeof(XF86VideoAdaptorPtr*));
+ if(newAdaptors) {
+ if(num_adaptors) {
+ memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr));
+@@ -356,7 +356,7 @@ SISInitVideo(ScreenPtr pScreen)
+ }
+
+ if(newAdaptors) {
+- xfree(newAdaptors);
++ free(newAdaptors);
+ }
+ }
+
+@@ -877,7 +877,7 @@ SISSetupImageVideo(ScreenPtr pScreen)
+ }
+ #endif
+
+- if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
++ if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
+ sizeof(SISPortPrivRec) +
+ sizeof(DevUnion)))) {
+ return NULL;
+@@ -4067,7 +4067,7 @@ SISSetupBlitVideo(ScreenPtr pScreen)
+ }
+ #endif
+
+- if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
++ if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
+ (sizeof(DevUnion) * NUM_BLIT_PORTS) +
+ sizeof(SISBPortPrivRec)))) {
+ return NULL;
+diff --git a/src/sispcirename.h b/src/sispcirename.h
+index c4beac6..54cc07f 100644
+--- a/src/sispcirename.h
++++ b/src/sispcirename.h
+@@ -29,11 +29,35 @@
+ #ifndef SISPCIRENAME_H
+ #define SISPCIRENAME_H
+
++#include <stdint.h>
++
+ enum region_type {
+ REGION_MEM,
+ REGION_IO
+ };
+
++#if (defined(__alpha__) || defined(__ia64__)) && defined (linux)
++#define PCI_DOM_MASK 0x01fful
++#else
++#define PCI_DOM_MASK 0x0ffu
++#endif
++
++#ifndef PCI_DOM_MASK
++# define PCI_DOM_MASK 0x0ffu
++#endif
++#define PCI_DOMBUS_MASK (((PCI_DOM_MASK) << 8) | 0x0ffu)
++
++static inline uint32_t
++pciTag(int busnum, int devnum, int funcnum)
++{
++ uint32_t tag;
++ tag = (busnum & (PCI_DOMBUS_MASK)) << 16;
++ tag |= (devnum & 0x00001fu) << 11;
++ tag |= (funcnum & 0x000007u) << 8;
++
++ return tag;
++}
++
+ #ifndef XSERVER_LIBPCIACCESS
+
+ /* pciVideoPtr */
+diff --git a/src/vgatypes.h b/src/vgatypes.h
+index 4be31e4..d6e7b6e 100644
+--- a/src/vgatypes.h
++++ b/src/vgatypes.h
+@@ -69,8 +69,9 @@ typedef unsigned int BOOLEAN;
+
+ #define SISIOMEMTYPE
+
+-#ifdef SIS_LINUX_KERNEL
+ typedef unsigned long SISIOADDRESS;
++
++#ifdef SIS_LINUX_KERNEL
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8)
+ #include <linux/types.h> /* Need __iomem */
+ #undef SISIOMEMTYPE
+@@ -78,15 +79,6 @@ typedef unsigned long SISIOADDRESS;
+ #endif
+ #endif
+
+-#ifdef SIS_XORG_XF86
+-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,0,0,0)
+-typedef unsigned long IOADDRESS;
+-typedef unsigned long SISIOADDRESS;
+-#else
+-typedef IOADDRESS SISIOADDRESS;
+-#endif
+-#endif
+-
+ typedef enum _SIS_CHIP_TYPE {
+ SIS_VGALegacy = 0,
+ SIS_530,
diff --git a/testing/xf86-video-sisusb/PKGBUILD b/testing/xf86-video-sisusb/PKGBUILD
new file mode 100644
index 000000000..8c70334e6
--- /dev/null
+++ b/testing/xf86-video-sisusb/PKGBUILD
@@ -0,0 +1,33 @@
+# $Id: PKGBUILD 150073 2012-02-12 09:45:43Z andyrtr $
+#Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-sisusb
+pkgver=0.9.4
+pkgrel=6
+pkgdesc="X.org SiS USB video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903')
+conflicts=('xorg-server<1.11.99.903')
+groups=('xorg-drivers' 'xorg')
+options=('!libtool')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ sisusb-0.9.4-git.patch)
+sha1sums=('600fd49dffe00121f9042555fea55948653d1a7e'
+ 'd74ce7732889c7a00d9d2dcd2bfc8be05c6eb912')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i ${srcdir}/sisusb-0.9.4-git.patch
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-sisusb/sisusb-0.9.4-git.patch b/testing/xf86-video-sisusb/sisusb-0.9.4-git.patch
new file mode 100644
index 000000000..24474954a
--- /dev/null
+++ b/testing/xf86-video-sisusb/sisusb-0.9.4-git.patch
@@ -0,0 +1,794 @@
+diff --git a/configure.ac b/configure.ac
+index 86c6ac5..725d6cb 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -20,49 +20,48 @@
+ #
+ # Process this file with autoconf to produce a configure script
+
+-AC_PREREQ(2.57)
++# Initialize Autoconf
++AC_PREREQ([2.60])
+ AC_INIT([xf86-video-sisusb],
+- 0.9.4,
++ [0.9.4],
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
+- xf86-video-sisusb)
+-
++ [xf86-video-sisusb])
+ AC_CONFIG_SRCDIR([Makefile.am])
+-AM_CONFIG_HEADER([config.h])
++AC_CONFIG_HEADERS([config.h])
+ AC_CONFIG_AUX_DIR(.)
+
++# Initialize Automake
+ AM_INIT_AUTOMAKE([foreign dist-bzip2])
+-
+ AM_MAINTAINER_MODE
+
+-# Require xorg-macros: XORG_DEFAULT_OPTIONS
++# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
+ m4_ifndef([XORG_MACROS_VERSION],
+- [m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])])
+-XORG_MACROS_VERSION(1.3)
++ [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
++XORG_MACROS_VERSION(1.8)
+ XORG_DEFAULT_OPTIONS
+
+-# Checks for programs.
++# Initialize libtool
+ AC_DISABLE_STATIC
+ AC_PROG_LIBTOOL
+-AC_PROG_CC
+-XORG_PROG_RAWCPP
+
+ AH_TOP([#include "xorg-server.h"])
+
++# Define a configure option for an alternate module directory
+ AC_ARG_WITH(xorg-module-dir,
+- AC_HELP_STRING([--with-xorg-module-dir=DIR],
++ AS_HELP_STRING([--with-xorg-module-dir=DIR],
+ [Default xorg module directory [[default=$libdir/xorg/modules]]]),
+ [moduledir="$withval"],
+ [moduledir="$libdir/xorg/modules"])
+
+-# Checks for extensions
++# Store the list of server defined optional extensions in REQUIRED_MODULES
+ XORG_DRIVER_CHECK_EXT(XINERAMA, xineramaproto)
+ XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
+ XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
+ XORG_DRIVER_CHECK_EXT(XV, videoproto)
+ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
+
+-# Checks for pkg-config packages
+-PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES])
++# Obtain compiler/linker options for the driver dependencies
++PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto pciaccess $REQUIRED_MODULES])
+ PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
+ HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
+ HAVE_XEXTPROTO_71="no")
+@@ -70,17 +69,14 @@ AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ])
+
+ # Checks for libraries.
+
+-# Checks for header files.
+-AC_HEADER_STDC
+-
+-AC_SUBST([XORG_CFLAGS])
+ AC_SUBST([moduledir])
+
+ DRIVER_NAME=sisusb
+ AC_SUBST([DRIVER_NAME])
+
+-AC_OUTPUT([
+- Makefile
+- src/Makefile
+- man/Makefile
++AC_CONFIG_FILES([
++ Makefile
++ src/Makefile
++ man/Makefile
+ ])
++AC_OUTPUT
+diff --git a/man/Makefile.am b/man/Makefile.am
+index 1b26ac2..9ceb36f 100644
+--- a/man/Makefile.am
++++ b/man/Makefile.am
+@@ -31,39 +31,9 @@ EXTRA_DIST = @DRIVER_NAME@.man
+
+ CLEANFILES = $(driverman_DATA)
+
+-SED = sed
+-
+-# Strings to replace in man pages
+-XORGRELSTRING = @PACKAGE_STRING@
+- XORGMANNAME = X Version 11
+-
+-MANDEFS = \
+- -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+- -D__appmansuffix__=$(APP_MAN_SUFFIX) \
+- -D__filemansuffix__=$(FILE_MAN_SUFFIX) \
+- -D__libmansuffix__=$(LIB_MAN_SUFFIX) \
+- -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
+- -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
+- -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
+- -D__xconfigfile__=xorg.conf \
+- -D__xservername__=Xorg
+-
+-# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+-# to cpp, because that trick does not work on all ANSI C preprocessors.
+-# Delete line numbers from the cpp output (-P is not portable, I guess).
+-# Allow XCOMM to be preceded by whitespace and provide a means of generating
+-# output lines with trailing backslashes.
+-# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+-
+-CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+- -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+- -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+- -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+- -e '/^[ ]*XHASH/s/XHASH/\#/' \
+- -e '/\@\@$$/s/\@\@$$/\\/'
+-
+ SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
+
++# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+ .man.$(DRIVER_MAN_SUFFIX):
+- $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
++ $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+
+diff --git a/man/sisusb.man b/man/sisusb.man
+index 7817cb5..6eafb8e 100644
+--- a/man/sisusb.man
++++ b/man/sisusb.man
+@@ -1,17 +1,5 @@
+-.\" $XFree86$
+-.\" $XdotOrg$
+ .\" shorthand for double quote that works everywhere.
+ .ds q \N'34'
+-#ifdef __xservername__
+-#define __myservername__ __xservername__
+-#else
+-#define __myservername__ XFree86
+-#endif
+-#ifdef __xconfigfile__
+-#define __myxconfigfile__ __xconfigfile__
+-#else
+-#define __myxconfigfile__ XF86Config
+-#endif
+ .TH SISUSB __drivermansuffix__ __vendorversion__
+ .SH NAME
+ sisusb \- SiS USB video driver
+@@ -25,7 +13,7 @@ sisusb \- SiS USB video driver
+ .fi
+ .SH DESCRIPTION
+ .B sisusb
+-is an __myservername__ driver for SiS (Silicon Integrated Systems) video chips that
++is an __xservername__ driver for SiS (Silicon Integrated Systems) video chips that
+ are connected via a Net2280-based USB dongle. The driver is not accelerated, but
+ provides support for colordepths of 8, 16 and 24 bpp as well as Render and other
+ extensions.
+@@ -39,7 +27,7 @@ driver supports USB video cards based on the following chipsets:
+ The SiS315E/PRO features two CRT controllers. However, in its USB version, only
+ the first output, referred to as "CRT1", is being used.
+ .SH CONFIGURATION DETAILS
+-Please refer to __myxconfigfile__(__filemansuffix__) for general configuration
++Please refer to __xconfigfile__(__filemansuffix__) for general configuration
+ details and to sis(__drivermansuffix__) for more information. This manpage only
+ covers a subset of the supported options.
+ .PP
+@@ -81,11 +69,7 @@ for device reconnection).
+ .SH "KNOWN BUGS"
+ none.
+ .SH "SEE ALSO"
+-#ifdef __xservername__
+ __xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__), sis(__drivermansuffix__)
+-#else
+-XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__), sis(__drivermansuffix__)
+-#endif
+ .PP
+ .B "http://www.winischhofer.at/linuxsisvga.shtml"
+ for more information and updates
+diff --git a/src/sisusb.h b/src/sisusb.h
+index b9992ac..82ed509 100644
+--- a/src/sisusb.h
++++ b/src/sisusb.h
+@@ -113,6 +113,14 @@
+ #include <X11/extensions/Xv.h>
+ #endif
+
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
++#define _swapl(x, n) swapl(x,n)
++#define _swaps(x, n) swaps(x,n)
++#else
++#define _swapl(x, n) swapl(x)
++#define _swaps(x, n) swaps(x)
++#endif
++
+ /* Platform/architecture related definitions: */
+
+ #undef SIS_PC_PLATFORM
+@@ -141,7 +149,6 @@
+ #define UNLOCK_ALWAYS /* Always unlock the registers (should be set!) */
+
+ /* Need that for SiSCtrl */
+-#define NEED_REPLIES /* ? */
+ #define EXTENSION_PROC_ARGS void *
+ #include "extnsionst.h" /* required */
+ #include <X11/extensions/panoramiXproto.h> /* required */
+@@ -732,7 +739,7 @@ typedef struct {
+ Bool skipswitchcheck;
+ ULong VBFlagsInit;
+ DisplayModePtr currentModeLast;
+- IOADDRESS MyPIOOffset;
++ unsigned long MyPIOOffset;
+
+ char messagebuffer[64];
+ unsigned int VGAMapSize; /* SiSVGA stuff */
+diff --git a/src/sisusb_dac.c b/src/sisusb_dac.c
+index 5e3eb7f..b5c4dce 100644
+--- a/src/sisusb_dac.c
++++ b/src/sisusb_dac.c
+@@ -672,7 +672,7 @@ SiSUSBMemCopyToVideoRam(SISUSBPtr pSiSUSB, UChar *to, UChar *from, int size)
+ int num, retry = 3;
+ if(pSiSUSB->sisusbfatalerror) return;
+ do {
+- lseek(pSiSUSB->sisusbdev, (int)to, SEEK_SET);
++ lseek(pSiSUSB->sisusbdev, (uintptr_t)to, SEEK_SET);
+ num = write(pSiSUSB->sisusbdev, from, size);
+ } while((num != size) && --retry);
+ if(!retry) SiSLostConnection(pSiSUSB);
+@@ -958,7 +958,7 @@ void sisclearvram(SISUSBPtr pSiSUSB, UChar *where, unsigned int howmuch)
+ if(pSiSUSB->sisusbfatalerror) return;
+ do {
+ x.operation = SUCMD_CLRSCR;
+- x.data3 = (CARD32)where;
++ x.data3 = (CARD32)(uintptr_t)where;
+ x.data0 = (howmuch >> 16) & 0xff;
+ x.data1 = (howmuch >> 8) & 0xff;
+ x.data2 = howmuch & 0xff;
+@@ -990,7 +990,7 @@ void SIS_MMIO_OUT8(SISUSBPtr pSiSUSB, UChar *base, unsigned int offset, CARD8 va
+ int num, retry = 3;
+ if(pSiSUSB->sisusbfatalerror) return;
+ do {
+- lseek(pSiSUSB->sisusbdev, (int)base + offset, SEEK_SET);
++ lseek(pSiSUSB->sisusbdev, (uintptr_t)base + offset, SEEK_SET);
+ num = write(pSiSUSB->sisusbdev, &val, 1);
+ } while((num != 1) && --retry);
+ if(!retry) SiSLostConnection(pSiSUSB);
+@@ -1002,7 +1002,7 @@ void SIS_MMIO_OUT16(SISUSBPtr pSiSUSB, UChar *base, unsigned int offset, CARD16
+ CARD16 buf = sisusb_cpu_to_le16(val);
+ if(pSiSUSB->sisusbfatalerror) return;
+ do {
+- lseek(pSiSUSB->sisusbdev, (int)base + offset, SEEK_SET);
++ lseek(pSiSUSB->sisusbdev, (uintptr_t)base + offset, SEEK_SET);
+ num = write(pSiSUSB->sisusbdev, &buf, 2);
+ } while((num != 2) && --retry);
+ if(!retry) SiSLostConnection(pSiSUSB);
+@@ -1014,7 +1014,7 @@ void SIS_MMIO_OUT32(SISUSBPtr pSiSUSB, UChar *base, unsigned int offset, CARD32
+ CARD32 buf = sisusb_cpu_to_le32(val);
+ if(pSiSUSB->sisusbfatalerror) return;
+ do {
+- lseek(pSiSUSB->sisusbdev, (int)base + offset, SEEK_SET);
++ lseek(pSiSUSB->sisusbdev, (uintptr_t)base + offset, SEEK_SET);
+ num = write(pSiSUSB->sisusbdev, &buf, 4);
+ } while((num != 4) && --retry);
+ if(!retry) SiSLostConnection(pSiSUSB);
+@@ -1026,7 +1026,7 @@ CARD8 SIS_MMIO_IN8(SISUSBPtr pSiSUSB, UChar *base, unsigned int offset)
+ CARD8 tmp;
+ if(pSiSUSB->sisusbfatalerror) return 0;
+ do {
+- lseek(pSiSUSB->sisusbdev, (int)base + offset, SEEK_SET);
++ lseek(pSiSUSB->sisusbdev, (uintptr_t)base + offset, SEEK_SET);
+ num = read(pSiSUSB->sisusbdev, &tmp, 1);
+ } while((num != 1) && --retry);
+ if(!retry) SiSLostConnection(pSiSUSB);
+@@ -1039,7 +1039,7 @@ CARD16 SIS_MMIO_IN16(SISUSBPtr pSiSUSB, UChar *base, unsigned int offset)
+ CARD16 tmp;
+ if(pSiSUSB->sisusbfatalerror) return 0;
+ do {
+- lseek(pSiSUSB->sisusbdev, (int)base + offset, SEEK_SET);
++ lseek(pSiSUSB->sisusbdev, (uintptr_t)base + offset, SEEK_SET);
+ num = read(pSiSUSB->sisusbdev, &tmp, 2);
+ } while((num != 2) && --retry);
+ if(!retry) SiSLostConnection(pSiSUSB);
+@@ -1052,7 +1052,7 @@ CARD32 SIS_MMIO_IN32(SISUSBPtr pSiSUSB, UChar *base, unsigned int offset)
+ CARD32 tmp;
+ if(pSiSUSB->sisusbfatalerror) return 0;
+ do {
+- lseek(pSiSUSB->sisusbdev, (int)base + offset, SEEK_SET);
++ lseek(pSiSUSB->sisusbdev, (uintptr_t)base + offset, SEEK_SET);
+ num = read(pSiSUSB->sisusbdev, &tmp, 4);
+ } while((num != 4) && --retry);
+ if(!retry) SiSLostConnection(pSiSUSB);
+diff --git a/src/sisusb_driver.c b/src/sisusb_driver.c
+index 8ba2c33..032225c 100644
+--- a/src/sisusb_driver.c
++++ b/src/sisusb_driver.c
+@@ -186,12 +186,12 @@ SISUSBFreeRec(ScrnInfoPtr pScrn)
+ /* Just to make sure... */
+ if(!pSiSUSB) return;
+
+- if(pSiSUSB->pstate) xfree(pSiSUSB->pstate);
++ if(pSiSUSB->pstate) free(pSiSUSB->pstate);
+ pSiSUSB->pstate = NULL;
+- if(pSiSUSB->fonts) xfree(pSiSUSB->fonts);
++ if(pSiSUSB->fonts) free(pSiSUSB->fonts);
+ pSiSUSB->fonts = NULL;
+
+- if(pSiSUSB->SiS_Pr) xfree(pSiSUSB->SiS_Pr);
++ if(pSiSUSB->SiS_Pr) free(pSiSUSB->SiS_Pr);
+ pSiSUSB->SiS_Pr = NULL;
+
+ if(pSiSUSB->sisusbdevopen) {
+@@ -200,12 +200,12 @@ SISUSBFreeRec(ScrnInfoPtr pScrn)
+ }
+
+ if(pScrn->chipset) {
+- xfree(pScrn->chipset);
++ free(pScrn->chipset);
+ pScrn->chipset = NULL;
+ }
+
+ if(pScrn->driverPrivate) {
+- xfree(pScrn->driverPrivate);
++ free(pScrn->driverPrivate);
+ pScrn->driverPrivate = NULL;
+ }
+ }
+@@ -217,14 +217,14 @@ SISUSBErrorLog(ScrnInfoPtr pScrn, const char *format, ...)
+ static const char *str = "**************************************************\n";
+
+ va_start(ap, format);
+- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, str);
++ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s", str);
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ " ERROR:\n");
+ xf86VDrvMsgVerb(pScrn->scrnIndex, X_ERROR, 1, format, ap);
+ va_end(ap);
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ " END OF MESSAGE\n");
+- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, str);
++ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s", str);
+ }
+
+ static int
+@@ -248,7 +248,7 @@ SiSUSBCheckForUSBDongle(char *filename, SISUSBPtr pSiSUSB, int *filehandle)
+
+ if((myfile = open(filename, O_RDWR, 0)) != -1) {
+ if(!ioctl(myfile, SISUSB_GET_CONFIG_SIZE, &sisusbinfosize)) {
+- if((mysisusbinfo = xalloc(sisusbinfosize))) {
++ if((mysisusbinfo = malloc(sisusbinfosize))) {
+ if(!ioctl(myfile, (SISUSB_GET_CONFIG | (sisusbinfosize << 16)), mysisusbinfo)) {
+ if(mysisusbinfo->sisusb_id == SISUSB_ID) {
+ sisusbversion = (mysisusbinfo->sisusb_version << 16) |
+@@ -280,7 +280,7 @@ SiSUSBCheckForUSBDongle(char *filename, SISUSBPtr pSiSUSB, int *filehandle)
+ retval = mysisusbinfo->sisusb_minor;
+ }
+ }
+- xfree(mysisusbinfo);
++ free(mysisusbinfo);
+ mysisusbinfo = NULL;
+ }
+ }
+@@ -307,13 +307,13 @@ SiSUSBFindUSBDongle(GDevPtr dev, int *minorArray, int numDevSections, char **nam
+ }
+ if((p) && (*p) && (*p == '/')) {
+ gotdev = 1;
+- *nameptr = xalloc(strlen(p) + 1);
++ *nameptr = malloc(strlen(p) + 1);
+ strcpy(*nameptr, p);
+ retval = SiSUSBCheckForUSBDongle(*nameptr, NULL, NULL);
+ } else if((p) && (*p) && (sscanf(p, "%d", &i) == 1)) {
+ if(i >= 0 && i <= 31) {
+ gotdev = 1;
+- *nameptr = xalloc(32);
++ *nameptr = malloc(32);
+ sprintf(*nameptr, "/dev/sisusbvga%d", i);
+ retval = SiSUSBCheckForUSBDongle(*nameptr, NULL, NULL);
+ if(retval < 0) {
+@@ -324,7 +324,7 @@ SiSUSBFindUSBDongle(GDevPtr dev, int *minorArray, int numDevSections, char **nam
+ }
+ }
+ if(!gotdev) {
+- *nameptr = xalloc(32);
++ *nameptr = malloc(32);
+ for(i = 0; i < 64; i++) {
+ if(i < 32) sprintf(*nameptr, "/dev/sisusbvga%d", i);
+ else sprintf(*nameptr, "/dev/usb/sisusbvga%d", i);
+@@ -338,7 +338,7 @@ SiSUSBFindUSBDongle(GDevPtr dev, int *minorArray, int numDevSections, char **nam
+ if(retval >= 0) {
+ xf86Msg(X_INFO, "Found SiSUSB dongle (node %s, minor %d)\n", *nameptr, retval);
+ } else if((*nameptr)) {
+- xfree(*nameptr);
++ free(*nameptr);
+ *nameptr = NULL;
+ }
+
+@@ -401,14 +401,14 @@ SISUSBProbe(DriverPtr drv, int flags)
+ */
+
+ /* Allocate and initialize an array of ints for storing the minors */
+- if(!(minorArray = (int *)xalloc(numDevSections * sizeof(int)))) {
++ if(!(minorArray = (int *)malloc(numDevSections * sizeof(int)))) {
+ return FALSE;
+ }
+ for(i = 0; i < numDevSections; i++) minorArray[i] = -1;
+
+ /* Allocate an array of char ptrs for storing the device node names */
+- if(!(devnameArray = (char **)xalloc(numDevSections * sizeof(char *)))) {
+- xfree(minorArray);
++ if(!(devnameArray = (char **)malloc(numDevSections * sizeof(char *)))) {
++ free(minorArray);
+ return FALSE;
+ }
+
+@@ -420,20 +420,20 @@ SISUSBProbe(DriverPtr drv, int flags)
+ if((myminor = SiSUSBFindUSBDongle(devSections[i], minorArray, numDevSections, &nameptr)) >= 0) {
+ if(!SiSUSBFindDuplicate(myminor, minorArray, numDevSections)) {
+ minorArray[numUsed] = myminor;
+- devnameArray[numUsed] = xalloc(strlen(nameptr) + 1);
++ devnameArray[numUsed] = malloc(strlen(nameptr) + 1);
+ strcpy(devnameArray[numUsed], nameptr);
+ numUsed++;
+ }
+- xfree(nameptr);
++ free(nameptr);
+ }
+ }
+
+ /* Free the minor array, we don't need it anymore */
+- xfree(minorArray);
++ free(minorArray);
+
+ if(numUsed <= 0) {
+- xfree(devSections);
+- xfree(devnameArray);
++ free(devSections);
++ free(devnameArray);
+ return FALSE;
+ }
+
+@@ -470,8 +470,8 @@ SISUSBProbe(DriverPtr drv, int flags)
+
+ }
+
+- xfree(devSections);
+- xfree(devnameArray);
++ free(devSections);
++ free(devnameArray);
+ return foundScreen;
+ }
+
+@@ -622,10 +622,10 @@ SISUSBCalculateGammaRamp(ScreenPtr pScreen, ScrnInfoPtr pScrn)
+ if(!(nramp = xf86GetGammaRampSize(pScreen))) return;
+
+ for(i=0; i<3; i++) {
+- ramp[i] = (UShort *)xalloc(nramp * sizeof(UShort));
++ ramp[i] = (UShort *)malloc(nramp * sizeof(UShort));
+ if(!ramp[i]) {
+- if(ramp[0]) { xfree(ramp[0]); ramp[0] = NULL; }
+- if(ramp[1]) { xfree(ramp[1]); ramp[1] = NULL; }
++ if(ramp[0]) { free(ramp[0]); ramp[0] = NULL; }
++ if(ramp[1]) { free(ramp[1]); ramp[1] = NULL; }
+ return;
+ }
+ }
+@@ -685,9 +685,9 @@ SISUSBCalculateGammaRamp(ScreenPtr pScreen, ScrnInfoPtr pScrn)
+
+ xf86ChangeGammaRamp(pScreen, nramp, ramp[0], ramp[1], ramp[2]);
+
+- xfree(ramp[0]);
+- xfree(ramp[1]);
+- xfree(ramp[2]);
++ free(ramp[0]);
++ free(ramp[1]);
++ free(ramp[2]);
+ ramp[0] = ramp[1] = ramp[2] = NULL;
+ }
+ #endif
+@@ -906,11 +906,11 @@ SISUSBPreInit(ScrnInfoPtr pScrn, int flags)
+ Bool gotit = FALSE;
+
+ if(!ioctl(fd, SISUSBFB_GET_INFO_SIZE, &sisfbinfosize)) {
+- if((mysisfbinfo = xalloc(sisfbinfosize))) {
++ if((mysisfbinfo = malloc(sisfbinfosize))) {
+ if(!ioctl(fd, (SISUSBFB_GET_INFO | (sisfbinfosize << 16)), mysisfbinfo)) {
+ gotit = TRUE;
+ } else {
+- xfree(mysisfbinfo);
++ free(mysisfbinfo);
+ mysisfbinfo = NULL;
+ }
+ }
+@@ -944,7 +944,7 @@ SISUSBPreInit(ScrnInfoPtr pScrn, int flags)
+
+ }
+ }
+- xfree(mysisfbinfo);
++ free(mysisfbinfo);
+ mysisfbinfo = NULL;
+ }
+ close (fd);
+@@ -1147,7 +1147,7 @@ SISUSBPreInit(ScrnInfoPtr pScrn, int flags)
+ #endif
+
+ if(pSiSUSB->HWCursor) {
+- if(!(pSiSUSB->USBCursorBuf = xcalloc(pSiSUSB->CursorSize * 4, 1))) pSiSUSB->HWCursor = FALSE;
++ if(!(pSiSUSB->USBCursorBuf = calloc(pSiSUSB->CursorSize * 4, 1))) pSiSUSB->HWCursor = FALSE;
+
+ pSiSUSB->availMem -= (pSiSUSB->CursorSize * 2);
+ if(pSiSUSB->OptUseColorCursor) pSiSUSB->availMem -= (pSiSUSB->CursorSize * 2);
+@@ -1456,8 +1456,8 @@ SISUSBMapMem(ScrnInfoPtr pScrn)
+ {
+ SISUSBPtr pSiSUSB = SISUSBPTR(pScrn);
+
+- pSiSUSB->FbBase = (UChar *)pSiSUSB->FbAddress;
+- pSiSUSB->IOBase = (UChar *)pSiSUSB->IOAddress;
++ pSiSUSB->FbBase = (UChar *)(uintptr_t)pSiSUSB->FbAddress;
++ pSiSUSB->IOBase = (UChar *)(uintptr_t)pSiSUSB->IOAddress;
+
+ return TRUE;
+ }
+@@ -1811,7 +1811,7 @@ SISUSBScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+
+ if(pSiSUSB->ShadowFB) {
+ pSiSUSB->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * displayWidth);
+- pSiSUSB->ShadowPtr = xalloc(pSiSUSB->ShadowPitch * height);
++ pSiSUSB->ShadowPtr = malloc(pSiSUSB->ShadowPitch * height);
+ if(!(FBStart = pSiSUSB->ShadowPtr)) {
+ SISUSBSaveScreen(pScreen, SCREEN_SAVER_OFF);
+ SISUSBErrorLog(pScrn, "Failed to allocate shadow framebuffer\n");
+@@ -1820,7 +1820,7 @@ SISUSBScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ #if X_BYTE_ORDER == X_BIG_ENDIAN
+ if(pScrn->bitsPerPixel == 16) {
+ /* For 16bpp, we need to swap the bytes in the framebuffer */
+- if(!(pSiSUSB->ShadowPtrSwap = xalloc(pSiSUSB->ShadowPitch * height))) {
++ if(!(pSiSUSB->ShadowPtrSwap = malloc(pSiSUSB->ShadowPitch * height))) {
+ SISUSBSaveScreen(pScreen, SCREEN_SAVER_OFF);
+ SISUSBErrorLog(pScrn, "Failed to allocate swap buffer for shadow framebuffer\n");
+ return FALSE;
+@@ -2238,24 +2238,24 @@ SISUSBCloseScreen(int scrnIndex, ScreenPtr pScreen)
+ }
+
+ if(pSiSUSB->USBCursorBuf) {
+- xfree(pSiSUSB->USBCursorBuf);
++ free(pSiSUSB->USBCursorBuf);
+ pSiSUSB->USBCursorBuf = NULL;
+ }
+
+ if(pSiSUSB->ShadowPtr) {
+- xfree(pSiSUSB->ShadowPtr);
++ free(pSiSUSB->ShadowPtr);
+ pSiSUSB->ShadowPtr = NULL;
+ }
+
+ #if 0
+ if(pSiSUSB->PreAllocMem) {
+- xfree(pSiSUSB->PreAllocMem);
++ free(pSiSUSB->PreAllocMem);
+ pSiSUSB->PreAllocMem = NULL;
+ }
+ #endif
+
+ if(pSiSUSB->adaptor) {
+- xfree(pSiSUSB->adaptor);
++ free(pSiSUSB->adaptor);
+ pSiSUSB->adaptor = NULL;
+ pSiSUSB->ResetXv = pSiSUSB->ResetXvGamma = NULL;
+ }
+diff --git a/src/sisusb_init.c b/src/sisusb_init.c
+index ba44431..99ec519 100644
+--- a/src/sisusb_init.c
++++ b/src/sisusb_init.c
+@@ -1301,10 +1301,10 @@ SiSUSBBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN i
+ }
+ }
+
+- if(!(new = xalloc(sizeof(DisplayModeRec)))) return first;
++ if(!(new = malloc(sizeof(DisplayModeRec)))) return first;
+ memset(new, 0, sizeof(DisplayModeRec));
+- if(!(new->name = xalloc(10))) {
+- xfree(new);
++ if(!(new->name = malloc(10))) {
++ free(new);
+ return first;
+ }
+ if(!first) first = new;
+diff --git a/src/sisusb_opt.c b/src/sisusb_opt.c
+index d4612b0..4d5cfa3 100644
+--- a/src/sisusb_opt.c
++++ b/src/sisusb_opt.c
+@@ -228,7 +228,7 @@ SiSUSBOptions(ScrnInfoPtr pScrn)
+ xf86CollectOptions(pScrn, NULL);
+
+ /* Process the options */
+- if(!(pSiSUSB->Options = xalloc(sizeof(SISUSBOptions)))) return;
++ if(!(pSiSUSB->Options = malloc(sizeof(SISUSBOptions)))) return;
+
+ memcpy(pSiSUSB->Options, SISUSBOptions, sizeof(SISUSBOptions));
+
+diff --git a/src/sisusb_osdef.h b/src/sisusb_osdef.h
+index 2d938ad..500bffb 100644
+--- a/src/sisusb_osdef.h
++++ b/src/sisusb_osdef.h
+@@ -77,11 +77,11 @@
+
+ #define SIS315H
+
+-#define OutPortByte(p,v) outSISREG((IOADDRESS)(p),(CARD8)(v))
+-#define OutPortWord(p,v) outSISREGW((IOADDRESS)(p),(CARD16)(v))
+-#define OutPortLong(p,v) outSISREGL((IOADDRESS)(p),(CARD32)(v))
+-#define InPortByte(p) inSISREG((IOADDRESS)(p))
+-#define InPortWord(p) inSISREGW((IOADDRESS)(p))
+-#define InPortLong(p) inSISREGL((IOADDRESS)(p))
++#define OutPortByte(p,v) outSISREG((unsigned long)(p),(CARD8)(v))
++#define OutPortWord(p,v) outSISREGW((unsigned long)(p),(CARD16)(v))
++#define OutPortLong(p,v) outSISREGL((unsigned long)(p),(CARD32)(v))
++#define InPortByte(p) inSISREG((unsigned long)(p))
++#define InPortWord(p) inSISREGW((unsigned long)(p))
++#define InPortLong(p) inSISREGL((unsigned long)(p))
+
+ #endif /* _SISUSB_OSDEF_H_ */
+diff --git a/src/sisusb_types.h b/src/sisusb_types.h
+index 04c7a7a..9fc6b41 100644
+--- a/src/sisusb_types.h
++++ b/src/sisusb_types.h
+@@ -51,6 +51,8 @@
+ #ifndef _VGATYPES_
+ #define _VGATYPES_
+
++#include <xf86Pci.h>
++
+ #ifndef FALSE
+ #define FALSE 0
+ #endif
+@@ -93,7 +95,7 @@ typedef unsigned char BOOLEAN;
+
+ #define SISIOMEMTYPE
+
+-typedef IOADDRESS SISIOADDRESS;
++typedef unsigned long SISIOADDRESS;
+
+ typedef enum _SIS_CHIP_TYPE {
+ SIS_VGALegacy = 0,
+diff --git a/src/sisusb_utility.c b/src/sisusb_utility.c
+index 8c03d63..a9c1ee1 100644
+--- a/src/sisusb_utility.c
++++ b/src/sisusb_utility.c
+@@ -34,8 +34,6 @@
+ #endif
+
+ #include "sisusb.h"
+-#define NEED_REPLIES
+-#define NEED_EVENTS
+ #include <X11/X.h>
+ #include "dixstruct.h"
+
+@@ -789,10 +787,10 @@ SiSUSBProcSiSCtrlQueryVersion(ClientPtr client)
+ rep.majorVersion = SISCTRL_MAJOR_VERSION;
+ rep.minorVersion = SISCTRL_MINOR_VERSION;
+ if(client->swapped) {
+- swaps(&rep.sequenceNumber, n);
+- swapl(&rep.length, n);
+- swaps(&rep.majorVersion, n);
+- swaps(&rep.minorVersion, n);
++ _swaps(&rep.sequenceNumber, n);
++ _swapl(&rep.length, n);
++ _swaps(&rep.majorVersion, n);
++ _swaps(&rep.minorVersion, n);
+ }
+ WriteToClient(client, sizeof(xSiSCtrlQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+@@ -834,15 +832,15 @@ SiSUSBProcSiSCtrlCommand(ClientPtr client)
+ rep.sequenceNumber = client->sequence;
+
+ if(client->swapped) {
+- swaps(&rep.sequenceNumber, n);
+- swapl(&rep.length, n);
+- swapl(&rep.screen, n);
+- swapl(&rep.sdc_id, n);
+- swapl(&rep.sdc_command, n);
+- swapl(&rep.sdc_result_header, n);
++ _swaps(&rep.sequenceNumber, n);
++ _swapl(&rep.length, n);
++ _swapl(&rep.screen, n);
++ _swapl(&rep.sdc_id, n);
++ _swapl(&rep.sdc_command, n);
++ _swapl(&rep.sdc_result_header, n);
+ for(i = 0; i < SDC_NUM_PARM_RESULT; i++) {
+- swapl(&rep.sdc_parm[i], n);
+- swapl(&rep.sdc_result[i], n);
++ _swapl(&rep.sdc_parm[i], n);
++ _swapl(&rep.sdc_result[i], n);
+ }
+ }
+ WriteToClient(client, sizeof(xSiSCtrlCommandReply), (char *)&rep);
+@@ -869,7 +867,7 @@ SiSUSBSProcSiSCtrlQueryVersion(ClientPtr client)
+ {
+ REQUEST(xSiSCtrlQueryVersionReq);
+ register int n;
+- swaps(&stuff->length, n);
++ _swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xSiSCtrlQueryVersionReq);
+ return SiSUSBProcSiSCtrlQueryVersion(client);
+ }
+@@ -880,14 +878,14 @@ SiSUSBSProcSiSCtrlCommand(ClientPtr client)
+ REQUEST(xSiSCtrlCommandReq);
+ register int n;
+ int i;
+- swaps(&stuff->length, n);
+- swapl(&stuff->screen, n);
+- swapl(&stuff->sdc_id, n);
+- swapl(&stuff->sdc_command, n);
+- swapl(&stuff->sdc_result_header, n);
++ _swaps(&stuff->length, n);
++ _swapl(&stuff->screen, n);
++ _swapl(&stuff->sdc_id, n);
++ _swapl(&stuff->sdc_command, n);
++ _swapl(&stuff->sdc_result_header, n);
+ for(i = 0; i < SDC_NUM_PARM_RESULT; i++) {
+- swapl(&stuff->sdc_parm[i], n);
+- swapl(&stuff->sdc_result[i], n);
++ _swapl(&stuff->sdc_parm[i], n);
++ _swapl(&stuff->sdc_result[i], n);
+ }
+ REQUEST_SIZE_MATCH(xSiSCtrlCommandReq);
+ return SiSUSBProcSiSCtrlCommand(client);
+@@ -911,7 +909,7 @@ SiSUSBCtrlResetProc(ExtensionEntry* extEntry)
+ {
+ /* Called by CloseDownExtensions() */
+ if(extEntry->extPrivate) {
+- xfree(extEntry->extPrivate);
++ free(extEntry->extPrivate);
+ extEntry->extPrivate = NULL;
+ }
+ }
+@@ -928,7 +926,7 @@ SiSUSBCtrlExtInit(ScrnInfoPtr pScrn)
+
+ if(!(myext = CheckExtension(SISCTRL_PROTOCOL_NAME))) {
+
+- if(!(myctrl = xcalloc(sizeof(xSiSCtrlScreenTable), 1)))
++ if(!(myctrl = calloc(sizeof(xSiSCtrlScreenTable), 1)))
+ return;
+
+ if(!(myext = AddExtension(SISCTRL_PROTOCOL_NAME, 0, 0,
+@@ -938,7 +936,7 @@ SiSUSBCtrlExtInit(ScrnInfoPtr pScrn)
+ StandardMinorOpcode))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to add SISCTRL extension\n");
+- xfree(myctrl);
++ free(myctrl);
+ return;
+ }
+
+diff --git a/src/sisusb_video.c b/src/sisusb_video.c
+index bc469b0..1dbf4f1 100644
+--- a/src/sisusb_video.c
++++ b/src/sisusb_video.c
+@@ -216,7 +216,7 @@ void SISUSBInitVideo(ScreenPtr pScreen)
+
+ if(newAdaptor) size++;
+
+- newAdaptors = xalloc(size * sizeof(XF86VideoAdaptorPtr*));
++ newAdaptors = malloc(size * sizeof(XF86VideoAdaptorPtr*));
+ if(newAdaptors) {
+ if(num_adaptors) {
+ memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr));
+@@ -234,7 +234,7 @@ void SISUSBInitVideo(ScreenPtr pScreen)
+ }
+
+ if(newAdaptors) {
+- xfree(newAdaptors);
++ free(newAdaptors);
+ }
+ }
+
+@@ -377,7 +377,7 @@ SISUSBSetupImageVideo(ScreenPtr pScreen)
+ XF86VideoAdaptorPtr adapt;
+ SISUSBPortPrivPtr pPriv;
+
+- if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
++ if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
+ sizeof(SISUSBPortPrivRec) +
+ sizeof(DevUnion))))
+ return NULL;
diff --git a/testing/xf86-video-tdfx/PKGBUILD b/testing/xf86-video-tdfx/PKGBUILD
new file mode 100644
index 000000000..b84d724e5
--- /dev/null
+++ b/testing/xf86-video-tdfx/PKGBUILD
@@ -0,0 +1,36 @@
+# $Id: PKGBUILD 150075 2012-02-12 09:45:45Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-tdfx
+pkgver=1.4.3
+pkgrel=8
+_gitver=a985b54c8559d7ff8f5481004d54989ed7499237
+pkgdesc="X.org tdfx video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903' 'libdrm' 'xf86driproto' 'mesa>=8.0') # 'glproto')
+conflicts=('xorg-server<1.11.99.902')
+options=(!libtool)
+groups=('xorg-drivers' 'xorg')
+source=(#${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ http://cgit.freedesktop.org/xorg/driver/xf86-video-tdfx/snapshot/xf86-video-tdfx-${_gitver}.tar.gz)
+sha1sums=('01c13cdec926c1aaa9c8c8855995c6cc38149ab2')
+
+build() {
+ #cd "${srcdir}/${pkgname}-${pkgver}"
+ cd ${srcdir}/${pkgname}*
+ autoreconf -fi
+ ./configure --prefix=/usr #--enable-dri
+ make
+}
+
+package() {
+ #cd "${srcdir}/${pkgname}-${pkgver}"
+ cd ${srcdir}/${pkgname}*
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-trident/PKGBUILD b/testing/xf86-video-trident/PKGBUILD
new file mode 100644
index 000000000..cfb5908b5
--- /dev/null
+++ b/testing/xf86-video-trident/PKGBUILD
@@ -0,0 +1,34 @@
+# $Id: PKGBUILD 150077 2012-02-12 09:45:47Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-trident
+pkgver=1.3.4
+pkgrel=6
+pkgdesc="X.org Trident video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903' 'xf86dgaproto')
+conflicts=('xorg-server<1.11.99.903')
+groups=('xorg-drivers' 'xorg')
+options=(!libtool)
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ trident-1.3.4-git.patch)
+sha1sums=('7c40f5c02bddf399862782b708941e79302318af'
+ 'cba17aad6cf2f051d89e65ffe26242ed62ea4454')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i ${srcdir}/trident-1.3.4-git.patch
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-trident/trident-1.3.4-git.patch b/testing/xf86-video-trident/trident-1.3.4-git.patch
new file mode 100644
index 000000000..4e0cc27b2
--- /dev/null
+++ b/testing/xf86-video-trident/trident-1.3.4-git.patch
@@ -0,0 +1,523 @@
+diff --git a/configure.ac b/configure.ac
+index be54427..0fc2066 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -20,47 +20,47 @@
+ #
+ # Process this file with autoconf to produce a configure script
+
+-AC_PREREQ(2.57)
++# Initialize Autoconf
++AC_PREREQ([2.60])
+ AC_INIT([xf86-video-trident],
+- 1.3.4,
++ [1.3.4],
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
+- xf86-video-trident)
+-
++ [xf86-video-trident])
+ AC_CONFIG_SRCDIR([Makefile.am])
+-AM_CONFIG_HEADER([config.h])
++AC_CONFIG_HEADERS([config.h])
+ AC_CONFIG_AUX_DIR(.)
+
++# Initialize Automake
+ AM_INIT_AUTOMAKE([foreign dist-bzip2])
+-
+ AM_MAINTAINER_MODE
+
+-# Require xorg-macros: XORG_DEFAULT_OPTIONS
++# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
+ m4_ifndef([XORG_MACROS_VERSION],
+- [m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])])
+-XORG_MACROS_VERSION(1.3)
++ [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
++XORG_MACROS_VERSION(1.8)
+ XORG_DEFAULT_OPTIONS
+
+-# Checks for programs.
++# Initialize libtool
+ AC_DISABLE_STATIC
+ AC_PROG_LIBTOOL
+-AC_PROG_CC
+
+ AH_TOP([#include "xorg-server.h"])
+
++# Define a configure option for an alternate module directory
+ AC_ARG_WITH(xorg-module-dir,
+- AC_HELP_STRING([--with-xorg-module-dir=DIR],
++ AS_HELP_STRING([--with-xorg-module-dir=DIR],
+ [Default xorg module directory [[default=$libdir/xorg/modules]]]),
+ [moduledir="$withval"],
+ [moduledir="$libdir/xorg/modules"])
+
+-# Checks for extensions
++# Store the list of server defined optional extensions in REQUIRED_MODULES
+ XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
+ XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
+ XORG_DRIVER_CHECK_EXT(XV, videoproto)
+ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
+ XORG_DRIVER_CHECK_EXT(XFreeXDGA, xf86dgaproto)
+
+-# Checks for pkg-config packages
++# Obtain compiler/linker options for the driver dependencies
+ PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES])
+ PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
+ HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
+@@ -90,17 +90,14 @@ AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
+
+ # Checks for libraries.
+
+-# Checks for header files.
+-AC_HEADER_STDC
+-
+-AC_SUBST([XORG_CFLAGS])
+ AC_SUBST([moduledir])
+
+ DRIVER_NAME=trident
+ AC_SUBST([DRIVER_NAME])
+
+-AC_OUTPUT([
+- Makefile
+- src/Makefile
+- man/Makefile
++AC_CONFIG_FILES([
++ Makefile
++ src/Makefile
++ man/Makefile
+ ])
++AC_OUTPUT
+diff --git a/man/Makefile.am b/man/Makefile.am
+index 8f2454b..b3688ce 100644
+--- a/man/Makefile.am
++++ b/man/Makefile.am
+@@ -31,25 +31,11 @@ EXTRA_DIST = @DRIVER_NAME@.man
+
+ CLEANFILES = $(driverman_DATA)
+
+-SED = sed
+-
+-# Strings to replace in man pages
+-XORGRELSTRING = @PACKAGE_STRING@
+- XORGMANNAME = X Version 11
+-
+-MAN_SUBSTS = \
+- -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+- -e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+- -e 's|__xservername__|Xorg|g' \
+- -e 's|__xconfigfile__|xorg.conf|g' \
+- -e 's|__projectroot__|$(prefix)|g' \
+- -e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \
+- -e 's|__drivermansuffix__|$(DRIVER_MAN_SUFFIX)|g' \
+- -e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \
+- -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \
+- -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g'
++
++# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
++
+
+ SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
+
+ .man.$(DRIVER_MAN_SUFFIX):
+- sed $(MAN_SUBSTS) < $< > $@
++ $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+diff --git a/man/trident.man b/man/trident.man
+index 8d04ed0..f461e10 100644
+--- a/man/trident.man
++++ b/man/trident.man
+@@ -1,4 +1,3 @@
+-.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man,v 1.14 2003/05/29 21:48:09 herrb Exp $
+ .\" shorthand for double quote that works everywhere.
+ .ds q \N'34'
+ .TH TRIDENT __drivermansuffix__ __vendorversion__
+diff --git a/src/blade_accel_exa.c b/src/blade_accel_exa.c
+index 80e3f23..3129623 100644
+--- a/src/blade_accel_exa.c
++++ b/src/blade_accel_exa.c
+@@ -251,14 +251,6 @@ static void WaitMarker(ScreenPtr pScreen, int marker)
+ }
+ }
+
+-static Bool PrepareAccess(PixmapPtr pPix, int index)
+-{
+-}
+-
+-static void FinishAccess(PixmapPtr pPix, int index)
+-{
+-}
+-
+ static void BladeInitializeAccelerator(ScrnInfoPtr pScrn)
+ {
+ TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
+diff --git a/src/trident.h b/src/trident.h
+index c15d39c..a28c9fc 100644
+--- a/src/trident.h
++++ b/src/trident.h
+@@ -70,7 +70,7 @@ typedef struct {
+ typedef struct {
+ ScrnInfoPtr pScrn;
+ pciVideoPtr PciInfo;
+- PCITAG PciTag;
++ uint32_t PciTag;
+ EntityInfoPtr pEnt;
+ ExaDriverPtr EXADriverPtr;
+ int useEXA;
+@@ -85,7 +85,7 @@ typedef struct {
+ unsigned char * IOBase;
+ unsigned char * FbBase;
+ long FbMapSize;
+- IOADDRESS PIOBase;
++ unsigned long PIOBase;
+ Bool NoAccel;
+ Bool HWCursor;
+ Bool UsePCIRetry;
+diff --git a/src/trident_dga.c b/src/trident_dga.c
+index 78fa8f4..dd836a6 100644
+--- a/src/trident_dga.c
++++ b/src/trident_dga.c
+@@ -83,15 +83,15 @@ TRIDENTDGAInit(ScreenPtr pScreen)
+ while(pMode) {
+
+ if(0 /*pScrn->displayWidth != pMode->HDisplay*/) {
+- newmodes = xrealloc(modes, (num + 2) * sizeof(DGAModeRec));
++ newmodes = realloc(modes, (num + 2) * sizeof(DGAModeRec));
+ oneMore = TRUE;
+ } else {
+- newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec));
++ newmodes = realloc(modes, (num + 1) * sizeof(DGAModeRec));
+ oneMore = FALSE;
+ }
+
+ if(!newmodes) {
+- xfree(modes);
++ free(modes);
+ return FALSE;
+ }
+ modes = newmodes;
+diff --git a/src/trident_driver.c b/src/trident_driver.c
+index 31cbb83..472c9b7 100644
+--- a/src/trident_driver.c
++++ b/src/trident_driver.c
+@@ -63,7 +63,7 @@
+
+ #ifdef XFreeXDGA
+ #define _XF86DGA_SERVER_
+-#include <X11/extensions/xf86dgastr.h>
++#include <X11/extensions/xf86dgaproto.h>
+ #endif
+
+ #include "globals.h"
+@@ -560,7 +560,7 @@ TRIDENTFreeRec(ScrnInfoPtr pScrn)
+ {
+ if (pScrn->driverPrivate == NULL)
+ return;
+- xfree(pScrn->driverPrivate);
++ free(pScrn->driverPrivate);
+ pScrn->driverPrivate = NULL;
+ }
+
+@@ -900,7 +900,7 @@ TRIDENTProbe(DriverPtr drv, int flags)
+ foundScreen = TRUE;
+ }
+ }
+- xfree(usedChips);
++ free(usedChips);
+ }
+ }
+
+@@ -933,11 +933,11 @@ TRIDENTProbe(DriverPtr drv, int flags)
+ foundScreen = TRUE;
+ }
+ }
+- xfree(usedChips);
++ free(usedChips);
+ }
+ #endif
+
+- xfree(devSections);
++ free(devSections);
+ return foundScreen;
+ }
+
+@@ -1109,7 +1109,12 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags)
+ hwp = VGAHWPTR(pScrn);
+ vgaHWGetIOBase(hwp);
+ vgaIOBase = hwp->IOBase;
++
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+ pTrident->PIOBase = hwp->PIOOffset;
++#else
++ pTrident->PIOBase = 0;
++#endif
+
+ #ifndef XSERVER_LIBPCIACCESS
+ xf86SetOperatingState(resVga, pTrident->pEnt->index, ResUnusedOpr);
+@@ -1163,7 +1168,7 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags)
+ xf86CollectOptions(pScrn, NULL);
+
+ /* Process the options */
+- if (!(pTrident->Options = xalloc(sizeof(TRIDENTOptions))))
++ if (!(pTrident->Options = malloc(sizeof(TRIDENTOptions))))
+ return FALSE;
+ memcpy(pTrident->Options, TRIDENTOptions, sizeof(TRIDENTOptions));
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pTrident->Options);
+@@ -2617,7 +2622,10 @@ TRIDENTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
+ TRIDENTRegPtr tridentReg;
+
+- if (!xf86IsPc98()) WAITFORVSYNC;
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
++ if (!xf86IsPc98())
++#endif
++ WAITFORVSYNC;
+
+ TridentFindClock(pScrn,mode->Clock);
+
+@@ -2709,8 +2717,10 @@ TRIDENTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
+
+ vgaHWProtect(pScrn, FALSE);
+
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+ if (xf86IsPc98())
+ PC98TRIDENTEnable(pScrn);
++#endif
+
+ if (pTrident->TVChipset != 0)
+ VIA_TVInit(pScrn);
+@@ -2782,7 +2792,10 @@ TRIDENTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ if (!TRIDENTMapMem(pScrn))
+ return FALSE;
+
+- if (!xf86IsPc98()) {
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
++ if (!xf86IsPc98())
++#endif
++ {
+ #ifdef VBE_INFO
+ if (pTrident->vbeModes) {
+ pTrident->pVbe = VBEInit(NULL,pTrident->pEnt->index);
+@@ -2796,7 +2809,7 @@ TRIDENTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ }
+ }
+ }
+-
++
+ hwp = VGAHWPTR(pScrn);
+
+ if (IsPciCard && UseMMIO) {
+@@ -2813,9 +2826,12 @@ TRIDENTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ * Some Trident chip on PC-9821 needs setup,
+ * because VGA chip is not initialized by VGA BIOS.
+ */
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+ if (IsPciCard && xf86IsPc98()) {
+ PC98TRIDENTInit(pScrn);
+- } else tridentSetModeBIOS(pScrn,pScrn->currentMode);
++ } else
++#endif
++ tridentSetModeBIOS(pScrn,pScrn->currentMode);
+
+ /* Initialise the first mode */
+ if (!TRIDENTModeInit(pScrn, pScrn->currentMode))
+@@ -2868,7 +2884,7 @@ TRIDENTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+
+ if(pTrident->ShadowFB) {
+ pTrident->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width);
+- pTrident->ShadowPtr = xalloc(pTrident->ShadowPitch * height);
++ pTrident->ShadowPtr = malloc(pTrident->ShadowPitch * height);
+ displayWidth = pTrident->ShadowPitch / (pScrn->bitsPerPixel >> 3);
+ FBStart = pTrident->ShadowPtr;
+ } else {
+@@ -2958,7 +2974,7 @@ TRIDENTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ (miBankProcPtr)TVGA8900SetReadWrite;
+ if (!miInitializeBanking(pScreen, pScrn->virtualX, pScrn->virtualY,
+ pScrn->displayWidth, pBankInfo)) {
+- xfree(pBankInfo);
++ free(pBankInfo);
+ pBankInfo = NULL;
+ if (pTrident->pVbe)
+ vbeFree(pTrident->pVbe);
+@@ -3200,8 +3216,10 @@ TRIDENTLeaveVT(int scrnIndex, int flags)
+ TRIDENTRestore(pScrn);
+ vgaHWLock(hwp);
+
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+ if (xf86IsPc98())
+ PC98TRIDENTDisable(pScrn);
++#endif
+
+ if (IsPciCard && UseMMIO) TRIDENTDisableMMIO(pScrn);
+ }
+@@ -3225,28 +3243,31 @@ TRIDENTCloseScreen(int scrnIndex, ScreenPtr pScreen)
+ pTrident->AccelInfoRec->Sync(pScrn);
+ else if (!pTrident->NoAccel && pTrident->useEXA)
+ pTrident->EXADriverPtr->WaitMarker(pScreen, 0);
+-
++
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+ if (xf86IsPc98())
+ PC98TRIDENTDisable(pScrn);
++#endif
+
+ TRIDENTRestore(pScrn);
+ vgaHWLock(hwp);
+ if (IsPciCard && UseMMIO) TRIDENTDisableMMIO(pScrn);
+ TRIDENTUnmapMem(pScrn);
+ }
++
+ if (pTrident->AccelInfoRec)
+ XAADestroyInfoRec(pTrident->AccelInfoRec);
+ if (pTrident->EXADriverPtr) {
+ exaDriverFini(pScreen);
+- xfree(pTrident->EXADriverPtr);
++ free(pTrident->EXADriverPtr);
+ pTrident->EXADriverPtr = NULL;
+ }
+ if (pTrident->CursorInfoRec)
+ xf86DestroyCursorInfoRec(pTrident->CursorInfoRec);
+ if (pTrident->ShadowPtr)
+- xfree(pTrident->ShadowPtr);
++ free(pTrident->ShadowPtr);
+ if (pTrident->DGAModes)
+- xfree(pTrident->DGAModes);
++ free(pTrident->DGAModes);
+ pScrn->vtSema = FALSE;
+
+ if(pTrident->BlockHandler)
+@@ -3317,15 +3338,17 @@ static void
+ TRIDENTEnableMMIO(ScrnInfoPtr pScrn)
+ {
+ TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
+- IOADDRESS vgaIOBase = pTrident->PIOBase + VGAHWPTR(pScrn)->IOBase;
++ unsigned long vgaIOBase = pTrident->PIOBase + VGAHWPTR(pScrn)->IOBase;
+ CARD8 temp = 0, protect = 0;
+
+ /*
+ * Skip MMIO Enable in PC-9821 PCI Trident Card!!
+ * Because of lack of non PCI VGA port
+ */
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+ if (IsPciCard && xf86IsPc98())
+ return;
++#endif
+
+ /* Goto New Mode */
+ outb(pTrident->PIOBase + 0x3C4, 0x0B);
+@@ -3366,8 +3389,10 @@ TRIDENTDisableMMIO(ScrnInfoPtr pScrn)
+ * Skip MMIO Disable in PC-9821 PCI Trident Card!!
+ * Because of lack of non PCI VGA port
+ */
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+ if (IsPciCard && xf86IsPc98())
+ return;
++#endif
+
+ /* Goto New Mode */
+ OUTB(0x3C4, 0x0B); temp = INB(0x3C5);
+@@ -3395,6 +3420,7 @@ TRIDENTDisableMMIO(ScrnInfoPtr pScrn)
+ outb(pTrident->PIOBase + 0x3C5, temp);
+ }
+
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+ /* Initialize VGA Block for Trident Chip on PC-98x1 */
+ static void
+ PC98TRIDENTInit(ScrnInfoPtr pScrn)
+@@ -3637,7 +3663,7 @@ PC98TRIDENT96xxDisable(ScrnInfoPtr pScrn)
+ outb(0x6A, 0x06);
+ outb(0x68, 0x0F);
+ }
+-
++#endif
+
+ /*
+ * This is a terrible hack! If we are on a notebook in a stretched
+diff --git a/src/trident_video.c b/src/trident_video.c
+index 0c5497b..0ae1d14 100644
+--- a/src/trident_video.c
++++ b/src/trident_video.c
+@@ -125,7 +125,7 @@ void TRIDENTInitVideo(ScreenPtr pScreen)
+ adaptors = &newAdaptor;
+ } else {
+ newAdaptors = /* need to free this someplace */
+- xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*));
++ malloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*));
+ if(newAdaptors) {
+ memcpy(newAdaptors, adaptors, num_adaptors *
+ sizeof(XF86VideoAdaptorPtr));
+@@ -140,7 +140,7 @@ void TRIDENTInitVideo(ScreenPtr pScreen)
+ xf86XVScreenInit(pScreen, adaptors, num_adaptors);
+
+ if(newAdaptors)
+- xfree(newAdaptors);
++ free(newAdaptors);
+
+ if (pTrident->videoFlags)
+ xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,3,
+@@ -321,7 +321,7 @@ TRIDENTSetupImageVideo(ScreenPtr pScreen)
+ XF86VideoAdaptorPtr adapt;
+ TRIDENTPortPrivPtr pPriv;
+
+- if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
++ if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
+ sizeof(TRIDENTPortPrivRec) +
+ sizeof(DevUnion))))
+ return NULL;
+@@ -978,18 +978,18 @@ TRIDENTAllocateSurface(
+ surface->width = w;
+ surface->height = h;
+
+- if(!(surface->pitches = xalloc(sizeof(int)))) {
++ if(!(surface->pitches = malloc(sizeof(int)))) {
+ xf86FreeOffscreenLinear(linear);
+ return BadAlloc;
+ }
+- if(!(surface->offsets = xalloc(sizeof(int)))) {
+- xfree(surface->pitches);
++ if(!(surface->offsets = malloc(sizeof(int)))) {
++ free(surface->pitches);
+ xf86FreeOffscreenLinear(linear);
+ return BadAlloc;
+ }
+- if(!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) {
+- xfree(surface->pitches);
+- xfree(surface->offsets);
++ if(!(pPriv = malloc(sizeof(OffscreenPrivRec)))) {
++ free(surface->pitches);
++ free(surface->offsets);
+ xf86FreeOffscreenLinear(linear);
+ return BadAlloc;
+ }
+@@ -1034,9 +1034,9 @@ TRIDENTFreeSurface(
+ if(pPriv->isOn)
+ TRIDENTStopSurface(surface);
+ xf86FreeOffscreenLinear(pPriv->linear);
+- xfree(surface->pitches);
+- xfree(surface->offsets);
+- xfree(surface->devPrivate.ptr);
++ free(surface->pitches);
++ free(surface->offsets);
++ free(surface->devPrivate.ptr);
+
+ return Success;
+ }
+@@ -1128,7 +1128,7 @@ TRIDENTInitOffscreenImages(ScreenPtr pScreen)
+ XF86OffscreenImagePtr offscreenImages;
+
+ /* need to free this someplace */
+- if(!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec))))
++ if(!(offscreenImages = malloc(sizeof(XF86OffscreenImageRec))))
+ return;
+
+ offscreenImages[0].image = &Images[0];
+@@ -1342,7 +1342,10 @@ WaitForVBlank(ScrnInfoPtr pScrn)
+ * full vblank has passed.
+ * - Alan.
+ */
+- if (!xf86IsPc98()) {
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
++ if (!xf86IsPc98())
++#endif
++ {
+ WAITFORVSYNC;
+ WAITFORVSYNC;
+ }
diff --git a/testing/xf86-video-tseng/PKGBUILD b/testing/xf86-video-tseng/PKGBUILD
new file mode 100644
index 000000000..24aeede8a
--- /dev/null
+++ b/testing/xf86-video-tseng/PKGBUILD
@@ -0,0 +1,33 @@
+# $Id: PKGBUILD 150079 2012-02-12 09:45:50Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-tseng
+pkgver=1.2.4
+pkgrel=6
+pkgdesc="X.org tseng video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903')
+conflicts=('xorg-server<1.11.99.903')
+groups=('xorg-drivers' 'xorg')
+options=('!libtool')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ tseng-1.2.4-git.patch)
+sha1sums=('1b45f55657b2c92f30abb0769cae57fca98d93b7'
+ 'd84bb75d62888096da7477b38e8b13f9c23d4e3a')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i ${srcdir}/tseng-1.2.4-git.patch
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-tseng/tseng-1.2.4-git.patch b/testing/xf86-video-tseng/tseng-1.2.4-git.patch
new file mode 100644
index 000000000..082b2cb0b
--- /dev/null
+++ b/testing/xf86-video-tseng/tseng-1.2.4-git.patch
@@ -0,0 +1,317 @@
+diff --git a/configure.ac b/configure.ac
+index 62cc318..8458c06 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -20,46 +20,46 @@
+ #
+ # Process this file with autoconf to produce a configure script
+
+-AC_PREREQ(2.57)
++# Initialize Autoconf
++AC_PREREQ([2.60])
+ AC_INIT([xf86-video-tseng],
+- 1.2.4,
++ [1.2.4],
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
+- xf86-video-tseng)
+-
++ [xf86-video-tseng])
+ AC_CONFIG_SRCDIR([Makefile.am])
+-AM_CONFIG_HEADER([config.h])
++AC_CONFIG_HEADERS([config.h])
+ AC_CONFIG_AUX_DIR(.)
+
++# Initialize Automake
+ AM_INIT_AUTOMAKE([foreign dist-bzip2])
+-
+ AM_MAINTAINER_MODE
+
+-# Require xorg-macros: XORG_DEFAULT_OPTIONS
++# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
+ m4_ifndef([XORG_MACROS_VERSION],
+- [m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])])
+-XORG_MACROS_VERSION(1.3)
++ [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
++XORG_MACROS_VERSION(1.8)
+ XORG_DEFAULT_OPTIONS
+
+-# Checks for programs.
++# Initialize libtool
+ AC_DISABLE_STATIC
+ AC_PROG_LIBTOOL
+-AC_PROG_CC
+
+ AH_TOP([#include "xorg-server.h"])
+
++# Define a configure option for an alternate module directory
+ AC_ARG_WITH(xorg-module-dir,
+- AC_HELP_STRING([--with-xorg-module-dir=DIR],
++ AS_HELP_STRING([--with-xorg-module-dir=DIR],
+ [Default xorg module directory [[default=$libdir/xorg/modules]]]),
+ [moduledir="$withval"],
+ [moduledir="$libdir/xorg/modules"])
+
+-# Checks for extensions
++# Store the list of server defined optional extensions in REQUIRED_MODULES
+ XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
+ XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
+ XORG_DRIVER_CHECK_EXT(XV, videoproto)
+ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
+
+-# Checks for pkg-config packages
++# Obtain compiler/linker options for the driver dependencies
+ PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES])
+
+ # Checks for libraries.
+@@ -78,17 +78,14 @@ if test "x$XSERVER_LIBPCIACCESS" = xyes; then
+ fi
+ AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
+
+-# Checks for header files.
+-AC_HEADER_STDC
+-
+-AC_SUBST([XORG_CFLAGS])
+ AC_SUBST([moduledir])
+
+ DRIVER_NAME=tseng
+ AC_SUBST([DRIVER_NAME])
+
+-AC_OUTPUT([
+- Makefile
+- src/Makefile
+- man/Makefile
++AC_CONFIG_FILES([
++ Makefile
++ src/Makefile
++ man/Makefile
+ ])
++AC_OUTPUT
+diff --git a/man/Makefile.am b/man/Makefile.am
+index 8f2454b..b3688ce 100644
+--- a/man/Makefile.am
++++ b/man/Makefile.am
+@@ -31,25 +31,11 @@ EXTRA_DIST = @DRIVER_NAME@.man
+
+ CLEANFILES = $(driverman_DATA)
+
+-SED = sed
+-
+-# Strings to replace in man pages
+-XORGRELSTRING = @PACKAGE_STRING@
+- XORGMANNAME = X Version 11
+-
+-MAN_SUBSTS = \
+- -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+- -e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+- -e 's|__xservername__|Xorg|g' \
+- -e 's|__xconfigfile__|xorg.conf|g' \
+- -e 's|__projectroot__|$(prefix)|g' \
+- -e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \
+- -e 's|__drivermansuffix__|$(DRIVER_MAN_SUFFIX)|g' \
+- -e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \
+- -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \
+- -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g'
++
++# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
++
+
+ SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
+
+ .man.$(DRIVER_MAN_SUFFIX):
+- sed $(MAN_SUBSTS) < $< > $@
++ $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+diff --git a/man/tseng.man b/man/tseng.man
+index 403782f..984c8e7 100644
+--- a/man/tseng.man
++++ b/man/tseng.man
+@@ -1,4 +1,3 @@
+-.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.man,v 1.2 2001/01/27 18:20:55 dawes Exp $
+ .\" shorthand for double quote that works everywhere.
+ .ds q \N'34'
+ .TH TSENG __drivermansuffix__ __vendorversion__
+diff --git a/src/tseng_cursor.c b/src/tseng_cursor.c
+index d4fb847..2412b31 100644
+--- a/src/tseng_cursor.c
++++ b/src/tseng_cursor.c
+@@ -159,7 +159,7 @@ TsengSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
+ }
+ }
+
+-void
++static void
+ TsengLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *bits)
+ {
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+diff --git a/src/tseng_dga.c b/src/tseng_dga.c
+index 70ebe23..528ba4c 100644
+--- a/src/tseng_dga.c
++++ b/src/tseng_dga.c
+@@ -74,9 +74,9 @@ TsengDGAInit(ScreenPtr pScreen)
+ if (!pTseng->DGAnumModes) {
+ pMode = firstMode = pScrn->modes;
+ while (pMode) {
+- newmodes = xrealloc(modes, (num + 1) * sizeof (DGAModeRec));
++ newmodes = realloc(modes, (num + 1) * sizeof (DGAModeRec));
+ if (!newmodes) {
+- xfree(modes);
++ free(modes);
+ return FALSE;
+ }
+ modes = newmodes;
+@@ -135,7 +135,7 @@ Tseng_OpenFramebuffer(
+ TsengPtr pTseng = TsengPTR(pScrn);
+
+ *name = NULL; /* no special device */
+- *mem = (unsigned char*)pTseng->FbAddress;
++ *mem = (unsigned char*)(uintptr_t)pTseng->FbAddress;
+ *size = pTseng->FbMapSize;
+ *offset = 0; /* Always */
+ *flags = 0; /* Root permissions OS-dependent */
+diff --git a/src/tseng_driver.c b/src/tseng_driver.c
+index 445c17e..d36b62c 100644
+--- a/src/tseng_driver.c
++++ b/src/tseng_driver.c
+@@ -269,9 +269,9 @@ TsengFreeRec(ScrnInfoPtr pScrn)
+ pTseng = TsengPTR(pScrn);
+
+ if (pTseng->SavedReg.RAMDAC)
+- xfree(pTseng->SavedReg.RAMDAC);
++ free(pTseng->SavedReg.RAMDAC);
+
+- xfree(pScrn->driverPrivate);
++ free(pScrn->driverPrivate);
+ pScrn->driverPrivate = NULL;
+ }
+
+@@ -395,10 +395,10 @@ TsengProbe(DriverPtr drv, int flags)
+ foundScreen = TRUE;
+ }
+ }
+- xfree(usedChips);
++ free(usedChips);
+ }
+
+- xfree(devSections);
++ free(devSections);
+ return foundScreen;
+ }
+
+@@ -806,7 +806,7 @@ TsengProcessOptions(ScrnInfoPtr pScrn)
+ xf86CollectOptions(pScrn, NULL);
+
+ /* Process the options */
+- if (!(pTseng->Options = xalloc(sizeof(TsengOptions))))
++ if (!(pTseng->Options = malloc(sizeof(TsengOptions))))
+ return FALSE;
+ memcpy(pTseng->Options, TsengOptions, sizeof(TsengOptions));
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pTseng->Options);
+@@ -883,7 +883,7 @@ TsengGetFbAddress(ScrnInfoPtr pScrn)
+ PDEBUG(" TsengGetFbAddress\n");
+
+ /* base0 is the framebuffer and base1 is the PCI IO space. */
+- if (PCI_REGION_BASE(pTseng->PciInfo, 0, REGION_MEM)) {
++ if (!PCI_REGION_BASE(pTseng->PciInfo, 0, REGION_MEM)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "No valid Framebuffer address in PCI config space;\n");
+ return FALSE;
+diff --git a/src/tseng_mode.c b/src/tseng_mode.c
+index f075226..a3ff87d 100644
+--- a/src/tseng_mode.c
++++ b/src/tseng_mode.c
+@@ -41,7 +41,11 @@ vgaHWWriteBank(vgaHWPtr hwp, CARD8 value)
+ if (hwp->MMIOBase)
+ MMIO_OUT8(hwp->MMIOBase, hwp->MMIOOffset + VGA_BANK, value);
+ else
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+ outb(hwp->PIOOffset + VGA_BANK, value);
++#else
++ pci_io_write8(hwp->io, VGA_BANK, value);
++#endif
+ }
+
+ CARD8
+@@ -50,7 +54,11 @@ vgaHWReadBank(vgaHWPtr hwp)
+ if (hwp->MMIOBase)
+ return MMIO_IN8(hwp->MMIOBase, hwp->MMIOOffset + VGA_BANK);
+ else
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+ return inb(hwp->PIOOffset + VGA_BANK);
++#else
++ return pci_io_read8(hwp->io, VGA_BANK);
++#endif
+ }
+
+ #define VGA_SEGMENT 0x3CD
+@@ -61,7 +69,11 @@ vgaHWWriteSegment(vgaHWPtr hwp, CARD8 value)
+ if (hwp->MMIOBase)
+ MMIO_OUT8(hwp->MMIOBase, hwp->MMIOOffset + VGA_SEGMENT, value);
+ else
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+ outb(hwp->PIOOffset + VGA_SEGMENT, value);
++#else
++ pci_io_write8(hwp->io, VGA_SEGMENT, value);
++#endif
+ }
+
+ CARD8
+@@ -70,7 +82,11 @@ vgaHWReadSegment(vgaHWPtr hwp)
+ if (hwp->MMIOBase)
+ return MMIO_IN8(hwp->MMIOBase, hwp->MMIOOffset + VGA_SEGMENT);
+ else
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+ return inb(hwp->PIOOffset + VGA_SEGMENT);
++#else
++ return pci_io_read8(hwp->io, VGA_SEGMENT);
++#endif
+ }
+
+ /*
+@@ -84,8 +100,12 @@ vgaHWWriteModeControl(vgaHWPtr hwp, CARD8 value)
+ if (hwp->MMIOBase)
+ MMIO_OUT8(hwp->MMIOBase,
+ hwp->MMIOOffset + hwp->IOBase + VGA_MODE_CONTROL, value);
+- else
+- outb(hwp->IOBase + hwp->PIOOffset + VGA_MODE_CONTROL, value);
++ else
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
++ outb(hwp->PIOOffset + VGA_MODE_CONTROL, value);
++#else
++ pci_io_write8(hwp->io, VGA_MODE_CONTROL, value);
++#endif
+ }
+
+ /*
+@@ -110,14 +130,22 @@ vgaHWHerculesSecondPage(vgaHWPtr hwp, Bool Enable)
+
+ MMIO_OUT8(hwp->MMIOBase, hwp->MMIOOffset + VGA_HERCULES, tmp);
+ } else {
+- tmp = inb(hwp->PIOOffset + VGA_HERCULES);
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
++ tmp = inb(hwp->PIOOffset + VGA_HERCULES);
++#else
++ tmp = pci_io_read8(hwp->io, VGA_HERCULES);
++#endif
+
+ if (Enable)
+ tmp |= 0x02;
+ else
+ tmp &= ~0x02;
+
+- outb(hwp->PIOOffset + VGA_HERCULES, tmp);
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
++ outb(hwp->PIOOffset + VGA_HERCULES, tmp);
++#else
++ pci_io_write8(hwp->io, VGA_HERCULES, tmp);
++#endif
+ }
+ }
+
+@@ -1502,7 +1530,7 @@ TsengModeInit(ScrnInfoPtr pScrn, DisplayModePtr OrigMode)
+
+ /* clean up */
+ if (new->RAMDAC)
+- xfree(new->RAMDAC);
++ free(new->RAMDAC);
+
+ return TRUE;
+ }
diff --git a/testing/xf86-video-unichrome/LICENSE b/testing/xf86-video-unichrome/LICENSE
new file mode 100644
index 000000000..f4007667b
--- /dev/null
+++ b/testing/xf86-video-unichrome/LICENSE
@@ -0,0 +1,23 @@
+Copyright (c) 2004-2007 Luc Verhaegen. All Rights Reserved.
+Copyright (c) 2004-2005 The Unichrome Project. All Rights Reserved.
+Copyright (c) 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+Copyright (c) 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+
+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, sub license,
+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 NON-INFRINGEMENT. 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.
diff --git a/testing/xf86-video-unichrome/PKGBUILD b/testing/xf86-video-unichrome/PKGBUILD
new file mode 100644
index 000000000..6f6424407
--- /dev/null
+++ b/testing/xf86-video-unichrome/PKGBUILD
@@ -0,0 +1,30 @@
+# $Id: PKGBUILD 150081 2012-02-12 09:45:52Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-unichrome
+pkgver=0.2.7
+pkgrel=7
+_gitversion=b917bee87db8a65b8e8da0ca12c24a176c9e9fb2
+pkgdesc="Unichrome video drivers for X.Org"
+arch=(i686 x86_64)
+url="http://unichrome.sf.net/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903' 'libx11' 'libdrm' 'xf86driproto' 'mesa' 'libxvmc') # 'glproto')
+options=('!libtool')
+conflicts=('xf86-video-via' 'openchrome' 'xf86-video-openchrome' 'xorg-server<1.11.99.903')
+source=(http://cgit.freedesktop.org/~libv/${pkgname}/snapshot/${pkgname}-${_gitversion}.tar.bz2)
+md5sums=('f7adef052de08a01af86e245d1932239')
+
+build() {
+ cd "${srcdir}/${pkgname}-${_gitversion}"
+ ./autogen.sh --prefix=/usr #--enable-dri
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${_gitversion}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 debian/copyright "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
+}
diff --git a/testing/xf86-video-v4l/LICENSE b/testing/xf86-video-v4l/LICENSE
new file mode 100644
index 000000000..535595b88
--- /dev/null
+++ b/testing/xf86-video-v4l/LICENSE
@@ -0,0 +1,826 @@
+This package was downloaded from
+http://xorg.freedesktop.org/releases/individual/driver/
+
+ Licenses
+
+ The X.Org Foundation
+
+ March 2004
+
+1. Introduction
+
+The X.org Foundation X Window System distribution is a compilation of code
+and documentation from many sources. This document is intended primarily as
+a guide to the licenses used in the distribution: you must check each file
+and/or package for precise redistribution terms. None-the-less, this summary
+may be useful to many users. No software incorporating the XFree86 1.1
+license has been incorporated.
+
+This document is based on the compilation from XFree86.
+
+2. XFree86 License
+
+XFree86 code without an explicit copyright is covered by the following copy-
+right/license:
+
+Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
+
+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 fur-
+nished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice 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, FIT-
+NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
+NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the XFree86 Project shall not
+be used in advertising or otherwise to promote the sale, use or other deal-
+ings in this Software without prior written authorization from the XFree86
+Project.
+
+3. Other Licenses
+
+Portions of code are covered by the following licenses/copyrights. See indi-
+vidual files for the copyright dates.
+
+3.1 X/MIT Copyrights
+
+3.1.1 X Consortium
+
+Copyright (C) <date> X Consortium
+
+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 fur-
+nished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice 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, FIT-
+NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X
+CONSORTIUM 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.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+X Window System is a trademark of X Consortium, Inc.
+
+3.1.2 The Open Group
+
+Copyright <date> The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting documentation.
+
+The above copyright notice and this permission notice 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, FIT-
+NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+3.2 Berkeley-based copyrights:
+
+o
+
+3.2.1 General
+
+Redistribution and use in source and binary forms, with or without modifica-
+tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
+CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
+CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
+ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
+3.2.2 UCB/LBL
+
+Copyright (c) 1993 The Regents of the University of California. All rights
+reserved.
+
+This software was developed by the Computer Systems Engineering group at
+Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and contributed to
+Berkeley.
+
+All advertising materials mentioning features or use of this software must
+display the following acknowledgement: This product includes software devel-
+oped by the University of California, Lawrence Berkeley Laboratory.
+
+Redistribution and use in source and binary forms, with or without modifica-
+tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement: This product includes soft-
+ ware developed by the University of California, Berkeley and its con-
+ tributors.
+
+ 4. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DIS-
+CLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+3.2.3 The NetBSD Foundation, Inc.
+
+Copyright (c) 2003 The NetBSD Foundation, Inc. All rights reserved.
+
+This code is derived from software contributed to The NetBSD Foundation by
+Ben Collver <collver1@attbi.com>
+
+Redistribution and use in source and binary forms, with or without modifica-
+tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement: This product includes soft-
+ ware developed by the NetBSD Foundation, Inc. and its contributors.
+
+ 4. Neither the name of The NetBSD Foundation nor the names of its con-
+ tributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSE-
+QUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAM-
+AGE.
+
+3.2.4 Theodore Ts'o.
+
+Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999. All rights
+reserved.
+
+Redistribution and use in source and binary forms, with or without modifica-
+tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ and the entire permission notice in its entirety, including the dis-
+ claimer of warranties.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. he name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE, ALL OF WHICH ARE HEREBY DISCLAIMED. IN NO
+EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
+CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
+ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF NOT
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+3.2.5 Theo de Raadt and Damien Miller
+
+Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. Copyright (c)
+2001-2002 Damien Miller. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modifica-
+tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
+CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
+CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
+ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
+3.2.6 Todd C. Miller
+
+Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
+
+Permission to use, copy, modify, and distribute this software for any purpose
+with or without fee is hereby granted, provided that the above copyright
+notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MER-
+CHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE FOR ANY
+SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CON-
+TRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+3.2.7 Thomas Winischhofer
+
+Copyright (C) 2001-2004 Thomas Winischhofer
+
+Redistribution and use in source and binary forms, with or without modifica-
+tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
+CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
+ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
+3.3 NVIDIA Corp
+
+Copyright (c) 1996 NVIDIA, Corp. All rights reserved.
+
+NOTICE TO USER: The source code is copyrighted under U.S. and international
+laws. NVIDIA, Corp. of Sunnyvale, California owns the copyright and as
+design patents pending on the design and interface of the NV chips. Users
+and possessors of this source code are hereby granted a nonexclusive, roy-
+alty-free copyright and design patent license to use this code in individual
+and commercial software.
+
+Any use of this source code must include, in the user documentation and
+internal comments to the code, notices to the end user as follows:
+
+Copyright (c) 1996 NVIDIA, Corp. NVIDIA design patents pending in the U.S.
+and foreign countries.
+
+NVIDIA, CORP. MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
+CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WAR-
+RANTY OF ANY KIND. NVIDIA, CORP. DISCLAIMS ALL WARRANTIES WITH REGARD TO
+THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA, CORP. BE LIABLE
+FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAM-
+AGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE.
+
+3.4 GLX Public License
+
+GLX PUBLIC LICENSE (Version 1.0 (2/11/99)) ("License")
+
+Subject to any third party claims, Silicon Graphics, Inc. ("SGI") hereby
+grants permission to Recipient (defined below), under Recipient's copyrights
+in the Original Software (defined below), to use, copy, modify, merge, pub-
+lish, distribute, sublicense and/or sell copies of Subject Software (defined
+below), and to permit persons to whom the Subject Software is furnished in
+accordance with this License to do the same, subject to all of the following
+terms and conditions, which Recipient accepts by engaging in any such use,
+copying, modifying, merging, publishing, distributing, sublicensing or sell-
+ing:
+
+1. Definitions.
+
+ (a) "Original Software" means source code of computer software code
+ which is described in Exhibit A as Original Software.
+
+ (b) "Modifications" means any addition to or deletion from the sub-
+ stance or structure of either the Original Software or any previous
+ Modifications. When Subject Software is released as a series of
+ files, a Modification means (i) any addition to or deletion from
+ the contents of a file containing Original Software or previous
+ Modifications and (ii) any new file that contains any part of the
+ Original Code or previous Modifications.
+
+ (c) "Subject Software" means the Original Software or Modifications
+ or the combination of the Original Software and Modifications, or
+ portions of any of the foregoing.
+
+ (d) "Recipient" means an individual or a legal entity exercising
+ rights under, and complying with all of the terms of, this License.
+ For legal entities, "Recipient" includes any entity which controls,
+ is controlled by, or is under common control with Recipient. For
+ purposes of this definition, "control" of an entity means (a) the
+ power, direct or indirect, to direct or manage such entity, or (b)
+ ownership of fifty percent (50%) or more of the outstanding shares
+ or beneficial ownership of such entity.
+
+2. Redistribution of Source Code Subject to These Terms. Redistributions of
+Subject Software in source code form must retain the notice set forth in
+Exhibit A, below, in every file. A copy of this License must be included in
+any documentation for such Subject Software where the recipients' rights
+relating to Subject Software are described. Recipient may distribute the
+source code version of Subject Software under a license of Recipient's
+choice, which may contain terms different from this License, provided that
+(i) Recipient is in compliance with the terms of this License, and (ii) the
+license terms include this Section 2 and Sections 3, 4, 7, 8, 10, 12 and 13
+of this License, which terms may not be modified or superseded by any other
+terms of such license. If Recipient distributes the source code version under
+a different license Recipient must make it absolutely clear that any terms
+which differ from this License are offered by Recipient alone, not by SGI.
+Recipient hereby agrees to indemnify SGI for any liability incurred by SGI as
+a result of any such terms Recipient offers.
+
+3. Redistribution in Executable Form. The notice set forth in Exhibit A must
+be conspicuously included in any notice in an executable version of Subject
+Software, related documentation or collateral in which Recipient describes
+the user's rights relating to the Subject Software. Recipient may distribute
+the executable version of Subject Software under a license of Recipient's
+choice, which may contain terms different from this License, provided that
+(i) Recipient is in compliance with the terms of this License, and (ii) the
+license terms include this Section 3 and Sections 4, 7, 8, 10, 12 and 13 of
+this License, which terms may not be modified or superseded by any other
+terms of such license. If Recipient distributes the executable version under
+a different license Recipient must make it absolutely clear that any terms
+which differ from this License are offered by Recipient alone, not by SGI.
+Recipient hereby agrees to indemnify SGI for any liability incurred by SGI as
+a result of any such terms Recipient offers.
+
+4. Termination. This License and the rights granted hereunder will terminate
+automatically if Recipient fails to comply with terms herein and fails to
+cure such breach within 30 days of the breach. Any sublicense to the Subject
+Software which is properly granted shall survive any termination of this
+License absent termination by the terms of such sublicense. Provisions which,
+by their nature, must remain in effect beyond the termination of this License
+shall survive.
+
+5. No Trademark Rights. This License does not grant any rights to use any
+trade name, trademark or service mark whatsoever. No trade name, trademark or
+service mark of SGI may be used to endorse or promote products derived from
+the Subject Software without prior written permission of SGI.
+
+6. No Other Rights. This License does not grant any rights with respect to
+the OpenGL API or to any software or hardware implementation thereof or to
+any other software whatsoever, nor shall any other rights or licenses not
+expressly granted hereunder arise by implication, estoppel or otherwise with
+respect to the Subject Software. Title to and ownership of the Original Soft-
+ware at all times remains with SGI. All rights in the Original Software not
+expressly granted under this License are reserved.
+
+7. Compliance with Laws; Non-Infringement. Recipient shall comply with all
+applicable laws and regulations in connection with use and distribution of
+the Subject Software, including but not limited to, all export and import
+control laws and regulations of the U.S. government and other countries.
+Recipient may not distribute Subject Software that (i) in any way infringes
+(directly or contributorily) the rights (including patent, copyright, trade
+secret, trademark or other intellectual property rights of any kind) of any
+other person or entity or (ii) breaches any representation or warranty,
+express, implied or statutory, which under any applicable law it might be
+deemed to have been distributed.
+
+8. Claims of Infringement. If Recipient at any time has knowledge of any one
+or more third party claims that reproduction, modification, use, distribu-
+tion, import or sale of Subject Software (including particular functionality
+or code incorporated in Subject Software) infringes the third party's intel-
+lectual property rights, Recipient must place in a well-identified web page
+bearing the title "LEGAL" a description of each such claim and a description
+of the party making each such claim in sufficient detail that a user of the
+Subject Software will know whom to contact regarding the claim. Also, upon
+gaining such knowledge of any such claim, Recipient must conspicuously
+include the URL for such web page in the Exhibit A notice required under Sec-
+tions 2 and 3, above, and in the text of any related documentation, license
+agreement or collateral in which Recipient describes end user's rights relat-
+ing to the Subject Software. If Recipient obtains such knowledge after it
+makes Subject Software available to any other person or entity, Recipient
+shall take other steps (such as notifying appropriate mailing lists or news-
+groups) reasonably calculated to inform those who received the Subject Soft-
+ware that new knowledge has been obtained.
+
+9. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS, MER-
+CHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON- INFRINGING. SGI ASSUMES NO
+RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE
+PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY SER-
+VICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
+ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED
+HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+10. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THE-
+ORY, WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIA-
+BILITY), CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR
+ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
+CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, LOSS OF DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF
+THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY
+TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SGI's NEGLIGENCE TO
+THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES,
+SO THAT EXCLUSION AND LIMITATION MAY NOT APPLY TO RECIPIENT.
+
+11. Indemnity. Recipient shall be solely responsible for damages arising,
+directly or indirectly, out of its utilization of rights under this License.
+Recipient will defend, indemnify and hold harmless Silicon Graphics, Inc.
+from and against any loss, liability, damages, costs or expenses (including
+the payment of reasonable attorneys fees) arising out of Recipient's use,
+modification, reproduction and distribution of the Subject Software or out of
+any representation or warranty made by Recipient.
+
+12. U.S. Government End Users. The Subject Software is a "commercial item"
+consisting of "commercial computer software" as such terms are defined in
+title 48 of the Code of Federal Regulations and all U.S. Government End
+Users acquire only the rights set forth in this License and are subject to
+the terms of this License.
+
+13. Miscellaneous. This License represents the complete agreement concerning
+subject matter hereof. If any provision of this License is held to be unen-
+forceable, such provision shall be reformed so as to achieve as nearly as
+possible the same economic effect as the original provision and the remainder
+of this License will remain in effect. This License shall be governed by and
+construed in accordance with the laws of the United States and the State of
+California as applied to agreements entered into and to be performed entirely
+within California between California residents. Any litigation relating to
+this License shall be subject to the exclusive jurisdiction of the Federal
+Courts of the Northern District of California (or, absent subject matter
+jurisdiction in such courts, the courts of the State of California), with
+venue lying exclusively in Santa Clara County, California, with the losing
+party responsible for costs, including without limitation, court costs and
+reasonable attorneys fees and expenses. The application of the United Nations
+Convention on Contracts for the International Sale of Goods is expressly
+excluded. Any law or regulation which provides that the language of a con-
+tract shall be construed against the drafter shall not apply to this License.
+
+Exhibit A
+
+The contents of this file are subject to Sections 2, 3, 4, 7, 8, 10, 12 and
+13 of the GLX Public License Version 1.0 (the "License"). You may not use
+this file except in compliance with those sections of the License. You may
+obtain a copy of the License at Silicon Graphics, Inc., attn: Legal Services,
+2011 N. Shoreline Blvd., Mountain View, CA 94043 or at
+http://www.sgi.com/software/opensource/glx/license.html.
+
+Software distributed under the License is distributed on an "AS IS" basis.
+ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
+WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF NON-
+INFRINGEMENT. See the License for the specific language governing rights and
+limitations under the License.
+
+The Original Software is GLX version 1.2 source code, released February,
+1999. The developer of the Original Software is Silicon Graphics, Inc. Those
+portions of the Subject Software created by Silicon Graphics, Inc. are Copy-
+right (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+
+3.5 CID Font Code Public License
+
+CID FONT CODE PUBLIC LICENSE (Version 1.0 (3/31/99))("License")
+
+Subject to any applicable third party claims, Silicon Graphics, Inc. ("SGI")
+hereby grants permission to Recipient (defined below), under SGI's copyrights
+in the Original Software (defined below), to use, copy, modify, merge, pub-
+lish, distribute, sublicense and/or sell copies of Subject Software (defined
+below) in both source code and executable form, and to permit persons to whom
+the Subject Software is furnished in accordance with this License to do the
+same, subject to all of the following terms and conditions, which Recipient
+accepts by engaging in any such use, copying, modifying, merging, publica-
+tion, distributing, sublicensing or selling:
+
+1. Definitions.
+
+ a. "Original Software" means source code of computer software code
+ that is described in Exhibit A as Original Software.
+
+ b. "Modifications" means any addition to or deletion from the sub-
+ stance or structure of either the Original Software or any previous
+ Modifications. When Subject Software is released as a series of
+ files, a Modification means (i) any addition to or deletion from
+ the contents of a file containing Original Software or previous
+ Modifications and (ii) any new file that contains any part of the
+ Original Code or previous Modifications.
+
+ c. "Subject Software" means the Original Software or Modifications
+ or the combination of the Original Software and Modifications, or
+ portions of any of the foregoing.
+
+ d. "Recipient" means an individual or a legal entity exercising
+ rights under the terms of this License. For legal entities, "Recip-
+ ient" includes any entity that controls, is controlled by, or is
+ under common control with Recipient. For purposes of this defini-
+ tion, "control" of an entity means (i) the power, direct or indi-
+ rect, to direct or manage such entity, or (ii) ownership of fifty
+ percent (50%) or more of the outstanding shares or beneficial own-
+ ership of such entity.
+
+ e. "Required Notice" means the notice set forth in Exhibit A to
+ this License.
+
+ f. "Accompanying Technology" means any software or other technology
+ that is not a Modification and that is distributed or made publicly
+ available by Recipient with the Subject Software. Separate soft-
+ ware files that do not contain any Original Software or any previ-
+ ous Modification shall not be deemed a Modification, even if such
+ software files are aggregated as part of a product, or in any
+ medium of storage, with any file that does contain Original Soft-
+ ware or any previous Modification.
+
+2. License Terms. All distribution of the Subject Software must be made sub-
+ject to the terms of this License. A copy of this License and the Required
+Notice must be included in any documentation for Subject Software where
+Recipient's rights relating to Subject Software and/or any Accompanying Tech-
+nology are described. Distributions of Subject Software in source code form
+must also include the Required Notice in every file distributed. In addition,
+a ReadMe file entitled "Important Legal Notice" must be distributed with each
+distribution of one or more files that incorporate Subject Software. That
+file must be included with distributions made in both source code and exe-
+cutable form. A copy of the License and the Required Notice must be included
+in that file. Recipient may distribute Accompanying Technology under a
+license of Recipient's choice, which may contain terms different from this
+License, provided that (i) Recipient is in compliance with the terms of this
+License, (ii) such other license terms do not modify or supersede the terms
+of this License as applicable to the Subject Software, (iii) Recipient hereby
+indemnifies SGI for any liability incurred by SGI as a result of the distri-
+bution of Accompanying Technology or the use of other license terms.
+
+3. Termination. This License and the rights granted hereunder will terminate
+automatically if Recipient fails to comply with terms herein and fails to
+cure such breach within 30 days of the breach. Any sublicense to the Subject
+Software that is properly granted shall survive any termination of this
+License absent termination by the terms of such sublicense. Provisions which,
+by their nature, must remain in effect beyond the termination of this License
+shall survive.
+
+4. Trademark Rights. This License does not grant any rights to use any trade
+name, trademark or service mark whatsoever. No trade name, trademark or ser-
+vice mark of SGI may be used to endorse or promote products derived from or
+incorporating any Subject Software without prior written permission of SGI.
+
+5. No Other Rights. No rights or licenses not expressly granted hereunder
+shall arise by implication, estoppel or otherwise. Title to and ownership of
+the Original Software at all times remains with SGI. All rights in the Origi-
+nal Software not expressly granted under this License are reserved.
+
+6. Compliance with Laws; Non-Infringement. Recipient shall comply with all
+applicable laws and regulations in connection with use and distribution of
+the Subject Software, including but not limited to, all export and import
+control laws and regulations of the U.S. government and other countries.
+Recipient may not distribute Subject Software that (i) in any way infringes
+(directly or contributorily) the rights (including patent, copyright, trade
+secret, trademark or other intellectual property rights of any kind) of any
+other person or entity, or (ii) breaches any representation or warranty,
+express, implied or statutory, which under any applicable law it might be
+deemed to have been distributed.
+
+7. Claims of Infringement. If Recipient at any time has knowledge of any one
+or more third party claims that reproduction, modification, use, distribu-
+tion, import or sale of Subject Software (including particular functionality
+or code incorporated in Subject Software) infringes the third party's intel-
+lectual property rights, Recipient must place in a well-identified web page
+bearing the title "LEGAL" a description of each such claim and a description
+of the party making each such claim in sufficient detail that a user of the
+Subject Software will know whom to contact regarding the claim. Also, upon
+gaining such knowledge of any such claim, Recipient must conspicuously
+include the URL for such web page in the Required Notice, and in the text of
+any related documentation, license agreement or collateral in which Recipient
+describes end user's rights relating to the Subject Software. If Recipient
+obtains such knowledge after it makes Subject Software available to any other
+person or entity, Recipient shall take other steps (such as notifying appro-
+priate mailing lists or newsgroups) reasonably calculated to provide such
+knowledge to those who received the Subject Software.
+
+8. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS, MER-
+CHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. SGI ASSUMES NO
+RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE
+PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY SER-
+VICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
+ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED
+HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY,
+WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIABILITY),
+CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR 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 SUBJECT SOFTWARE OR
+THE USE OR OTHER DEALINGS IN THE SUBJECT SOFTWARE. SOME JURISDICTIONS DO NOT
+ALLOW THE EXCLUSION OR LIMITATION OF CERTAIN DAMAGES, SO THIS EXCLUSION AND
+LIMITATION MAY NOT APPLY TO RECIPIENT TO THE EXTENT SO DISALLOWED.
+
+10. Indemnity. Recipient shall be solely responsible for damages arising,
+directly or indirectly, out of its utilization of rights under this License.
+Recipient will defend, indemnify and hold SGI and its successors and assigns
+harmless from and against any loss, liability, damages, costs or expenses
+(including the payment of reasonable attorneys fees) arising out of (Recipi-
+ent's use, modification, reproduction and distribution of the Subject Soft-
+ware or out of any representation or warranty made by Recipient.
+
+11. U.S. Government End Users. The Subject Software is a "commercial item"
+consisting of "commercial computer software" as such terms are defined in
+title 48 of the Code of Federal Regulations and all U.S. Government End Users
+acquire only the rights set forth in this License and are subject to the
+terms of this License.
+
+12. Miscellaneous. This License represents the complete agreement concerning
+subject matter hereof. If any provision of this License is held to be unen-
+forceable by any judicial or administrative authority having proper jurisdic-
+tion with respect thereto, such provision shall be reformed so as to achieve
+as nearly as possible the same economic effect as the original provision and
+the remainder of this License will remain in effect. This License shall be
+governed by and construed in accordance with the laws of the United States
+and the State of California as applied to agreements entered into and to be
+performed entirely within California between California residents. Any liti-
+gation relating to this License shall be subject to the exclusive jurisdic-
+tion of the Federal Courts of the Northern District of California (or, absent
+subject matter jurisdiction in such courts, the courts of the State of Cali-
+fornia), with venue lying exclusively in Santa Clara County, California, with
+the losing party responsible for costs, including without limitation, court
+costs and reasonable attorneys fees and expenses. The application of the
+United Nations Convention on Contracts for the International Sale of Goods is
+expressly excluded. Any law or regulation that provides that the language of
+a contract shall be construed against the drafter shall not apply to this
+License.
+
+Exhibit A
+
+Copyright (c) 1994-1999 Silicon Graphics, Inc.
+
+The contents of this file are subject to the CID Font Code Public License
+Version 1.0 (the "License"). You may not use this file except in compliance
+with the License. You may obtain a copy of the License at Silicon Graphics,
+Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+or at http://www.sgi.com/software/opensource/cid/license.html
+
+Software distributed under the License is distributed on an "AS IS" basis.
+ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
+WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF NON-
+INFRINGEMENT. See the License for the specific language governing rights and
+limitations under the License.
+
+The Original Software (as defined in the License) is CID font code that was
+developed by Silicon Graphics, Inc. Those portions of the Subject Software
+(as defined in the License) that were created by Silicon Graphics, Inc. are
+Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
+
+[NOTE: When using this text in connection with Subject Software delivered
+solely in object code form, Recipient may replace the words "this file" with
+"this software" in both the first and second sentences.]
+
+3.6 Bitstream Vera Fonts Copyright
+
+The fonts have a generous copyright, allowing derivative works (as long as
+"Bitstream" or "Vera" are not in the names), and full redistribution (so long
+as they are not *sold* by themselves). They can be be bundled, redistributed
+and sold with any software.
+
+The fonts are distributed under the following copyright:
+
+Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
+a trademark of Bitstream, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the fonts accompanying this license ("Fonts") and associated documentation
+files (the "Font Software"), to reproduce and distribute the Font Software,
+including without limitation the rights to use, copy, merge, publish, dis-
+tribute, and/or sell copies of the Font Software, and to permit persons to
+whom the Font Software is furnished to do so, subject to the following condi-
+tions:
+
+The above copyright and trademark notices and this permission notice shall be
+included in all copies of one or more of the Font Software typefaces.
+
+The Font Software may be modified, altered, or added to, and in particular
+the designs of glyphs or characters in the Fonts may be modified and addi-
+tional glyphs or characters may be added to the Fonts, only if the fonts are
+renamed to names not containing either the words "Bitstream" or the word
+"Vera".
+
+This License becomes null and void to the extent applicable to Fonts or Font
+Software that has been modified and is distributed under the "Bitstream Vera"
+names.
+
+The Font Software may be sold as part of a larger software package but no
+copy of one or more of the Font Software typefaces may be sold by itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDA-
+TION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GEN-
+ERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR
+INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFT-
+WARE.
+
+Except as contained in this notice, the names of Gnome, the Gnome Foundation,
+and Bitstream Inc., shall not be used in advertising or otherwise to promote
+the sale, use or other dealings in this Font Software without prior written
+authorization from the Gnome Foundation or Bitstream Inc., respectively. For
+further information, contact: fonts at gnome dot org.
+
+3.7 Bigelow & Holmes Inc and URW++ GmbH Luxi font license
+
+Luxi fonts copyright (c) 2001 by Bigelow & Holmes Inc. Luxi font instruction
+code copyright (c) 2001 by URW++ GmbH. All Rights Reserved. Luxi is a regis-
+tered trademark of Bigelow & Holmes Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of these Fonts and associated documentation files (the "Font Software"), to
+deal in the Font Software, including without limitation the rights to use,
+copy, merge, publish, distribute, sublicense, and/or sell copies of the Font
+Software, and to permit persons to whom the Font Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright and trademark notices and this permission notice shall be
+included in all copies of one or more of the Font Software.
+
+The Font Software may not be modified, altered, or added to, and in particu-
+lar the designs of glyphs or characters in the Fonts may not be modified nor
+may additional glyphs or characters be added to the Fonts. This License
+becomes null and void when the Fonts or Font Software have been modified.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BIGELOW & HOLMES INC. OR URW++
+GMBH. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GEN-
+ERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR
+INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFT-
+WARE.
+
+Except as contained in this notice, the names of Bigelow & Holmes Inc. and
+URW++ GmbH. shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Font Software without prior written
+authorization from Bigelow & Holmes Inc. and URW++ GmbH.
+
+For further information, contact:
+
+info@urwpp.de or design@bigelowandholmes.com
+
+ $Id: LICENSE,v 1.3 2004/09/03 23:41:21 kem Exp $
diff --git a/testing/xf86-video-v4l/PKGBUILD b/testing/xf86-video-v4l/PKGBUILD
new file mode 100644
index 000000000..a947504f5
--- /dev/null
+++ b/testing/xf86-video-v4l/PKGBUILD
@@ -0,0 +1,36 @@
+# $Id: PKGBUILD 150083 2012-02-12 09:45:54Z andyrtr $
+#Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-v4l
+pkgver=0.2.0
+pkgrel=10
+pkgdesc="X.org v4l video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903')
+conflicts=('xorg-server<1.11.99.903')
+groups=('xorg-drivers' 'xorg')
+options=('!libtool')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ git-fixes.patch
+ LICENSE)
+md5sums=('2251ae2a0a905764941cd7b098e85ad1'
+ 'cdb7113a9564ea9202e847de88440540'
+ '7d4d018f6bbff7e42672d1aabc75c5cf')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i "${srcdir}/git-fixes.patch"
+ autoreconf -fi
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-v4l/git-fixes.patch b/testing/xf86-video-v4l/git-fixes.patch
new file mode 100644
index 000000000..2f752fc8c
--- /dev/null
+++ b/testing/xf86-video-v4l/git-fixes.patch
@@ -0,0 +1,4362 @@
+diff --git a/ChangeLog b/ChangeLog
+deleted file mode 100644
+index 02fc6fa..0000000
+--- a/ChangeLog
++++ /dev/null
+@@ -1,57 +0,0 @@
+-2006-04-07 Adam Jackson <ajax@freedesktop.org>
+-
+- * configure.ac:
+- * src/v4l.c:
+- Bump to 0.1.1 for Xv changes.
+-
+-2006-04-07 Aaron Plattner <aplattner@nvidia.com>
+-
+- * src/v4l.c: (V4lPutVideo), (V4lPutStill):
+- Add a DrawablePtr argument to the XV functions to pave the way for
+- redirected video.
+-
+-2006-04-07 Adam Jackson <ajax@freedesktop.org>
+-
+- * configure.ac:
+- * src/v4l.c:
+- Unlibcwrap. Bump server version requirement. Bump to 0.1.0.
+-
+-2005-12-20 Kevin E. Martin <kem-at-freedesktop-dot-org>
+-
+- * configure.ac:
+- Update package version for X11R7 release.
+-
+-2005-12-14 Kevin E. Martin <kem-at-freedesktop-dot-org>
+-
+- * configure.ac:
+- Update package version number for final X11R7 release candidate.
+-
+-2005-12-06 Kevin E. Martin <kem-at-freedesktop-dot-org>
+-
+- * man/Makefile.am:
+- Change *man_SOURCES ==> *man_PRE to fix autotools warnings.
+-
+-2005-12-03 Kevin E. Martin <kem-at-freedesktop-dot-org>
+-
+- * configure.ac:
+- Update package version number for X11R7 RC3 release.
+-
+-2005-12-01 Kevin E. Martin <kem-at-freedesktop-dot-org>
+-
+- * configure.ac:
+- Remove extraneous AC_MSG_RESULT.
+-
+-2005-11-29 Adam Jackson <ajax@freedesktop.org>
+-
+- * configure.ac:
+- Only build dlloader modules by default.
+-
+-2005-11-09 Kevin E. Martin <kem-at-freedesktop-dot-org>
+-
+- * configure.ac:
+- Update package version number for X11R7 RC2 release.
+-
+-2005-11-01 Kevin E. Martin <kem-at-freedesktop-dot-org>
+-
+- * configure.ac:
+- Update pkgcheck dependencies to work with separate build roots.
+diff --git a/Makefile.am b/Makefile.am
+index 3ae2692..4c278ba 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -18,6 +18,15 @@
+ # 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.
+
+-AUTOMAKE_OPTIONS = foreign
+ SUBDIRS = src man
+-EXTRA_DIST = README
++MAINTAINERCLEANFILES = ChangeLog INSTALL
++
++.PHONY: ChangeLog INSTALL
++
++INSTALL:
++ $(INSTALL_CMD)
++
++ChangeLog:
++ $(CHANGELOG_CMD)
++
++dist-hook: ChangeLog INSTALL
+diff --git a/configure.ac b/configure.ac
+index d9ac542..c490919 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -20,57 +20,56 @@
+ #
+ # Process this file with autoconf to produce a configure script
+
+-AC_PREREQ(2.57)
++# Initialize Autoconf
++AC_PREREQ([2.60])
+ AC_INIT([xf86-video-v4l],
+- 0.2.0,
++ [0.2.0],
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
+- xf86-video-v4l)
+-
++ [xf86-video-v4l])
+ AC_CONFIG_SRCDIR([Makefile.am])
+-AM_CONFIG_HEADER([config.h])
++AC_CONFIG_HEADERS([config.h])
+ AC_CONFIG_AUX_DIR(.)
+
+-AM_INIT_AUTOMAKE([dist-bzip2])
+-
++# Initialize Automake
++AM_INIT_AUTOMAKE([foreign dist-bzip2])
+ AM_MAINTAINER_MODE
+
+-# Checks for programs.
++# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
++m4_ifndef([XORG_MACROS_VERSION],
++ [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
++XORG_MACROS_VERSION(1.8)
++XORG_DEFAULT_OPTIONS
++
++# Initialize libtool
+ AC_DISABLE_STATIC
+ AC_PROG_LIBTOOL
+-AC_PROG_CC
+
+ AH_TOP([#include "xorg-server.h"])
+
++# Define a configure option for an alternate module directory
+ AC_ARG_WITH(xorg-module-dir,
+- AC_HELP_STRING([--with-xorg-module-dir=DIR],
++ AS_HELP_STRING([--with-xorg-module-dir=DIR],
+ [Default xorg module directory [[default=$libdir/xorg/modules]]]),
+ [moduledir="$withval"],
+ [moduledir="$libdir/xorg/modules"])
+
+-# Checks for extensions
++# Store the list of server defined optional extensions in REQUIRED_MODULES
+ XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
+ XORG_DRIVER_CHECK_EXT(XV, videoproto)
+
+-# Checks for pkg-config packages
++# Obtain compiler/linker options for the driver dependencies
+ PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto $REQUIRED_MODULES])
+-sdkdir=$(pkg-config --variable=sdkdir xorg-server)
+
+ # Checks for libraries.
+
+-# Checks for header files.
+-AC_HEADER_STDC
+-
+-AC_SUBST([XORG_CFLAGS])
+ AC_SUBST([moduledir])
+
+ DRIVER_NAME=v4l
+ AC_SUBST([DRIVER_NAME])
+
+-XORG_MANPAGE_SECTIONS
+-XORG_RELEASE_VERSION
+-
+-AC_OUTPUT([
+- Makefile
+- src/Makefile
+- man/Makefile
++AC_CONFIG_FILES([
++ Makefile
++ src/Makefile
++ man/Makefile
+ ])
++AC_OUTPUT
+diff --git a/man/Makefile.am b/man/Makefile.am
+index f0eb29b..b3688ce 100644
+--- a/man/Makefile.am
++++ b/man/Makefile.am
+@@ -1,27 +1,24 @@
+ #
+ # Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+-#
+-# Permission to use, copy, modify, distribute, and sell this software and its
+-# documentation for any purpose is hereby granted without fee, provided that
+-# the above copyright notice appear in all copies and that both that
+-# copyright notice and this permission notice appear in supporting
+-# documentation.
+-#
+-# The above copyright notice and this permission notice 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 OPEN GROUP 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.
+-#
+-# Except as contained in this notice, the name of the copyright holders shall
+-# not be used in advertising or otherwise to promote the sale, use or
+-# other dealings in this Software without prior written authorization
+-# from the copyright holders.
++#
++# 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.
+ #
+
+ drivermandir = $(DRIVER_MAN_DIR)
+@@ -34,25 +31,11 @@ EXTRA_DIST = @DRIVER_NAME@.man
+
+ CLEANFILES = $(driverman_DATA)
+
+-SED = sed
+
+-# Strings to replace in man pages
+-XORGRELSTRING = @PACKAGE_STRING@
+- XORGMANNAME = X Version 11
++# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+
+-MAN_SUBSTS = \
+- -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+- -e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+- -e 's|__xservername__|Xorg|g' \
+- -e 's|__xconfigfile__|xorg.conf|g' \
+- -e 's|__projectroot__|$(prefix)|g' \
+- -e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \
+- -e 's|__drivermansuffix__|$(DRIVER_MAN_SUFFIX)|g' \
+- -e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \
+- -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \
+- -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g'
+
+ SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
+
+ .man.$(DRIVER_MAN_SUFFIX):
+- sed $(MAN_SUBSTS) < $< > $@
++ $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+diff --git a/man/v4l.man b/man/v4l.man
+index 7d35b86..dc1e201 100644
+--- a/man/v4l.man
++++ b/man/v4l.man
+@@ -34,6 +34,6 @@ Please refer to __xconfigfile__(__filemansuffix__) for general configuration
+ details. This section only covers configuration details specific to this
+ driver.
+ .SH "SEE ALSO"
+-__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
++__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
+ .SH AUTHORS
+ Authors include: Gerd Knorr <kraxel@bytesex.org>
+diff --git a/src/Makefile.am b/src/Makefile.am
+index ed30a80..08afe60 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -28,7 +28,6 @@ v4l_drv_la_LTLIBRARIES = v4l_drv.la
+ v4l_drv_la_LDFLAGS = -module -avoid-version
+ v4l_drv_ladir = @moduledir@/drivers
+
+-v4l_drv_la_SOURCES = \
+- v4l.c
+-
+-EXTRA_DIST = videodev.h
++v4l_drv_la_SOURCES = \
++ v4l.c \
++ videodev.h
+diff --git a/src/v4l.c b/src/v4l.c
+index b827f80..10e782b 100644
+--- a/src/v4l.c
++++ b/src/v4l.c
+@@ -1,6 +1,9 @@
+ /*
+- * video4linux Xv Driver
++ * video4linux Xv Driver
+ * based on Michael Schimek's permedia 2 driver.
++ *
++ * Copyright (c) 2011 Mauro Carvalho Chehab <mchehab@redhat.com> for:
++ * - Major rewrite, as driver got ported to V4L2 API
+ */
+
+ #ifdef HAVE_CONFIG_H
+@@ -9,12 +12,16 @@
+
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include <ctype.h>
++
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <string.h>
+ #include <stdio.h>
++#include <unistd.h>
++#include <sys/ioctl.h>
+
+-#include "videodev.h"
++#include "videodev2.h"
+ #include "xf86.h"
+ #include "xf86_OSproc.h"
+ #include "xf86Pci.h"
+@@ -25,8 +32,9 @@
+ #include "regionstr.h"
+ #include "dgaproc.h"
+ #include "xf86str.h"
++#include "fourcc.h"
+
+-#include <asm/ioctl.h> /* _IORW(xxx) #defines are here */
++#include <asm/ioctl.h> /* _IORW(xxx) #defines are here */
+
+ #if 0
+ # define DEBUG(x) (x)
+@@ -34,20 +42,22 @@
+ # define DEBUG(x)
+ #endif
+
++/***************************************************************************/
++
+ static void V4LIdentify(int flags);
+ static Bool V4LProbe(DriverPtr drv, int flags);
+ static const OptionInfoRec * V4LAvailableOptions(int chipid, int busid);
+
+ _X_EXPORT DriverRec V4L = {
+- 40000,
+- "v4l",
+- V4LIdentify, /* Identify*/
+- V4LProbe, /* Probe */
+- V4LAvailableOptions,
+- NULL,
+- 0
+-};
+-
++ .driverVersion = 50000,
++ .driverName = "v4l",
++ .Identify = V4LIdentify,
++ .Probe = V4LProbe,
++ .AvailableOptions = V4LAvailableOptions,
++ .module = NULL,
++ .refCount = 0,
++ .driverFunc = NULL, /* FIXME: Need to implement for new probing mode */
++};
+
+ #ifdef XFree86LOADER
+
+@@ -55,16 +65,16 @@ static MODULESETUPPROTO(v4lSetup);
+
+ static XF86ModuleVersionInfo v4lVersRec =
+ {
+- "v4l",
+- MODULEVENDORSTRING,
+- MODINFOSTRING1,
+- MODINFOSTRING2,
+- XORG_VERSION_CURRENT,
+- 0, 1, 1,
+- ABI_CLASS_VIDEODRV,
+- ABI_VIDEODRV_VERSION,
+- MOD_CLASS_NONE,
+- {0,0,0,0}
++ "v4l",
++ MODULEVENDORSTRING,
++ MODINFOSTRING1,
++ MODINFOSTRING2,
++ XORG_VERSION_CURRENT,
++ 0, 1, 1,
++ ABI_CLASS_VIDEODRV,
++ ABI_VIDEODRV_VERSION,
++ MOD_CLASS_NONE,
++ {0,0,0,0}
+ };
+
+ _X_EXPORT XF86ModuleData v4lModuleData = { &v4lVersRec, v4lSetup, NULL };
+@@ -72,32 +82,32 @@ _X_EXPORT XF86ModuleData v4lModuleData = { &v4lVersRec, v4lSetup, NULL };
+ static pointer
+ v4lSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+ {
+- const char *osname;
+- static Bool setupDone = FALSE;
+-
+- if (setupDone) {
+- if (errmaj)
+- *errmaj = LDR_ONCEONLY;
+- return NULL;
+- }
+-
+- setupDone = TRUE;
+-
+- /* Check that we're being loaded on a Linux system */
+- LoaderGetOS(&osname, NULL, NULL, NULL);
+- if (!osname || strcmp(osname, "linux") != 0) {
+- if (errmaj)
+- *errmaj = LDR_BADOS;
+- if (errmin)
+- *errmin = 0;
+- return NULL;
+- } else {
+- /* OK */
+-
+- xf86AddDriver (&V4L, module, 0);
+-
+- return (pointer)1;
+- }
++ const char *osname;
++ static Bool setupDone = FALSE;
++
++ if (setupDone) {
++ if (errmaj)
++ *errmaj = LDR_ONCEONLY;
++ return NULL;
++ }
++
++ setupDone = TRUE;
++
++ /* Check that we're being loaded on a Linux system */
++ LoaderGetOS(&osname, NULL, NULL, NULL);
++ if (!osname || strcmp(osname, "linux") != 0) {
++ if (errmaj)
++ *errmaj = LDR_BADOS;
++ if (errmin)
++ *errmin = 0;
++ return NULL;
++ } else {
++ /* OK */
++
++ xf86AddDriver (&V4L, module, 0);
++
++ return (pointer)1;
++ }
+ }
+
+ #else
+@@ -112,25 +122,28 @@ v4lSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+ #define VIDEO_YUV 2 /* yuv overlay (to offscreen memory + hw scaling) */
+ #define VIDEO_RECLIP 3 /* temporarly off, window clipping changes */
+
++typedef struct _XvV4LCtrlRec {
++ struct v4l2_queryctrl qctrl;
++ Atom xv;
++} XvV4LCtrlRec, *XvV4LCtrlPtr;
++
+ typedef struct _PortPrivRec {
+ ScrnInfoPtr pScrn;
+- FBAreaPtr pFBArea[2];
+- int VideoOn;
+- Bool StreamOn;
++ FBAreaPtr pFBArea[2];
++ int VideoOn;
++ Bool StreamOn;
+
+ /* file handle */
+- int nr;
+- struct video_capability cap;
++ int nr;
++ struct v4l2_capability cap;
+
+ /* RGB overlay */
+- struct video_buffer rgb_fbuf;
+- struct video_window rgb_win;
+- int rgbpalette;
++ struct v4l2_framebuffer rgb_fbuf;
++ struct v4l2_window rgb_win;
+ int rgbdepth;
+
+ /* attributes */
+- struct video_picture pict;
+- struct video_audio audio;
++ CARD32 pixelformat;
+
+ XF86VideoEncodingPtr enc;
+ int *input;
+@@ -145,24 +158,21 @@ typedef struct _PortPrivRec {
+
+ int yuv_width,yuv_height;
+ XF86SurfacePtr surface;
+- struct video_buffer yuv_fbuf;
+- struct video_window yuv_win;
+-} PortPrivRec, *PortPrivPtr;
++ struct v4l2_framebuffer yuv_fbuf;
++ struct v4l2_window yuv_win;
++
++ struct v4l2_standard *standard; /* FIXME: can be removed */
+
+-#define XV_ENCODING "XV_ENCODING"
+-#define XV_BRIGHTNESS "XV_BRIGHTNESS"
+-#define XV_CONTRAST "XV_CONTRAST"
+-#define XV_SATURATION "XV_SATURATION"
+-#define XV_HUE "XV_HUE"
++ XvV4LCtrlPtr XvV4LCtrl;
++ int n_qctrl;
++} PortPrivRec, *PortPrivPtr;
+
+-#define XV_FREQ "XV_FREQ"
+-#define XV_MUTE "XV_MUTE"
+-#define XV_VOLUME "XV_VOLUME"
++#define XV_ENCODING "XV_ENCODING"
++#define XV_FREQ "XV_FREQ"
+
+-#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
++#define MAKE_ATOM(a) MakeAtom(a, strlen(a), TRUE)
+
+-static Atom xvEncoding, xvBrightness, xvContrast, xvSaturation, xvHue;
+-static Atom xvFreq, xvMute, xvVolume;
++static Atom xvEncoding, xvFreq;
+
+ static XF86VideoFormatRec
+ InputVideoFormats[] = {
+@@ -176,16 +186,8 @@ InputVideoFormats[] = {
+
+ static const XF86AttributeRec Attributes[] = {
+ {XvSettable | XvGettable, -1000, 1000, XV_ENCODING},
+- {XvSettable | XvGettable, -1000, 1000, XV_BRIGHTNESS},
+- {XvSettable | XvGettable, -1000, 1000, XV_CONTRAST},
+- {XvSettable | XvGettable, -1000, 1000, XV_SATURATION},
+- {XvSettable | XvGettable, -1000, 1000, XV_HUE},
+ };
+-static const XF86AttributeRec VolumeAttr =
+- {XvSettable | XvGettable, -1000, 1000, XV_VOLUME};
+-static const XF86AttributeRec MuteAttr =
+- {XvSettable | XvGettable, 0, 1, XV_MUTE};
+-static const XF86AttributeRec FreqAttr =
++static const XF86AttributeRec FreqAttr =
+ {XvSettable | XvGettable, 0, 16*1000, XV_FREQ};
+
+
+@@ -206,59 +208,247 @@ static struct V4L_DEVICE {
+ };
+
+ /* ---------------------------------------------------------------------- */
+-/* forward decl */
+
+-static void V4lQueryBestSize(ScrnInfoPtr pScrn, Bool motion,
+- short vid_w, short vid_h, short drw_w, short drw_h,
+- unsigned int *p_w, unsigned int *p_h, pointer data);
++static int SetV4LFmt(int fd, CARD32 pixelformat)
++{
++ struct v4l2_framebuffer fbuf;
++ char *p = (char *)&pixelformat;
++
++ memset(&fbuf, 0, sizeof(fbuf));
++ if (ioctl(fd, VIDIOC_G_FBUF, &fbuf) == -1) {
++ xf86Msg(X_ERROR, "v4l: Error %d: Can't get FBUF\n", errno);
++ return errno;
++ }
++ if (fbuf.fmt.pixelformat != pixelformat) {
++ fbuf.fmt.pixelformat = pixelformat;
++ if (ioctl(fd, VIDIOC_S_FBUF, &fbuf) == -1) {
++ xf86Msg(X_ERROR, "v4l: Error %d: Can't set FBUF to %c%c%c%c\n",
++ errno, p[0], p[1], p[2], p[3]);
++ return errno;
++ }
++ }
++ DEBUG(xf86Msg(X_INFO, "v4l: Set overlay format to %c%c%c%c\n",
++ p[0], p[1], p[2], p[3]));
++ return 0;
++}
++static int GetV4LFmt(int fd, CARD32 *pixelformat)
++{
++ struct v4l2_framebuffer fbuf;
++
++ memset(&fbuf, 0, sizeof(fbuf));
++ if (ioctl(fd, VIDIOC_G_FBUF, &fbuf) == -1) {
++ xf86Msg(X_ERROR, "v4l: Error %d: Can't get FBUF\n", errno);
++ return errno;
++ }
++
++ *pixelformat = fbuf.fmt.pixelformat;
++
++ return 0;
++}
++
++#define ATTR_NAME_PREFIX "XV_"
++static int AddControl(PortPrivPtr p, XF86AttributeRec **list, int *count,
++ struct v4l2_queryctrl *qctrl, int *n)
++{
++ char *ptr;
++
++/* v4l_add_attr */
++ if (qctrl->flags & V4L2_CTRL_FLAG_DISABLED)
++ return 0;
++ switch (qctrl->type) {
++ case V4L2_CTRL_TYPE_INTEGER:
++ case V4L2_CTRL_TYPE_BOOLEAN:
++ case V4L2_CTRL_TYPE_MENU:
++ case V4L2_CTRL_TYPE_BUTTON:
++ break;
++ default:
++ return 0;
++ }
++
++ p->XvV4LCtrl = realloc(p->XvV4LCtrl, sizeof(XvV4LCtrlRec) * (*n + 1));
++ if (!p->XvV4LCtrl) {
++ if (*list) {
++ free (*list);
++ *count = 0;
++ *n = 0;
++ }
++ return -1;
++ }
++
++ *list = realloc(*list, sizeof(XF86AttributeRec) * (*count + 1));
++ if (NULL == *list) {
++ if (p->XvV4LCtrl)
++ free (p->XvV4LCtrl);
++ *count = 0;
++ return -1;
++ }
++
++ memset(*list + *count, 0, sizeof(XF86AttributeRec));
++ (*list)[*count].flags = XvSettable | XvGettable;
++
++ if (qctrl->flags & V4L2_CTRL_FLAG_READ_ONLY)
++ (*list)[*count].flags &= ~XvSettable;
++ if (qctrl->flags & V4L2_CTRL_FLAG_WRITE_ONLY)
++ (*list)[*count].flags &= ~XvGettable;
++ (*list)[*count].min_value = qctrl->minimum;
++ (*list)[*count].max_value = qctrl->maximum;
++ (*list)[*count].name = malloc(strlen((char *)qctrl->name) + 1 + sizeof (ATTR_NAME_PREFIX));
++ strcpy((*list)[*count].name, ATTR_NAME_PREFIX);
++ strcat((*list)[*count].name, (char *)qctrl->name);
++ for (ptr = (*list)[*count].name; *ptr; ptr++) {
++ *ptr = toupper(*ptr);
++ if (*ptr == ' ')
++ *ptr = '_';
++ }
++
++ p->XvV4LCtrl[*n].xv = MAKE_ATOM((*list)[*count].name);
++ memcpy(&p->XvV4LCtrl[*n].qctrl, qctrl, sizeof(*qctrl));
++
++ xf86Msg(X_INFO, "v4l: add attr %s (Xv/GPA %d) (%d to %d)\n",
++ (*list)[*count].name, (int)p->XvV4LCtrl[*n].xv,
++ p->XvV4LCtrl[*n].qctrl.minimum,
++ p->XvV4LCtrl[*n].qctrl.maximum);
++
++ (*count)++;
++ (*n)++;
++
++ return 0;
++}
++
++static void AddAllV4LControls(PortPrivPtr p, XF86AttributeRec **list,
++ int *count, int fd)
++{
++ int entries = 0;
++ CARD32 id;
++ struct v4l2_queryctrl qctrl;
++
++ memset(&qctrl, 0, sizeof(qctrl));
++ qctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL;
++ while (!ioctl(fd, VIDIOC_QUERYCTRL, &qctrl)) {
++ if (AddControl(p, list, count, &qctrl, &entries))
++ return;
++ qctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;
++ }
++ if (qctrl.id != V4L2_CTRL_FLAG_NEXT_CTRL)
++ return;
++ for (id = V4L2_CID_USER_BASE; id < V4L2_CID_LASTP1; id++) {
++ qctrl.id = id;
++ if (!ioctl(fd, VIDIOC_QUERYCTRL, &qctrl)) {
++ if (AddControl(p, list, count, &qctrl, &entries))
++ return;
++ }
++ }
++ qctrl.id = V4L2_CID_PRIVATE_BASE;
++ while (!ioctl(fd, VIDIOC_QUERYCTRL, &qctrl)) {
++ if (AddControl(p, list, count, &qctrl, &entries))
++ return;
++ qctrl.id++;
++ }
++ p->n_qctrl = entries;
++}
+
+ /* ---------------------------------------------------------------------- */
+
++/* setup yuv overlay + hw scaling: look if we find some common video
++ format which both v4l driver and the X-Server can handle */
++static int v4l_check_yuv(ScrnInfoPtr pScrn, PortPrivPtr pPPriv,
++ char *dev, int fd)
++{
++ static const struct {
++ CARD32 v4l_palette;
++ unsigned int xv_id;
++ unsigned int xv_format;
++ } yuvlist[] = {
++ { V4L2_PIX_FMT_YUYV, FOURCC_YUY2, XvPacked },
++ { V4L2_PIX_FMT_UYVY, FOURCC_UYVY, XvPacked },
++ { 0 /* end of list */ },
++ };
++ /* FIXME: Why pScrn->scrnIndex? */
++ ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
++ int fmt,i;
++
++ pPPriv->format = xf86XVQueryOffscreenImages(pScreen, &pPPriv->nformat);
++ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
++ "v4l: Number of Xv formats: %d\n", pPPriv->nformat);
++ if (!pPPriv->nformat)
++ return FALSE;
++
++ for (fmt = 0; yuvlist[fmt].v4l_palette != 0; fmt++) {
++ pPPriv->pixelformat = yuvlist[fmt].v4l_palette;
++ if (-1 == SetV4LFmt(fd, pPPriv->pixelformat))
++ continue;
++ GetV4LFmt(fd, &pPPriv->pixelformat);
++ if (pPPriv->pixelformat != yuvlist[fmt].v4l_palette)
++ continue;
++ /* ... works, check available offscreen image formats now ... */
++ for (i = 0; i < pPPriv->nformat; i++) {
++ if (pPPriv->format[i].image->id == yuvlist[fmt].xv_id &&
++ pPPriv->format[i].image->format == yuvlist[fmt].xv_format) {
++ /* ... match found, good. */
++ pPPriv->yuv_format = yuvlist[fmt].v4l_palette;
++ pPPriv->myfmt = pPPriv->format+i;
++ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
++ "v4l[%s]: using hw video scaling [%4.4s].\n",
++ dev,(char*)&(pPPriv->format[i].image->id));
++ return TRUE;
++ }
++ }
++ }
++ return TRUE;
++}
++
+ static int V4lOpenDevice(PortPrivPtr pPPriv, ScrnInfoPtr pScrn)
+ {
+ static int first = 1;
+
++#if 0
++ /*
++ * It may be a good idea to probe here, but this would break
++ * some things, as initialization uses yuv_format
++ */
++ if (!pPPriv->yuv_format && first)
++ v4l_check_yuv(pScrn, pPPriv, V4L_NAME, V4L_FD);
++#endif
+ if (-1 == V4L_FD) {
+- V4L_FD = open(V4L_NAME, O_RDWR, 0);
+-
+- pPPriv->rgb_fbuf.width = pScrn->virtualX;
+- pPPriv->rgb_fbuf.height = pScrn->virtualY;
+- pPPriv->rgb_fbuf.depth = pScrn->bitsPerPixel;
+- pPPriv->rgb_fbuf.bytesperline = pScrn->displayWidth * ((pScrn->bitsPerPixel + 7)/8);
+- pPPriv->rgb_fbuf.base = (pointer)(pScrn->memPhysBase + pScrn->fbOffset);
+- if (first) {
+- first = 0;
+- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+- "v4l: memPhysBase=0x%lx\n", pScrn->memPhysBase);
+- }
+-
+- switch (pScrn->bitsPerPixel) {
+- case 16:
+- if (pScrn->weight.green == 5) {
+- pPPriv->rgbpalette = VIDEO_PALETTE_RGB555;
+- pPPriv->rgbdepth = 16;
+- } else {
+- pPPriv->rgbpalette = VIDEO_PALETTE_RGB565;
+- pPPriv->rgbdepth = 16;
+- }
+- break;
+- case 24:
+- pPPriv->rgbpalette = VIDEO_PALETTE_RGB24;
+- pPPriv->rgbdepth = 24;
+- break;
+- case 32:
+- pPPriv->rgbpalette = VIDEO_PALETTE_RGB32;
+- pPPriv->rgbdepth = 32;
+- break;
+- }
++ V4L_FD = open(V4L_NAME, O_RDWR, 0);
++
++ if (-1 == V4L_FD)
++ return errno;
++
++ if (-1 == ioctl(V4L_FD, VIDIOC_G_FBUF, &pPPriv->rgb_fbuf)) {
++ xf86Msg(X_ERROR, "v4l: Error %d: Can't get FBUF\n", errno);
++ return errno;
++ }
++ pPPriv->rgb_fbuf.fmt.width = pScrn->virtualX;
++ pPPriv->rgb_fbuf.fmt.height = pScrn->virtualY;
++ pPPriv->rgb_fbuf.fmt.bytesperline = pScrn->displayWidth * ((pScrn->bitsPerPixel + 7)/8);
++ pPPriv->rgb_fbuf.base = (pointer)(pScrn->memPhysBase + pScrn->fbOffset);
++ if (first) {
++ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
++ "v4l: memPhysBase=0x%lx\n", pScrn->memPhysBase);
++ first = 0;
++ }
++
++ switch (pScrn->bitsPerPixel) {
++ case 16:
++ if (pScrn->weight.green == 5) {
++ pPPriv->rgb_fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB555;
++ } else {
++ pPPriv->rgb_fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB565;
++ }
++ break;
++ case 24:
++ pPPriv->rgb_fbuf.fmt.pixelformat = V4L2_PIX_FMT_BGR24;
++ break;
++ case 32:
++ pPPriv->rgb_fbuf.fmt.pixelformat = V4L2_PIX_FMT_BGR32;
++ break;
++ }
+ }
+
+- if (-1 == V4L_FD)
+- return errno;
+-
+ V4L_REF++;
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+- "Xv/open: refcount=%d\n",V4L_REF));
++ "Xv/open: refcount=%d\n",V4L_REF));
+
+ return 0;
+ }
+@@ -267,10 +457,10 @@ static void V4lCloseDevice(PortPrivPtr pPPriv, ScrnInfoPtr pScrn)
+ {
+ V4L_REF--;
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+- "Xv/close: refcount=%d\n",V4L_REF));
++ "Xv/close: refcount=%d\n",V4L_REF));
+ if (0 == V4L_REF && -1 != V4L_FD) {
+- close(V4L_FD);
+- V4L_FD = -1;
++ close(V4L_FD);
++ V4L_FD = -1;
+ }
+ }
+
+@@ -280,8 +470,10 @@ V4lPutVideo(ScrnInfoPtr pScrn,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw)
+ {
++ struct v4l2_format fmt;
++
+ PortPrivPtr pPPriv = (PortPrivPtr) data;
+- struct video_clip *clip;
++ struct v4l2_clip *clip;
+ BoxPtr pBox;
+ RegionRec newReg;
+ BoxRec newBox;
+@@ -291,179 +483,214 @@ V4lPutVideo(ScrnInfoPtr pScrn,
+
+ /* Open a file handle to the device */
+ if (VIDEO_OFF == pPPriv->VideoOn) {
+- if (V4lOpenDevice(pPPriv, pScrn))
+- return Success;
++ if (V4lOpenDevice(pPPriv, pScrn))
++ return Success;
+ }
+
+ if (0 != pPPriv->yuv_format) {
+- DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/PV yuv\n"));
+- width = pPPriv->enc[pPPriv->cenc].width;
++ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/PV yuv\n"));
++ width = pPPriv->enc[pPPriv->cenc].width;
+ height = pPPriv->enc[pPPriv->cenc].height/2; /* no interlace */
+- if (drw_w < width)
+- width = drw_w;
+- if (drw_h < height)
+- height = drw_h;
+- if ((height != pPPriv->yuv_height) || (width != pPPriv->yuv_width)) {
+- /* new size -- free old surface */
+- DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, " surface resize\n"));
+- if (pPPriv->surface) {
+- pPPriv->VideoOn = VIDEO_OFF;
+- pPPriv->myfmt->stop(pPPriv->surface);
+- pPPriv->myfmt->free_surface(pPPriv->surface);
+- xfree(pPPriv->surface);
+- pPPriv->surface = NULL;
+- }
+- pPPriv->yuv_width = width;
+- pPPriv->yuv_height = height;
+- }
+- if (!pPPriv->surface) {
+- /* allocate + setup offscreen surface */
+- if (NULL == (pPPriv->surface = xalloc(sizeof(XF86SurfaceRec))))
+- return FALSE;
+- if (Success != pPPriv->myfmt->alloc_surface
+- (pScrn,pPPriv->myfmt->image->id,
+- pPPriv->yuv_width,pPPriv->yuv_height,pPPriv->surface)) {
+- xfree(pPPriv->surface);
+- pPPriv->surface = NULL;
+- goto fallback_to_rgb;
+- }
+- pPPriv->yuv_fbuf.width = pPPriv->surface->width;
+- pPPriv->yuv_fbuf.height = pPPriv->surface->height;
+- pPPriv->yuv_fbuf.depth = 16;
+- pPPriv->yuv_fbuf.bytesperline = pPPriv->surface->pitches[0];
+- pPPriv->yuv_fbuf.base =
+- (pointer)(pScrn->memPhysBase + pPPriv->surface->offsets[0]);
+- DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, " surface: %p+%d = %p, %dx%d, pitch %d\n",
+- pScrn->memPhysBase,pPPriv->surface->offsets[0],
+- pScrn->memPhysBase+pPPriv->surface->offsets[0],
+- pPPriv->surface->width,pPPriv->surface->height,
+- pPPriv->surface->pitches[0]));
+- pPPriv->yuv_win.width = pPPriv->surface->width;
+- pPPriv->yuv_win.height = pPPriv->surface->height;
+- }
+-
+- /* program driver */
+- if (-1 == ioctl(V4L_FD,VIDIOCSFBUF,&(pPPriv->yuv_fbuf)))
+- perror("ioctl VIDIOCSFBUF");
+- if (-1 == ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict))
+- perror("ioctl VIDIOCGPICT");
+- pPPriv->pict.palette = pPPriv->yuv_format;
+- pPPriv->pict.depth = 16;
+- if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict))
+- perror("ioctl VIDIOCSPICT");
+- if (-1 == ioctl(V4L_FD,VIDIOCSWIN,&(pPPriv->yuv_win)))
+- perror("ioctl VIDIOCSWIN");
+- if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &one))
+- perror("ioctl VIDIOCCAPTURE(1)");
+-
+- if (0 == (pPPriv->myfmt->flags & VIDEO_INVERT_CLIPLIST)) {
+- /* invert cliplist */
+- newBox.x1 = drw_x;
+- newBox.y1 = drw_y;
+- newBox.x2 = drw_x + drw_w;
+- newBox.y2 = drw_y + drw_h;
+-
+- if (pPPriv->myfmt->flags & VIDEO_CLIP_TO_VIEWPORT) {
+- /* trim to the viewport */
+- if(newBox.x1 < pScrn->frameX0)
+- newBox.x1 = pScrn->frameX0;
+- if(newBox.x2 > pScrn->frameX1)
+- newBox.x2 = pScrn->frameX1;
+-
+- if(newBox.y1 < pScrn->frameY0)
+- newBox.y1 = pScrn->frameY0;
+- if(newBox.y2 > pScrn->frameY1)
+- newBox.y2 = pScrn->frameY1;
+- }
++ if (drw_w < width)
++ width = drw_w;
++ if (drw_h < height)
++ height = drw_h;
++ if ((height != pPPriv->yuv_height) || (width != pPPriv->yuv_width)) {
++ /* new size -- free old surface */
++ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, " surface resize\n"));
++ if (pPPriv->surface) {
++ pPPriv->VideoOn = VIDEO_OFF;
++ pPPriv->myfmt->stop(pPPriv->surface);
++ pPPriv->myfmt->free_surface(pPPriv->surface);
++ free(pPPriv->surface);
++ pPPriv->surface = NULL;
++ }
++ pPPriv->yuv_width = width;
++ pPPriv->yuv_height = height;
++ }
++ if (!pPPriv->surface) {
++ /* allocate + setup offscreen surface */
++ if (NULL == (pPPriv->surface = malloc(sizeof(XF86SurfaceRec))))
++ return FALSE;
++ if (Success != pPPriv->myfmt->alloc_surface
++ (pScrn,pPPriv->myfmt->image->id,
++ pPPriv->yuv_width,pPPriv->yuv_height,pPPriv->surface)) {
++ free(pPPriv->surface);
++ pPPriv->surface = NULL;
++ goto fallback_to_rgb;
++ }
++
++ if (-1 == ioctl(V4L_FD, VIDIOC_G_FBUF, &pPPriv->yuv_fbuf)) {
++ xf86Msg(X_ERROR, "v4l: Error %d: Can't get FBUF\n", errno);
++ return errno;
++ }
++ pPPriv->yuv_fbuf.fmt.width = pPPriv->surface->width;
++ pPPriv->yuv_fbuf.fmt.height = pPPriv->surface->height;
++ pPPriv->yuv_fbuf.fmt.bytesperline = pPPriv->surface->pitches[0];
++ pPPriv->yuv_fbuf.fmt.pixelformat = pPPriv->yuv_format;
++ pPPriv->yuv_fbuf.base =
++ (pointer)(pScrn->memPhysBase + pPPriv->surface->offsets[0]);
++ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
++ " surface: %p+%d = %p, %dx%d, pitch %d\n",
++ (void *)pScrn->memPhysBase, pPPriv->surface->offsets[0],
++ (void *)pScrn->memPhysBase+pPPriv->surface->offsets[0],
++ pPPriv->surface->width, pPPriv->surface->height,
++ pPPriv->surface->pitches[0]));
++ memset(&pPPriv->yuv_win, 0, sizeof(pPPriv->yuv_win));
++ pPPriv->yuv_win.w.left = 0;
++ pPPriv->yuv_win.w.top = 0;
++ pPPriv->yuv_win.w.width = pPPriv->surface->width;
++ pPPriv->yuv_win.w.height = pPPriv->surface->height;
++ }
+
+- REGION_INIT(pScrn->pScreen, &newReg, &newBox, 1);
+- REGION_SUBTRACT(pScrn->pScreen, &newReg, &newReg, clipBoxes);
+- clipBoxes = &newReg;
+- }
+-
+- /* start overlay */
+- DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+- "over: - %d,%d -> %d,%d (%dx%d) (yuv=%dx%d)\n",
+- drw_x, drw_y,
+- drw_x+drw_w, drw_y+drw_h,
+- drw_w, drw_h,
+- pPPriv->surface->width,pPPriv->surface->height));
+- pPPriv->myfmt->display(pPPriv->surface,
+- 0, 0, drw_x, drw_y,
+- pPPriv->surface->width,
+- pPPriv->surface->height,
+- drw_w, drw_h,
+- clipBoxes);
+- if (0 == (pPPriv->myfmt->flags & VIDEO_INVERT_CLIPLIST)) {
+- REGION_UNINIT(pScrn->pScreen, &newReg);
+- }
+- pPPriv->VideoOn = VIDEO_YUV;
+- return Success;
++ /* program driver */
++ if (-1 == ioctl(V4L_FD, VIDIOC_S_FBUF, &pPPriv->yuv_fbuf)) {
++ xf86Msg(X_ERROR, "Error %d at VIDIOC_S_FBUF\n", errno);
++ return BadValue;
++ }
++ pPPriv->pixelformat = pPPriv->yuv_format;
++ if (-1 == SetV4LFmt(V4L_FD, pPPriv->pixelformat))
++ return BadValue;
++
++ memset(&fmt, 0, sizeof(fmt));
++ fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
++ memcpy(&fmt.fmt.win, &pPPriv->yuv_win, sizeof(pPPriv->yuv_win));
++ if (-1 == ioctl(V4L_FD, VIDIOC_S_FMT, &fmt)) {
++ xf86Msg(X_ERROR, "Error %d at VIDIOC_S_FMT\n", errno);
++ return BadValue;
++ }
++ if (-1 == ioctl(V4L_FD, VIDIOC_OVERLAY, &one)) {
++ xf86Msg(X_ERROR, "v4l: Error %d while enabling Overlay\n", errno);
++ return BadValue;
++ }
++
++ if (0 == (pPPriv->myfmt->flags & VIDEO_INVERT_CLIPLIST)) {
++ /* invert cliplist */
++ newBox.x1 = drw_x;
++ newBox.y1 = drw_y;
++ newBox.x2 = drw_x + drw_w;
++ newBox.y2 = drw_y + drw_h;
++
++ if (pPPriv->myfmt->flags & VIDEO_CLIP_TO_VIEWPORT) {
++ /* trim to the viewport */
++ if(newBox.x1 < pScrn->frameX0)
++ newBox.x1 = pScrn->frameX0;
++ if(newBox.x2 > pScrn->frameX1)
++ newBox.x2 = pScrn->frameX1;
++
++ if(newBox.y1 < pScrn->frameY0)
++ newBox.y1 = pScrn->frameY0;
++ if(newBox.y2 > pScrn->frameY1)
++ newBox.y2 = pScrn->frameY1;
++ }
++
++ REGION_INIT(pScrn->pScreen, &newReg, &newBox, 1);
++ REGION_SUBTRACT(pScrn->pScreen, &newReg, &newReg, clipBoxes);
++ clipBoxes = &newReg;
++ }
++
++ /* start overlay */
++ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
++ "over: - %d,%d -> %d,%d (%dx%d) (yuv=%dx%d)\n",
++ drw_x, drw_y,
++ drw_x+drw_w, drw_y+drw_h,
++ drw_w, drw_h,
++ pPPriv->surface->width,pPPriv->surface->height));
++ pPPriv->myfmt->display(pPPriv->surface,
++ 0, 0, drw_x, drw_y,
++ pPPriv->surface->width,
++ pPPriv->surface->height,
++ drw_w, drw_h,
++ clipBoxes);
++ if (0 == (pPPriv->myfmt->flags & VIDEO_INVERT_CLIPLIST)) {
++ REGION_UNINIT(pScrn->pScreen, &newReg);
++ }
++ pPPriv->VideoOn = VIDEO_YUV;
++ return Success;
+ }
+
+- fallback_to_rgb:
++fallback_to_rgb:
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/PV rgb\n"));
+ /* FIXME: vid-* is ignored for now, not supported by v4l */
+
+ dw = (drw_w < pPPriv->enc[pPPriv->cenc].width) ?
+- drw_w : pPPriv->enc[pPPriv->cenc].width;
++ drw_w : pPPriv->enc[pPPriv->cenc].width;
+ dh = (drw_h < pPPriv->enc[pPPriv->cenc].height) ?
+- drw_h : pPPriv->enc[pPPriv->cenc].height;
++ drw_h : pPPriv->enc[pPPriv->cenc].height;
+ /* if the window is too big, center the video */
+ dx = drw_x + (drw_w - dw)/2;
+ dy = drw_y + (drw_h - dh)/2;
+ /* bttv prefeares aligned addresses */
+ dx &= ~3;
+- if (dx < drw_x) dx += 4;
+- if (dx+dw > drw_x+drw_w) dw -= 4;
++ if (dx < drw_x)
++ dx += 4;
++ if (dx+dw > drw_x+drw_w)
++ dw -= 4;
+
+ /* window */
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, " win: %dx%d+%d+%d\n",
+- drw_w,drw_h,drw_x,drw_y));
++ drw_w,drw_h,drw_x,drw_y));
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, " use: %dx%d+%d+%d\n",
+- dw,dh,dx,dy));
+- pPPriv->rgb_win.x = dx;
+- pPPriv->rgb_win.y = dy;
+- pPPriv->rgb_win.width = dw;
+- pPPriv->rgb_win.height = dh;
+- pPPriv->rgb_win.flags = 0;
+-
++ dw,dh,dx,dy));
++ memset(&pPPriv->rgb_win, 0, sizeof(pPPriv->rgb_win));
++ pPPriv->rgb_win.w.left = dx;
++ pPPriv->rgb_win.w.top = dy;
++ pPPriv->rgb_win.w.width = dw;
++ pPPriv->rgb_win.w.height = dh;
++
+ /* clipping */
+ if (pPPriv->rgb_win.clips) {
+- xfree(pPPriv->rgb_win.clips);
+- pPPriv->rgb_win.clips = NULL;
++ free(pPPriv->rgb_win.clips);
++ pPPriv->rgb_win.clips = NULL;
+ }
+ pPPriv->rgb_win.clipcount = REGION_NUM_RECTS(clipBoxes);
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2," clip: have #%d\n",
+- pPPriv->rgb_win.clipcount));
++ pPPriv->rgb_win.clipcount));
+ if (0 != pPPriv->rgb_win.clipcount) {
+- pPPriv->rgb_win.clips = xalloc(pPPriv->rgb_win.clipcount*sizeof(struct video_clip));
+- if (NULL != pPPriv->rgb_win.clips) {
+- memset(pPPriv->rgb_win.clips,0,pPPriv->rgb_win.clipcount*sizeof(struct video_clip));
+- pBox = REGION_RECTS(clipBoxes);
+- clip = pPPriv->rgb_win.clips;
+- for (i = 0; i < REGION_NUM_RECTS(clipBoxes); i++, pBox++, clip++) {
+- clip->x = pBox->x1 - dx;
+- clip->y = pBox->y1 - dy;
+- clip->width = pBox->x2 - pBox->x1;
+- clip->height = pBox->y2 - pBox->y1;
+- }
+- }
++ pPPriv->rgb_win.clips = malloc(pPPriv->rgb_win.clipcount*sizeof(struct v4l2_clip));
++ if (NULL != pPPriv->rgb_win.clips) {
++ memset(pPPriv->rgb_win.clips,0,pPPriv->rgb_win.clipcount*sizeof(struct v4l2_clip));
++ pBox = REGION_RECTS(clipBoxes);
++ clip = pPPriv->rgb_win.clips;
++
++ /*
++ * FIXME: This code currently does nothing, as we don't emulate
++ * The V4L1 clipping stuff
++ */
++ for (i = 0; i < REGION_NUM_RECTS(clipBoxes); i++, pBox++, clip++) {
++ clip->c.left = pBox->x1 - dx;
++ clip->c.top = pBox->y1 - dy;
++ clip->c.width = pBox->x2 - pBox->x1;
++ clip->c.height = pBox->y2 - pBox->y1;
++ }
++ }
+ }
+
+ /* start */
+- if (-1 == ioctl(V4L_FD,VIDIOCSFBUF,&(pPPriv->rgb_fbuf)))
+- perror("ioctl VIDIOCSFBUF");
+- if (-1 == ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict))
+- perror("ioctl VIDIOCGPICT");
+- pPPriv->pict.palette = pPPriv->rgbpalette;
+- pPPriv->pict.depth = pPPriv->rgbdepth;
+- if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict))
+- perror("ioctl VIDIOCSPICT");
+- if (-1 == ioctl(V4L_FD,VIDIOCSWIN,&(pPPriv->rgb_win)))
+- perror("ioctl VIDIOCSWIN");
+- if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &one))
+- perror("ioctl VIDIOCCAPTURE(1)");
++ if (-1 == ioctl(V4L_FD, VIDIOC_S_FBUF, &pPPriv->rgb_fbuf)) {
++ xf86Msg(X_ERROR, "Error %d at VIDIOC_S_FBUF\n", errno);
++ return BadValue;
++ }
++ if (-1 == GetV4LFmt(V4L_FD, &pPPriv->pixelformat)) {
++ xf86Msg(X_ERROR, "Error %d getting pixelformat\n", errno);
++ return BadValue;
++ }
++ pPPriv->pixelformat = pPPriv->rgb_fbuf.fmt.pixelformat;
++ if (-1 == SetV4LFmt(V4L_FD, pPPriv->pixelformat)) {
++ xf86Msg(X_ERROR, "Error %d getting pixelformat\n", errno);
++ return BadValue;
++ }
++ memset(&fmt, 0, sizeof(fmt));
++ fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
++ memcpy(&fmt.fmt.win, &pPPriv->rgb_win, sizeof(pPPriv->rgb_win));
++ if (-1 == ioctl(V4L_FD, VIDIOC_S_FMT, &fmt)) {
++ xf86Msg(X_ERROR, "Error %d at VIDIOC_S_FMT\n", errno);
++ return BadValue;
++ }
++ if (-1 == ioctl(V4L_FD, VIDIOC_OVERLAY, &one)) {
++ xf86Msg(X_ERROR, "v4l: Error %d while enabling Overlay\n", errno);
++ return BadValue;
++ }
+ pPPriv->VideoOn = VIDEO_RGB;
+
+ return Success;
+@@ -476,7 +703,7 @@ V4lPutStill(ScrnInfoPtr pScrn,
+ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw)
+ {
+ #if 0
+- PortPrivPtr pPPriv = (PortPrivPtr) data;
++ PortPrivPtr pPPriv = (PortPrivPtr) data;
+ #endif
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/PS\n"));
+@@ -488,177 +715,152 @@ V4lPutStill(ScrnInfoPtr pScrn,
+ static void
+ V4lStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
+ {
+- PortPrivPtr pPPriv = (PortPrivPtr) data;
++ PortPrivPtr pPPriv = (PortPrivPtr) data;
+ int zero=0;
+
+ if (VIDEO_OFF == pPPriv->VideoOn) {
+- DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+- "Xv/StopVideo called with video already off\n"));
+- return;
++ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
++ "Xv/StopVideo called with video already off\n"));
++ return;
+ }
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/StopVideo shutdown=%d\n",shutdown));
+
+ if (!shutdown) {
+- /* just reclipping, we have to stop DMA transfers to the visible screen */
+- if (VIDEO_RGB == pPPriv->VideoOn) {
+- if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &zero))
+- perror("ioctl VIDIOCCAPTURE(0)");
+- pPPriv->VideoOn = VIDEO_RECLIP;
+- }
++ /* just reclipping, we have to stop DMA transfers to the visible screen */
++ if (VIDEO_RGB == pPPriv->VideoOn) {
++ if (-1 == ioctl(V4L_FD, VIDIOC_OVERLAY, &zero))
++ xf86Msg(X_ERROR, "v4l: Error %d while disabling Overlay\n", errno);
++ pPPriv->VideoOn = VIDEO_RECLIP;
++ }
+ } else {
+- /* video stop - turn off and free everything */
+- if (VIDEO_YUV == pPPriv->VideoOn) {
+- pPPriv->myfmt->stop(pPPriv->surface);
+- pPPriv->myfmt->free_surface(pPPriv->surface);
+- xfree(pPPriv->surface);
+- pPPriv->surface = NULL;
+- }
+- if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &zero))
+- perror("ioctl VIDIOCCAPTURE(0)");
+-
+- V4lCloseDevice(pPPriv,pScrn);
+- pPPriv->VideoOn = VIDEO_OFF;
+- }
+-}
++ /* video stop - turn off and free everything */
++ if (VIDEO_YUV == pPPriv->VideoOn) {
++ pPPriv->myfmt->stop(pPPriv->surface);
++ pPPriv->myfmt->free_surface(pPPriv->surface);
++ free(pPPriv->surface);
++ pPPriv->surface = NULL;
++ }
++ if (-1 == ioctl(V4L_FD, VIDIOC_OVERLAY, &zero))
++ xf86Msg(X_ERROR, "v4l: Error %d while disabling Overlay\n", errno);
+
+-/* v4l uses range 0 - 65535; Xv uses -1000 - 1000 */
+-static int
+-v4l_to_xv(int val) {
+- val = val * 2000 / 65536 - 1000;
+- if (val < -1000) val = -1000;
+- if (val > 1000) val = 1000;
+- return val;
+-}
+-static int
+-xv_to_v4l(int val) {
+- val = val * 65536 / 2000 + 32768;
+- if (val < -0) val = 0;
+- if (val > 65535) val = 65535;
+- return val;
++ V4lCloseDevice(pPPriv,pScrn);
++ pPPriv->VideoOn = VIDEO_OFF;
++ }
+ }
+
+ static int
+ V4lSetPortAttribute(ScrnInfoPtr pScrn,
+ Atom attribute, INT32 value, pointer data)
+ {
+- PortPrivPtr pPPriv = (PortPrivPtr) data;
+- struct video_channel chan;
+- int ret = Success;
++ struct v4l2_control ctrl;
++ PortPrivPtr pPPriv = (PortPrivPtr) data;
++ int i, ret = BadValue;
+
+ if (V4lOpenDevice(pPPriv, pScrn))
+- return Success;
++ return Success;
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/SPA %d, %d\n",
+- attribute, value));
++ (int)attribute, (int)value));
+
+ if (-1 == V4L_FD) {
+- ret = Success;
++ ret = Success;
+ } else if (attribute == xvEncoding) {
+- if (value >= 0 && value < pPPriv->nenc) {
+- pPPriv->cenc = value;
+- chan.channel = pPPriv->input[value];
+- chan.norm = pPPriv->norm[value];
+- if (-1 == ioctl(V4L_FD,VIDIOCSCHAN,&chan))
+- perror("ioctl VIDIOCSCHAN");
+- } else {
+- ret = BadValue;
+- }
+- } else if (attribute == xvBrightness ||
+- attribute == xvContrast ||
+- attribute == xvSaturation ||
+- attribute == xvHue) {
+- ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict);
+- if (attribute == xvBrightness) pPPriv->pict.brightness = xv_to_v4l(value);
+- if (attribute == xvContrast) pPPriv->pict.contrast = xv_to_v4l(value);
+- if (attribute == xvSaturation) pPPriv->pict.colour = xv_to_v4l(value);
+- if (attribute == xvHue) pPPriv->pict.hue = xv_to_v4l(value);
+- if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict))
+- perror("ioctl VIDIOCSPICT");
+- } else if (attribute == xvMute ||
+- attribute == xvVolume) {
+- ioctl(V4L_FD,VIDIOCGAUDIO,&pPPriv->audio);
+- if (attribute == xvMute) {
+- if (value)
+- pPPriv->audio.flags |= VIDEO_AUDIO_MUTE;
+- else
+- pPPriv->audio.flags &= ~VIDEO_AUDIO_MUTE;
+- } else if (attribute == xvVolume) {
+- if (pPPriv->audio.flags & VIDEO_AUDIO_VOLUME)
+- pPPriv->audio.volume = xv_to_v4l(value);
+- } else {
+- ret = BadValue;
+- }
+- if (ret != BadValue)
+- if (-1 == ioctl(V4L_FD,VIDIOCSAUDIO,&pPPriv->audio))
+- perror("ioctl VIDIOCSAUDIO");
++ if (value < 0 || value >= pPPriv->nenc)
++ goto err;
++ if (ioctl(V4L_FD, VIDIOC_S_INPUT, &pPPriv->input[value]) == -1) {
++ xf86Msg(X_ERROR, "v4l: Error %d while setting input\n", errno);
++ goto err;
++ }
++ if (ioctl(V4L_FD, VIDIOC_S_STD, &pPPriv->norm[value]) == -1) {
++ xf86Msg(X_ERROR, "v4l: Error %d while setting standard\n", errno);
++ goto err;
++ }
++ pPPriv->cenc = value;
++ ret = Success;
+ } else if (attribute == xvFreq) {
+- unsigned long freq = value;
+- if (-1 == ioctl(V4L_FD,VIDIOCSFREQ,&freq))
+- perror("ioctl VIDIOCSFREQ");
+- } else if (0 != pPPriv->yuv_format &&
+- pPPriv->myfmt->setAttribute) {
+- /* not mine -> pass to yuv scaler driver */
+- ret = pPPriv->myfmt->setAttribute(pScrn, attribute, value);
++ struct v4l2_frequency freq;
++ memset(&freq, 0, sizeof(freq));
++ ioctl(V4L_FD, VIDIOC_G_FREQUENCY, &freq);
++ freq.frequency = value;
++ if (ioctl(V4L_FD, VIDIOC_S_FREQUENCY, &freq) == -1)
++ xf86Msg(X_ERROR, "v4l: Error %d while setting frequency\n", errno);
++ else
++ ret = Success;
+ } else {
+- ret = BadValue;
++ for (i = 0; i < pPPriv->n_qctrl; i++)
++ if (pPPriv->XvV4LCtrl[i].xv == attribute)
++ break;
++ if (i == pPPriv->n_qctrl) {
++ /* not mine -> pass to yuv scaler driver */
++ if (0 != pPPriv->yuv_format && pPPriv->myfmt->setAttribute)
++ ret = pPPriv->myfmt->setAttribute(pScrn, attribute, value);
++ else
++ ret = BadMatch;
++ goto err;
++ }
++ if (pPPriv->XvV4LCtrl[i].qctrl.flags & V4L2_CTRL_FLAG_DISABLED)
++ goto err;
++ ctrl.id = pPPriv->XvV4LCtrl[i].qctrl.id;
++ ctrl.value = value;
++ if (ioctl(V4L_FD, VIDIOC_S_CTRL, &ctrl) != 1)
++ ret = Success;
+ }
+
++err:
+ V4lCloseDevice(pPPriv,pScrn);
+ return ret;
+ }
+
+ static int
+-V4lGetPortAttribute(ScrnInfoPtr pScrn,
++V4lGetPortAttribute(ScrnInfoPtr pScrn,
+ Atom attribute, INT32 *value, pointer data)
+ {
++ struct v4l2_control ctrl;
+ PortPrivPtr pPPriv = (PortPrivPtr) data;
+- int ret = Success;
++ int i, ret = BadValue;
+
+ if (V4lOpenDevice(pPPriv, pScrn))
+- return Success;
++ return Success;
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/GPA %d\n",
+- attribute));
++ (int)attribute));
+
+ if (-1 == V4L_FD) {
+- ret = Success;
++ ret = Success;
+ } else if (attribute == xvEncoding) {
+- *value = pPPriv->cenc;
+- } else if (attribute == xvBrightness ||
+- attribute == xvContrast ||
+- attribute == xvSaturation ||
+- attribute == xvHue) {
+- ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict);
+- if (attribute == xvBrightness) *value = v4l_to_xv(pPPriv->pict.brightness);
+- if (attribute == xvContrast) *value = v4l_to_xv(pPPriv->pict.contrast);
+- if (attribute == xvSaturation) *value = v4l_to_xv(pPPriv->pict.colour);
+- if (attribute == xvHue) *value = v4l_to_xv(pPPriv->pict.hue);
+- } else if (attribute == xvMute ||
+- attribute == xvVolume) {
+- ioctl(V4L_FD,VIDIOCGAUDIO,&pPPriv->audio);
+- if (attribute == xvMute) {
+- *value = (pPPriv->audio.flags & VIDEO_AUDIO_MUTE) ? 1 : 0;
+- } else if (attribute == xvVolume) {
+- if (pPPriv->audio.flags & VIDEO_AUDIO_VOLUME)
+- *value = v4l_to_xv(pPPriv->audio.volume);
+- } else {
+- ret = BadValue;
+- }
++ *value = pPPriv->cenc;
++ ret = Success;
+ } else if (attribute == xvFreq) {
+- unsigned long freq;
+- ioctl(V4L_FD,VIDIOCGFREQ,&freq);
+- *value = freq;
+- } else if (0 != pPPriv->yuv_format &&
+- pPPriv->myfmt->getAttribute) {
+- /* not mine -> pass to yuv scaler driver */
+- ret = pPPriv->myfmt->getAttribute(pScrn, attribute, value);
++ struct v4l2_frequency freq;
++ memset(&freq, 0, sizeof(freq));
++ if (ioctl(V4L_FD, VIDIOC_G_FREQUENCY, &freq) != -1) {
++ *value = freq.frequency;
++ ret = Success;
++ }
+ } else {
+- ret = BadValue;
++ for (i = 0; i < pPPriv->n_qctrl; i++)
++ if (pPPriv->XvV4LCtrl[i].xv == attribute)
++ break;
++ if (i == pPPriv->n_qctrl) {
++ /* not mine -> pass to yuv scaler driver */
++ if (0 != pPPriv->yuv_format && pPPriv->myfmt->getAttribute)
++ ret = pPPriv->myfmt->getAttribute(pScrn, attribute, value);
++ else
++ ret = BadMatch;
++ goto err;
++ }
++ if (pPPriv->XvV4LCtrl[i].qctrl.flags & V4L2_CTRL_FLAG_DISABLED)
++ goto err;
++ ctrl.id = pPPriv->XvV4LCtrl[i].qctrl.id;
++ if (ioctl(V4L_FD, VIDIOC_G_CTRL, &ctrl) != -1) {
++ *value = ctrl.value;
++ ret = Success;
++ }
+ }
+-
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/GPA %d, %d\n",
+- attribute, *value));
++ (int)attribute, (int)*value));
+
++err:
+ V4lCloseDevice(pPPriv,pScrn);
+ return ret;
+ }
+@@ -673,15 +875,15 @@ V4lQueryBestSize(ScrnInfoPtr pScrn, Bool motion,
+ int maxy = pPPriv->enc[pPPriv->cenc].height;
+
+ if (0 != pPPriv->yuv_format) {
+- *p_w = pPPriv->myfmt->max_width;
+- *p_h = pPPriv->myfmt->max_height;
++ *p_w = pPPriv->myfmt->max_width;
++ *p_h = pPPriv->myfmt->max_height;
+ } else {
+- *p_w = (drw_w < maxx) ? drw_w : maxx;
+- *p_h = (drw_h < maxy) ? drw_h : maxy;
++ *p_w = (drw_w < maxx) ? drw_w : maxx;
++ *p_h = (drw_h < maxy) ? drw_h : maxy;
+ }
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/BS %d %dx%d %dx%d\n",
+- pPPriv->cenc,drw_w,drw_h,*p_w,*p_h));
++ pPPriv->cenc,drw_w,drw_h,*p_w,*p_h));
+ }
+
+ static const OptionInfoRec *
+@@ -693,132 +895,198 @@ V4LAvailableOptions(int chipid, int busid)
+ static void
+ V4LIdentify(int flags)
+ {
+- xf86Msg(X_INFO, "v4l driver for Video4Linux\n");
+-}
++ xf86Msg(X_INFO, "v4l driver for Video4Linux overlay mode (V4L2)\n");
++}
+
+ static char*
+ fixname(char *str)
+ {
+ int s,d;
+ for (s=0, d=0;; s++) {
+- if (str[s] == '-')
+- continue;
+- str[d++] = tolower(str[s]);
+- if (0 == str[s])
+- break;
++ if (str[s] == '-')
++ continue;
++ str[d++] = tolower(str[s]);
++ if (0 == str[s])
++ break;
+ }
+ return str;
+ }
+
+ static int
+-v4l_add_enc(XF86VideoEncodingPtr enc, int i,
+- char *norm, char *input, int width, int height, int n, int d)
++AddV4LEnc(XF86VideoEncodingPtr enc, int entry,
++ char *norm, char *input, int width, int height, int n, int d)
+ {
+- enc[i].id = i;
+- enc[i].name = xalloc(strlen(norm)+strlen(input)+2);
+- if (NULL == enc[i].name)
+- return -1;
+- enc[i].width = width;
+- enc[i].height = height;
+- enc[i].rate.numerator = n;
+- enc[i].rate.denominator = d;
+- sprintf(enc[i].name,"%s-%s",norm,fixname(input));
++ enc->id = entry;
++ enc->name = malloc(strlen(norm) + strlen(input) + 2);
++ if (!enc->name)
++ return -1;
++
++ enc->width = width;
++ enc->height = height;
++ enc->rate.numerator = n;
++ enc->rate.denominator = d * 2; /* Refresh rate is twice, due to interlace */
++ sprintf(enc->name,"%s-%s",norm,fixname(input));
++
++ xf86Msg(X_INFO, "v4l: adding input %s, %dx%d %d fps\n",
++ enc->name, enc->width, enc->height, (d + n - 1)/n);
++
+ return 0;
+ }
+
++static int
++V4LGetStd(PortPrivPtr p, int fd)
++{
++ struct v4l2_standard standard;
++ int entries = 0;
++
++ /*
++ * 128 is just an arbitrary large number. There aren't that many video stds
++ * The max value is there just to avoid an endless loop, if the driver is
++ * broken.
++ */
++ for (entries = 0; entries < 128; entries++) {
++ memset(&standard, 0, sizeof(standard));
++ standard.index = entries;
++ if (-1 == ioctl(fd,VIDIOC_ENUMSTD, &standard))
++ break;
++ p->standard = realloc(p->standard, sizeof(standard) * (entries + 1));
++ memcpy(&p->standard[entries], &standard, sizeof(standard));
++ }
++
++ /*
++ * Some webcam drivers don't implement VIDIOC_ENUMSTD. Fake it
++ * This is currently unused, as no webcam driver allows OVERLAY mode,
++ * but the code is here, in the case some webcam driver starts allowing
++ * overlay.
++ * FIXME: Webcam drivers may use VIDIOC_ENUM_FRAMESIZES and
++ * VIDIOC_ENUM_FRAMEINTERVALS ioctl's that may help to fine-tune
++ * their needs. Those ioctl's could be used here in order to better
++ * support webcams.
++ */
++ if (!entries) {
++ xf86Msg(X_INFO, "v4l: VIDIOC_ENUMSTD error %d.\n",errno);
++ p->standard = realloc(p->standard, sizeof(standard) * (entries + 1));
++ p->standard[0].id = V4L2_STD_ALL;
++ strcpy((char *)p->standard[0].name, "CAMERA");
++ p->standard[0].frameperiod.numerator = 1001;
++ p->standard[0].frameperiod.denominator = 300001;
++ p->standard[0].framelines = 480;
++ entries++;
++ }
++ return entries;
++}
++
+ static void
+-V4LBuildEncodings(PortPrivPtr p, int fd, int channels)
++V4LBuildEncodings(PortPrivPtr p, int fd)
+ {
+- static struct video_channel channel;
+- int i,entries,have_bttv,bttv_ver;
+-
+-#define BTTV_VERSION _IOR('v' , BASE_VIDIOCPRIVATE+6, int)
+- have_bttv = 0;
+- if (-1 != ioctl(fd,BTTV_VERSION,&bttv_ver))
+- have_bttv = 1;
+-
+- entries = (have_bttv ? 7 : 3) * channels;
+- p->enc = xalloc(sizeof(XF86VideoEncodingRec) * entries);
+- if (NULL == p->enc)
+- goto fail;
+- memset(p->enc,0,sizeof(XF86VideoEncodingRec) * entries);
+- p->norm = xalloc(sizeof(int) * entries);
+- if (NULL == p->norm)
+- goto fail;
+- memset(p->norm,0,sizeof(int) * entries);
+- p->input = xalloc(sizeof(int) * entries);
+- if (NULL == p->input)
+- goto fail;
+- memset(p->input,0,sizeof(int) * entries);
++ unsigned int inp, std, num_std;
++
++ num_std = V4LGetStd(p, fd);
+
+ p->nenc = 0;
+- for (i = 0; i < channels; i++) {
+- channel.channel = i;
+- if (-1 == ioctl(fd,VIDIOCGCHAN,&channel)) {
+- perror("ioctl VIDIOCGCHAN");
+- continue;
+- }
+-
+- v4l_add_enc(p->enc, p->nenc,"PAL", channel.name, 768,576, 1,50);
+- p->norm[p->nenc] = VIDEO_MODE_PAL;
+- p->input[p->nenc] = i;
+- p->nenc++;
+-
+- v4l_add_enc(p->enc,p->nenc,"NTSC", channel.name, 640,480, 1001,60000);
+- p->norm[p->nenc] = VIDEO_MODE_NTSC;
+- p->input[p->nenc] = i;
+- p->nenc++;
+-
+- v4l_add_enc(p->enc,p->nenc,"SECAM",channel.name, 768,576, 1,50);
+- p->norm[p->nenc] = VIDEO_MODE_SECAM;
+- p->input[p->nenc] = i;
+- p->nenc++;
+-
+- if (have_bttv) {
+- /* workaround for a v4l design flaw: The v4l API knows just pal,
+- ntsc and secam. But there are a few more norms (pal versions
+- with a different timings used in south america for example).
+- The bttv driver can handle these too. */
+- if (0 != v4l_add_enc(p->enc,p->nenc,"PAL-Nc",channel.name,
+- 640, 576, 1,50))
+- goto fail;
+- p->norm[p->nenc] = 3;
+- p->input[p->nenc] = i;
+- p->nenc++;
+-
+- if (0 != v4l_add_enc(p->enc,p->nenc,"PAL-M",channel.name,
+- 640, 576, 1,50))
+- goto fail;
+- p->norm[p->nenc] = 4;
+- p->input[p->nenc] = i;
+- p->nenc++;
+-
+- if (0 != v4l_add_enc(p->enc, p->nenc,"PAL-N", channel.name,
+- 768,576, 1,50))
+- goto fail;
+- p->norm[p->nenc] = 5;
+- p->input[p->nenc] = i;
+- p->nenc++;
+-
+- if (0 != v4l_add_enc(p->enc,p->nenc,"NTSC-JP", channel.name,
+- 640,480, 1001,60000))
+- goto fail;
+- p->norm[p->nenc] = 6;
+- p->input[p->nenc] = i;
+- p->nenc++;
+- }
++
++ /*
++ * 256 is just an arbitrary large number. There aren't that many video
++ * inputs on any driver. The max value is there just to avoid an endless
++ * loop, if the driver is broken.
++ */
++ for (inp = 0; inp < 256; inp++) {
++ struct v4l2_input input;
++
++ memset(&input, 0, sizeof(input));
++ input.index = inp;
++ if (ioctl(fd, VIDIOC_ENUMINPUT, &input) == -1)
++ break;
++
++ for (std = 0; std < num_std; std++) {
++ int width, height;
++
++ /*
++ * Currently, this code is not reliable, due to driver
++ * non-compliance on both saa7134 and bttv. So, instead,
++ * just use the video standard information
++ */
++#if 0
++ struct v4l2_framebuffer fbuf;
++
++ /* Some webcam drivers will fail here, but that's OK */
++ ioctl(fd, VIDIOC_S_STD, &p->standard[std].id);
++
++ memset(&fbuf, 0, sizeof(fbuf));
++ if (ioctl(fd, VIDIOC_G_FBUF, &fbuf) == -1) {
++ xf86Msg(X_INFO, "v4l: Error %d: Can't get FBUF\n", errno);
++ return;
++ }
++ height = fbuf.fmt.height;
++ width = fbuf.fmt.width;
++
++ /*
++ * If the overlay method fails, get the resolution
++ * via checking V4L2_BUF_TYPE_VIDEO_CAPTURE
++ */
++ if (!height || !width) {
++ struct v4l2_format format;
++
++ format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
++ if (ioctl(fd, VIDIOC_G_FMT, &format) == -1) {
++ /* Hmm... device doesn't support capture. */
++ height = p->standard[std].framelines;
++ if (height == 480)
++ width = 640;
++ else if (height == 576)
++ width = 768;
++ else
++ continue;
++ } else {
++ height = format.fmt.pix.height;
++ width = format.fmt.pix.width;
++ }
++ }
++#else
++ if (p->standard[std].id & V4L2_STD_525_60) {
++ height = 480;
++ width = 640;
++ } else {
++ height = 576;
++ width = 768;
++ }
++
++#endif
++ /* Fixup for some driver bug */
++ if ((p->standard[std].id & V4L2_STD_525_60) && (height == 576))
++ height = 480;
++
++ p->enc = realloc(p->enc, sizeof(XF86VideoEncodingRec) * (p->nenc + 1));
++ p->norm = realloc(p->norm, sizeof(int) * (p->nenc + 1));
++ p->input = realloc(p->input, sizeof(int) * (p->nenc + 1));
++ if (!p->enc || !p->norm || !p->input)
++ goto fail;
++ if (AddV4LEnc(&p->enc[p->nenc], p->nenc,
++ (char *)p->standard[std].name,
++ (char *)input.name, width, height,
++ p->standard[std].frameperiod.numerator,
++ p->standard[std].frameperiod.denominator))
++ goto fail;
++ p->norm[p->nenc] = p->standard[std].id;
++ p->input[p->nenc] = inp;
++ p->nenc++;
++ }
+ }
++
++ if (!p->nenc)
++ xf86Msg(X_ERROR, "v4l: couldn't detect any valid input/standard\n");
+ return;
+-
+- fail:
++
++fail:
++ xf86Msg(X_ERROR, "v4l: Fail to get standards: %d\n", errno);
+ if (p->input)
+- xfree(p->input);
++ free(p->input);
+ p->input = NULL;
+ if (p->norm)
+- xfree(p->norm);
++ free(p->norm);
+ p->norm = NULL;
+ if (p->enc)
+- xfree(p->enc);
++ free(p->enc);
+ p->enc = NULL;
+ p->nenc = 0;
+ }
+@@ -826,73 +1094,33 @@ V4LBuildEncodings(PortPrivPtr p, int fd, int channels)
+ /* add a attribute a list */
+ static void
+ v4l_add_attr(XF86AttributeRec **list, int *count,
+- const XF86AttributeRec *attr)
++ const XF86AttributeRec *attr)
+ {
+ XF86AttributeRec *oldlist = *list;
+ int i;
++ Atom gpa;
+
+ for (i = 0; i < *count; i++) {
+- if (0 == strcmp((*list)[i].name,attr->name)) {
+- DEBUG(xf86Msg(X_INFO, "v4l: skip dup attr %s\n",attr->name));
+- return;
+- }
++ if (0 == strcmp((*list)[i].name,attr->name)) {
++ DEBUG(xf86Msg(X_INFO, "v4l: skip dup attr %s\n",attr->name));
++ return;
++ }
+ }
+-
+- DEBUG(xf86Msg(X_INFO, "v4l: add attr %s\n",attr->name));
+- *list = xalloc((*count + 1) * sizeof(XF86AttributeRec));
++
++ *list = malloc((*count + 1) * sizeof(XF86AttributeRec));
+ if (NULL == *list) {
+- *count = 0;
+- return;
++ *count = 0;
++ return;
+ }
+ if (*count)
+- memcpy(*list, oldlist, *count * sizeof(XF86AttributeRec));
++ memcpy(*list, oldlist, *count * sizeof(XF86AttributeRec));
+ memcpy(*list + *count, attr, sizeof(XF86AttributeRec));
+- (*count)++;
+-}
+
+-/* setup yuv overlay + hw scaling: look if we find some common video
+- format which both v4l driver and the X-Server can handle */
+-static void v4l_check_yuv(ScrnInfoPtr pScrn, PortPrivPtr pPPriv,
+- char *dev, int fd)
+-{
+- static const struct {
+- unsigned int v4l_palette;
+- unsigned int v4l_depth;
+- unsigned int xv_id;
+- unsigned int xv_format;
+- } yuvlist[] = {
+- { VIDEO_PALETTE_YUV422, 16, 0x32595559, XvPacked },
+- { VIDEO_PALETTE_UYVY, 16, 0x59565955, XvPacked },
+- { 0 /* end of list */ },
+- };
+- ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
+- int fmt,i;
++ gpa = MAKE_ATOM((*list)[*count].name);
++ xf86Msg(X_INFO, "v4l: add attr %s (Xv/GPA %d) (%d to %d)\n",
++ attr->name, (int)gpa, attr->min_value, attr->max_value);
+
+- pPPriv->format = xf86XVQueryOffscreenImages(pScreen,&pPPriv->nformat);
+- for (fmt = 0; yuvlist[fmt].v4l_palette != 0; fmt++) {
+- /* check v4l ... */
+- ioctl(fd,VIDIOCGPICT,&pPPriv->pict);
+- pPPriv->pict.palette = yuvlist[fmt].v4l_palette;
+- pPPriv->pict.depth = yuvlist[fmt].v4l_depth;
+- if (-1 == ioctl(fd,VIDIOCSPICT,&pPPriv->pict))
+- continue;
+- ioctl(fd,VIDIOCGPICT,&pPPriv->pict);
+- if (pPPriv->pict.palette != yuvlist[fmt].v4l_palette)
+- continue;
+- /* ... works, check available offscreen image formats now ... */
+- for (i = 0; i < pPPriv->nformat; i++) {
+- if (pPPriv->format[i].image->id == yuvlist[fmt].xv_id &&
+- pPPriv->format[i].image->format == yuvlist[fmt].xv_format) {
+- /* ... match found, good. */
+- pPPriv->yuv_format = yuvlist[fmt].v4l_palette;
+- pPPriv->myfmt = pPPriv->format+i;
+- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+- "v4l[%s]: using hw video scaling [%4.4s].\n",
+- dev,(char*)&(pPPriv->format[i].image->id));
+- return;
+- }
+- }
+- }
++ (*count)++;
+ }
+
+ static int
+@@ -904,118 +1132,114 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors)
+ char dev[18];
+ int fd,i,j,d;
+
+- DEBUG(xf86Msg(X_INFO, "v4l: init start\n"));
+-
+ for (i = 0, d = 0; d < MAX_V4L_DEVICES; d++) {
+- sprintf(dev, "/dev/video%d", d);
+- fd = open(dev, O_RDWR, 0);
+- if (fd == -1) {
+- sprintf(dev, "/dev/v4l/video%d", d);
+- fd = open(dev, O_RDWR, 0);
+- if (fd == -1)
+- break;
+- }
+- DEBUG(xf86Msg(X_INFO, "v4l: %s open ok\n",dev));
+-
+- /* our private data */
+- pPPriv = xalloc(sizeof(PortPrivRec));
+- if (!pPPriv)
+- return FALSE;
+- memset(pPPriv,0,sizeof(PortPrivRec));
+- pPPriv->nr = d;
+-
+- /* check device */
+- if (-1 == ioctl(fd,VIDIOCGCAP,&pPPriv->cap) ||
+- 0 == (pPPriv->cap.type & VID_TYPE_OVERLAY)) {
+- DEBUG(xf86Msg(X_INFO, "v4l: %s: no overlay support\n",dev));
+- xfree(pPPriv);
+- close(fd);
+- continue;
+- }
+- strncpy(V4L_NAME, dev, 16);
+- V4LBuildEncodings(pPPriv,fd,pPPriv->cap.channels);
+- if (NULL == pPPriv->enc)
+- return FALSE;
+- v4l_check_yuv(pScrn,pPPriv,dev,fd);
+-
+- /* alloc VideoAdaptorRec */
+- VAR = xrealloc(VAR,sizeof(XF86VideoAdaptorPtr)*(i+1));
+- VAR[i] = xalloc(sizeof(XF86VideoAdaptorRec));
+- if (!VAR[i])
+- return FALSE;
+- memset(VAR[i],0,sizeof(XF86VideoAdaptorRec));
+-
+-
+- /* build attribute list */
+- for (j = 0; j < V4L_ATTR; j++) {
+- /* video attributes */
+- v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+- &Attributes[j]);
+- }
+- if (0 == ioctl(fd,VIDIOCGAUDIO,&pPPriv->audio)) {
+- /* audio attributes */
+- if (pPPriv->audio.flags & VIDEO_AUDIO_VOLUME)
+- v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+- &VolumeAttr);
+- if (pPPriv->audio.flags & VIDEO_AUDIO_MUTABLE)
+- v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+- &MuteAttr);
+- }
+- if (pPPriv->cap.type & VID_TYPE_TUNER) {
+- /* tuner attributes */
+- v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+- &FreqAttr);
+- }
+- if (0 != pPPriv->yuv_format) {
+- /* pass throuth scaler attributes */
+- for (j = 0; j < pPPriv->myfmt->num_attributes; j++) {
+- v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+- pPPriv->myfmt->attributes+j);
+- }
+- }
+-
+-
+- /* hook in private data */
+- Private = xalloc(sizeof(DevUnion));
+- if (!Private)
+- return FALSE;
+- memset(Private,0,sizeof(DevUnion));
+- Private->ptr = (pointer)pPPriv;
+- VAR[i]->pPortPrivates = Private;
+- VAR[i]->nPorts = 1;
+-
+- /* init VideoAdaptorRec */
+- VAR[i]->type = XvInputMask | XvWindowMask | XvVideoMask;
+- VAR[i]->name = "video4linux";
+- VAR[i]->flags = VIDEO_INVERT_CLIPLIST;
+-
+- VAR[i]->PutVideo = V4lPutVideo;
+- VAR[i]->PutStill = V4lPutStill;
+- VAR[i]->StopVideo = V4lStopVideo;
+- VAR[i]->SetPortAttribute = V4lSetPortAttribute;
+- VAR[i]->GetPortAttribute = V4lGetPortAttribute;
+- VAR[i]->QueryBestSize = V4lQueryBestSize;
+-
+- VAR[i]->nEncodings = pPPriv->nenc;
+- VAR[i]->pEncodings = pPPriv->enc;
+- VAR[i]->nFormats =
+- sizeof(InputVideoFormats) / sizeof(InputVideoFormats[0]);
+- VAR[i]->pFormats = InputVideoFormats;
+-
+- if (fd != -1)
+- close(fd);
+- i++;
++ sprintf(dev, "/dev/video%d", d);
++ fd = open(dev, O_RDWR, 0);
++ if (fd == -1) {
++ sprintf(dev, "/dev/v4l/video%d", d);
++ fd = open(dev, O_RDWR, 0);
++ if (fd == -1)
++ break;
++ }
++ DEBUG(xf86Msg(X_INFO, "v4l: %s open ok\n",dev));
++
++ /* our private data */
++ pPPriv = malloc(sizeof(PortPrivRec));
++ if (!pPPriv)
++ return FALSE;
++ memset(pPPriv,0,sizeof(PortPrivRec));
++ pPPriv->nr = d;
++
++ /* check device capabilities */
++ memset(&pPPriv->cap, 0, sizeof(&pPPriv->cap));
++ if (-1 == ioctl(fd, VIDIOC_QUERYCAP, &pPPriv->cap) ||
++ 0 == (pPPriv->cap.capabilities & V4L2_CAP_VIDEO_OVERLAY)) {
++ xf86Msg(X_ERROR, "v4l: %s: no overlay support\n",dev);
++ free(pPPriv);
++ close(fd);
++ continue;
++ }
++
++ if (v4l_check_yuv(pScrn, pPPriv, dev, fd) == FALSE) {
++ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
++ "Xv Overlay not supported. Can't use v4l driver\n");
++ free(pPPriv);
++ close(fd);
++ continue;
++ }
++
++ xf86Msg(X_INFO, "v4l: enabling overlay mode for %s.\n", dev);
++ strncpy(V4L_NAME, dev, 16);
++ V4LBuildEncodings(pPPriv, fd);
++ if (NULL == pPPriv->enc)
++ return FALSE;
++
++ /* alloc VideoAdaptorRec */
++ VAR = realloc(VAR,sizeof(XF86VideoAdaptorPtr)*(i+1));
++ VAR[i] = malloc(sizeof(XF86VideoAdaptorRec));
++ if (!VAR[i])
++ return FALSE;
++ memset(VAR[i],0,sizeof(XF86VideoAdaptorRec));
++
++ /* build attribute list */
++ AddAllV4LControls(pPPriv, &VAR[i]->pAttributes, &VAR[i]->nAttributes, fd);
++
++ for (j = 0; j < V4L_ATTR; j++) {
++ /* Other video attributes */
++ v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
++ &Attributes[j]);
++ }
++ if (pPPriv->cap.capabilities & V4L2_CAP_TUNER) {
++ /* tuner attributes */
++ v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
++ &FreqAttr);
++ }
++
++ /* Initialize yuv_format */
++ if (0 != pPPriv->yuv_format) {
++ /* pass throuth scaler attributes */
++ for (j = 0; j < pPPriv->myfmt->num_attributes; j++) {
++ v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
++ pPPriv->myfmt->attributes+j);
++ }
++ }
++
++ DEBUG(xf86Msg(X_INFO, "v4l: saving config into driver data\n"));
++ /* hook in private data */
++ Private = malloc(sizeof(DevUnion));
++ if (!Private)
++ return FALSE;
++ memset(Private,0,sizeof(DevUnion));
++ Private->ptr = (pointer)pPPriv;
++ VAR[i]->pPortPrivates = Private;
++ VAR[i]->nPorts = 1;
++
++ /* init VideoAdaptorRec */
++ VAR[i]->type = XvInputMask | XvWindowMask | XvVideoMask;
++ VAR[i]->name = "video4linux";
++ VAR[i]->flags = VIDEO_INVERT_CLIPLIST;
++
++ VAR[i]->PutVideo = V4lPutVideo;
++ VAR[i]->PutStill = V4lPutStill;
++ VAR[i]->StopVideo = V4lStopVideo;
++ VAR[i]->SetPortAttribute = V4lSetPortAttribute;
++ VAR[i]->GetPortAttribute = V4lGetPortAttribute;
++ VAR[i]->QueryBestSize = V4lQueryBestSize;
++
++ VAR[i]->nEncodings = pPPriv->nenc;
++ VAR[i]->pEncodings = pPPriv->enc;
++ VAR[i]->nFormats = sizeof(InputVideoFormats) / sizeof(InputVideoFormats[0]);
++ VAR[i]->pFormats = InputVideoFormats;
++
++ if (fd != -1) {
++ DEBUG(xf86Msg(X_INFO, "v4l: %s init finished.\n",dev));
++ close(fd);
++ }
++ i++;
+ }
+
+ xvEncoding = MAKE_ATOM(XV_ENCODING);
+- xvHue = MAKE_ATOM(XV_HUE);
+- xvSaturation = MAKE_ATOM(XV_SATURATION);
+- xvBrightness = MAKE_ATOM(XV_BRIGHTNESS);
+- xvContrast = MAKE_ATOM(XV_CONTRAST);
+-
+ xvFreq = MAKE_ATOM(XV_FREQ);
+- xvMute = MAKE_ATOM(XV_MUTE);
+- xvVolume = MAKE_ATOM(XV_VOLUME);
+
+ DEBUG(xf86Msg(X_INFO, "v4l: init done, %d device(s) found\n",i));
+
+@@ -1024,10 +1248,43 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors)
+ }
+
+ static Bool
++V4LDetect(void)
++{
++ struct v4l2_capability cap;
++ int fd, d, n = 0;
++ char dev[18];
++
++ for (d = 0; d < MAX_V4L_DEVICES; d++) {
++ sprintf(dev, "/dev/video%d", d);
++ fd = open(dev, O_RDWR, 0);
++ if (fd == -1) {
++ sprintf(dev, "/dev/v4l/video%d", d);
++ fd = open(dev, O_RDWR, 0);
++ if (fd == -1)
++ break;
++ }
++ close (fd);
++ memset(&cap, 0, sizeof(cap));
++ if (!ioctl(fd, VIDIOC_QUERYCAP, &cap) &&
++ (cap.capabilities & V4L2_CAP_VIDEO_OVERLAY))
++ n++;
++ }
++ xf86Msg(X_INFO, "v4l: %d video adapters with overlay support detected\n", n);
++
++ return (n > 0) ? TRUE : FALSE;
++}
++
++static Bool
+ V4LProbe(DriverPtr drv, int flags)
+ {
+- if (flags & PROBE_DETECT)
+- return TRUE;
++ /*
++ * Don't try to register adapter at the detection phase, as Xv
++ * extensions won't be there
++ */
++ if (flags == PROBE_DETECT)
++ return V4LDetect();
++
++ DEBUG(xf86Msg(X_INFO, "v4l: Initiating device probe\n"));
+
+ xf86XVRegisterGenericAdaptorDriver(V4LInit);
+ drv->refCount++;
+diff --git a/src/videodev.h b/src/videodev.h
+deleted file mode 100644
+index 3c9a7d8..0000000
+--- a/src/videodev.h
++++ /dev/null
+@@ -1,254 +0,0 @@
+-#ifndef __LINUX_VIDEODEV_H
+-#define __LINUX_VIDEODEV_H
+-
+-/* Linux V4L API, Version 1
+- * videodev.h from v4l driver in Linux 2.2.3
+- *
+- * Used here with the explicit permission of the original author, Alan Cox.
+- * <alan@lxorguk.ukuu.org.uk>
+- */
+-
+-#include <X11/Xmd.h>
+-
+-#define VID_TYPE_CAPTURE 1 /* Can capture */
+-#define VID_TYPE_TUNER 2 /* Can tune */
+-#define VID_TYPE_TELETEXT 4 /* Does teletext */
+-#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
+-#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
+-#define VID_TYPE_CLIPPING 32 /* Can clip */
+-#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
+-#define VID_TYPE_SCALES 128 /* Scalable */
+-#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
+-#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
+-
+-struct video_capability
+-{
+- char name[32];
+- int type;
+- int channels; /* Num channels */
+- int audios; /* Num audio devices */
+- int maxwidth; /* Supported width */
+- int maxheight; /* And height */
+- int minwidth; /* Supported width */
+- int minheight; /* And height */
+-};
+-
+-
+-struct video_channel
+-{
+- int channel;
+- char name[32];
+- int tuners;
+- CARD32 flags;
+-#define VIDEO_VC_TUNER 1 /* Channel has a tuner */
+-#define VIDEO_VC_AUDIO 2 /* Channel has audio */
+- CARD16 type;
+-#define VIDEO_TYPE_TV 1
+-#define VIDEO_TYPE_CAMERA 2
+- CARD16 norm; /* Norm set by channel */
+-};
+-
+-struct video_tuner
+-{
+- int tuner;
+- char name[32];
+- unsigned long rangelow, rangehigh; /* Tuner range */
+- CARD32 flags;
+-#define VIDEO_TUNER_PAL 1
+-#define VIDEO_TUNER_NTSC 2
+-#define VIDEO_TUNER_SECAM 4
+-#define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */
+-#define VIDEO_TUNER_NORM 16 /* Tuner can set norm */
+-#define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */
+- CARD16 mode; /* PAL/NTSC/SECAM/OTHER */
+-#define VIDEO_MODE_PAL 0
+-#define VIDEO_MODE_NTSC 1
+-#define VIDEO_MODE_SECAM 2
+-#define VIDEO_MODE_AUTO 3
+- CARD16 signal; /* Signal strength 16bit scale */
+-};
+-
+-struct video_picture
+-{
+- CARD16 brightness;
+- CARD16 hue;
+- CARD16 colour;
+- CARD16 contrast;
+- CARD16 whiteness; /* Black and white only */
+- CARD16 depth; /* Capture depth */
+- CARD16 palette; /* Palette in use */
+-#define VIDEO_PALETTE_GREY 1 /* Linear greyscale */
+-#define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */
+-#define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */
+-#define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */
+-#define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */
+-#define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */
+-#define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */
+-#define VIDEO_PALETTE_YUYV 8
+-#define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */
+-#define VIDEO_PALETTE_YUV420 10
+-#define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */
+-#define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */
+-#define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */
+-#define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */
+-#define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */
+-#define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */
+-#define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */
+-#define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */
+-};
+-
+-struct video_audio
+-{
+- int audio; /* Audio channel */
+- CARD16 volume; /* If settable */
+- CARD16 bass, treble;
+- CARD32 flags;
+-#define VIDEO_AUDIO_MUTE 1
+-#define VIDEO_AUDIO_MUTABLE 2
+-#define VIDEO_AUDIO_VOLUME 4
+-#define VIDEO_AUDIO_BASS 8
+-#define VIDEO_AUDIO_TREBLE 16
+- char name[16];
+-#define VIDEO_SOUND_MONO 1
+-#define VIDEO_SOUND_STEREO 2
+-#define VIDEO_SOUND_LANG1 4
+-#define VIDEO_SOUND_LANG2 8
+- CARD16 mode;
+- CARD16 balance; /* Stereo balance */
+- CARD16 step; /* Step actual volume uses */
+-};
+-
+-struct video_clip
+-{
+- INT32 x,y;
+- INT32 width, height;
+- struct video_clip *next; /* For user use/driver use only */
+-};
+-
+-struct video_window
+-{
+- CARD32 x,y; /* Position of window */
+- CARD32 width,height; /* Its size */
+- CARD32 chromakey;
+- CARD32 flags;
+- struct video_clip *clips; /* Set only */
+- int clipcount;
+-#define VIDEO_WINDOW_INTERLACE 1
+-#define VIDEO_CLIP_BITMAP -1
+-/* bitmap is 1024x625, a '1' bit represents a clipped pixel */
+-#define VIDEO_CLIPMAP_SIZE (128 * 625)
+-};
+-
+-struct video_capture
+-{
+- CARD32 x,y; /* Offsets into image */
+- CARD32 width, height; /* Area to capture */
+- CARD16 decimation; /* Decimation divder */
+- CARD16 flags; /* Flags for capture */
+-#define VIDEO_CAPTURE_ODD 0 /* Temporal */
+-#define VIDEO_CAPTURE_EVEN 1
+-};
+-
+-struct video_buffer
+-{
+- void *base;
+- int height,width;
+- int depth;
+- int bytesperline;
+-};
+-
+-struct video_mmap
+-{
+- unsigned int frame; /* Frame (0 - n) for double buffer */
+- int height,width;
+- unsigned int format; /* should be VIDEO_PALETTE_* */
+-};
+-
+-struct video_key
+-{
+- CARD8 key[8];
+- CARD32 flags;
+-};
+-
+-
+-#define VIDEO_MAX_FRAME 32
+-
+-struct video_mbuf
+-{
+- int size; /* Total memory to map */
+- int frames; /* Frames */
+- int offsets[VIDEO_MAX_FRAME];
+-};
+-
+-
+-#define VIDEO_NO_UNIT (-1)
+-
+-
+-struct video_unit
+-{
+- int video; /* Video minor */
+- int vbi; /* VBI minor */
+- int radio; /* Radio minor */
+- int audio; /* Audio minor */
+- int teletext; /* Teletext minor */
+-};
+-
+-#define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */
+-#define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */
+-#define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */
+-#define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */
+-#define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */
+-#define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */
+-#define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */
+-#define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */
+-#define VIDIOCGWIN _IOR('v',9, struct video_window) /* Set the video overlay window */
+-#define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
+-#define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */
+-#define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */
+-#define VIDIOCKEY _IOR('v',13, struct video_key) /* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */
+-#define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */
+-#define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */
+-#define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */
+-#define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */
+-#define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */
+-#define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */
+-#define VIDIOCGMBUF _IOR('v', 20, struct video_mbuf) /* Memory map buffer info */
+-#define VIDIOCGUNIT _IOR('v', 21, struct video_unit) /* Get attached units */
+-#define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) /* Get frame buffer */
+-#define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) /* Set frame buffer - root only */
+-
+-#define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */
+-
+-
+-#define VID_HARDWARE_BT848 1
+-#define VID_HARDWARE_QCAM_BW 2
+-#define VID_HARDWARE_PMS 3
+-#define VID_HARDWARE_QCAM_C 4
+-#define VID_HARDWARE_PSEUDO 5
+-#define VID_HARDWARE_SAA5249 6
+-#define VID_HARDWARE_AZTECH 7
+-#define VID_HARDWARE_SF16MI 8
+-#define VID_HARDWARE_RTRACK 9
+-#define VID_HARDWARE_ZOLTRIX 10
+-#define VID_HARDWARE_SAA7146 11
+-#define VID_HARDWARE_VIDEUM 12 /* Reserved for Winnov videum */
+-#define VID_HARDWARE_RTRACK2 13
+-#define VID_HARDWARE_PERMEDIA2 14 /* Reserved for Permedia2 */
+-#define VID_HARDWARE_RIVA128 15 /* Reserved for RIVA 128 */
+-#define VID_HARDWARE_PLANB 16 /* PowerMac motherboard video-in */
+-#define VID_HARDWARE_BROADWAY 17 /* Broadway project */
+-#define VID_HARDWARE_GEMTEK 18
+-#define VID_HARDWARE_TYPHOON 19
+-#define VID_HARDWARE_VINO 20 /* Reserved for SGI Indy Vino */
+-
+-/*
+- * Initialiser list
+- */
+-
+-struct video_init
+-{
+- char *name;
+- int (*init)(struct video_init *);
+-};
+-
+-#endif
+diff --git a/src/videodev2.h b/src/videodev2.h
+new file mode 100644
+index 0000000..bf6dde2
+--- /dev/null
++++ b/src/videodev2.h
+@@ -0,0 +1,1929 @@
++/*
++ * Video for Linux Two header file
++ *
++ * Copyright (C) 1999-2007 the contributors
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * Alternatively you can redistribute this file under the terms of the
++ * BSD license as stated below:
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in
++ * the documentation and/or other materials provided with the
++ * distribution.
++ * 3. The names of its contributors may not be used to endorse or promote
++ * products derived from this software without specific prior written
++ * permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
++ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
++ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
++ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ *
++ * Header file for v4l or V4L2 drivers and applications
++ * with public API.
++ * All kernel-specific stuff were moved to media/v4l2-dev.h, so
++ * no #if __KERNEL tests are allowed here
++ *
++ * See http://linuxtv.org for more info
++ *
++ * Author: Bill Dirks <bill@thedirks.org>
++ * Justin Schoeman
++ * Hans Verkuil <hverkuil@xs4all.nl>
++ * et al.
++ */
++#ifndef __LINUX_VIDEODEV2_H
++#define __LINUX_VIDEODEV2_H
++
++#include <linux/ioctl.h>
++#include <linux/types.h>
++#include <sys/time.h>
++
++/*
++ * Common stuff for both V4L1 and V4L2
++ * Moved from videodev.h
++ */
++#define VIDEO_MAX_FRAME 32
++#define VIDEO_MAX_PLANES 8
++
++/* These defines are V4L1 specific and should not be used with the V4L2 API!
++ They will be removed from this header in the future. */
++
++#define VID_TYPE_CAPTURE 1 /* Can capture */
++#define VID_TYPE_TUNER 2 /* Can tune */
++#define VID_TYPE_TELETEXT 4 /* Does teletext */
++#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
++#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
++#define VID_TYPE_CLIPPING 32 /* Can clip */
++#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
++#define VID_TYPE_SCALES 128 /* Scalable */
++#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
++#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
++#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
++#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
++#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
++#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
++
++/*
++ * M I S C E L L A N E O U S
++ */
++
++/* Four-character-code (FOURCC) */
++#define v4l2_fourcc(a, b, c, d)\
++ ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24))
++
++/*
++ * E N U M S
++ */
++enum v4l2_field {
++ V4L2_FIELD_ANY = 0, /* driver can choose from none,
++ top, bottom, interlaced
++ depending on whatever it thinks
++ is approximate ... */
++ V4L2_FIELD_NONE = 1, /* this device has no fields ... */
++ V4L2_FIELD_TOP = 2, /* top field only */
++ V4L2_FIELD_BOTTOM = 3, /* bottom field only */
++ V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */
++ V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one
++ buffer, top-bottom order */
++ V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */
++ V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into
++ separate buffers */
++ V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field
++ first and the top field is
++ transmitted first */
++ V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field
++ first and the bottom field is
++ transmitted first */
++};
++#define V4L2_FIELD_HAS_TOP(field) \
++ ((field) == V4L2_FIELD_TOP ||\
++ (field) == V4L2_FIELD_INTERLACED ||\
++ (field) == V4L2_FIELD_INTERLACED_TB ||\
++ (field) == V4L2_FIELD_INTERLACED_BT ||\
++ (field) == V4L2_FIELD_SEQ_TB ||\
++ (field) == V4L2_FIELD_SEQ_BT)
++#define V4L2_FIELD_HAS_BOTTOM(field) \
++ ((field) == V4L2_FIELD_BOTTOM ||\
++ (field) == V4L2_FIELD_INTERLACED ||\
++ (field) == V4L2_FIELD_INTERLACED_TB ||\
++ (field) == V4L2_FIELD_INTERLACED_BT ||\
++ (field) == V4L2_FIELD_SEQ_TB ||\
++ (field) == V4L2_FIELD_SEQ_BT)
++#define V4L2_FIELD_HAS_BOTH(field) \
++ ((field) == V4L2_FIELD_INTERLACED ||\
++ (field) == V4L2_FIELD_INTERLACED_TB ||\
++ (field) == V4L2_FIELD_INTERLACED_BT ||\
++ (field) == V4L2_FIELD_SEQ_TB ||\
++ (field) == V4L2_FIELD_SEQ_BT)
++
++enum v4l2_buf_type {
++ V4L2_BUF_TYPE_VIDEO_CAPTURE = 1,
++ V4L2_BUF_TYPE_VIDEO_OUTPUT = 2,
++ V4L2_BUF_TYPE_VIDEO_OVERLAY = 3,
++ V4L2_BUF_TYPE_VBI_CAPTURE = 4,
++ V4L2_BUF_TYPE_VBI_OUTPUT = 5,
++ V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6,
++ V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7,
++#if 1
++ /* Experimental */
++ V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8,
++#endif
++ V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9,
++ V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10,
++ V4L2_BUF_TYPE_PRIVATE = 0x80,
++};
++
++#define V4L2_TYPE_IS_MULTIPLANAR(type) \
++ ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE \
++ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
++
++#define V4L2_TYPE_IS_OUTPUT(type) \
++ ((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT \
++ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE \
++ || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY \
++ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY \
++ || (type) == V4L2_BUF_TYPE_VBI_OUTPUT \
++ || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT)
++
++enum v4l2_tuner_type {
++ V4L2_TUNER_RADIO = 1,
++ V4L2_TUNER_ANALOG_TV = 2,
++ V4L2_TUNER_DIGITAL_TV = 3,
++};
++
++enum v4l2_memory {
++ V4L2_MEMORY_MMAP = 1,
++ V4L2_MEMORY_USERPTR = 2,
++ V4L2_MEMORY_OVERLAY = 3,
++};
++
++/* see also http://vektor.theorem.ca/graphics/ycbcr/ */
++enum v4l2_colorspace {
++ /* ITU-R 601 -- broadcast NTSC/PAL */
++ V4L2_COLORSPACE_SMPTE170M = 1,
++
++ /* 1125-Line (US) HDTV */
++ V4L2_COLORSPACE_SMPTE240M = 2,
++
++ /* HD and modern captures. */
++ V4L2_COLORSPACE_REC709 = 3,
++
++ /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */
++ V4L2_COLORSPACE_BT878 = 4,
++
++ /* These should be useful. Assume 601 extents. */
++ V4L2_COLORSPACE_470_SYSTEM_M = 5,
++ V4L2_COLORSPACE_470_SYSTEM_BG = 6,
++
++ /* I know there will be cameras that send this. So, this is
++ * unspecified chromaticities and full 0-255 on each of the
++ * Y'CbCr components
++ */
++ V4L2_COLORSPACE_JPEG = 7,
++
++ /* For RGB colourspaces, this is probably a good start. */
++ V4L2_COLORSPACE_SRGB = 8,
++};
++
++enum v4l2_priority {
++ V4L2_PRIORITY_UNSET = 0, /* not initialized */
++ V4L2_PRIORITY_BACKGROUND = 1,
++ V4L2_PRIORITY_INTERACTIVE = 2,
++ V4L2_PRIORITY_RECORD = 3,
++ V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE,
++};
++
++struct v4l2_rect {
++ __s32 left;
++ __s32 top;
++ __s32 width;
++ __s32 height;
++};
++
++struct v4l2_fract {
++ __u32 numerator;
++ __u32 denominator;
++};
++
++/*
++ * D R I V E R C A P A B I L I T I E S
++ */
++struct v4l2_capability {
++ __u8 driver[16]; /* i.e. "bttv" */
++ __u8 card[32]; /* i.e. "Hauppauge WinTV" */
++ __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */
++ __u32 version; /* should use KERNEL_VERSION() */
++ __u32 capabilities; /* Device capabilities */
++ __u32 reserved[4];
++};
++
++/* Values for 'capabilities' field */
++#define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */
++#define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */
++#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */
++#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */
++#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */
++#define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */
++#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */
++#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */
++#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */
++#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */
++#define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */
++
++/* Is a video capture device that supports multiplanar formats */
++#define V4L2_CAP_VIDEO_CAPTURE_MPLANE 0x00001000
++/* Is a video output device that supports multiplanar formats */
++#define V4L2_CAP_VIDEO_OUTPUT_MPLANE 0x00002000
++
++#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */
++#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */
++#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */
++#define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */
++
++#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */
++#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */
++#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */
++
++/*
++ * V I D E O I M A G E F O R M A T
++ */
++struct v4l2_pix_format {
++ __u32 width;
++ __u32 height;
++ __u32 pixelformat;
++ enum v4l2_field field;
++ __u32 bytesperline; /* for padding, zero if unused */
++ __u32 sizeimage;
++ enum v4l2_colorspace colorspace;
++ __u32 priv; /* private data, depends on pixelformat */
++};
++
++/* Pixel format FOURCC depth Description */
++
++/* RGB formats */
++#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */
++#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */
++#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */
++#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */
++#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */
++#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */
++#define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H') /* 18 BGR-6-6-6 */
++#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */
++#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */
++#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */
++#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */
++
++/* Grey formats */
++#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
++#define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */
++#define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */
++#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */
++#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */
++
++/* Palette formats */
++#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */
++
++/* Luminance+Chrominance formats */
++#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */
++#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */
++#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */
++#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */
++#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
++#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */
++#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */
++#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */
++#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */
++#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */
++#define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4') /* 16 xxxxyyyy uuuuvvvv */
++#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */
++#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */
++#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */
++#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
++#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */
++#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */
++#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */
++
++/* two planes -- one Y, one Cr + Cb interleaved */
++#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */
++#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
++#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
++#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
++
++/* two non contiguous planes - one Y, one Cr + Cb interleaved */
++#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
++#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
++
++/* three non contiguous planes - Y, Cb, Cr */
++#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */
++
++/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
++#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
++#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */
++#define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */
++#define V4L2_PIX_FMT_SRGGB8 v4l2_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */
++#define V4L2_PIX_FMT_SBGGR10 v4l2_fourcc('B', 'G', '1', '0') /* 10 BGBG.. GRGR.. */
++#define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */
++#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */
++#define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */
++ /* 10bit raw bayer DPCM compressed to 8 bits */
++#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
++ /*
++ * 10bit raw bayer, expanded to 16 bits
++ * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb...
++ */
++#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */
++
++/* compressed formats */
++#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */
++#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */
++#define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */
++#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */
++
++/* Vendor-specific formats */
++#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
++#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */
++#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */
++#define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */
++#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P', 'W', 'C', '1') /* pwc older webcam */
++#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P', 'W', 'C', '2') /* pwc newer webcam */
++#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') /* ET61X251 compression */
++#define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1') /* YUYV per line */
++#define V4L2_PIX_FMT_SPCA505 v4l2_fourcc('S', '5', '0', '5') /* YYUV per line */
++#define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */
++#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
++#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
++#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
++#define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */
++#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
++#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
++#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */
++#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
++#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */
++#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */
++#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */
++#define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */
++
++/*
++ * F O R M A T E N U M E R A T I O N
++ */
++struct v4l2_fmtdesc {
++ __u32 index; /* Format number */
++ enum v4l2_buf_type type; /* buffer type */
++ __u32 flags;
++ __u8 description[32]; /* Description string */
++ __u32 pixelformat; /* Format fourcc */
++ __u32 reserved[4];
++};
++
++#define V4L2_FMT_FLAG_COMPRESSED 0x0001
++#define V4L2_FMT_FLAG_EMULATED 0x0002
++
++#if 1
++ /* Experimental Frame Size and frame rate enumeration */
++/*
++ * F R A M E S I Z E E N U M E R A T I O N
++ */
++enum v4l2_frmsizetypes {
++ V4L2_FRMSIZE_TYPE_DISCRETE = 1,
++ V4L2_FRMSIZE_TYPE_CONTINUOUS = 2,
++ V4L2_FRMSIZE_TYPE_STEPWISE = 3,
++};
++
++struct v4l2_frmsize_discrete {
++ __u32 width; /* Frame width [pixel] */
++ __u32 height; /* Frame height [pixel] */
++};
++
++struct v4l2_frmsize_stepwise {
++ __u32 min_width; /* Minimum frame width [pixel] */
++ __u32 max_width; /* Maximum frame width [pixel] */
++ __u32 step_width; /* Frame width step size [pixel] */
++ __u32 min_height; /* Minimum frame height [pixel] */
++ __u32 max_height; /* Maximum frame height [pixel] */
++ __u32 step_height; /* Frame height step size [pixel] */
++};
++
++struct v4l2_frmsizeenum {
++ __u32 index; /* Frame size number */
++ __u32 pixel_format; /* Pixel format */
++ __u32 type; /* Frame size type the device supports. */
++
++ union { /* Frame size */
++ struct v4l2_frmsize_discrete discrete;
++ struct v4l2_frmsize_stepwise stepwise;
++ };
++
++ __u32 reserved[2]; /* Reserved space for future use */
++};
++
++/*
++ * F R A M E R A T E E N U M E R A T I O N
++ */
++enum v4l2_frmivaltypes {
++ V4L2_FRMIVAL_TYPE_DISCRETE = 1,
++ V4L2_FRMIVAL_TYPE_CONTINUOUS = 2,
++ V4L2_FRMIVAL_TYPE_STEPWISE = 3,
++};
++
++struct v4l2_frmival_stepwise {
++ struct v4l2_fract min; /* Minimum frame interval [s] */
++ struct v4l2_fract max; /* Maximum frame interval [s] */
++ struct v4l2_fract step; /* Frame interval step size [s] */
++};
++
++struct v4l2_frmivalenum {
++ __u32 index; /* Frame format index */
++ __u32 pixel_format; /* Pixel format */
++ __u32 width; /* Frame width */
++ __u32 height; /* Frame height */
++ __u32 type; /* Frame interval type the device supports. */
++
++ union { /* Frame interval */
++ struct v4l2_fract discrete;
++ struct v4l2_frmival_stepwise stepwise;
++ };
++
++ __u32 reserved[2]; /* Reserved space for future use */
++};
++#endif
++
++/*
++ * T I M E C O D E
++ */
++struct v4l2_timecode {
++ __u32 type;
++ __u32 flags;
++ __u8 frames;
++ __u8 seconds;
++ __u8 minutes;
++ __u8 hours;
++ __u8 userbits[4];
++};
++
++/* Type */
++#define V4L2_TC_TYPE_24FPS 1
++#define V4L2_TC_TYPE_25FPS 2
++#define V4L2_TC_TYPE_30FPS 3
++#define V4L2_TC_TYPE_50FPS 4
++#define V4L2_TC_TYPE_60FPS 5
++
++/* Flags */
++#define V4L2_TC_FLAG_DROPFRAME 0x0001 /* "drop-frame" mode */
++#define V4L2_TC_FLAG_COLORFRAME 0x0002
++#define V4L2_TC_USERBITS_field 0x000C
++#define V4L2_TC_USERBITS_USERDEFINED 0x0000
++#define V4L2_TC_USERBITS_8BITCHARS 0x0008
++/* The above is based on SMPTE timecodes */
++
++struct v4l2_jpegcompression {
++ int quality;
++
++ int APPn; /* Number of APP segment to be written,
++ * must be 0..15 */
++ int APP_len; /* Length of data in JPEG APPn segment */
++ char APP_data[60]; /* Data in the JPEG APPn segment. */
++
++ int COM_len; /* Length of data in JPEG COM segment */
++ char COM_data[60]; /* Data in JPEG COM segment */
++
++ __u32 jpeg_markers; /* Which markers should go into the JPEG
++ * output. Unless you exactly know what
++ * you do, leave them untouched.
++ * Inluding less markers will make the
++ * resulting code smaller, but there will
++ * be fewer applications which can read it.
++ * The presence of the APP and COM marker
++ * is influenced by APP_len and COM_len
++ * ONLY, not by this property! */
++
++#define V4L2_JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */
++#define V4L2_JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */
++#define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */
++#define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */
++#define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will
++ * allways use APP0 */
++};
++
++/*
++ * M E M O R Y - M A P P I N G B U F F E R S
++ */
++struct v4l2_requestbuffers {
++ __u32 count;
++ enum v4l2_buf_type type;
++ enum v4l2_memory memory;
++ __u32 reserved[2];
++};
++
++/**
++ * struct v4l2_plane - plane info for multi-planar buffers
++ * @bytesused: number of bytes occupied by data in the plane (payload)
++ * @length: size of this plane (NOT the payload) in bytes
++ * @mem_offset: when memory in the associated struct v4l2_buffer is
++ * V4L2_MEMORY_MMAP, equals the offset from the start of
++ * the device memory for this plane (or is a "cookie" that
++ * should be passed to mmap() called on the video node)
++ * @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer
++ * pointing to this plane
++ * @data_offset: offset in the plane to the start of data; usually 0,
++ * unless there is a header in front of the data
++ *
++ * Multi-planar buffers consist of one or more planes, e.g. an YCbCr buffer
++ * with two planes can have one plane for Y, and another for interleaved CbCr
++ * components. Each plane can reside in a separate memory buffer, or even in
++ * a completely separate memory node (e.g. in embedded devices).
++ */
++struct v4l2_plane {
++ __u32 bytesused;
++ __u32 length;
++ union {
++ __u32 mem_offset;
++ unsigned long userptr;
++ } m;
++ __u32 data_offset;
++ __u32 reserved[11];
++};
++
++/**
++ * struct v4l2_buffer - video buffer info
++ * @index: id number of the buffer
++ * @type: buffer type (type == *_MPLANE for multiplanar buffers)
++ * @bytesused: number of bytes occupied by data in the buffer (payload);
++ * unused (set to 0) for multiplanar buffers
++ * @flags: buffer informational flags
++ * @field: field order of the image in the buffer
++ * @timestamp: frame timestamp
++ * @timecode: frame timecode
++ * @sequence: sequence count of this frame
++ * @memory: the method, in which the actual video data is passed
++ * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP;
++ * offset from the start of the device memory for this plane,
++ * (or a "cookie" that should be passed to mmap() as offset)
++ * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR;
++ * a userspace pointer pointing to this buffer
++ * @planes: for multiplanar buffers; userspace pointer to the array of plane
++ * info structs for this buffer
++ * @length: size in bytes of the buffer (NOT its payload) for single-plane
++ * buffers (when type != *_MPLANE); number of elements in the
++ * planes array for multi-plane buffers
++ * @input: input number from which the video data has has been captured
++ *
++ * Contains data exchanged by application and driver using one of the Streaming
++ * I/O methods.
++ */
++struct v4l2_buffer {
++ __u32 index;
++ enum v4l2_buf_type type;
++ __u32 bytesused;
++ __u32 flags;
++ enum v4l2_field field;
++ struct timeval timestamp;
++ struct v4l2_timecode timecode;
++ __u32 sequence;
++
++ /* memory location */
++ enum v4l2_memory memory;
++ union {
++ __u32 offset;
++ unsigned long userptr;
++ struct v4l2_plane *planes;
++ } m;
++ __u32 length;
++ __u32 input;
++ __u32 reserved;
++};
++
++/* Flags for 'flags' field */
++#define V4L2_BUF_FLAG_MAPPED 0x0001 /* Buffer is mapped (flag) */
++#define V4L2_BUF_FLAG_QUEUED 0x0002 /* Buffer is queued for processing */
++#define V4L2_BUF_FLAG_DONE 0x0004 /* Buffer is ready */
++#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */
++#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */
++#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */
++/* Buffer is ready, but the data contained within is corrupted. */
++#define V4L2_BUF_FLAG_ERROR 0x0040
++#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */
++#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */
++
++/*
++ * O V E R L A Y P R E V I E W
++ */
++struct v4l2_framebuffer {
++ __u32 capability;
++ __u32 flags;
++/* FIXME: in theory we should pass something like PCI device + memory
++ * region + offset instead of some physical address */
++ void *base;
++ struct v4l2_pix_format fmt;
++};
++/* Flags for the 'capability' field. Read only */
++#define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001
++#define V4L2_FBUF_CAP_CHROMAKEY 0x0002
++#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004
++#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008
++#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010
++#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020
++#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040
++#define V4L2_FBUF_CAP_SRC_CHROMAKEY 0x0080
++/* Flags for the 'flags' field. */
++#define V4L2_FBUF_FLAG_PRIMARY 0x0001
++#define V4L2_FBUF_FLAG_OVERLAY 0x0002
++#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004
++#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008
++#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010
++#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020
++#define V4L2_FBUF_FLAG_SRC_CHROMAKEY 0x0040
++
++struct v4l2_clip {
++ struct v4l2_rect c;
++ struct v4l2_clip *next;
++};
++
++struct v4l2_window {
++ struct v4l2_rect w;
++ enum v4l2_field field;
++ __u32 chromakey;
++ struct v4l2_clip *clips;
++ __u32 clipcount;
++ void *bitmap;
++ __u8 global_alpha;
++};
++
++/*
++ * C A P T U R E P A R A M E T E R S
++ */
++struct v4l2_captureparm {
++ __u32 capability; /* Supported modes */
++ __u32 capturemode; /* Current mode */
++ struct v4l2_fract timeperframe; /* Time per frame in .1us units */
++ __u32 extendedmode; /* Driver-specific extensions */
++ __u32 readbuffers; /* # of buffers for read */
++ __u32 reserved[4];
++};
++
++/* Flags for 'capability' and 'capturemode' fields */
++#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */
++#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */
++
++struct v4l2_outputparm {
++ __u32 capability; /* Supported modes */
++ __u32 outputmode; /* Current mode */
++ struct v4l2_fract timeperframe; /* Time per frame in seconds */
++ __u32 extendedmode; /* Driver-specific extensions */
++ __u32 writebuffers; /* # of buffers for write */
++ __u32 reserved[4];
++};
++
++/*
++ * I N P U T I M A G E C R O P P I N G
++ */
++struct v4l2_cropcap {
++ enum v4l2_buf_type type;
++ struct v4l2_rect bounds;
++ struct v4l2_rect defrect;
++ struct v4l2_fract pixelaspect;
++};
++
++struct v4l2_crop {
++ enum v4l2_buf_type type;
++ struct v4l2_rect c;
++};
++
++/*
++ * A N A L O G V I D E O S T A N D A R D
++ */
++
++typedef __u64 v4l2_std_id;
++
++/* one bit for each */
++#define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001)
++#define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002)
++#define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004)
++#define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008)
++#define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010)
++#define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020)
++#define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040)
++#define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080)
++
++#define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100)
++#define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200)
++#define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400)
++#define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800)
++
++#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000)
++#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000)
++#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000)
++#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000)
++
++#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000)
++#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000)
++#define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000)
++#define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000)
++#define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000)
++#define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000)
++#define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000)
++#define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000)
++
++/* ATSC/HDTV */
++#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000)
++#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000)
++
++/* FIXME:
++ Although std_id is 64 bits, there is an issue on PPC32 architecture that
++ makes switch(__u64) to break. So, there's a hack on v4l2-common.c rounding
++ this value to 32 bits.
++ As, currently, the max value is for V4L2_STD_ATSC_16_VSB (30 bits wide),
++ it should work fine. However, if needed to add more than two standards,
++ v4l2-common.c should be fixed.
++ */
++
++/* some merged standards */
++#define V4L2_STD_MN (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC)
++#define V4L2_STD_B (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B)
++#define V4L2_STD_GH (V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H)
++#define V4L2_STD_DK (V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK)
++
++/* some common needed stuff */
++#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\
++ V4L2_STD_PAL_B1 |\
++ V4L2_STD_PAL_G)
++#define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\
++ V4L2_STD_PAL_D1 |\
++ V4L2_STD_PAL_K)
++#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\
++ V4L2_STD_PAL_DK |\
++ V4L2_STD_PAL_H |\
++ V4L2_STD_PAL_I)
++#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\
++ V4L2_STD_NTSC_M_JP |\
++ V4L2_STD_NTSC_M_KR)
++#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\
++ V4L2_STD_SECAM_K |\
++ V4L2_STD_SECAM_K1)
++#define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\
++ V4L2_STD_SECAM_G |\
++ V4L2_STD_SECAM_H |\
++ V4L2_STD_SECAM_DK |\
++ V4L2_STD_SECAM_L |\
++ V4L2_STD_SECAM_LC)
++
++#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\
++ V4L2_STD_PAL_60 |\
++ V4L2_STD_NTSC |\
++ V4L2_STD_NTSC_443)
++#define V4L2_STD_625_50 (V4L2_STD_PAL |\
++ V4L2_STD_PAL_N |\
++ V4L2_STD_PAL_Nc |\
++ V4L2_STD_SECAM)
++#define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\
++ V4L2_STD_ATSC_16_VSB)
++
++#define V4L2_STD_UNKNOWN 0
++#define V4L2_STD_ALL (V4L2_STD_525_60 |\
++ V4L2_STD_625_50)
++
++struct v4l2_standard {
++ __u32 index;
++ v4l2_std_id id;
++ __u8 name[24];
++ struct v4l2_fract frameperiod; /* Frames, not fields */
++ __u32 framelines;
++ __u32 reserved[4];
++};
++
++/*
++ * V I D E O T I M I N G S D V P R E S E T
++ */
++struct v4l2_dv_preset {
++ __u32 preset;
++ __u32 reserved[4];
++};
++
++/*
++ * D V P R E S E T S E N U M E R A T I O N
++ */
++struct v4l2_dv_enum_preset {
++ __u32 index;
++ __u32 preset;
++ __u8 name[32]; /* Name of the preset timing */
++ __u32 width;
++ __u32 height;
++ __u32 reserved[4];
++};
++
++/*
++ * D V P R E S E T V A L U E S
++ */
++#define V4L2_DV_INVALID 0
++#define V4L2_DV_480P59_94 1 /* BT.1362 */
++#define V4L2_DV_576P50 2 /* BT.1362 */
++#define V4L2_DV_720P24 3 /* SMPTE 296M */
++#define V4L2_DV_720P25 4 /* SMPTE 296M */
++#define V4L2_DV_720P30 5 /* SMPTE 296M */
++#define V4L2_DV_720P50 6 /* SMPTE 296M */
++#define V4L2_DV_720P59_94 7 /* SMPTE 274M */
++#define V4L2_DV_720P60 8 /* SMPTE 274M/296M */
++#define V4L2_DV_1080I29_97 9 /* BT.1120/ SMPTE 274M */
++#define V4L2_DV_1080I30 10 /* BT.1120/ SMPTE 274M */
++#define V4L2_DV_1080I25 11 /* BT.1120 */
++#define V4L2_DV_1080I50 12 /* SMPTE 296M */
++#define V4L2_DV_1080I60 13 /* SMPTE 296M */
++#define V4L2_DV_1080P24 14 /* SMPTE 296M */
++#define V4L2_DV_1080P25 15 /* SMPTE 296M */
++#define V4L2_DV_1080P30 16 /* SMPTE 296M */
++#define V4L2_DV_1080P50 17 /* BT.1120 */
++#define V4L2_DV_1080P60 18 /* BT.1120 */
++
++/*
++ * D V B T T I M I N G S
++ */
++
++/* BT.656/BT.1120 timing data */
++struct v4l2_bt_timings {
++ __u32 width; /* width in pixels */
++ __u32 height; /* height in lines */
++ __u32 interlaced; /* Interlaced or progressive */
++ __u32 polarities; /* Positive or negative polarity */
++ __u64 pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */
++ __u32 hfrontporch; /* Horizpontal front porch in pixels */
++ __u32 hsync; /* Horizontal Sync length in pixels */
++ __u32 hbackporch; /* Horizontal back porch in pixels */
++ __u32 vfrontporch; /* Vertical front porch in pixels */
++ __u32 vsync; /* Vertical Sync length in lines */
++ __u32 vbackporch; /* Vertical back porch in lines */
++ __u32 il_vfrontporch; /* Vertical front porch for bottom field of
++ * interlaced field formats
++ */
++ __u32 il_vsync; /* Vertical sync length for bottom field of
++ * interlaced field formats
++ */
++ __u32 il_vbackporch; /* Vertical back porch for bottom field of
++ * interlaced field formats
++ */
++ __u32 reserved[16];
++} __attribute__ ((packed));
++
++/* Interlaced or progressive format */
++#define V4L2_DV_PROGRESSIVE 0
++#define V4L2_DV_INTERLACED 1
++
++/* Polarities. If bit is not set, it is assumed to be negative polarity */
++#define V4L2_DV_VSYNC_POS_POL 0x00000001
++#define V4L2_DV_HSYNC_POS_POL 0x00000002
++
++
++/* DV timings */
++struct v4l2_dv_timings {
++ __u32 type;
++ union {
++ struct v4l2_bt_timings bt;
++ __u32 reserved[32];
++ };
++} __attribute__ ((packed));
++
++/* Values for the type field */
++#define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */
++
++/*
++ * V I D E O I N P U T S
++ */
++struct v4l2_input {
++ __u32 index; /* Which input */
++ __u8 name[32]; /* Label */
++ __u32 type; /* Type of input */
++ __u32 audioset; /* Associated audios (bitfield) */
++ __u32 tuner; /* Associated tuner */
++ v4l2_std_id std;
++ __u32 status;
++ __u32 capabilities;
++ __u32 reserved[3];
++};
++
++/* Values for the 'type' field */
++#define V4L2_INPUT_TYPE_TUNER 1
++#define V4L2_INPUT_TYPE_CAMERA 2
++
++/* field 'status' - general */
++#define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */
++#define V4L2_IN_ST_NO_SIGNAL 0x00000002
++#define V4L2_IN_ST_NO_COLOR 0x00000004
++
++/* field 'status' - sensor orientation */
++/* If sensor is mounted upside down set both bits */
++#define V4L2_IN_ST_HFLIP 0x00000010 /* Frames are flipped horizontally */
++#define V4L2_IN_ST_VFLIP 0x00000020 /* Frames are flipped vertically */
++
++/* field 'status' - analog */
++#define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */
++#define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */
++
++/* field 'status' - digital */
++#define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */
++#define V4L2_IN_ST_NO_EQU 0x00020000 /* No equalizer lock */
++#define V4L2_IN_ST_NO_CARRIER 0x00040000 /* Carrier recovery failed */
++
++/* field 'status' - VCR and set-top box */
++#define V4L2_IN_ST_MACROVISION 0x01000000 /* Macrovision detected */
++#define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */
++#define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */
++
++/* capabilities flags */
++#define V4L2_IN_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */
++#define V4L2_IN_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
++#define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */
++
++/*
++ * V I D E O O U T P U T S
++ */
++struct v4l2_output {
++ __u32 index; /* Which output */
++ __u8 name[32]; /* Label */
++ __u32 type; /* Type of output */
++ __u32 audioset; /* Associated audios (bitfield) */
++ __u32 modulator; /* Associated modulator */
++ v4l2_std_id std;
++ __u32 capabilities;
++ __u32 reserved[3];
++};
++/* Values for the 'type' field */
++#define V4L2_OUTPUT_TYPE_MODULATOR 1
++#define V4L2_OUTPUT_TYPE_ANALOG 2
++#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3
++
++/* capabilities flags */
++#define V4L2_OUT_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */
++#define V4L2_OUT_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
++#define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */
++
++/*
++ * C O N T R O L S
++ */
++struct v4l2_control {
++ __u32 id;
++ __s32 value;
++};
++
++struct v4l2_ext_control {
++ __u32 id;
++ __u32 size;
++ __u32 reserved2[1];
++ union {
++ __s32 value;
++ __s64 value64;
++ char *string;
++ };
++} __attribute__ ((packed));
++
++struct v4l2_ext_controls {
++ __u32 ctrl_class;
++ __u32 count;
++ __u32 error_idx;
++ __u32 reserved[2];
++ struct v4l2_ext_control *controls;
++};
++
++/* Values for ctrl_class field */
++#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */
++#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
++#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
++#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
++
++#define V4L2_CTRL_ID_MASK (0x0fffffff)
++#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
++#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
++
++enum v4l2_ctrl_type {
++ V4L2_CTRL_TYPE_INTEGER = 1,
++ V4L2_CTRL_TYPE_BOOLEAN = 2,
++ V4L2_CTRL_TYPE_MENU = 3,
++ V4L2_CTRL_TYPE_BUTTON = 4,
++ V4L2_CTRL_TYPE_INTEGER64 = 5,
++ V4L2_CTRL_TYPE_CTRL_CLASS = 6,
++ V4L2_CTRL_TYPE_STRING = 7,
++};
++
++/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
++struct v4l2_queryctrl {
++ __u32 id;
++ enum v4l2_ctrl_type type;
++ __u8 name[32]; /* Whatever */
++ __s32 minimum; /* Note signedness */
++ __s32 maximum;
++ __s32 step;
++ __s32 default_value;
++ __u32 flags;
++ __u32 reserved[2];
++};
++
++/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
++struct v4l2_querymenu {
++ __u32 id;
++ __u32 index;
++ __u8 name[32]; /* Whatever */
++ __u32 reserved;
++};
++
++/* Control flags */
++#define V4L2_CTRL_FLAG_DISABLED 0x0001
++#define V4L2_CTRL_FLAG_GRABBED 0x0002
++#define V4L2_CTRL_FLAG_READ_ONLY 0x0004
++#define V4L2_CTRL_FLAG_UPDATE 0x0008
++#define V4L2_CTRL_FLAG_INACTIVE 0x0010
++#define V4L2_CTRL_FLAG_SLIDER 0x0020
++#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040
++
++/* Query flag, to be ORed with the control ID */
++#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
++
++/* User-class control IDs defined by V4L2 */
++#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900)
++#define V4L2_CID_USER_BASE V4L2_CID_BASE
++/* IDs reserved for driver specific controls */
++#define V4L2_CID_PRIVATE_BASE 0x08000000
++
++#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1)
++#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0)
++#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1)
++#define V4L2_CID_SATURATION (V4L2_CID_BASE+2)
++#define V4L2_CID_HUE (V4L2_CID_BASE+3)
++#define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5)
++#define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6)
++#define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7)
++#define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8)
++#define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9)
++#define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10)
++#define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) /* Deprecated */
++#define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12)
++#define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13)
++#define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14)
++#define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15)
++#define V4L2_CID_GAMMA (V4L2_CID_BASE+16)
++#define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* Deprecated */
++#define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17)
++#define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18)
++#define V4L2_CID_GAIN (V4L2_CID_BASE+19)
++#define V4L2_CID_HFLIP (V4L2_CID_BASE+20)
++#define V4L2_CID_VFLIP (V4L2_CID_BASE+21)
++
++/* Deprecated; use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */
++#define V4L2_CID_HCENTER (V4L2_CID_BASE+22)
++#define V4L2_CID_VCENTER (V4L2_CID_BASE+23)
++
++#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24)
++enum v4l2_power_line_frequency {
++ V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0,
++ V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1,
++ V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2,
++};
++#define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25)
++#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26)
++#define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27)
++#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28)
++#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29)
++#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30)
++#define V4L2_CID_COLORFX (V4L2_CID_BASE+31)
++enum v4l2_colorfx {
++ V4L2_COLORFX_NONE = 0,
++ V4L2_COLORFX_BW = 1,
++ V4L2_COLORFX_SEPIA = 2,
++ V4L2_COLORFX_NEGATIVE = 3,
++ V4L2_COLORFX_EMBOSS = 4,
++ V4L2_COLORFX_SKETCH = 5,
++ V4L2_COLORFX_SKY_BLUE = 6,
++ V4L2_COLORFX_GRASS_GREEN = 7,
++ V4L2_COLORFX_SKIN_WHITEN = 8,
++ V4L2_COLORFX_VIVID = 9,
++};
++#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
++#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
++
++#define V4L2_CID_ROTATE (V4L2_CID_BASE+34)
++#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35)
++
++#define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36)
++
++#define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37)
++#define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38)
++
++/* last CID + 1 */
++#define V4L2_CID_LASTP1 (V4L2_CID_BASE+39)
++
++/* MPEG-class control IDs defined by V4L2 */
++#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
++#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1)
++
++/* MPEG streams */
++#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0)
++enum v4l2_mpeg_stream_type {
++ V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */
++ V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */
++ V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */
++ V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */
++ V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */
++ V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */
++};
++#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1)
++#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2)
++#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3)
++#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4)
++#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5)
++#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6)
++#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7)
++enum v4l2_mpeg_stream_vbi_fmt {
++ V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */
++ V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */
++};
++
++/* MPEG audio */
++#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100)
++enum v4l2_mpeg_audio_sampling_freq {
++ V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0,
++ V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1,
++ V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2,
++};
++#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101)
++enum v4l2_mpeg_audio_encoding {
++ V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0,
++ V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1,
++ V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2,
++ V4L2_MPEG_AUDIO_ENCODING_AAC = 3,
++ V4L2_MPEG_AUDIO_ENCODING_AC3 = 4,
++};
++#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102)
++enum v4l2_mpeg_audio_l1_bitrate {
++ V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0,
++ V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1,
++ V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2,
++ V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3,
++ V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4,
++ V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5,
++ V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6,
++ V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7,
++ V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8,
++ V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9,
++ V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10,
++ V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11,
++ V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12,
++ V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13,
++};
++#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103)
++enum v4l2_mpeg_audio_l2_bitrate {
++ V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0,
++ V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1,
++ V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2,
++ V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3,
++ V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4,
++ V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5,
++ V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6,
++ V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7,
++ V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8,
++ V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9,
++ V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10,
++ V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11,
++ V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12,
++ V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13,
++};
++#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104)
++enum v4l2_mpeg_audio_l3_bitrate {
++ V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0,
++ V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1,
++ V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2,
++ V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3,
++ V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4,
++ V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5,
++ V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6,
++ V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7,
++ V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8,
++ V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9,
++ V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10,
++ V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11,
++ V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12,
++ V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13,
++};
++#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105)
++enum v4l2_mpeg_audio_mode {
++ V4L2_MPEG_AUDIO_MODE_STEREO = 0,
++ V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1,
++ V4L2_MPEG_AUDIO_MODE_DUAL = 2,
++ V4L2_MPEG_AUDIO_MODE_MONO = 3,
++};
++#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106)
++enum v4l2_mpeg_audio_mode_extension {
++ V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0,
++ V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1,
++ V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2,
++ V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3,
++};
++#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107)
++enum v4l2_mpeg_audio_emphasis {
++ V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0,
++ V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1,
++ V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2,
++};
++#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108)
++enum v4l2_mpeg_audio_crc {
++ V4L2_MPEG_AUDIO_CRC_NONE = 0,
++ V4L2_MPEG_AUDIO_CRC_CRC16 = 1,
++};
++#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109)
++#define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110)
++#define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111)
++enum v4l2_mpeg_audio_ac3_bitrate {
++ V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
++};
++
++/* MPEG video */
++#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
++enum v4l2_mpeg_video_encoding {
++ V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
++ V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1,
++ V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2,
++};
++#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201)
++enum v4l2_mpeg_video_aspect {
++ V4L2_MPEG_VIDEO_ASPECT_1x1 = 0,
++ V4L2_MPEG_VIDEO_ASPECT_4x3 = 1,
++ V4L2_MPEG_VIDEO_ASPECT_16x9 = 2,
++ V4L2_MPEG_VIDEO_ASPECT_221x100 = 3,
++};
++#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202)
++#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203)
++#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204)
++#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205)
++#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206)
++enum v4l2_mpeg_video_bitrate_mode {
++ V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0,
++ V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1,
++};
++#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207)
++#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208)
++#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
++#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210)
++#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211)
++
++/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
++#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
++#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0)
++enum v4l2_mpeg_cx2341x_video_spatial_filter_mode {
++ V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0,
++ V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1,
++};
++#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1)
++#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2)
++enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type {
++ V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0,
++ V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
++ V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2,
++ V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3,
++ V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4,
++};
++#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3)
++enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type {
++ V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0,
++ V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
++};
++#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4)
++enum v4l2_mpeg_cx2341x_video_temporal_filter_mode {
++ V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0,
++ V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1,
++};
++#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5)
++#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6)
++enum v4l2_mpeg_cx2341x_video_median_filter_type {
++ V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0,
++ V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1,
++ V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2,
++ V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3,
++ V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4,
++};
++#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7)
++#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8)
++#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9)
++#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10)
++#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11)
++
++/* Camera class control IDs */
++#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900)
++#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1)
++
++#define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1)
++enum v4l2_exposure_auto_type {
++ V4L2_EXPOSURE_AUTO = 0,
++ V4L2_EXPOSURE_MANUAL = 1,
++ V4L2_EXPOSURE_SHUTTER_PRIORITY = 2,
++ V4L2_EXPOSURE_APERTURE_PRIORITY = 3
++};
++#define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2)
++#define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3)
++
++#define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4)
++#define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5)
++#define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE+6)
++#define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE+7)
++
++#define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+8)
++#define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+9)
++
++#define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10)
++#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11)
++#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12)
++
++#define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13)
++#define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14)
++#define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15)
++
++#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16)
++
++#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)
++#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18)
++
++/* FM Modulator class control IDs */
++#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
++#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
++
++#define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1)
++#define V4L2_CID_RDS_TX_PI (V4L2_CID_FM_TX_CLASS_BASE + 2)
++#define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3)
++#define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5)
++#define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6)
++
++#define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64)
++#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65)
++#define V4L2_CID_AUDIO_LIMITER_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 66)
++
++#define V4L2_CID_AUDIO_COMPRESSION_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 80)
++#define V4L2_CID_AUDIO_COMPRESSION_GAIN (V4L2_CID_FM_TX_CLASS_BASE + 81)
++#define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD (V4L2_CID_FM_TX_CLASS_BASE + 82)
++#define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME (V4L2_CID_FM_TX_CLASS_BASE + 83)
++#define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 84)
++
++#define V4L2_CID_PILOT_TONE_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 96)
++#define V4L2_CID_PILOT_TONE_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 97)
++#define V4L2_CID_PILOT_TONE_FREQUENCY (V4L2_CID_FM_TX_CLASS_BASE + 98)
++
++#define V4L2_CID_TUNE_PREEMPHASIS (V4L2_CID_FM_TX_CLASS_BASE + 112)
++enum v4l2_preemphasis {
++ V4L2_PREEMPHASIS_DISABLED = 0,
++ V4L2_PREEMPHASIS_50_uS = 1,
++ V4L2_PREEMPHASIS_75_uS = 2,
++};
++#define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113)
++#define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114)
++
++/*
++ * T U N I N G
++ */
++struct v4l2_tuner {
++ __u32 index;
++ __u8 name[32];
++ enum v4l2_tuner_type type;
++ __u32 capability;
++ __u32 rangelow;
++ __u32 rangehigh;
++ __u32 rxsubchans;
++ __u32 audmode;
++ __s32 signal;
++ __s32 afc;
++ __u32 reserved[4];
++};
++
++struct v4l2_modulator {
++ __u32 index;
++ __u8 name[32];
++ __u32 capability;
++ __u32 rangelow;
++ __u32 rangehigh;
++ __u32 txsubchans;
++ __u32 reserved[4];
++};
++
++/* Flags for the 'capability' field */
++#define V4L2_TUNER_CAP_LOW 0x0001
++#define V4L2_TUNER_CAP_NORM 0x0002
++#define V4L2_TUNER_CAP_STEREO 0x0010
++#define V4L2_TUNER_CAP_LANG2 0x0020
++#define V4L2_TUNER_CAP_SAP 0x0020
++#define V4L2_TUNER_CAP_LANG1 0x0040
++#define V4L2_TUNER_CAP_RDS 0x0080
++#define V4L2_TUNER_CAP_RDS_BLOCK_IO 0x0100
++#define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200
++
++/* Flags for the 'rxsubchans' field */
++#define V4L2_TUNER_SUB_MONO 0x0001
++#define V4L2_TUNER_SUB_STEREO 0x0002
++#define V4L2_TUNER_SUB_LANG2 0x0004
++#define V4L2_TUNER_SUB_SAP 0x0004
++#define V4L2_TUNER_SUB_LANG1 0x0008
++#define V4L2_TUNER_SUB_RDS 0x0010
++
++/* Values for the 'audmode' field */
++#define V4L2_TUNER_MODE_MONO 0x0000
++#define V4L2_TUNER_MODE_STEREO 0x0001
++#define V4L2_TUNER_MODE_LANG2 0x0002
++#define V4L2_TUNER_MODE_SAP 0x0002
++#define V4L2_TUNER_MODE_LANG1 0x0003
++#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004
++
++struct v4l2_frequency {
++ __u32 tuner;
++ enum v4l2_tuner_type type;
++ __u32 frequency;
++ __u32 reserved[8];
++};
++
++struct v4l2_hw_freq_seek {
++ __u32 tuner;
++ enum v4l2_tuner_type type;
++ __u32 seek_upward;
++ __u32 wrap_around;
++ __u32 spacing;
++ __u32 reserved[7];
++};
++
++/*
++ * R D S
++ */
++
++struct v4l2_rds_data {
++ __u8 lsb;
++ __u8 msb;
++ __u8 block;
++} __attribute__ ((packed));
++
++#define V4L2_RDS_BLOCK_MSK 0x7
++#define V4L2_RDS_BLOCK_A 0
++#define V4L2_RDS_BLOCK_B 1
++#define V4L2_RDS_BLOCK_C 2
++#define V4L2_RDS_BLOCK_D 3
++#define V4L2_RDS_BLOCK_C_ALT 4
++#define V4L2_RDS_BLOCK_INVALID 7
++
++#define V4L2_RDS_BLOCK_CORRECTED 0x40
++#define V4L2_RDS_BLOCK_ERROR 0x80
++
++/*
++ * A U D I O
++ */
++struct v4l2_audio {
++ __u32 index;
++ __u8 name[32];
++ __u32 capability;
++ __u32 mode;
++ __u32 reserved[2];
++};
++
++/* Flags for the 'capability' field */
++#define V4L2_AUDCAP_STEREO 0x00001
++#define V4L2_AUDCAP_AVL 0x00002
++
++/* Flags for the 'mode' field */
++#define V4L2_AUDMODE_AVL 0x00001
++
++struct v4l2_audioout {
++ __u32 index;
++ __u8 name[32];
++ __u32 capability;
++ __u32 mode;
++ __u32 reserved[2];
++};
++
++/*
++ * M P E G S E R V I C E S
++ *
++ * NOTE: EXPERIMENTAL API
++ */
++#if 1
++#define V4L2_ENC_IDX_FRAME_I (0)
++#define V4L2_ENC_IDX_FRAME_P (1)
++#define V4L2_ENC_IDX_FRAME_B (2)
++#define V4L2_ENC_IDX_FRAME_MASK (0xf)
++
++struct v4l2_enc_idx_entry {
++ __u64 offset;
++ __u64 pts;
++ __u32 length;
++ __u32 flags;
++ __u32 reserved[2];
++};
++
++#define V4L2_ENC_IDX_ENTRIES (64)
++struct v4l2_enc_idx {
++ __u32 entries;
++ __u32 entries_cap;
++ __u32 reserved[4];
++ struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES];
++};
++
++
++#define V4L2_ENC_CMD_START (0)
++#define V4L2_ENC_CMD_STOP (1)
++#define V4L2_ENC_CMD_PAUSE (2)
++#define V4L2_ENC_CMD_RESUME (3)
++
++/* Flags for V4L2_ENC_CMD_STOP */
++#define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0)
++
++struct v4l2_encoder_cmd {
++ __u32 cmd;
++ __u32 flags;
++ union {
++ struct {
++ __u32 data[8];
++ } raw;
++ };
++};
++
++#endif
++
++
++/*
++ * D A T A S E R V I C E S ( V B I )
++ *
++ * Data services API by Michael Schimek
++ */
++
++/* Raw VBI */
++struct v4l2_vbi_format {
++ __u32 sampling_rate; /* in 1 Hz */
++ __u32 offset;
++ __u32 samples_per_line;
++ __u32 sample_format; /* V4L2_PIX_FMT_* */
++ __s32 start[2];
++ __u32 count[2];
++ __u32 flags; /* V4L2_VBI_* */
++ __u32 reserved[2]; /* must be zero */
++};
++
++/* VBI flags */
++#define V4L2_VBI_UNSYNC (1 << 0)
++#define V4L2_VBI_INTERLACED (1 << 1)
++
++/* Sliced VBI
++ *
++ * This implements is a proposal V4L2 API to allow SLICED VBI
++ * required for some hardware encoders. It should change without
++ * notice in the definitive implementation.
++ */
++
++struct v4l2_sliced_vbi_format {
++ __u16 service_set;
++ /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
++ service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
++ (equals frame lines 313-336 for 625 line video
++ standards, 263-286 for 525 line standards) */
++ __u16 service_lines[2][24];
++ __u32 io_size;
++ __u32 reserved[2]; /* must be zero */
++};
++
++/* Teletext World System Teletext
++ (WST), defined on ITU-R BT.653-2 */
++#define V4L2_SLICED_TELETEXT_B (0x0001)
++/* Video Program System, defined on ETS 300 231*/
++#define V4L2_SLICED_VPS (0x0400)
++/* Closed Caption, defined on EIA-608 */
++#define V4L2_SLICED_CAPTION_525 (0x1000)
++/* Wide Screen System, defined on ITU-R BT1119.1 */
++#define V4L2_SLICED_WSS_625 (0x4000)
++
++#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525)
++#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625)
++
++struct v4l2_sliced_vbi_cap {
++ __u16 service_set;
++ /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
++ service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
++ (equals frame lines 313-336 for 625 line video
++ standards, 263-286 for 525 line standards) */
++ __u16 service_lines[2][24];
++ enum v4l2_buf_type type;
++ __u32 reserved[3]; /* must be 0 */
++};
++
++struct v4l2_sliced_vbi_data {
++ __u32 id;
++ __u32 field; /* 0: first field, 1: second field */
++ __u32 line; /* 1-23 */
++ __u32 reserved; /* must be 0 */
++ __u8 data[48];
++};
++
++/*
++ * Sliced VBI data inserted into MPEG Streams
++ */
++
++/*
++ * V4L2_MPEG_STREAM_VBI_FMT_IVTV:
++ *
++ * Structure of payload contained in an MPEG 2 Private Stream 1 PES Packet in an
++ * MPEG-2 Program Pack that contains V4L2_MPEG_STREAM_VBI_FMT_IVTV Sliced VBI
++ * data
++ *
++ * Note, the MPEG-2 Program Pack and Private Stream 1 PES packet header
++ * definitions are not included here. See the MPEG-2 specifications for details
++ * on these headers.
++ */
++
++/* Line type IDs */
++#define V4L2_MPEG_VBI_IVTV_TELETEXT_B (1)
++#define V4L2_MPEG_VBI_IVTV_CAPTION_525 (4)
++#define V4L2_MPEG_VBI_IVTV_WSS_625 (5)
++#define V4L2_MPEG_VBI_IVTV_VPS (7)
++
++struct v4l2_mpeg_vbi_itv0_line {
++ __u8 id; /* One of V4L2_MPEG_VBI_IVTV_* above */
++ __u8 data[42]; /* Sliced VBI data for the line */
++} __attribute__ ((packed));
++
++struct v4l2_mpeg_vbi_itv0 {
++ __le32 linemask[2]; /* Bitmasks of VBI service lines present */
++ struct v4l2_mpeg_vbi_itv0_line line[35];
++} __attribute__ ((packed));
++
++struct v4l2_mpeg_vbi_ITV0 {
++ struct v4l2_mpeg_vbi_itv0_line line[36];
++} __attribute__ ((packed));
++
++#define V4L2_MPEG_VBI_IVTV_MAGIC0 "itv0"
++#define V4L2_MPEG_VBI_IVTV_MAGIC1 "ITV0"
++
++struct v4l2_mpeg_vbi_fmt_ivtv {
++ __u8 magic[4];
++ union {
++ struct v4l2_mpeg_vbi_itv0 itv0;
++ struct v4l2_mpeg_vbi_ITV0 ITV0;
++ };
++} __attribute__ ((packed));
++
++/*
++ * A G G R E G A T E S T R U C T U R E S
++ */
++
++/**
++ * struct v4l2_plane_pix_format - additional, per-plane format definition
++ * @sizeimage: maximum size in bytes required for data, for which
++ * this plane will be used
++ * @bytesperline: distance in bytes between the leftmost pixels in two
++ * adjacent lines
++ */
++struct v4l2_plane_pix_format {
++ __u32 sizeimage;
++ __u16 bytesperline;
++ __u16 reserved[7];
++} __attribute__ ((packed));
++
++/**
++ * struct v4l2_pix_format_mplane - multiplanar format definition
++ * @width: image width in pixels
++ * @height: image height in pixels
++ * @pixelformat: little endian four character code (fourcc)
++ * @field: field order (for interlaced video)
++ * @colorspace: supplemental to pixelformat
++ * @plane_fmt: per-plane information
++ * @num_planes: number of planes for this format
++ */
++struct v4l2_pix_format_mplane {
++ __u32 width;
++ __u32 height;
++ __u32 pixelformat;
++ enum v4l2_field field;
++ enum v4l2_colorspace colorspace;
++
++ struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
++ __u8 num_planes;
++ __u8 reserved[11];
++} __attribute__ ((packed));
++
++/**
++ * struct v4l2_format - stream data format
++ * @type: type of the data stream
++ * @pix: definition of an image format
++ * @pix_mp: definition of a multiplanar image format
++ * @win: definition of an overlaid image
++ * @vbi: raw VBI capture or output parameters
++ * @sliced: sliced VBI capture or output parameters
++ * @raw_data: placeholder for future extensions and custom formats
++ */
++struct v4l2_format {
++ enum v4l2_buf_type type;
++ union {
++ struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
++ struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */
++ struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
++ struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */
++ struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
++ __u8 raw_data[200]; /* user-defined */
++ } fmt;
++};
++
++/* Stream type-dependent parameters
++ */
++struct v4l2_streamparm {
++ enum v4l2_buf_type type;
++ union {
++ struct v4l2_captureparm capture;
++ struct v4l2_outputparm output;
++ __u8 raw_data[200]; /* user-defined */
++ } parm;
++};
++
++/*
++ * E V E N T S
++ */
++
++#define V4L2_EVENT_ALL 0
++#define V4L2_EVENT_VSYNC 1
++#define V4L2_EVENT_EOS 2
++#define V4L2_EVENT_PRIVATE_START 0x08000000
++
++/* Payload for V4L2_EVENT_VSYNC */
++struct v4l2_event_vsync {
++ /* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */
++ __u8 field;
++} __attribute__ ((packed));
++
++struct v4l2_event {
++ __u32 type;
++ union {
++ struct v4l2_event_vsync vsync;
++ __u8 data[64];
++ } u;
++ __u32 pending;
++ __u32 sequence;
++ struct timespec timestamp;
++ __u32 reserved[9];
++};
++
++struct v4l2_event_subscription {
++ __u32 type;
++ __u32 reserved[7];
++};
++
++/*
++ * A D V A N C E D D E B U G G I N G
++ *
++ * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS!
++ * FOR DEBUGGING, TESTING AND INTERNAL USE ONLY!
++ */
++
++/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */
++
++#define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */
++#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */
++#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */
++#define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */
++
++struct v4l2_dbg_match {
++ __u32 type; /* Match type */
++ union { /* Match this chip, meaning determined by type */
++ __u32 addr;
++ char name[32];
++ };
++} __attribute__ ((packed));
++
++struct v4l2_dbg_register {
++ struct v4l2_dbg_match match;
++ __u32 size; /* register size in bytes */
++ __u64 reg;
++ __u64 val;
++} __attribute__ ((packed));
++
++/* VIDIOC_DBG_G_CHIP_IDENT */
++struct v4l2_dbg_chip_ident {
++ struct v4l2_dbg_match match;
++ __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */
++ __u32 revision; /* chip revision, chip specific */
++} __attribute__ ((packed));
++
++/*
++ * I O C T L C O D E S F O R V I D E O D E V I C E S
++ *
++ */
++#define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability)
++#define VIDIOC_RESERVED _IO('V', 1)
++#define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc)
++#define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format)
++#define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format)
++#define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers)
++#define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer)
++#define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer)
++#define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer)
++#define VIDIOC_OVERLAY _IOW('V', 14, int)
++#define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer)
++#define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer)
++#define VIDIOC_STREAMON _IOW('V', 18, int)
++#define VIDIOC_STREAMOFF _IOW('V', 19, int)
++#define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm)
++#define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm)
++#define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id)
++#define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id)
++#define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard)
++#define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input)
++#define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control)
++#define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control)
++#define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner)
++#define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner)
++#define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio)
++#define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio)
++#define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl)
++#define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu)
++#define VIDIOC_G_INPUT _IOR('V', 38, int)
++#define VIDIOC_S_INPUT _IOWR('V', 39, int)
++#define VIDIOC_G_OUTPUT _IOR('V', 46, int)
++#define VIDIOC_S_OUTPUT _IOWR('V', 47, int)
++#define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output)
++#define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout)
++#define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout)
++#define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator)
++#define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator)
++#define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency)
++#define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency)
++#define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap)
++#define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop)
++#define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop)
++#define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression)
++#define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression)
++#define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id)
++#define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format)
++#define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio)
++#define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout)
++#define VIDIOC_G_PRIORITY _IOR('V', 67, enum v4l2_priority)
++#define VIDIOC_S_PRIORITY _IOW('V', 68, enum v4l2_priority)
++#define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap)
++#define VIDIOC_LOG_STATUS _IO('V', 70)
++#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls)
++#define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls)
++#define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls)
++#if 1
++#define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum)
++#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum)
++#define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx)
++#define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd)
++#define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd)
++#endif
++
++#if 1
++/* Experimental, meant for debugging, testing and internal use.
++ Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined.
++ You must be root to use these ioctls. Never use these in applications! */
++#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register)
++#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register)
++
++/* Experimental, meant for debugging, testing and internal use.
++ Never use this ioctl in applications! */
++#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident)
++#endif
++
++#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
++#define VIDIOC_ENUM_DV_PRESETS _IOWR('V', 83, struct v4l2_dv_enum_preset)
++#define VIDIOC_S_DV_PRESET _IOWR('V', 84, struct v4l2_dv_preset)
++#define VIDIOC_G_DV_PRESET _IOWR('V', 85, struct v4l2_dv_preset)
++#define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset)
++#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
++#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
++#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event)
++#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription)
++#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
++
++#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
++
++#endif /* __LINUX_VIDEODEV2_H */
diff --git a/testing/xf86-video-vesa/PKGBUILD b/testing/xf86-video-vesa/PKGBUILD
new file mode 100644
index 000000000..eadf3d5f3
--- /dev/null
+++ b/testing/xf86-video-vesa/PKGBUILD
@@ -0,0 +1,40 @@
+# $Id: PKGBUILD 150085 2012-02-12 09:45:57Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-vesa
+pkgver=2.3.0
+pkgrel=8
+_gitver=4ba7306fd0c9533750d389829e2cbf0522e149b3
+pkgdesc="X.org vesa video driver"
+arch=(i686 x86_64)
+license=('custom')
+url="http://xorg.freedesktop.org/"
+depends=('glibc')
+makedepends=('pkgconfig' 'xorg-server-devel>=1.11.99.903')
+conflicts=('xorg-server<1.11.99.903')
+groups=('xorg-drivers' 'xorg')
+options=('!libtool')
+source=(#${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ http://cgit.freedesktop.org/xorg/driver/xf86-video-vesa/snapshot/xf86-video-vesa-${_gitver}.tar.gz
+ #git-fixes.patch
+ revert-kernelcheck.patch)
+sha1sums=('52f5bf577038c6fe7819743ceac787bb619b6d47'
+ 'c14454521ac91aaa08aad8a6025d7720a613d54b')
+
+build() {
+ #cd "${srcdir}/${pkgname}-${pkgver}"
+ cd ${srcdir}/${pkgname}*
+ #patch -Np1 -i "${srcdir}/git-fixes.patch"
+ patch -Np1 -R -i "${srcdir}/revert-kernelcheck.patch"
+ autoreconf -fi
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ #cd "${srcdir}/${pkgname}-${pkgver}"
+ cd ${srcdir}/${pkgname}*
+ make DESTDIR="${pkgdir}" install
+ install -d -m755 "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-vesa/git-fixes.patch b/testing/xf86-video-vesa/git-fixes.patch
new file mode 100644
index 000000000..c4f442265
--- /dev/null
+++ b/testing/xf86-video-vesa/git-fixes.patch
@@ -0,0 +1,444 @@
+diff --git a/COPYING b/COPYING
+index 22b4b13..f101fb8 100644
+--- a/COPYING
++++ b/COPYING
+@@ -1,4 +1,5 @@
+ Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
++Copyright 2008 Red Hat, Inc.
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+diff --git a/configure.ac b/configure.ac
+index ff4713d..2e4f542 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -20,45 +20,44 @@
+ #
+ # Process this file with autoconf to produce a configure script
+
+-AC_PREREQ(2.57)
++# Initialize Autoconf
++AC_PREREQ([2.60])
+ AC_INIT([xf86-video-vesa],
+- 2.3.0,
++ [2.3.0],
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
+- xf86-video-vesa)
+-
++ [xf86-video-vesa])
+ AC_CONFIG_SRCDIR([Makefile.am])
+-AM_CONFIG_HEADER([config.h])
++AC_CONFIG_HEADERS([config.h])
+ AC_CONFIG_AUX_DIR(.)
+
++# Initialize Automake
+ AM_INIT_AUTOMAKE([foreign dist-bzip2])
+-
+ AM_MAINTAINER_MODE
+
+-# Require xorg-macros: XORG_DEFAULT_OPTIONS
++# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
+ m4_ifndef([XORG_MACROS_VERSION],
+- [m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])])
+-XORG_MACROS_VERSION(1.3)
++ [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
++XORG_MACROS_VERSION(1.8)
+ XORG_DEFAULT_OPTIONS
+
+-# Checks for programs.
++# Initialize libtool
+ AC_DISABLE_STATIC
+ AC_PROG_LIBTOOL
+-AC_PROG_CC
+
+ AH_TOP([#include "xorg-server.h"])
+
++# Define a configure option for an alternate module directory
+ AC_ARG_WITH(xorg-module-dir, [ --with-xorg-module-dir=DIR ],
+ [ moduledir="$withval" ],
+ [ moduledir="$libdir/xorg/modules" ])
+ AC_SUBST(moduledir)
+
+-
+-# Checks for extensions
++# Store the list of server defined optional extensions in REQUIRED_MODULES
+ XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
+ XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
+ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
+
+-# Checks for pkg-config packages
++# Obtain compiler/linker options for the driver dependencies
+ PKG_CHECK_MODULES(XORG, xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES)
+ PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
+ HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
+@@ -93,21 +92,14 @@ if test "x$XSERVER_LIBPCIACCESS" = xyes; then
+ fi
+ AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
+
+-CFLAGS="$CFLAGS $XORG_CFLAGS "' -I$(top_srcdir)/src'
+-INCLUDES="$XORG_INCS "'-I$(top_srcdir)/src'
+-AC_SUBST([CFLAGS])
+-AC_SUBST([INCLUDES])
+-
+ # Checks for libraries.
+
+-# Checks for header files.
+-AC_HEADER_STDC
+-
+ DRIVER_NAME=vesa
+ AC_SUBST([DRIVER_NAME])
+
+-AC_OUTPUT([
+- Makefile
+- src/Makefile
+- man/Makefile
++AC_CONFIG_FILES([
++ Makefile
++ src/Makefile
++ man/Makefile
+ ])
++AC_OUTPUT
+diff --git a/man/Makefile.am b/man/Makefile.am
+index f0eb29b..b3688ce 100644
+--- a/man/Makefile.am
++++ b/man/Makefile.am
+@@ -1,27 +1,24 @@
+ #
+ # Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+-#
+-# Permission to use, copy, modify, distribute, and sell this software and its
+-# documentation for any purpose is hereby granted without fee, provided that
+-# the above copyright notice appear in all copies and that both that
+-# copyright notice and this permission notice appear in supporting
+-# documentation.
+-#
+-# The above copyright notice and this permission notice 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 OPEN GROUP 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.
+-#
+-# Except as contained in this notice, the name of the copyright holders shall
+-# not be used in advertising or otherwise to promote the sale, use or
+-# other dealings in this Software without prior written authorization
+-# from the copyright holders.
++#
++# 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.
+ #
+
+ drivermandir = $(DRIVER_MAN_DIR)
+@@ -34,25 +31,11 @@ EXTRA_DIST = @DRIVER_NAME@.man
+
+ CLEANFILES = $(driverman_DATA)
+
+-SED = sed
+
+-# Strings to replace in man pages
+-XORGRELSTRING = @PACKAGE_STRING@
+- XORGMANNAME = X Version 11
++# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+
+-MAN_SUBSTS = \
+- -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+- -e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+- -e 's|__xservername__|Xorg|g' \
+- -e 's|__xconfigfile__|xorg.conf|g' \
+- -e 's|__projectroot__|$(prefix)|g' \
+- -e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \
+- -e 's|__drivermansuffix__|$(DRIVER_MAN_SUFFIX)|g' \
+- -e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \
+- -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \
+- -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g'
+
+ SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
+
+ .man.$(DRIVER_MAN_SUFFIX):
+- sed $(MAN_SUBSTS) < $< > $@
++ $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+diff --git a/man/vesa.man b/man/vesa.man
+index 19cb766..ce4b369 100644
+--- a/man/vesa.man
++++ b/man/vesa.man
+@@ -1,4 +1,3 @@
+-.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.man,v 1.2 2001/01/27 18:20:56 dawes Exp $
+ .\" shorthand for double quote that works everywhere.
+ .ds q \N'34'
+ .TH VESA __drivermansuffix__ __vendorversion__
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 88da8a2..dc702f0 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -24,6 +24,9 @@
+ # -avoid-version prevents gratuitous .0.0.0 version numbers on the end
+ # _ladir passes a dummy rpath to libtool so the thing will actually link
+ # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
++
++AM_CFLAGS = $(XORG_CFLAGS) $(PCIACCESS_CFLAGS)
++
+ vesa_drv_la_LTLIBRARIES = vesa_drv.la
+ vesa_drv_la_LDFLAGS = -module -avoid-version
+ vesa_drv_ladir = @moduledir@/drivers
+diff --git a/src/vesa.c b/src/vesa.c
+index 034a019..61d3550 100644
+--- a/src/vesa.c
++++ b/src/vesa.c
+@@ -281,7 +281,7 @@ static VESAPtr
+ VESAGetRec(ScrnInfoPtr pScrn)
+ {
+ if (!pScrn->driverPrivate)
+- pScrn->driverPrivate = xcalloc(sizeof(VESARec), 1);
++ pScrn->driverPrivate = calloc(sizeof(VESARec), 1);
+
+ return ((VESAPtr)pScrn->driverPrivate);
+ }
+@@ -296,7 +296,7 @@ VESASetModeParameters(vbeInfoPtr pVbe, DisplayModePtr vbemode,
+
+ data = (VbeModeInfoData *)vbemode->Private;
+
+- data->block = xcalloc(sizeof(VbeCRTCInfoBlock), 1);
++ data->block = calloc(sizeof(VbeCRTCInfoBlock), 1);
+ data->block->HorizontalTotal = ddcmode->HTotal;
+ data->block->HorizontalSyncStart = ddcmode->HSyncStart;
+ data->block->HorizontalSyncEnd = ddcmode->HSyncEnd;
+@@ -317,6 +317,30 @@ VESASetModeParameters(vbeInfoPtr pVbe, DisplayModePtr vbemode,
+ (double)(ddcmode->HTotal * ddcmode->VTotal));
+ }
+
++/*
++ * Despite that VBE gives you pixel granularity for mode sizes, some BIOSes
++ * think they can only give sizes in multiples of character cells; and
++ * indeed, the reference CVT and GTF formulae only give results where
++ * (h % 8) == 0. Whatever, let's just try to cope. What we're looking for
++ * here is cases where the display says 1366x768 and the BIOS says 1360x768.
++ */
++static Bool
++vesaModesCloseEnough(DisplayModePtr edid, DisplayModePtr vbe)
++{
++ if (!(edid->type & M_T_DRIVER))
++ return FALSE;
++
++ /* never seen a height granularity... */
++ if (edid->VDisplay != vbe->VDisplay)
++ return FALSE;
++
++ if (edid->HDisplay >= vbe->HDisplay &&
++ (edid->HDisplay & ~7) == (vbe->HDisplay & ~7))
++ return TRUE;
++
++ return FALSE;
++}
++
+ static ModeStatus
+ VESAValidMode(int scrn, DisplayModePtr p, Bool flag, int pass)
+ {
+@@ -358,9 +382,7 @@ VESAValidMode(int scrn, DisplayModePtr p, Bool flag, int pass)
+ */
+ if (pScrn->monitor->DDC) {
+ for (mode = pScrn->monitor->Modes; mode; mode = mode->next) {
+- if (mode->type & M_T_DRIVER &&
+- mode->HDisplay == p->HDisplay &&
+- mode->VDisplay == p->VDisplay) {
++ if (vesaModesCloseEnough(mode, p)) {
+ if (xf86CheckModeForMonitor(mode, mon) == MODE_OK) {
+ found = 1;
+ break;
+@@ -391,7 +413,8 @@ VESAValidMode(int scrn, DisplayModePtr p, Bool flag, int pass)
+ for (v = mon->vrefresh[0].lo; v <= mon->vrefresh[0].hi; v++) {
+ mode = xf86GTFMode(p->HDisplay, p->VDisplay, v, 0, 0);
+ ret = xf86CheckModeForMonitor(mode, mon);
+- xfree(mode);
++ free(mode->name);
++ free(mode);
+ if (ret == MODE_OK)
+ break;
+ }
+@@ -431,8 +454,14 @@ VESAPciProbe(DriverPtr drv, int entity_num, struct pci_device *dev,
+ pScrn = xf86ConfigPciEntity(NULL, 0, entity_num, NULL,
+ NULL, NULL, NULL, NULL, NULL);
+ if (pScrn != NULL) {
+- VESAPtr pVesa = VESAGetRec(pScrn);
++ VESAPtr pVesa;
++
++ if (pci_device_has_kernel_driver(dev)) {
++ ErrorF("vesa: Ignoring device with a bound kernel driver\n");
++ return FALSE;
++ }
+
++ pVesa = VESAGetRec(pScrn);
+ VESAInitScrn(pScrn);
+ pVesa->pciInfo = dev;
+ }
+@@ -480,7 +509,7 @@ VESAProbe(DriverPtr drv, int flags)
+ }
+ }
+ }
+- xfree(usedChips);
++ free(usedChips);
+ }
+ }
+ #endif
+@@ -503,11 +532,11 @@ VESAProbe(DriverPtr drv, int flags)
+ foundScreen = TRUE;
+ }
+ }
+- xfree(usedChips);
++ free(usedChips);
+ }
+ #endif
+
+- xfree(devSections);
++ free(devSections);
+
+ return (foundScreen);
+ }
+@@ -554,9 +583,9 @@ VESAFreeRec(ScrnInfoPtr pScrn)
+ VbeModeInfoData *data = (VbeModeInfoData*)mode->Private;
+
+ if (data->block)
+- xfree(data->block);
++ free(data->block);
+
+- xfree(data);
++ free(data);
+
+ mode->Private = NULL;
+ }
+@@ -564,12 +593,12 @@ VESAFreeRec(ScrnInfoPtr pScrn)
+ } while (mode && mode != pScrn->modes);
+ }
+ #endif
+- xfree(pVesa->monitor);
+- xfree(pVesa->vbeInfo);
+- xfree(pVesa->pal);
+- xfree(pVesa->savedPal);
+- xfree(pVesa->fonts);
+- xfree(pScrn->driverPrivate);
++ free(pVesa->monitor);
++ free(pVesa->vbeInfo);
++ free(pVesa->pal);
++ free(pVesa->savedPal);
++ free(pVesa->fonts);
++ free(pScrn->driverPrivate);
+ pScrn->driverPrivate = NULL;
+ }
+
+@@ -712,7 +741,7 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags)
+ else {
+ void *panelid = VBEReadPanelID(pVesa->pVbe);
+ VBEInterpretPanelID(pScrn->scrnIndex, panelid);
+- xfree(panelid);
++ free(panelid);
+ }
+ #endif
+
+@@ -805,7 +834,7 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags)
+
+ /* options */
+ xf86CollectOptions(pScrn, NULL);
+- if (!(pVesa->Options = xalloc(sizeof(VESAOptions)))) {
++ if (!(pVesa->Options = malloc(sizeof(VESAOptions)))) {
+ vbeFree(pVesa->pVbe);
+ return FALSE;
+ }
+@@ -940,7 +969,7 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ pScrn->bitsPerPixel = 8;
+
+ if (pVesa->shadowFB) {
+- pVesa->shadow = xcalloc(1, pScrn->displayWidth * pScrn->virtualY *
++ pVesa->shadow = calloc(1, pScrn->displayWidth * pScrn->virtualY *
+ ((pScrn->bitsPerPixel + 7) / 8));
+ if (!pVesa->shadow) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+@@ -1119,10 +1148,10 @@ VESACloseScreen(int scrnIndex, ScreenPtr pScreen)
+ }
+ if (pVesa->shadowFB && pVesa->shadow) {
+ shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen));
+- xfree(pVesa->shadow);
++ free(pVesa->shadow);
+ }
+ if (pVesa->pDGAMode) {
+- xfree(pVesa->pDGAMode);
++ free(pVesa->pDGAMode);
+ pVesa->pDGAMode = NULL;
+ pVesa->nDGAMode = 0;
+ }
+@@ -1180,7 +1209,7 @@ VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode)
+ * Free it as it will not be any longer useful
+ */
+ xf86ErrorF(", mode set without customized refresh.\n");
+- xfree(data->block);
++ free(data->block);
+ data->block = NULL;
+ data->mode &= ~(1 << 11);
+ }
+@@ -1315,7 +1344,7 @@ VESALoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
+ int base;
+
+ if (pVesa->pal == NULL)
+- pVesa->pal = xcalloc(1, sizeof(CARD32) * 256);
++ pVesa->pal = calloc(1, sizeof(CARD32) * 256);
+
+ for (i = 0, base = idx = indices[i]; i < numColors; i++, idx++) {
+ int j = indices[i];
+@@ -1414,7 +1443,7 @@ SaveFonts(ScrnInfoPtr pScrn)
+ if (attr10 & 0x01)
+ return;
+
+- pVesa->fonts = xalloc(16384);
++ pVesa->fonts = malloc(16384);
+
+ /* save the registers that are needed here */
+ miscOut = ReadMiscOut();
+@@ -1622,7 +1651,7 @@ VESASaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function)
+ && function == MODE_SAVE) {
+ /* don't rely on the memory not being touched */
+ if (pVesa->pstate == NULL)
+- pVesa->pstate = xalloc(pVesa->stateSize);
++ pVesa->pstate = malloc(pVesa->stateSize);
+ memcpy(pVesa->pstate, pVesa->state, pVesa->stateSize);
+ }
+ }
+@@ -1737,7 +1766,7 @@ VESADGAAddModes(ScrnInfoPtr pScrn)
+ DGAModePtr pDGAMode;
+
+ do {
+- pDGAMode = xrealloc(pVesa->pDGAMode,
++ pDGAMode = realloc(pVesa->pDGAMode,
+ (pVesa->nDGAMode + 1) * sizeof(DGAModeRec));
+ if (!pDGAMode)
+ break;
+diff --git a/src/vesa.h b/src/vesa.h
+index 4656e4c..89245b9 100644
+--- a/src/vesa.h
++++ b/src/vesa.h
+@@ -25,8 +25,6 @@
+ * Conectiva Linux.
+ *
+ * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+- *
+- * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.12 2002/08/06 13:46:27 dawes Exp $
+ */
+
+ #ifndef _VESA_H_
diff --git a/testing/xf86-video-vesa/revert-kernelcheck.patch b/testing/xf86-video-vesa/revert-kernelcheck.patch
new file mode 100644
index 000000000..37418cc3f
--- /dev/null
+++ b/testing/xf86-video-vesa/revert-kernelcheck.patch
@@ -0,0 +1,31 @@
+From b1f7f190f9d4f2ab63d3e9ade3e7e04bb4b1f89f Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Wed, 08 Dec 2010 18:45:32 +0000
+Subject: Refuse to load if there's a kernel driver bound to the device
+
+Ported from the equivalent check in nv.
+
+Signed-off-by: Adam Jackson <ajax@redhat.com>
+---
+diff --git a/src/vesa.c b/src/vesa.c
+index 168fde1..2523d76 100644
+--- a/src/vesa.c
++++ b/src/vesa.c
+@@ -431,8 +431,14 @@ VESAPciProbe(DriverPtr drv, int entity_num, struct pci_device *dev,
+ pScrn = xf86ConfigPciEntity(NULL, 0, entity_num, NULL,
+ NULL, NULL, NULL, NULL, NULL);
+ if (pScrn != NULL) {
+- VESAPtr pVesa = VESAGetRec(pScrn);
++ VESAPtr pVesa;
+
++ if (pci_device_has_kernel_driver(dev)) {
++ ErrorF("vesa: Ignoring device with a bound kernel driver\n");
++ return FALSE;
++ }
++
++ pVesa = VESAGetRec(pScrn);
+ VESAInitScrn(pScrn);
+ pVesa->pciInfo = dev;
+ }
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/testing/xf86-video-voodoo/PKGBUILD b/testing/xf86-video-voodoo/PKGBUILD
new file mode 100644
index 000000000..78320a904
--- /dev/null
+++ b/testing/xf86-video-voodoo/PKGBUILD
@@ -0,0 +1,30 @@
+# $Id: PKGBUILD 150089 2012-02-12 09:46:01Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-voodoo
+pkgver=1.2.4
+pkgrel=6
+pkgdesc="X.org 3dfx Voodoo1/Voodoo2 2D video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903' 'xf86dgaproto')
+conflicts=('xorg-server<1.11.99.903')
+groups=('xorg-drivers' 'xorg')
+options=('!libtool')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2)
+sha1sums=('7ecd232cc0b7fe507e18e08799791eefa9fdaf48')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+}
diff --git a/testing/xf86-video-xgixp/PKGBUILD b/testing/xf86-video-xgixp/PKGBUILD
new file mode 100644
index 000000000..a8afd402d
--- /dev/null
+++ b/testing/xf86-video-xgixp/PKGBUILD
@@ -0,0 +1,33 @@
+# $Id: PKGBUILD 150091 2012-02-12 09:46:03Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-xgixp
+pkgver=1.8.0
+pkgrel=5
+pkgdesc="X.org XGIXP video driver"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel>=1.11.99.903' 'libdrm' 'xf86driproto' 'mesa') # 'glproto')
+conflicts=('xorg-server<1.11.99.903')
+options=('!libtool')
+groups=('xorg-drivers' 'xorg')
+source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
+ api-compat-fix-for-DRAWABLE_BUFFER.patch)
+sha1sums=('67caeaa4c746572160208fe23c7257f62cb442a3'
+ 'ea140a13963bbf33cdff1ad75789d765867ec53b')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i "${srcdir}/api-compat-fix-for-DRAWABLE_BUFFER.patch"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/testing/xf86-video-xgixp/api-compat-fix-for-DRAWABLE_BUFFER.patch b/testing/xf86-video-xgixp/api-compat-fix-for-DRAWABLE_BUFFER.patch
new file mode 100644
index 000000000..f8cb64673
--- /dev/null
+++ b/testing/xf86-video-xgixp/api-compat-fix-for-DRAWABLE_BUFFER.patch
@@ -0,0 +1,23 @@
+From 86258a6fd8fc8bb09a52ee446b37abe6bd0843ef Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Fri, 25 Mar 2011 22:46:55 +0000
+Subject: API compat fix for DRAWABLE_BUFFER
+
+Signed-off-by: Adam Jackson <ajax@redhat.com>
+---
+diff --git a/src/xgi_driver.c b/src/xgi_driver.c
+index e54d8c7..189b84a 100644
+--- a/src/xgi_driver.c
++++ b/src/xgi_driver.c
+@@ -2708,7 +2708,9 @@ xg47_setup_fb_wrap(ReadMemoryProcPtr *read_ptr,
+ {
+ switch (pDraw->type) {
+ case DRAWABLE_WINDOW:
++#ifdef DRAWABLE_BUFFER
+ case DRAWABLE_BUFFER:
++#endif
+ *read_ptr = xg47_read_memory_swap_func;
+ *write_ptr = xg47_write_memory_swap_func;
+ break;
+--
+cgit v0.8.3-6-g21f6
diff --git a/testing/xorg-server/10-quirks.conf b/testing/xorg-server/10-quirks.conf
new file mode 100644
index 000000000..7afad22dc
--- /dev/null
+++ b/testing/xorg-server/10-quirks.conf
@@ -0,0 +1,10 @@
+# Collection of quirks and blacklist/whitelists for specific devices.
+
+
+# Accelerometer device, posts data through ABS_X/ABS_Y, making X unusable
+# http://bugs.freedesktop.org/show_bug.cgi?id=22442
+Section "InputClass"
+ Identifier "ThinkPad HDAPS accelerometer blacklist"
+ MatchProduct "ThinkPad HDAPS accelerometer data"
+ Option "Ignore" "on"
+EndSection
diff --git a/testing/xorg-server/PKGBUILD b/testing/xorg-server/PKGBUILD
new file mode 100644
index 000000000..f1d323746
--- /dev/null
+++ b/testing/xorg-server/PKGBUILD
@@ -0,0 +1,191 @@
+# $Id: PKGBUILD 150093 2012-02-12 09:46:06Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgbase=xorg-server
+pkgname=('xorg-server' 'xorg-server-xephyr' 'xorg-server-xdmx' 'xorg-server-xvfb' 'xorg-server-xnest' 'xorg-server-common' 'xorg-server-devel')
+pkgver=1.11.99.903
+pkgrel=1
+arch=('i686' 'x86_64')
+license=('custom')
+url="http://xorg.freedesktop.org"
+makedepends=('pixman' 'libx11' 'mesa' 'libgl' 'xf86driproto' 'xcmiscproto' 'xtrans' 'bigreqsproto' 'randrproto' 'inputproto' 'fontsproto' 'videoproto'
+ 'compositeproto' 'recordproto' 'scrnsaverproto' 'resourceproto' 'xineramaproto' 'libxkbfile' 'libxfont' 'renderproto' 'libpciaccess'
+ 'libxv' 'xf86dgaproto' 'libxmu' 'libxrender' 'libxi' 'dmxproto' 'libxaw' 'libdmx' 'libxtst' 'libxres' 'xorg-xkbcomp' 'xorg-util-macros'
+ 'xorg-font-util' 'glproto' 'dri2proto' 'udev' 'libgcrypt')
+options=('!libtool')
+source=(${url}/releases/individual/xserver/${pkgbase}-${pkgver}.tar.bz2
+ autoconfig-nvidia.patch
+ autoconfig-sis.patch
+ #git-fixes.patch
+ xvfb-run
+ xvfb-run.1
+ 10-quirks.conf)
+sha1sums=('a8058c22c2dc0388e64fa58e0307813cb72a337f'
+ 'f19658773d3fa4dc468bb28f9f01866acce71540'
+ '962fecc159c128728f14e8ba231c5b00391ff4ac'
+ 'c94f742d3f9cabf958ae58e4015d9dd185aabedc'
+ '6838fc00ef4618c924a77e0fb03c05346080908a'
+ '993798f3d22ad672d769dae5f48d1fa068d5578f')
+
+build() {
+ cd "${srcdir}/${pkgbase}-${pkgver}"
+
+ # Use nouveau/nv/nvidia drivers for nvidia devices
+ patch -Np1 -i "${srcdir}/autoconfig-nvidia.patch"
+
+ # Use unofficial imedia SiS driver for supported SiS devices
+ patch -Np0 -i "${srcdir}/autoconfig-sis.patch"
+
+ # Add post-release patches from 1.11 branch
+# patch -Np1 -i "${srcdir}/git-fixes.patch"
+
+ autoreconf -fi
+ ./configure --prefix=/usr \
+ --enable-ipv6 \
+ --enable-dri \
+ --enable-dmx \
+ --enable-xvfb \
+ --enable-xnest \
+ --enable-composite \
+ --enable-xcsecurity \
+ --enable-xorg \
+ --enable-xephyr \
+ --enable-glx-tls \
+ --enable-kdrive \
+ --enable-install-setuid \
+ --enable-config-udev \
+ --disable-config-dbus \
+ --enable-record \
+ --disable-xfbdev \
+ --disable-xfake \
+ --disable-static \
+ --sysconfdir=/etc/X11 \
+ --localstatedir=/var \
+ --with-xkb-path=/usr/share/X11/xkb \
+ --with-xkb-output=/var/lib/xkb \
+ --with-fontrootdir=/usr/share/fonts
+ make
+
+ # Disable subdirs for make install rule to make splitting easier
+ sed -e 's/^DMX_SUBDIRS =.*/DMX_SUBDIRS =/' \
+ -e 's/^XVFB_SUBDIRS =.*/XVFB_SUBDIRS =/' \
+ -e 's/^XNEST_SUBDIRS =.*/XNEST_SUBDIRS = /' \
+ -e 's/^KDRIVE_SUBDIRS =.*/KDRIVE_SUBDIRS =/' \
+ -i hw/Makefile
+}
+
+package_xorg-server-common() {
+ pkgdesc="Xorg server common files"
+ depends=('xkeyboard-config' 'xorg-xkbcomp' 'xorg-setxkbmap' 'xorg-fonts-misc')
+
+ cd "${srcdir}/${pkgbase}-${pkgver}"
+ install -m755 -d "${pkgdir}/usr/share/licenses/xorg-server-common"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/xorg-server-common"
+
+ make -C xkb DESTDIR="${pkgdir}" install-data
+
+ install -m755 -d "${pkgdir}/usr/share/man/man1"
+ install -m644 man/Xserver.1 "${pkgdir}/usr/share/man/man1/"
+
+ install -m755 -d "${pkgdir}/usr/lib/xorg"
+ install -m644 dix/protocol.txt "${pkgdir}/usr/lib/xorg/"
+}
+
+package_xorg-server() {
+ pkgdesc="Xorg X server"
+ depends=(libxdmcp libxfont udev libpciaccess libdrm pixman libgcrypt libxau xorg-server-common xf86-input-evdev)
+ backup=('etc/X11/xorg.conf.d/10-evdev.conf' 'etc/X11/xorg.conf.d/10-quirks.conf')
+ provides=('x-server')
+ groups=('xorg')
+ conflicts=('nvidia-utils<=290.10')
+
+ cd "${srcdir}/${pkgbase}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/etc/X11"
+ mv "${pkgdir}/usr/share/X11/xorg.conf.d" "${pkgdir}/etc/X11/"
+ install -m644 "${srcdir}/10-quirks.conf" "${pkgdir}/etc/X11/xorg.conf.d/"
+
+ rmdir "${pkgdir}/usr/share/X11"
+
+ # Needed for non-mesa drivers, libgl will restore it
+ mv "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so" \
+ "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.xorg"
+
+ rm -rf "${pkgdir}/var"
+
+ rm -f "${pkgdir}/usr/share/man/man1/Xserver.1"
+ rm -f "${pkgdir}/usr/lib/xorg/protocol.txt"
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/xorg-server"
+ ln -sf ../xorg-server-common/COPYING "${pkgdir}/usr/share/licenses/xorg-server/COPYING"
+
+ rm -rf "${pkgdir}/usr/lib/pkgconfig"
+ rm -rf "${pkgdir}/usr/include"
+ rm -rf "${pkgdir}/usr/share/aclocal"
+}
+
+package_xorg-server-xephyr() {
+ pkgdesc="A nested X server that runs as an X application"
+ depends=(libxfont libgl libgcrypt libxv pixman xorg-server-common)
+
+ cd "${srcdir}/${pkgbase}-${pkgver}/hw/kdrive"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/xorg-server-xephyr"
+ ln -sf ../xorg-server-common/COPYING "${pkgdir}/usr/share/licenses/xorg-server-xephyr/COPYING"
+}
+
+package_xorg-server-xvfb() {
+ pkgdesc="Virtual framebuffer X server"
+ depends=(libxfont libxdmcp libxau libgcrypt pixman xorg-server-common)
+
+ cd "${srcdir}/${pkgbase}-${pkgver}/hw/vfb"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 "${srcdir}/xvfb-run" "${pkgdir}/usr/bin/"
+ install -m644 "${srcdir}/xvfb-run.1" "${pkgdir}/usr/share/man/man1/"
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/xorg-server-xvfb"
+ ln -sf ../xorg-server-common/COPYING "${pkgdir}/usr/share/licenses/xorg-server-xvfb/COPYING"
+}
+
+package_xorg-server-xnest() {
+ pkgdesc="A nested X server that runs as an X application"
+ depends=(libxfont libxext libgcrypt pixman xorg-server-common)
+
+ cd "${srcdir}/${pkgbase}-${pkgver}/hw/xnest"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/xorg-server-xnest"
+ ln -sf ../xorg-server-common/COPYING "${pkgdir}/usr/share/licenses/xorg-server-xnest/COPYING"
+}
+
+package_xorg-server-xdmx() {
+ pkgdesc="Distributed Multihead X Server and utilities"
+ depends=(libxfont libxi libgcrypt libxaw libxrender libdmx libxfixes pixman xorg-server-common)
+
+ cd "${srcdir}/${pkgbase}-${pkgver}/hw/dmx"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/xorg-server-xdmx"
+ ln -sf ../xorg-server-common/COPYING "${pkgdir}/usr/share/licenses/xorg-server-xdmx/COPYING"
+}
+
+package_xorg-server-devel() {
+ pkgdesc="Development files for the X.Org X server"
+ depends=(xproto randrproto renderproto xextproto inputproto kbproto fontsproto videoproto dri2proto xineramaproto xorg-util-macros pixman libpciaccess)
+
+ cd "${srcdir}/${pkgbase}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ rm -rf "${pkgdir}/usr/bin"
+ rm -rf "${pkgdir}/usr/share/man"
+ rm -rf "${pkgdir}/usr/share/doc"
+ rm -rf "${pkgdir}/usr/share/X11"
+ rm -rf "${pkgdir}/usr/lib/xorg"
+ rm -rf "${pkgdir}/var"
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/xorg-server-devel"
+ ln -sf ../xorg-server-common/COPYING "${pkgdir}/usr/share/licenses/xorg-server-devel/COPYING"
+}
diff --git a/testing/xorg-server/autoconfig-nvidia.patch b/testing/xorg-server/autoconfig-nvidia.patch
new file mode 100644
index 000000000..9ed9b7aee
--- /dev/null
+++ b/testing/xorg-server/autoconfig-nvidia.patch
@@ -0,0 +1,28 @@
+diff -Nur xorg-server-1.11.99.902.orig/hw/xfree86/common/xf86pciBus.c xorg-server-1.11.99.902/hw/xfree86/common/xf86pciBus.c
+--- xorg-server-1.11.99.902.orig/hw/xfree86/common/xf86pciBus.c 2012-02-10 10:10:37.583014924 +0000
++++ xorg-server-1.11.99.902/hw/xfree86/common/xf86pciBus.c 2012-02-10 11:16:07.148971317 +0000
+@@ -1111,7 +1111,23 @@
+ {
+ int idx = 0;
+ #ifdef __linux__
+- driverList[idx++] = "nouveau";
++ switch (dev->device_id)
++ {
++ /* NV1 */
++ case 0x0008:
++ case 0x0009:
++ driverList[idx++] = "vesa";
++ break;
++ /* NV3 */
++ case 0x0018:
++ case 0x0019:
++ driverList[idx++] = "nouveau";
++ break;
++ default:
++ driverList[idx++] = "nouveau";
++ driverList[idx++] = "nvidia";
++ break;
++ }
+ #endif
+ driverList[idx++] = "nv";
+ break;
diff --git a/testing/xorg-server/autoconfig-sis.patch b/testing/xorg-server/autoconfig-sis.patch
new file mode 100644
index 000000000..d936efaaa
--- /dev/null
+++ b/testing/xorg-server/autoconfig-sis.patch
@@ -0,0 +1,19 @@
+--- hw/xfree86/common/xf86pciBus.c.orig 2011-09-24 10:53:45.421697668 +0000
++++ hw/xfree86/common/xf86pciBus.c 2011-09-24 10:55:56.416250708 +0000
+@@ -1140,7 +1140,15 @@
+ driverList[0] = "savage"; break;
+ }
+ break;
+- case 0x1039: driverList[0] = "sis"; break;
++ case 0x1039:
++ switch (dev->device_id)
++ {
++ case 0x6350: case 0x6351:
++ driverList[0] = "sisimedia"; driverList[1] = "sis"; break;
++ default:
++ driverList[0] = "sis"; break;
++ }
++ break;
+ case 0x126f: driverList[0] = "siliconmotion"; break;
+ case 0x121a:
+ if (dev->device_id < 0x0003)
diff --git a/testing/xorg-server/git-fixes.patch b/testing/xorg-server/git-fixes.patch
new file mode 100644
index 000000000..27da61eca
--- /dev/null
+++ b/testing/xorg-server/git-fixes.patch
@@ -0,0 +1,161 @@
+From 89626304ea1ad316c5b7145a40f09377148cff21 Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied@redhat.com>
+Date: Thu, 20 Oct 2011 13:43:01 +0000
+Subject: xf86Crtc: handle no outputs with no modes harder.
+
+If you started an X server with no connected outputs, we pick a default
+1024x768 mode, however if you then ran an xvidmode using app against that
+server it would segfault the server due to not finding any valid modes.
+
+This was due to the no output mode set code, only adding the modes to the
+scrn->modes once, when something called randr 1.2 xf86SetScrnInfoModes would
+get called and remove all the modes and we'd end up with 0.
+
+This change fixes xf86SetScrnInfoModes to always report a scrn mode of at
+least 1024x768, and pushes the initial configuration to just call it instead
+of setting up the mode itself.
+
+Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=746926
+
+I've seen other bugs like this on other distros so it might also actually fix them.
+
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Reviewed-by: Keith Packard <keithp@keithp.com>
+Signed-off-by: Keith Packard <keithp@keithp.com>
+(cherry picked from commit 17416e88dcfcc584fe5f87580d5d2b719b3521c3)
+---
+diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
+index d75cd77..8906806 100644
+--- a/hw/xfree86/modes/xf86Crtc.c
++++ b/hw/xfree86/modes/xf86Crtc.c
+@@ -1915,19 +1915,25 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn)
+ break;
+ }
+
+- if (scrn->modes != NULL) {
+- /* For some reason, scrn->modes is circular, unlike the other mode
+- * lists. How great is that?
+- */
+- for (last = scrn->modes; last && last->next; last = last->next)
+- ;
+- last->next = scrn->modes;
+- scrn->modes->prev = last;
+- if (mode) {
+- while (scrn->modes != mode)
+- scrn->modes = scrn->modes->next;
+- }
++ if (!scrn->modes) {
++ scrn->modes = xf86ModesAdd(scrn->modes,
++ xf86CVTMode(scrn->display->virtualX,
++ scrn->display->virtualY,
++ 60, 0, 0));
++ }
++
++ /* For some reason, scrn->modes is circular, unlike the other mode
++ * lists. How great is that?
++ */
++ for (last = scrn->modes; last && last->next; last = last->next)
++ ;
++ last->next = scrn->modes;
++ scrn->modes->prev = last;
++ if (mode) {
++ while (scrn->modes != mode)
++ scrn->modes = scrn->modes->next;
+ }
++
+ scrn->currentMode = scrn->modes;
+ #ifdef XFreeXDGA
+ if (scrn->pScreen)
+@@ -2529,16 +2535,7 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
+ width, height);
+ }
+
+- if (have_outputs) {
+- /* Mirror output modes to scrn mode list */
+- xf86SetScrnInfoModes (scrn);
+- } else {
+- /* Clear any existing modes from scrn->modes */
+- while (scrn->modes != NULL)
+- xf86DeleteMode(&scrn->modes, scrn->modes);
+- scrn->modes = xf86ModesAdd(scrn->modes,
+- xf86CVTMode(width, height, 60, 0, 0));
+- }
++ xf86SetScrnInfoModes (scrn);
+
+ success = TRUE;
+ bailout:
+--
+cgit v0.9.0.2-2-gbebe
+From 97f2ae60fc0cc755abd8b88df826fcb1a20464fe Mon Sep 17 00:00:00 2001
+From: Christopher Yeleighton <giecrilj@stegny.2a.pl>
+Date: Tue, 25 Oct 2011 01:47:06 +0000
+Subject: Bug 38420: Xvfb crashes in miInitVisuals() when started with depth=2
+
+https://bugs.freedesktop.org/show_bug.cgi?id=38420
+
+Exit with fatal error message, not segfault.
+
+Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
+Signed-off-by: Keith Packard <keithp@keithp.com>
+(cherry picked from commit 7d50211ab57a35910d79fc3f67ae89aff91fa995)
+---
+diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
+index 31ed505..dce3f84 100644
+--- a/hw/vfb/InitOutput.c
++++ b/hw/vfb/InitOutput.c
+@@ -864,6 +864,8 @@ vfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
+ (1 << DirectColor)),
+ 10, TrueColor, 0x3ff00000, 0x000ffc00, 0x000003ff);
+ break;
++ default:
++ return FALSE;
+ }
+
+ miSetPixmapDepths ();
+--
+cgit v0.9.0.2-2-gbebe
+From 34bb83b9df20ff63dbb147ed661f39efb8bae8e4 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Mon, 24 Oct 2011 02:00:32 +0000
+Subject: dix: block signals when closing all devices
+
+When closing down all devices, we manually unset master for all attached
+devices, but the device's sprite info still points to the master's sprite
+info. This leaves us a window where the master is freed already but the
+device isn't yet. A signal during that window causes dereference of the
+already freed spriteInfo in mieqEnqueue's EnqueueScreen macro.
+
+Simply block signals when removing all devices. It's not like we're really
+worrying about high-responsive input at this stage.
+
+https://bugzilla.redhat.com/show_bug.cgi?id=737031
+
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+Reviewed-by: Julien Cristau <jcristau@debian.org>
+(cherry picked from commit d7c44a7c9760449bef263413ad3b20f19b1dc95a)
+---
+diff --git a/dix/devices.c b/dix/devices.c
+index 0ccf252..cbdd4ea 100644
+--- a/dix/devices.c
++++ b/dix/devices.c
+@@ -982,6 +982,8 @@ CloseDownDevices(void)
+ {
+ DeviceIntPtr dev;
+
++ OsBlockSignals();
++
+ /* Float all SDs before closing them. Note that at this point resources
+ * (e.g. cursors) have been freed already, so we can't just call
+ * AttachDevice(NULL, dev, NULL). Instead, we have to forcibly set master
+@@ -1004,6 +1006,8 @@ CloseDownDevices(void)
+ inputInfo.keyboard = NULL;
+ inputInfo.pointer = NULL;
+ XkbDeleteRulesDflts();
++
++ OsReleaseSignals();
+ }
+
+ /**
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/testing/xorg-server/xvfb-run b/testing/xorg-server/xvfb-run
new file mode 100644
index 000000000..4c2f4e0d3
--- /dev/null
+++ b/testing/xorg-server/xvfb-run
@@ -0,0 +1,180 @@
+#!/bin/sh
+
+# $Id: xvfb-run 2027 2004-11-16 14:54:16Z branden $
+
+# This script starts an instance of Xvfb, the "fake" X server, runs a command
+# with that server available, and kills the X server when done. The return
+# value of the command becomes the return value of this script.
+#
+# If anyone is using this to build a Debian package, make sure the package
+# Build-Depends on xvfb, xbase-clients, and xfonts-base.
+
+set -e
+
+PROGNAME=xvfb-run
+SERVERNUM=99
+AUTHFILE=
+ERRORFILE=/dev/null
+STARTWAIT=3
+XVFBARGS="-screen 0 640x480x8"
+LISTENTCP="-nolisten tcp"
+XAUTHPROTO=.
+
+# Query the terminal to establish a default number of columns to use for
+# displaying messages to the user. This is used only as a fallback in the event
+# the COLUMNS variable is not set. ($COLUMNS can react to SIGWINCH while the
+# script is running, and this cannot, only being calculated once.)
+DEFCOLUMNS=$(stty size 2>/dev/null | awk '{print $2}') || true
+if ! expr "$DEFCOLUMNS" : "[[:digit:]]\+$" >/dev/null 2>&1; then
+ DEFCOLUMNS=80
+fi
+
+# Display a message, wrapping lines at the terminal width.
+message () {
+ echo "$PROGNAME: $*" | fmt -t -w ${COLUMNS:-$DEFCOLUMNS}
+}
+
+# Display an error message.
+error () {
+ message "error: $*" >&2
+}
+
+# Display a usage message.
+usage () {
+ if [ -n "$*" ]; then
+ message "usage error: $*"
+ fi
+ cat <<EOF
+Usage: $PROGNAME [OPTION ...] COMMAND
+Run COMMAND (usually an X client) in a virtual X server environment.
+Options:
+-a --auto-servernum try to get a free server number, starting at
+ --server-num
+-e FILE --error-file=FILE file used to store xauth errors and Xvfb
+ output (default: $ERRORFILE)
+-f FILE --auth-file=FILE file used to store auth cookie
+ (default: ./.Xauthority)
+-h --help display this usage message and exit
+-n NUM --server-num=NUM server number to use (default: $SERVERNUM)
+-l --listen-tcp enable TCP port listening in the X server
+-p PROTO --xauth-protocol=PROTO X authority protocol name to use
+ (default: xauth command's default)
+-s ARGS --server-args=ARGS arguments (other than server number and
+ "-nolisten tcp") to pass to the Xvfb server
+ (default: "$XVFBARGS")
+-w DELAY --wait=DELAY delay in seconds to wait for Xvfb to start
+ before running COMMAND (default: $STARTWAIT)
+EOF
+}
+
+# Find a free server number by looking at .X*-lock files in /tmp.
+find_free_servernum() {
+ # Sadly, the "local" keyword is not POSIX. Leave the next line commented in
+ # the hope Debian Policy eventually changes to allow it in /bin/sh scripts
+ # anyway.
+ #local i
+
+ i=$SERVERNUM
+ while [ -f /tmp/.X$i-lock ]; do
+ i=$(($i + 1))
+ done
+ echo $i
+}
+
+# Clean up files
+clean_up() {
+ if [ -e "$AUTHFILE" ]; then
+ XAUTHORITY=$AUTHFILE xauth remove ":$SERVERNUM" >>"$ERRORFILE" 2>&1
+ fi
+ if [ -n "$XVFB_RUN_TMPDIR" ]; then
+ if ! rm -r "$XVFB_RUN_TMPDIR"; then
+ error "problem while cleaning up temporary directory"
+ exit 5
+ fi
+ fi
+}
+
+# Parse the command line.
+ARGS=$(getopt --options +ae:f:hn:lp:s:w: \
+ --long auto-servernum,error-file:,auth-file:,help,server-num:,listen-tcp,xauth-protocol:,server-args:,wait: \
+ --name "$PROGNAME" -- "$@")
+GETOPT_STATUS=$?
+
+if [ $GETOPT_STATUS -ne 0 ]; then
+ error "internal error; getopt exited with status $GETOPT_STATUS"
+ exit 6
+fi
+
+eval set -- "$ARGS"
+
+while :; do
+ case "$1" in
+ -a|--auto-servernum) SERVERNUM=$(find_free_servernum) ;;
+ -e|--error-file) ERRORFILE="$2"; shift ;;
+ -f|--auth-file) AUTHFILE="$2"; shift ;;
+ -h|--help) SHOWHELP="yes" ;;
+ -n|--server-num) SERVERNUM="$2"; shift ;;
+ -l|--listen-tcp) LISTENTCP="" ;;
+ -p|--xauth-protocol) XAUTHPROTO="$2"; shift ;;
+ -s|--server-args) XVFBARGS="$2"; shift ;;
+ -w|--wait) STARTWAIT="$2"; shift ;;
+ --) shift; break ;;
+ *) error "internal error; getopt permitted \"$1\" unexpectedly"
+ exit 6
+ ;;
+ esac
+ shift
+done
+
+if [ "$SHOWHELP" ]; then
+ usage
+ exit 0
+fi
+
+if [ -z "$*" ]; then
+ usage "need a command to run" >&2
+ exit 2
+fi
+
+if ! which xauth >/dev/null; then
+ error "xauth command not found"
+ exit 3
+fi
+
+# tidy up after ourselves
+trap clean_up EXIT
+
+# If the user did not specify an X authorization file to use, set up a temporary
+# directory to house one.
+if [ -z "$AUTHFILE" ]; then
+ XVFB_RUN_TMPDIR="$(mktemp -d -t $PROGNAME.XXXXXX)"
+ AUTHFILE="$XVFB_RUN_TMPDIR/Xauthority"
+fi
+
+# Start Xvfb.
+MCOOKIE=$(mcookie)
+XAUTHORITY=$AUTHFILE xauth source - << EOF >>"$ERRORFILE" 2>&1
+add :$SERVERNUM $XAUTHPROTO $MCOOKIE
+EOF
+XAUTHORITY=$AUTHFILE Xvfb ":$SERVERNUM" $XVFBARGS $LISTENTCP >>"$ERRORFILE" \
+ 2>&1 &
+XVFBPID=$!
+sleep "$STARTWAIT"
+if ! kill -0 $XVFBPID 2>/dev/null; then
+ echo "Xvfb failed to start" >&2
+ exit 1
+fi
+
+# Start the command and save its exit status.
+set +e
+DISPLAY=:$SERVERNUM XAUTHORITY=$AUTHFILE "$@" 2>&1
+RETVAL=$?
+set -e
+
+# Kill Xvfb now that the command has exited.
+kill $XVFBPID
+
+# Return the executed command's exit status.
+exit $RETVAL
+
+# vim:set ai et sts=4 sw=4 tw=80:
diff --git a/testing/xorg-server/xvfb-run.1 b/testing/xorg-server/xvfb-run.1
new file mode 100644
index 000000000..137d3a196
--- /dev/null
+++ b/testing/xorg-server/xvfb-run.1
@@ -0,0 +1,282 @@
+.\" $Id: xvfb-run.1 2138 2005-01-17 23:40:27Z branden $
+.\"
+.\" Copyright 1998-2004 Branden Robinson <branden@debian.org>.
+.\"
+.\" This is free software; you may redistribute it and/or modify
+.\" it under the terms of the GNU General Public License as
+.\" published by the Free Software Foundation; either version 2,
+.\" or (at your option) any later version.
+.\"
+.\" This is distributed in the hope that it will be useful, but
+.\" WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.\" GNU General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU General Public License with
+.\" the Debian operating system, in /usr/share/common-licenses/GPL; if
+.\" not, write to the Free Software Foundation, Inc., 59 Temple Place,
+.\" Suite 330, Boston, MA 02111-1307 USA
+.\"
+.\" We need the URL macro from groff's www macro package, but also want
+.\" things to work all right for people who don't have it. So we define
+.\" our own URL macro and let the www macro package override it if it's
+.\" available.
+.de URL
+\\$2 \(laURL: \\$1 \(ra\\$3
+..
+.if \n[.g] .mso www.tmac
+.TH xvfb\-run 1 "2004\-11\-12" "Debian Project"
+.SH NAME
+xvfb\-run \- run specified X client or command in a virtual X server environment
+.SH SYNOPSIS
+.B xvfb\-run
+[
+.I options
+]
+.I command
+.SH DESCRIPTION
+.B xvfb\-run
+is a wrapper for the
+.BR Xvfb (1x)
+command which simplifies the task of running commands (typically an X
+client, or a script containing a list of clients to be run) within a virtual
+X server environment.
+.PP
+.B xvfb\-run
+sets up an X authority file (or uses an existing user\-specified one),
+writes a cookie to it (see
+.BR xauth (1x))
+and then starts the
+.B Xvfb
+X server as a background process.
+The process ID of
+.B Xvfb
+is stored for later use.
+The specified
+.I command
+is then run using the X display corresponding to the
+.B Xvfb
+server
+just started and the X authority file created earlier.
+.PP
+When the
+.I command
+exits, its status is saved, the
+.B Xvfb
+server is killed (using the process ID stored earlier), the X authority
+cookie removed, and the authority file deleted (if the user did not specify
+one to use).
+.B xvfb\-run
+then exits with the exit status of
+.IR command .
+.PP
+.B xvfb\-run
+requires the
+.B xauth
+command to function.
+.SH OPTIONS
+.TP
+.B \-a\fR,\fB \-\-auto\-servernum
+Try to get a free server number, starting at 99, or the argument to
+.BR \-\-server\-num .
+.TP
+.BI \-e\ file \fR,\fB\ \-\-error\-file= file
+Store output from
+.B xauth
+and
+.B Xvfb
+in
+.IR file .
+The default is
+.IR /dev/null .
+.TP
+.BI \-f\ file \fR,\fB\ \-\-auth\-file= file
+Store X authentication data in
+.IR file .
+By default, a temporary directory called
+.IR xvfb\-run. PID
+(where PID is the process ID of
+.B xvfb\-run
+itself) is created in the directory specified by the environment variable
+.B TMPDIR
+(or
+.I /tmp
+if that variable is null or unset), and the
+.BR tempfile (1)
+command is used to create a file in that temporary directory called
+.IR Xauthority .
+.TP
+.B \-h\fR,\fB \-\-help
+Display a usage message and exit.
+.TP
+.BI \-n\ servernumber \fR,\fB\ \-\-server\-num= servernumber
+Use
+.I servernumber
+as the server number (but see the
+.B \-a\fR,\fB \-\-auto\-servernum
+option above).
+The default is 99.
+.TP
+.B \-l\fR,\fB \-\-listen\-tcp
+Enable TCP port listening in the X server.
+For security reasons (to avoid denial\-of\-service attacks or exploits),
+TCP port listening is disabled by default.
+.TP
+.BI \-p\ protocolname \fR,\fB\ \-\-xauth\-protocol= protocolname
+Use
+.I protocolname
+as the X authority protocol to use.
+The default is \(oq.\(cq, which
+.B xauth
+interprets as its own default protocol, which is MIT\-MAGIC\-COOKIE\-1.
+.TP
+.BI \-s\ arguments \fR,\fB\ \-\-server\-args= arguments
+Pass
+.I arguments
+to the
+.B Xvfb
+server.
+Be careful to quote any whitespace characters that may occur within
+.I arguments
+to prevent them from regarded as separators for
+.BR xvfb\-run 's
+own arguments.
+Also, note that specification of \(oq\-nolisten tcp\(cq in
+.I arguments
+may override the function of
+.BR xvfb\-run 's
+own
+.B \-l\fR,\fB \-\-listen\-tcp
+option, and that specification of the server number (e.g., \(oq:1\(cq) may
+be ignored because of the way the X server parses its argument list.
+Use the
+.B xvfb\-run
+option
+.BI \-n\ servernumber \fR,\fB\ \-\-server\-num= servernumber
+to achieve the latter function.
+The default is \(oq\-screen 0 640x480x8\(cq.
+.TP
+.BI \-w\ delay \fR,\fB\ \-\-wait= delay
+Wait
+.I delay
+seconds after launching
+.B Xvfb
+before attempting to start the specified command.
+The default is 3.
+.SH ENVIRONMENT
+.TP
+.B COLUMNS
+indicates the width of the terminal device in character cells.
+This value is used for formatting diagnostic messages.
+If not set, the terminal is queried using
+.BR stty (1)
+to determine its width.
+If that fails, a value of \(oq80\(cq is assumed.
+.TP
+.B TMPDIR
+specifies the directory in which to place
+.BR xvfb\-run 's
+temporary directory for storage of the X authority file; only used if the
+.B \-f
+or
+.B \-\-auth\-file
+options are not specified.
+.SH "OUTPUT FILES"
+.PP
+Unless the
+.B \-f
+or
+.B \-\-auth\-file
+options are specified, a temporary
+directory and file within it are created (and deleted) to store the X
+authority cookies used by the
+.B Xvfb
+server and client(s) run under it.
+See
+.BR tempfile (1).
+If \-f or \-\-auth\-file are used, then the specified X authority file is
+only written to, not created or deleted (though
+.B xauth
+creates an authority file itself if told to use use that does not already
+exist).
+.PP
+An error file with a user\-specified name is also created if the
+.B \-e
+or
+.B \-\-error\-file
+options are specifed; see above.
+.SH "EXIT STATUS"
+.B xvfb\-run
+uses its exit status as well as output to standard error to communicate
+diagnostics.
+The exit status of \(oq1\(cq is not used, and should be interpreted as failure
+of the specified command.
+.TP
+0
+.B xvfb\-run
+only uses this exit status if the
+.B \-h\fR,\fB \-\-help
+option is given.
+In all other situations, this may be interpreted as success of the specified
+command.
+.TP
+2
+No command to run was specified.
+.TP
+3
+The
+.B xauth
+command is not available.
+.TP
+4
+The temporary directory that was going to be used already exists; since
+.B xvfb\-run
+produces a uniquely named directory, this may indicate an attempt by another
+process on the system to exploit a temporary file race condition.
+.TP
+5
+A problem was encountered while cleaning up the temporary directory.
+.TP
+6
+A problem was encountered while using
+.BR getopt (1)
+to parse the command\-line arguments.
+.SH EXAMPLES
+.TP
+.B xvfb\-run \-\-auto\-servernum \-\-server\-num=1 xlogo
+runs the
+.BR xlogo (1x)
+demonstration client inside the
+.B Xvfb
+X server on the first available server number greater than or equal to 1.
+.TP
+.B xvfb\-run \-\-server\-args="\-screen 0 1024x768x24" ico \-faces
+runs the
+.BR ico (1x)
+demonstration client (and passes it the
+.B \-faces
+argument) inside the
+.B Xvfb
+X server, configured with a root window of 1024 by 768 pixels and a color
+depth of 24 bits.
+.PP
+Note that the demo X clients used in the above examples will not exit on
+their own, so they will have to be killed before
+.B xvfb\-run
+will exit.
+.SH BUGS
+See
+.URL "http://bugs.debian.org/xvfb" "the Debian Bug Tracking System" .
+If you wish to report a bug in
+.BR xvfb\-run ,
+please use the
+.BR reportbug (1)
+command.
+.SH AUTHOR
+.B xfvb\-run
+was written by Branden Robinson and Jeff Licquia with sponsorship from
+Progeny Linux Systems.
+.SH "SEE ALSO"
+.BR Xvfb (1x),
+.BR xauth (1x)
+.\" vim:set et tw=80:
diff --git a/testing/xorg-xinput/PKGBUILD b/testing/xorg-xinput/PKGBUILD
new file mode 100644
index 000000000..7d9b5c2bf
--- /dev/null
+++ b/testing/xorg-xinput/PKGBUILD
@@ -0,0 +1,28 @@
+# $Id: PKGBUILD 150095 2012-02-12 09:46:08Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xorg-xinput
+pkgver=1.5.99.1
+pkgrel=1
+pkgdesc="Small commandline tool to configure devices"
+arch=(i686 x86_64)
+url="http://xorg.freedesktop.org/"
+license=('custom')
+depends=('libx11' 'libxi>=1.5.99.2' 'xorg-xrandr' 'libxinerama')
+makedepends=('xorg-util-macros' 'inputproto')
+groups=('xorg-apps' 'xorg')
+source=(http://xorg.freedesktop.org/archive/individual/app/xinput-${pkgver}.tar.bz2)
+sha1sums=('f979d9a4005d71db7e58064dff6ca6738bd9a345')
+
+build() {
+ cd "${srcdir}/xinput-${pkgver}"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/xinput-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/~mtjm/python2-pydns/PKGBUILD b/~mtjm/python2-pydns/PKGBUILD
index 76ea7b112..cf5f4b388 100644
--- a/~mtjm/python2-pydns/PKGBUILD
+++ b/~mtjm/python2-pydns/PKGBUILD
@@ -4,7 +4,7 @@
# Contributor: Samed Beyribey <ras0ir AT eventualis DOT org>
pkgname=python2-pydns
_pkgname=pydns
-pkgver=2.3.5
+pkgver=2.3.6
pkgrel=1
pkgdesc="Python2 module for performing DNS queries"
arch=('any')
@@ -13,7 +13,7 @@ license=('custom')
depends=('python2')
options=(!emptydirs)
source=(http://downloads.sourceforge.net/$_pkgname/$_pkgname-$pkgver.tar.gz)
-md5sums=('50fb6ec23808110162e84ef49140a73f')
+md5sums=('d12ca75251854ab6fcabbaff6909b690')
build() {
cd "$srcdir/$_pkgname-$pkgver"
diff --git a/~mtjm/python2-pyflakes/PKGBUILD b/~mtjm/python2-pyflakes/PKGBUILD
new file mode 100644
index 000000000..397c487b7
--- /dev/null
+++ b/~mtjm/python2-pyflakes/PKGBUILD
@@ -0,0 +1,33 @@
+# $Id: PKGBUILD 64234 2012-02-11 00:28:07Z arodseth $
+# Maintainer: Thomas Dziedzic < gostrc at gmail >
+# Contributor: TDY <tdy@gmx.com>
+# Contributor: Tiago Pierezan Camargo <tcamargo@gmail.com>
+
+pkgname=python2-pyflakes
+pkgver=0.5.0
+pkgrel=1
+pkgdesc='A lint-like tool for Python to identify common errors quickly without executing code'
+arch=('any')
+url='http://pypi.python.org/pypi/pyflakes'
+license=('custom:MIT')
+depends=('python2')
+provides=('pyflakes')
+conflicts=('pyflakes')
+replaces=('pyflakes')
+source=("http://pypi.python.org/packages/source/p/pyflakes/pyflakes-${pkgver}.tar.gz")
+md5sums=('568dab27c42e5822787aa8a603898672')
+
+build() {
+ cd pyflakes-${pkgver}
+
+ python2 setup.py build
+}
+
+package() {
+ cd pyflakes-${pkgver}
+
+ python2 setup.py install --prefix=/usr --root=${pkgdir} --optimize=1
+
+ install -D -m644 LICENSE \
+ ${pkgdir}/usr/share/licenses/pyflakes/LICENSE
+}
diff --git a/~mtjm/python2-pyspf/PKGBUILD b/~mtjm/python2-pyspf/PKGBUILD
index a32893066..abb3bfa5f 100644
--- a/~mtjm/python2-pyspf/PKGBUILD
+++ b/~mtjm/python2-pyspf/PKGBUILD
@@ -4,8 +4,8 @@
# Contributor: Samed Beyribey <ras0ir AT eventualis DOT org>
pkgname=python2-pyspf
_pkgname=pyspf
-pkgver=2.0.5
-pkgrel=2
+pkgver=2.0.7
+pkgrel=1
pkgdesc="Python2 implementation of the Sender Policy Framework (SPF) protocol"
arch=('any')
url="http://pypi.python.org/pypi/pyspf"
@@ -15,7 +15,7 @@ checkdepends=('python2-yaml')
conflicts=('python-pyspf')
options=(!emptydirs)
source=(http://downloads.sourceforge.net/pymilter/$_pkgname-$pkgver.tar.gz)
-md5sums=(7e3f53362e3ad52ec8a496445085a34f)
+md5sums=('df47e2c04054a89da8b46b7f67e704ae')
build() {
cd "$srcdir/$_pkgname-$pkgver"