summaryrefslogtreecommitdiff
path: root/extra/xf86-video-sisimedia
diff options
context:
space:
mode:
Diffstat (limited to 'extra/xf86-video-sisimedia')
-rw-r--r--extra/xf86-video-sisimedia/PKGBUILD30
-rw-r--r--extra/xf86-video-sisimedia/Untangle-XF86DRI.patch186
-rw-r--r--extra/xf86-video-sisimedia/pciTag-removal-workaround.patch39
-rw-r--r--extra/xf86-video-sisimedia/swap-func-rename.patch256
-rw-r--r--extra/xf86-video-sisimedia/sync-with-freedesktop.patch63
-rw-r--r--extra/xf86-video-sisimedia/xf86MapDomainMemory-pci_device_map_legacy.patch205
-rw-r--r--extra/xf86-video-sisimedia/xserver112.patch12
7 files changed, 785 insertions, 6 deletions
diff --git a/extra/xf86-video-sisimedia/PKGBUILD b/extra/xf86-video-sisimedia/PKGBUILD
index b1d9e01d6..02febf216 100644
--- a/extra/xf86-video-sisimedia/PKGBUILD
+++ b/extra/xf86-video-sisimedia/PKGBUILD
@@ -1,16 +1,16 @@
-# $Id: PKGBUILD 142261 2011-11-07 13:08:57Z jgc $
+# $Id: PKGBUILD 153653 2012-03-17 10:02:45Z andyrtr $
# Maintainer: Jan de Groot <jgc@archlinux.org>
pkgname=xf86-video-sisimedia
pkgver=0.9.1
-pkgrel=2
+pkgrel=3
pkgdesc="X.org SiS 671 video driver"
arch=(i686 x86_64)
url="http://www.linuxconsulting.ro/xorg-drivers/"
license=('custom')
-depends=('glibc' 'sis-dri')
-makedepends=('xorg-server-devel>=1.11.0' 'xf86dgaproto' 'libdrm' 'xf86driproto' 'mesa' 'glproto')
-conflicts=('xorg-server<1.11.0')
+depends=('libdrm')
+makedepends=('xorg-server-devel>=1.12.0' 'xf86dgaproto' 'xf86driproto' 'glproto')
+conflicts=('xorg-server<1.12.0')
options=('!libtool')
source=(ftp://ftp.archlinux.org/other/xf86-video-sisimedia/xf86-video-sisimedia-0.9.1_20091203.tar.bz2
xf86-video-sis-0.9.1-20102701.patch
@@ -28,6 +28,12 @@ source=(ftp://ftp.archlinux.org/other/xf86-video-sisimedia/xf86-video-sisimedia-
0004-Make-sisRegs3D4-big-enough-to-hold-all-values-writte.patch
0005-Correct-bounds-check-of-blitClip-array-access.patch
xserver19.patch
+ xserver112.patch
+ pciTag-removal-workaround.patch
+ Untangle-XF86DRI.patch
+ swap-func-rename.patch
+ xf86MapDomainMemory-pci_device_map_legacy.patch
+ sync-with-freedesktop.patch
fix-xv-crash.patch
COPYING)
sha1sums=('22e6616df49ec82755daae08043a29aaf92fa430'
@@ -46,6 +52,12 @@ sha1sums=('22e6616df49ec82755daae08043a29aaf92fa430'
'5e288526bfa2c534f1feabdb571da16da8a1c7a6'
'e86d702cb0b5e9bf43ff732696229965e176db7c'
'b5f260bed7e705808ec05620316e503ed5d52ee5'
+ 'ca25df590590284161cd68440fc4f0cfeb8618b2'
+ 'ce60625b915e8bd82a6ab2c78e52eb589f27a083'
+ '963ef59ecd0ca478434623efb68fce9ee832501d'
+ '5f686c54383c6677b043c6ca0b565b023c1907f9'
+ '4ea8d76b3e74172109e7013a2931e571d3a2f4e1'
+ '1d29504466840d2fbe1fc355d78666c1a9cd9b76'
'1fdd74a2aef9455ac5c37d1fe0146d81aa905d2d'
'a64e244f274bcb155f892d0488a1a4b1b2f7d70d')
@@ -66,6 +78,12 @@ build() {
patch -Np1 -i "${srcdir}/0004-Make-sisRegs3D4-big-enough-to-hold-all-values-writte.patch"
patch -Np1 -i "${srcdir}/0005-Correct-bounds-check-of-blitClip-array-access.patch"
patch -Np1 -i "${srcdir}/xserver19.patch"
+ patch -Np1 -i "${srcdir}/xserver112.patch"
+ patch -Np1 -i "${srcdir}/pciTag-removal-workaround.patch"
+ patch -Np1 -i "${srcdir}/Untangle-XF86DRI.patch"
+ patch -Np1 -i "${srcdir}/swap-func-rename.patch"
+ patch -Np1 -i "${srcdir}/xf86MapDomainMemory-pci_device_map_legacy.patch"
+ patch -Np1 -i "${srcdir}/sync-with-freedesktop.patch"
patch -Np0 -i "${srcdir}/fix-xv-crash.patch"
sed -i -e 's,sis_drv,sisimedia_drv,g' src/Makefile.am
@@ -74,7 +92,7 @@ build() {
autoreconf -fi
- ./configure --prefix=/usr --enable-dri
+ ./configure --prefix=/usr --disable-dri
make
make DESTDIR="${pkgdir}" install
diff --git a/extra/xf86-video-sisimedia/Untangle-XF86DRI.patch b/extra/xf86-video-sisimedia/Untangle-XF86DRI.patch
new file mode 100644
index 000000000..55b9c9deb
--- /dev/null
+++ b/extra/xf86-video-sisimedia/Untangle-XF86DRI.patch
@@ -0,0 +1,186 @@
+diff -aur xf86-video-sis-0.9.1.pristine/configure.ac xf86-video-sis-0.9.1.new/configure.ac
+--- xf86-video-sis-0.9.1.pristine/configure.ac 2012-03-17 04:52:35.410417514 +1100
++++ xf86-video-sis-0.9.1.new/configure.ac 2012-03-17 04:55:05.949412228 +1100
+@@ -97,8 +97,8 @@
+ AM_CONDITIONAL(DRI, test x$DRI = xyes)
+ if test "$DRI" = yes; then
+ PKG_CHECK_MODULES(DRI, [libdrm >= 2.0 xf86driproto])
+- AC_DEFINE(XF86DRI,1,[Enable DRI driver support])
+- AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support])
++ AC_DEFINE(SISDRI,1,[Enable DRI driver support])
++ AC_DEFINE(SISDRI_DEVEL,1,[Enable developmental DRI driver support])
+ fi
+
+ # technically this should be a configure flag. meh.
+diff -aur xf86-video-sis-0.9.1.pristine/src/sis_driver.c xf86-video-sis-0.9.1.new/src/sis_driver.c
+--- xf86-video-sis-0.9.1.pristine/src/sis_driver.c 2012-03-17 04:52:35.380417061 +1100
++++ xf86-video-sis-0.9.1.new/src/sis_driver.c 2012-03-17 04:57:54.118679619 +1100
+@@ -115,7 +115,7 @@
+ #endif
+
+
+-#ifdef XF86DRI
++#ifdef SISDRI
+ #include "dri.h"
+ #endif
+
+@@ -5779,7 +5779,7 @@
+ }
+
+ /* Load the dri and glx modules if requested. */
+-#ifdef XF86DRI
++#ifdef SISDRI
+ if(pSiS->loadDRI) {
+ if(!xf86LoaderCheckSymbol("DRIScreenInit")) {
+ if(xf86LoadSubModule(pScrn, "dri")) {
+@@ -9469,7 +9469,7 @@
+
+ pSiS->cmdQueueLen = 0; /* Force an EngineIdle() at start */
+
+-#ifdef XF86DRI
++#ifdef SISDRI
+ if(pSiS->loadDRI) {
+ #ifdef SISDUALHEAD
+ /* No DRI in dual head mode */
+@@ -9802,7 +9802,7 @@
+ #endif
+
+ /* Finish DRI initialisation */
+-#ifdef XF86DRI
++#ifdef SISDRI
+ if(pSiS->loadDRI) {
+ if(pSiS->directRenderingEnabled) {
+ /* Now that mi, drm and others have done their thing,
+@@ -10359,7 +10359,7 @@
+ }
+ /* Mark for 3D full-screen bug */
+ /*
+-#ifdef XF86DRI
++#ifdef SISDRI
+ if(pSiS->directRenderingEnabled) {
+ DRILock(screenInfo.screens[scrnIndex], DRM_LOCK_QUIESCENT);
+ }
+@@ -10388,7 +10388,7 @@
+ #endif
+ /* Mark for 3D full-screen bug */
+ /*
+-#ifdef XF86DRI
++#ifdef SISDRI
+ if(pSiS->directRenderingEnabled) {
+ DRIUnlock(screenInfo.screens[scrnIndex]);
+ }
+@@ -10601,7 +10601,7 @@
+
+ /* Mark for 3D full-screen bug */
+ /*
+-#ifdef XF86DRI
++#ifdef SISDRI
+ if(pSiS->directRenderingEnabled) {
+ DRIUnlock(screenInfo.screens[scrnIndex]);
+ }
+@@ -10629,7 +10629,7 @@
+ {
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+-#ifdef XF86DRI
++#ifdef SISDRI
+ ScreenPtr pScreen;
+
+ if(pSiS->directRenderingEnabled) {
+@@ -10715,7 +10715,7 @@
+ SiSCtrlExtUnregister(pSiS, pScrn->scrnIndex);
+ }
+
+-#ifdef XF86DRI
++#ifdef SISDRI
+ if(pSiS->directRenderingEnabled) {
+ SISDRICloseScreen(pScreen);
+ pSiS->directRenderingEnabled = FALSE;
+diff -aur xf86-video-sis-0.9.1.pristine/src/sis.h xf86-video-sis-0.9.1.new/src/sis.h
+--- xf86-video-sis-0.9.1.pristine/src/sis.h 2012-03-17 04:52:35.357083354 +1100
++++ xf86-video-sis-0.9.1.new/src/sis.h 2012-03-17 04:56:36.814150836 +1100
+@@ -215,7 +215,13 @@
+
+ #undef SISHAVEDRMWRITE
+ #undef SISNEWDRI
+-#ifdef XF86DRI
++
++/* if the server was built without DRI support, force-disable DRI */
++#ifndef XF86DRI
++#undef SISDRI
++#endif
++
++#ifdef SISDRI
+ #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,3,0)
+ #define SISHAVEDRMWRITE
+ #endif
+@@ -229,7 +235,7 @@
+ #include "dri.h"
+ #include "GL/glxint.h"
+ #include "sis_dri.h"
+-#endif /* XF86DRI */
++#endif /* SISDRI */
+
+ #include "sis_config.h"
+
+@@ -884,7 +890,7 @@
+ ScrnInfoPtr pScrn_2;
+ UChar *BIOS;
+ struct SiS_Private *SiS_Pr;
+-#ifdef XF86DRI
++#ifdef SISDRI
+ SISAGPHTYPE agpHandle;
+ ULong agpAddr;
+ UChar *agpBase;
+@@ -1291,7 +1297,7 @@
+ unsigned int cmdQueueSize_div2;
+ unsigned int cmdQueueSize_div4;
+ unsigned int cmdQueueSize_4_3;
+-#ifdef XF86DRI
++#ifdef SISDRI
+ SISAGPHTYPE agpHandle;
+ ULong agpAddr;
+ UChar *agpBase;
+@@ -1351,7 +1357,7 @@
+ /* DRI */
+ Bool loadDRI;
+ Bool DRIEnabled;
+-#ifdef XF86DRI
++#ifdef SISDRI
+ Bool directRenderingEnabled;
+ DRIInfoPtr pDRIInfo;
+ int drmSubFD;
+diff -aur xf86-video-sis-0.9.1.pristine/src/sis_hwmc.c xf86-video-sis-0.9.1.new/src/sis_hwmc.c
+--- xf86-video-sis-0.9.1.pristine/src/sis_hwmc.c 2012-03-17 04:52:35.330416274 +1100
++++ xf86-video-sis-0.9.1.new/src/sis_hwmc.c 2012-03-17 05:22:17.014636372 +1100
+@@ -53,7 +53,9 @@
+ #include "regionstr.h"
+
+ #include "sis.h"
++#ifdef SISDRI
+ #include "sis_dri.h"
++#endif
+
+ #include "xf86xv.h"
+ #include "xf86xvmc.h"
+diff -aur xf86-video-sis-0.9.1/src/sis_opt.c xf86-video-sis-0.9.1.new/src/sis_opt.c
+--- xf86-video-sis-0.9.1/src/sis_opt.c 2012-03-17 07:36:12.285566154 +1100
++++ xf86-video-sis-0.9.1.new/src/sis_opt.c 2012-03-17 07:34:59.451106475 +1100
+@@ -494,7 +494,7 @@
+ pSiS->ShadowFB = FALSE;
+ pSiS->loadDRI = FALSE;
+ pSiS->DRIEnabled = FALSE;
+-#ifdef XF86DRI
++#ifdef SISDRI
+ pSiS->agpWantedPages = AGP_PAGES;
+ #endif
+ pSiS->VESA = -1;
+@@ -2160,7 +2160,7 @@
+ }
+
+
+-#ifdef XF86DRI
++#ifdef SISDRI
+ /* DRI */
+ from = X_DEFAULT;
+ if(xf86GetOptValBool(pSiS->Options, OPTION_DRI, &pSiS->loadDRI)) {
diff --git a/extra/xf86-video-sisimedia/pciTag-removal-workaround.patch b/extra/xf86-video-sisimedia/pciTag-removal-workaround.patch
new file mode 100644
index 000000000..b41f3c71b
--- /dev/null
+++ b/extra/xf86-video-sisimedia/pciTag-removal-workaround.patch
@@ -0,0 +1,39 @@
+diff -aur xf86-video-sis-0.9.1.pristine/src/sispcirename.h xf86-video-sis-0.9.1.new/src/sispcirename.h
+--- xf86-video-sis-0.9.1.pristine/src/sispcirename.h 2012-03-17 04:45:58.280942665 +1100
++++ xf86-video-sis-0.9.1.new/src/sispcirename.h 2012-03-17 04:48:28.539933065 +1100
+@@ -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/extra/xf86-video-sisimedia/swap-func-rename.patch b/extra/xf86-video-sisimedia/swap-func-rename.patch
new file mode 100644
index 000000000..e22b38896
--- /dev/null
+++ b/extra/xf86-video-sisimedia/swap-func-rename.patch
@@ -0,0 +1,256 @@
+diff -aur xf86-video-sis-0.9.1.pristine/src/sis.h xf86-video-sis-0.9.1.new/src/sis.h
+--- xf86-video-sis-0.9.1.pristine/src/sis.h 2012-03-17 05:32:39.414261430 +1100
++++ xf86-video-sis-0.9.1.new/src/sis.h 2012-03-17 05:28:34.100467696 +1100
+@@ -35,6 +35,10 @@
+ #ifndef _SIS_H_
+ #define _SIS_H_
+
++// XXX!!!
++#define _swapl(x, n) swapl(x)
++#define _swaps(x, n) swaps(x)
++
+ #define SISDRIVERVERSIONYEAR 6
+ #define SISDRIVERVERSIONMONTH 10
+ #define SISDRIVERVERSIONDAY 17
+diff -aur xf86-video-sis-0.9.1.pristine/src/sis_mergedfb.c xf86-video-sis-0.9.1.new/src/sis_mergedfb.c
+--- xf86-video-sis-0.9.1.pristine/src/sis_mergedfb.c 2012-03-17 05:42:19.423231119 +1100
++++ xf86-video-sis-0.9.1.new/src/sis_mergedfb.c 2012-03-17 06:01:18.070840068 +1100
+@@ -2472,10 +2472,10 @@
+ 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);
+@@ -2498,9 +2498,9 @@
+ 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);
++ //_swaps (&rep.state, n); // XXX???
+ }
+ WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *)&rep);
+ return client->noClientException;
+@@ -2523,9 +2523,9 @@
+ 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);
++ //_swaps(&rep.ScreenCount, n); // XXX???
+ }
+ WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *)&rep);
+ return client->noClientException;
+@@ -2549,10 +2549,10 @@
+ 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;
+@@ -2571,9 +2571,9 @@
+ 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;
+@@ -2592,9 +2592,9 @@
+ 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);
+
+@@ -2609,10 +2609,10 @@
+ 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);
+ }
+@@ -2763,7 +2763,7 @@
+ {
+ REQUEST(xPanoramiXQueryVersionReq);
+ register int n;
+- swaps(&stuff->length,n);
++ _swaps(&stuff->length,n);
+ REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
+ return SiSProcXineramaQueryVersion(client);
+ }
+@@ -2773,7 +2773,7 @@
+ {
+ REQUEST(xPanoramiXGetStateReq);
+ register int n;
+- swaps (&stuff->length, n);
++ _swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
+ return SiSProcXineramaGetState(client);
+ }
+@@ -2783,7 +2783,7 @@
+ {
+ REQUEST(xPanoramiXGetScreenCountReq);
+ register int n;
+- swaps (&stuff->length, n);
++ _swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
+ return SiSProcXineramaGetScreenCount(client);
+ }
+@@ -2793,7 +2793,7 @@
+ {
+ REQUEST(xPanoramiXGetScreenSizeReq);
+ register int n;
+- swaps (&stuff->length, n);
++ _swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
+ return SiSProcXineramaGetScreenSize(client);
+ }
+@@ -2803,7 +2803,7 @@
+ {
+ REQUEST(xXineramaIsActiveReq);
+ register int n;
+- swaps (&stuff->length, n);
++ _swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
+ return SiSProcXineramaIsActive(client);
+ }
+@@ -2813,7 +2813,7 @@
+ {
+ REQUEST(xXineramaQueryScreensReq);
+ register int n;
+- swaps (&stuff->length, n);
++ _swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
+ return SiSProcXineramaQueryScreens(client);
+ }
+@@ -2823,8 +2823,8 @@
+ {
+ REQUEST(xXineramaSelectInputReq);
+ register int n;
+- swaps(&stuff->length, n);
+- swapl(&stuff->window, n);
++ _swaps(&stuff->length, n);
++ _swapl(&stuff->window, n);
+ return SiSProcXineramaSelectInput(client);
+ }
+
+diff -aur xf86-video-sis-0.9.1.pristine/src/sis_utility.c xf86-video-sis-0.9.1.new/src/sis_utility.c
+--- xf86-video-sis-0.9.1.pristine/src/sis_utility.c 2012-03-17 07:34:54.727700088 +1100
++++ xf86-video-sis-0.9.1.new/src/sis_utility.c 2012-03-17 08:06:48.570630477 +1100
+@@ -2059,11 +2059,11 @@
+ rep.sequenceNumber = client->sequence;
+ 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);
++ if(client->swapped) {
++ _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);
+@@ -2103,16 +2103,16 @@
+ rep.length = (sizeof(xSiSCtrlCommandReply) - sizeof(xGenericReply)) >> 2;
+ 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);
++ 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);
+ 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);
+@@ -2139,7 +2139,7 @@
+ {
+ REQUEST(xSiSCtrlQueryVersionReq);
+ register int n;
+- swaps(&stuff->length, n);
++ _swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xSiSCtrlQueryVersionReq);
+ return SiSProcSiSCtrlQueryVersion(client);
+ }
+@@ -2150,14 +2150,14 @@
+ 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);
diff --git a/extra/xf86-video-sisimedia/sync-with-freedesktop.patch b/extra/xf86-video-sisimedia/sync-with-freedesktop.patch
new file mode 100644
index 000000000..eb15814ff
--- /dev/null
+++ b/extra/xf86-video-sisimedia/sync-with-freedesktop.patch
@@ -0,0 +1,63 @@
+diff -daur xf86-video-sis-0.9.1.pristine/configure.ac xf86-video-sis-0.9.1.new/configure.ac
+--- xf86-video-sis-0.9.1.pristine/configure.ac 2012-03-17 14:38:50.324387997 +1100
++++ xf86-video-sis-0.9.1.new/configure.ac 2012-03-17 15:02:13.142748894 +1100
+@@ -21,7 +21,7 @@
+ # Process this file with autoconf to produce a configure script
+
+ # Initialize Autoconf
+-AC_PREREQ(2.60)
++AC_PREREQ([2.60])
+ AC_INIT([xf86-video-sis],
+ 0.9.1,
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
+@@ -31,7 +31,7 @@
+ AC_CONFIG_AUX_DIR(.)
+
+ # Initialize Automake
+-AM_INIT_AUTOMAKE([dist-bzip2])
++AM_INIT_AUTOMAKE([foreign dist-bzip2])
+ AM_MAINTAINER_MODE
+
+ # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
+@@ -40,10 +40,9 @@
+ 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"])
+@@ -76,9 +75,6 @@
+
+ # 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"])
+@@ -123,8 +119,6 @@
+ fi
+ AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
+
+-AC_SUBST([DRI_CFLAGS])
+-AC_SUBST([XORG_CFLAGS])
+ AC_SUBST([moduledir])
+
+ DRIVER_NAME=sis
+diff -daur xf86-video-sis-0.9.1.pristine/Makefile.am xf86-video-sis-0.9.1.new/Makefile.am
+--- xf86-video-sis-0.9.1.pristine/Makefile.am 2012-03-17 14:38:50.304387685 +1100
++++ xf86-video-sis-0.9.1.new/Makefile.am 2012-03-17 15:01:44.442304963 +1100
+@@ -18,7 +18,6 @@
+ # 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
+
+ if BUILD_LINUXDOC
diff --git a/extra/xf86-video-sisimedia/xf86MapDomainMemory-pci_device_map_legacy.patch b/extra/xf86-video-sisimedia/xf86MapDomainMemory-pci_device_map_legacy.patch
new file mode 100644
index 000000000..7a39cf2df
--- /dev/null
+++ b/extra/xf86-video-sisimedia/xf86MapDomainMemory-pci_device_map_legacy.patch
@@ -0,0 +1,205 @@
+diff -aur xf86-video-sis-0.9.1.pristine/configure.ac xf86-video-sis-0.9.1.new/configure.ac
+--- xf86-video-sis-0.9.1.pristine/configure.ac 2012-03-17 08:23:42.346308237 +1100
++++ xf86-video-sis-0.9.1.new/configure.ac 2012-03-17 08:40:04.821501949 +1100
+@@ -20,20 +20,26 @@
+ #
+ # 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.9.1,
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
+ xf86-video-sis)
+-
+ AC_CONFIG_SRCDIR([Makefile.am])
+ AM_CONFIG_HEADER([config.h])
+ AC_CONFIG_AUX_DIR(.)
+
++# Initialize Automake
+ AM_INIT_AUTOMAKE([dist-bzip2])
+-
+ AM_MAINTAINER_MODE
+
++# 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.
+ AC_DISABLE_STATIC
+ AC_PROG_LIBTOOL
+@@ -66,7 +72,7 @@
+ 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.
+
+@@ -104,6 +110,19 @@
+ # technically this should be a configure flag. meh.
+ AC_DEFINE(XF86EXA, 1, [Build support for Exa])
+
++SAVE_CPPFLAGS="$CPPFLAGS"
++CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
++AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
++ [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no],
++ [#include "xorg-server.h"])
++CPPFLAGS="$SAVE_CPPFLAGS"
++
++if test "x$XSERVER_LIBPCIACCESS" = xyes; then
++ 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])
+diff -aur xf86-video-sis-0.9.1.pristine/src/sis_vga.c xf86-video-sis-0.9.1.new/src/sis_vga.c
+--- xf86-video-sis-0.9.1.pristine/src/sis_vga.c 2012-03-17 08:23:42.329641291 +1100
++++ xf86-video-sis-0.9.1.new/src/sis_vga.c 2012-03-17 08:28:25.020679715 +1100
+@@ -1740,8 +1740,8 @@
+
+ #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);
+@@ -1761,7 +1761,12 @@
+
+ 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 -daur xf86-video-sis-0.9.1.pristine/src/sis_driver.c xf86-video-sis-0.9.1.new/src/sis_driver.c
+--- xf86-video-sis-0.9.1.pristine/src/sis_driver.c 2012-03-17 08:23:42.336308093 +1100
++++ xf86-video-sis-0.9.1.new/src/sis_driver.c 2012-03-17 09:35:33.766316476 +1100
+@@ -6014,7 +6014,11 @@
+ if(pSiSEnt->MapCountIOPBase) {
+ pSiSEnt->MapCountIOPBase--;
+ if((pSiSEnt->MapCountIOPBase == 0) || (pSiSEnt->forceUnmapIOPBase)) {
+- xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOPBase, 2048);
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(pSiS->PciInfo, (pointer)pSiSEnt->IOPBase, 2048);
++#else
++ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOPBase, 2048);
++#endif
+ pSiSEnt->IOPBase = NULL;
+ pSiSEnt->MapCountIOPBase = 0;
+ pSiSEnt->forceUnmapIOPBase = FALSE;
+@@ -6023,7 +6027,11 @@
+ }
+ } else {
+ #endif
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(pSiS->PciInfo, (pointer)pSiS->IOPBase, 2048);
++#else
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOPBase, 2048);
++#endif
+ pSiS->IOPBase = NULL;
+ #ifdef SISDUALHEAD
+ }
+@@ -6248,7 +6256,11 @@
+ if(pSiSEnt->MapCountIOBase) {
+ pSiSEnt->MapCountIOBase--;
+ if((pSiSEnt->MapCountIOBase == 0) || (pSiSEnt->forceUnmapIOBase)) {
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(pSiS->PciInfo, (pointer)pSiSEnt->IOBase, (pSiS->mmioSize * 1024));
++#else
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOBase, (pSiS->mmioSize * 1024));
++#endif
+ pSiSEnt->IOBase = NULL;
+ pSiSEnt->MapCountIOBase = 0;
+ pSiSEnt->forceUnmapIOBase = FALSE;
+@@ -6259,7 +6271,11 @@
+ if(pSiSEnt->MapCountIOBaseDense) {
+ pSiSEnt->MapCountIOBaseDense--;
+ if((pSiSEnt->MapCountIOBaseDense == 0) || (pSiSEnt->forceUnmapIOBaseDense)) {
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(pSiS->PciInfo, (pointer)pSiSEnt->IOBaseDense, (pSiS->mmioSize * 1024));
++#else
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOBaseDense, (pSiS->mmioSize * 1024));
++#endif
+ pSiSEnt->IOBaseDense = NULL;
+ pSiSEnt->MapCountIOBaseDense = 0;
+ pSiSEnt->forceUnmapIOBaseDense = FALSE;
+@@ -6270,7 +6286,11 @@
+ if(pSiSEnt->MapCountFbBase) {
+ pSiSEnt->MapCountFbBase--;
+ if((pSiSEnt->MapCountFbBase == 0) || (pSiSEnt->forceUnmapFbBase)) {
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(pSiS->PciInfo, (pointer)pSiSEnt->RealFbBase, pSiS->FbMapSize);
++#else
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->RealFbBase, pSiS->FbMapSize);
++#endif
+ pSiSEnt->FbBase = pSiSEnt->RealFbBase = NULL;
+ pSiSEnt->MapCountFbBase = 0;
+ pSiSEnt->forceUnmapFbBase = FALSE;
+@@ -6280,13 +6300,25 @@
+ }
+ } else {
+ #endif
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(pSiS->PciInfo, (pointer)pSiS->IOBase, (pSiS->mmioSize * 1024));
++#else
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBase, (pSiS->mmioSize * 1024));
++#endif
+ pSiS->IOBase = NULL;
+ #ifdef __alpha__
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(pSiS->PciInfo, (pointer)pSiS->IOBaseDense, (pSiS->mmioSize * 1024));
++#else
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBaseDense, (pSiS->mmioSize * 1024));
++#endif
+ pSiS->IOBaseDense = NULL;
+ #endif
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(pSiS->PciInfo, (pointer)pSiS->RealFbBase, pSiS->FbMapSize);
++#else
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->RealFbBase, pSiS->FbMapSize);
++#endif
+ pSiS->FbBase = pSiS->RealFbBase = NULL;
+ #ifdef SISDUALHEAD
+ }
+@@ -10940,7 +10972,13 @@
+
+ #ifdef SIS_USE_BIOS_SCRATCH
+ if(SISPTR(pScrn)->Primary) {
++
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_map_legacy(SISPTR(pScrn)->PciInfo, 0, 0x2000, 1, &base); // HA HA HA MAGIC NUMBER
++#else
+ base = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO, 0, 0x2000);
++#endif
++
+ if(!base) {
+ SISErrorLog(pScrn, "(Could not map BIOS scratch area)\n");
+ return ret;
+@@ -10953,7 +10991,11 @@
+ *(base + offset) = value;
+ }
+
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(SISPTR(pScrn)->PciInfo, base, 0x2000);
++#else
+ xf86UnMapVidMem(pScrn->scrnIndex, base, 0x2000);
++#endif
+ }
+ #endif
+ return ret;
diff --git a/extra/xf86-video-sisimedia/xserver112.patch b/extra/xf86-video-sisimedia/xserver112.patch
new file mode 100644
index 000000000..f0dff46b5
--- /dev/null
+++ b/extra/xf86-video-sisimedia/xserver112.patch
@@ -0,0 +1,12 @@
+diff -aur xf86-video-sis-0.9.1.pristine/src/sis_driver.c xf86-video-sis-0.9.1.new/src/sis_driver.c
+--- xf86-video-sis-0.9.1.pristine/src/sis_driver.c 2012-03-17 03:06:21.148507957 +1100
++++ xf86-video-sis-0.9.1.new/src/sis_driver.c 2012-03-17 03:18:57.373535928 +1100
+@@ -3278,7 +3278,7 @@
+ 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;