summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandor Nagy2016-01-13 15:32:19 +0100
committerSandor Nagy2016-01-13 15:33:39 +0100
commit726b02e5b0b99e130d51af7e4846fceb6c9dcdd4 (patch)
tree02d5260af83f12bbdc9f17e2c88f5f8581abf4fd
downloadaur-726b02e5b0b99e130d51af7e4846fceb6c9dcdd4.tar.gz
Initial import
-rw-r--r--.SRCINFO78
-rw-r--r--0001-Remove-xorgconfig-xorgcfg-from-See-Also-list-in-man-.patch25
-rw-r--r--0002-Remove-XFree86-Misc-PassMessage-support.patch91
-rw-r--r--0003-Fix-build-with-Werror-format-security.patch65
-rw-r--r--0004-Make-sisRegs3D4-big-enough-to-hold-all-values-writte.patch32
-rw-r--r--0005-Correct-bounds-check-of-blitClip-array-access.patch38
-rw-r--r--0005-Fix-backlight-off-on-SiS30x.-video-bridges.patch25
-rw-r--r--0006-Add-IgnoreHotkeyFlag-driver-option.patch89
-rw-r--r--0007-Remove-useless-loader-symbol-lists.patch249
-rw-r--r--0008-update-to-xextproto-7-1-support.patch45
-rw-r--r--0009-update-for-rac-removal.patch69
-rw-r--r--0010-change-to-use-abi-version-check.patch34
-rw-r--r--0011-more-rac-removal.patch13
-rw-r--r--COPYING139
-rw-r--r--PKGBUILD128
-rw-r--r--Untangle-XF86DRI.patch186
-rw-r--r--deprecated-sym2.patch1068
-rw-r--r--disable-UploadToScreen-DownloadFromScreen.patch64
-rw-r--r--fix-xv-crash.patch11
-rw-r--r--pciTag-removal-workaround.patch39
-rw-r--r--remove_mibstore.h.patch18
-rw-r--r--sisimedia-no-xaa.patch11
-rw-r--r--sisimedia-xorg-1.13.patch654
-rw-r--r--swap-func-rename.patch256
-rw-r--r--sync-with-freedesktop.patch63
-rw-r--r--xf86-video-sis-0.9.1-20102701.patch1376
-rw-r--r--xf86-video-sis-0.9.1-dump-regs-after-video-init.patch89
-rw-r--r--xf86MapDomainMemory-pci_device_map_legacy.patch205
-rw-r--r--xserver112.patch12
-rw-r--r--xserver19.patch30
30 files changed, 5202 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..b72dd4b62b53
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,78 @@
+# Generated by mksrcinfo v8
+# Wed Jan 13 14:31:14 UTC 2016
+pkgbase = xf86-video-sisimedia
+ pkgdesc = X.org SiS 671 video driver
+ pkgver = 0.9.1
+ pkgrel = 10
+ url = http://www.linuxconsulting.ro/xorg-drivers/
+ arch = i686
+ arch = x86_64
+ license = custom
+ makedepends = xorg-server-devel
+ makedepends = X-ABI-VIDEODRV_VERSION=19
+ makedepends = xf86dgaproto
+ depends = glibc
+ conflicts = xorg-server<1.16
+ conflicts = X-ABI-VIDEODRV_VERSION<19
+ conflicts = X-ABI-VIDEODRV_VERSION>=20
+ source = https://sources.archlinux.org/other/xf86-video-sisimedia/xf86-video-sisimedia-0.9.1_20091203.tar.bz2
+ source = xf86-video-sis-0.9.1-20102701.patch
+ source = 0002-Remove-XFree86-Misc-PassMessage-support.patch
+ source = 0003-Fix-build-with-Werror-format-security.patch
+ source = 0005-Fix-backlight-off-on-SiS30x.-video-bridges.patch
+ source = 0006-Add-IgnoreHotkeyFlag-driver-option.patch
+ source = xf86-video-sis-0.9.1-dump-regs-after-video-init.patch
+ source = 0007-Remove-useless-loader-symbol-lists.patch
+ source = 0008-update-to-xextproto-7-1-support.patch
+ source = 0009-update-for-rac-removal.patch
+ source = 0010-change-to-use-abi-version-check.patch
+ source = 0011-more-rac-removal.patch
+ source = 0001-Remove-xorgconfig-xorgcfg-from-See-Also-list-in-man-.patch
+ source = 0004-Make-sisRegs3D4-big-enough-to-hold-all-values-writte.patch
+ source = 0005-Correct-bounds-check-of-blitClip-array-access.patch
+ source = xserver19.patch
+ source = xserver112.patch
+ source = pciTag-removal-workaround.patch
+ source = Untangle-XF86DRI.patch
+ source = swap-func-rename.patch
+ source = xf86MapDomainMemory-pci_device_map_legacy.patch
+ source = sync-with-freedesktop.patch
+ source = fix-xv-crash.patch
+ source = sisimedia-no-xaa.patch
+ source = sisimedia-xorg-1.13.patch
+ source = deprecated-sym2.patch
+ source = disable-UploadToScreen-DownloadFromScreen.patch
+ source = remove_mibstore.h.patch
+ source = COPYING
+ sha1sums = 22e6616df49ec82755daae08043a29aaf92fa430
+ sha1sums = 61715bb86180decde55a56fad9a12d841c89fbb2
+ sha1sums = 33fdea57187a2758802bcb9572d3a864aaab4d59
+ sha1sums = 6f05eae535b099b01c2819e63c68d4489b940267
+ sha1sums = a6cb5da9312d32d729ad2619d8ae50cb26ba7d4d
+ sha1sums = df728052a89c4152abbe89826756040dac23b624
+ sha1sums = 4bed1c2455ed447f7053cb0729e99cbe598b3274
+ sha1sums = d7802db5c49540ab136e71450cc846cfccd8b8d1
+ sha1sums = e2236d2d00338f1658c66d9b972919af39897071
+ sha1sums = 0c6b9322e6cb22c67e04d50a0b818a2dd4585cf2
+ sha1sums = 802829a8ebd2b7e35fcc86665d842b1594a8ba30
+ sha1sums = c26afe7508183735b7568b435be9c270ceeb62f1
+ sha1sums = d2fa2a21454f3a161bcd8ae4d349657561049edd
+ sha1sums = 5e288526bfa2c534f1feabdb571da16da8a1c7a6
+ sha1sums = e86d702cb0b5e9bf43ff732696229965e176db7c
+ sha1sums = b5f260bed7e705808ec05620316e503ed5d52ee5
+ sha1sums = ca25df590590284161cd68440fc4f0cfeb8618b2
+ sha1sums = ce60625b915e8bd82a6ab2c78e52eb589f27a083
+ sha1sums = 963ef59ecd0ca478434623efb68fce9ee832501d
+ sha1sums = 5f686c54383c6677b043c6ca0b565b023c1907f9
+ sha1sums = 4ea8d76b3e74172109e7013a2931e571d3a2f4e1
+ sha1sums = 1d29504466840d2fbe1fc355d78666c1a9cd9b76
+ sha1sums = 1fdd74a2aef9455ac5c37d1fe0146d81aa905d2d
+ sha1sums = 370af234867df98206a98c8cd0a6c89323593f6b
+ sha1sums = 4ea333d659abe2b78f07511467c5356f39bf8695
+ sha1sums = 9bef0b61c0505cc64464073d73684e6933d3f84c
+ sha1sums = ff95fd41be43560245caa40adc6b481f2dafca7d
+ sha1sums = e130b4b4cafa0d54426a9b9c4735ad4bf46686f5
+ sha1sums = a64e244f274bcb155f892d0488a1a4b1b2f7d70d
+
+pkgname = xf86-video-sisimedia
+
diff --git a/0001-Remove-xorgconfig-xorgcfg-from-See-Also-list-in-man-.patch b/0001-Remove-xorgconfig-xorgcfg-from-See-Also-list-in-man-.patch
new file mode 100644
index 000000000000..fd87b6c8c258
--- /dev/null
+++ b/0001-Remove-xorgconfig-xorgcfg-from-See-Also-list-in-man-.patch
@@ -0,0 +1,25 @@
+From e4f6a2fcd5712d0f994d3719b9c6c13f5b02bc7c Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <alan.coopersmith@sun.com>
+Date: Fri, 9 Jan 2009 16:34:01 -0800
+Subject: [PATCH 01/10] Remove xorgconfig & xorgcfg from See Also list in man page
+
+---
+ man/sis.man | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/man/sis.man b/man/sis.man
+index d743fe6..c321808 100644
+--- a/man/sis.man
++++ b/man/sis.man
+@@ -429,7 +429,7 @@ The amount is to be specified in megabyte, the default is 8.
+ none.
+ .SH "SEE ALSO"
+ #ifdef __xservername__
+-__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
++__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
+ #else
+ XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__)
+ #endif
+--
+1.6.5.4
+
diff --git a/0002-Remove-XFree86-Misc-PassMessage-support.patch b/0002-Remove-XFree86-Misc-PassMessage-support.patch
new file mode 100644
index 000000000000..860e593c6fc9
--- /dev/null
+++ b/0002-Remove-XFree86-Misc-PassMessage-support.patch
@@ -0,0 +1,91 @@
+diff -p -up xf86-video-sis-0.9.1/configure.ac.orig xf86-video-sis-0.9.1/configure.ac
+--- xf86-video-sis-0.9.1/configure.ac.orig 2010-01-27 15:34:26.000000000 -0500
++++ xf86-video-sis-0.9.1/configure.ac 2010-01-27 15:34:43.000000000 -0500
+@@ -58,7 +58,6 @@ XORG_DRIVER_CHECK_EXT(XINERAMA, xinerama
+ 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
+diff -p -up xf86-video-sis-0.9.1/src/sis_driver.c.orig xf86-video-sis-0.9.1/src/sis_driver.c
+--- xf86-video-sis-0.9.1/src/sis_driver.c.orig 2010-01-27 15:35:05.000000000 -0500
++++ xf86-video-sis-0.9.1/src/sis_driver.c 2010-01-27 15:35:39.000000000 -0500
+@@ -86,8 +86,6 @@
+ #include "mibank.h"
+ #include "mipointer.h"
+ #include "mibstore.h"
+-#define _XF86MISC_SERVER_
+-#include <X11/extensions/xf86misc.h>
+ #include "edid.h"
+
+ #define SIS_NEED_inSISREG
+@@ -506,11 +504,6 @@ xf86DrvMsg(0, X_INFO, "
+ pScrn->FreeScreen = SISFreeScreen;
+ pScrn->ValidMode = SISValidMode;
+ pScrn->PMEvent = SISPMEvent; /*add PM function for ACPI hotkey,Ivans*/
+-#ifdef X_XF86MiscPassMessage
+-// if(xf86GetVersion() >= XF86_VERSION_NUMERIC(4,3,99,2,0)) {
+-// pScrn->HandleMessage = SISHandleMessage;
+-// }
+-#endif
+ foundScreen = TRUE;
+ }
+ #ifdef SISDUALHEAD
+diff -p -up xf86-video-sis-0.9.1/src/sis_driver.h.orig xf86-video-sis-0.9.1/src/sis_driver.h
+--- xf86-video-sis-0.9.1/src/sis_driver.h.orig 2010-01-27 15:35:49.000000000 -0500
++++ xf86-video-sis-0.9.1/src/sis_driver.h 2010-01-27 15:36:04.000000000 -0500
+@@ -791,10 +791,6 @@ static Bool SISHotkeySwitchMode(ScrnInfo
+ #ifdef SISDUALHEAD
+ static Bool SISSaveScreenDH(ScreenPtr pScreen, int mode);
+ #endif
+-#ifdef X_XF86MiscPassMessage
+-extern int SISHandleMessage(int scrnIndex, const char *msgtype,
+- const char *msgval, char **retmsg);
+-#endif
+ static void SISFreeScreen(int scrnIndex, int flags);
+ static ModeStatus SISValidMode(int scrnIndex, DisplayModePtr mode,
+ Bool verbose, int flags);
+diff -p -up xf86-video-sis-0.9.1/src/sis_utility.c.orig xf86-video-sis-0.9.1/src/sis_utility.c
+--- xf86-video-sis-0.9.1/src/sis_utility.c.orig 2010-01-27 15:36:23.000000000 -0500
++++ xf86-video-sis-0.9.1/src/sis_utility.c 2010-01-27 15:36:59.000000000 -0500
+@@ -40,8 +40,6 @@
+ #define NEED_EVENTS
+ #include <X11/X.h>
+ #include "dixstruct.h"
+-#define _XF86MISC_SERVER_
+-#include <X11/extensions/xf86misc.h>
+
+ #include "sis_videostr.h"
+
+@@ -262,9 +260,6 @@ typedef struct {
+ int (*HandleSiSDirectCommand[SISCTRL_MAX_SCREENS])(xSiSCtrlCommandReply *);
+ } xSiSCtrlScreenTable;
+
+-#ifdef X_XF86MiscPassMessage
+-int SISHandleMessage(int scrnIndex, const char *msgtype, const char *msgval, char **retmsg);
+-#endif
+ void SiSCtrlExtInit(ScrnInfoPtr pScrn);
+ void SiSCtrlExtUnregister(SISPtr pSiS, int index);
+
+@@ -975,19 +970,6 @@ unsigned int SISVGADetected(ScrnInfoPtr
+ }
+
+ /***********************************
+- * MessageHandler interface *
+- * (unused now; use extension) *
+- ***********************************/
+-
+-#ifdef X_XF86MiscPassMessage
+-int
+-SISHandleMessage(int scrnIndex, const char *msgtype, const char *msgval, char **retmsg)
+-{
+- return BadMatch;
+-}
+-#endif
+-
+-/***********************************
+ * SiSCtrl extension interface *
+ ***********************************/
+
diff --git a/0003-Fix-build-with-Werror-format-security.patch b/0003-Fix-build-with-Werror-format-security.patch
new file mode 100644
index 000000000000..4fc355bbb288
--- /dev/null
+++ b/0003-Fix-build-with-Werror-format-security.patch
@@ -0,0 +1,65 @@
+From 9b010b7db7f0c6730c1a1b3cd473d49b01ed5b5f Mon Sep 17 00:00:00 2001
+From: Ander Conselvan de Oliveira <ander@mandriva.com.br>
+Date: Mon, 22 Jun 2009 16:07:26 -0400
+Subject: [PATCH] Fix build with -Werror=format-security
+
+---
+ src/sis_driver.c | 4 ++--
+ src/sis_mergedfb.c | 6 +++---
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index 5b91004..0a154db 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -831,14 +831,14 @@ SISErrorLog(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 void
+diff --git a/src/sis_mergedfb.c b/src/sis_mergedfb.c
+index 61b4255..feca024 100644
+--- a/src/sis_mergedfb.c
++++ b/src/sis_mergedfb.c
+@@ -357,7 +357,7 @@ SiSCopyModeNLink(ScrnInfoPtr pScrn, DisplayModePtr dest,
+
+ strcat(printbuffer, namebuf1);
+
+- xf86DrvMsg(pScrn->scrnIndex, X_INFO, printbuffer);
++ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s", printbuffer);
+ }
+
+ mode->next = mode;
+@@ -2137,7 +2137,7 @@ SiSUpdateXineramaScreenInfo(ScrnInfoPtr pScrn1)
+ if(infochanged && !usenonrect) {
+ xf86DrvMsgVerb(pScrn1->scrnIndex, X_INFO, pSiS->XineVerb,
+ "Current screen size does not match maximum display modes...\n");
+- xf86DrvMsgVerb(pScrn1->scrnIndex, X_INFO, pSiS->XineVerb, rectxine);
++ xf86DrvMsgVerb(pScrn1->scrnIndex, X_INFO, pSiS->XineVerb, "%s", rectxine);
+ }
+
+ } else if(infochanged && usenonrect) {
+@@ -2145,7 +2145,7 @@ SiSUpdateXineramaScreenInfo(ScrnInfoPtr pScrn1)
+ usenonrect = FALSE;
+ xf86DrvMsgVerb(pScrn1->scrnIndex, X_INFO, pSiS->XineVerb,
+ "Only clone modes available for this screen size...\n");
+- xf86DrvMsgVerb(pScrn1->scrnIndex, X_INFO, pSiS->XineVerb, rectxine);
++ xf86DrvMsgVerb(pScrn1->scrnIndex, X_INFO, pSiS->XineVerb, "%s", rectxine);
+
+ }
+
+--
+1.6.2.4
+
diff --git a/0004-Make-sisRegs3D4-big-enough-to-hold-all-values-writte.patch b/0004-Make-sisRegs3D4-big-enough-to-hold-all-values-writte.patch
new file mode 100644
index 000000000000..68ec63138d22
--- /dev/null
+++ b/0004-Make-sisRegs3D4-big-enough-to-hold-all-values-writte.patch
@@ -0,0 +1,32 @@
+From 49c641b638ac36d2a559555c04a3bd2777c8d071 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <alan.coopersmith@sun.com>
+Date: Fri, 1 May 2009 16:52:10 -0700
+Subject: [PATCH 04/10] Make sisRegs3D4 big enough to hold all values written to it
+
+Increase size from 0xff to 0x100 since SiS315Save (sis_dac.c line 752)
+writes values into sisRegs3D4[0x00..0xff] if ChipType >= XGI_20
+
+[This bug was found by the Parfait bug checking tool.
+ For more information see http://research.sun.com/projects/parfait ]
+
+Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+---
+ src/sis.h | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/sis.h b/src/sis.h
+index 9bafd4b..773f709 100644
+--- a/src/sis.h
++++ b/src/sis.h
+@@ -747,7 +747,7 @@ typedef struct {
+ UChar sisRegsGR[10];
+ UChar sisDAC[768];
+ UChar sisRegs3C4[0x80];
+- UChar sisRegs3D4[0xff];
++ UChar sisRegs3D4[0x100];
+ UChar sisRegs3C2;
+ UChar sisCapt[0x60];
+ UChar sisVid[0x50];
+--
+1.6.5.4
+
diff --git a/0005-Correct-bounds-check-of-blitClip-array-access.patch b/0005-Correct-bounds-check-of-blitClip-array-access.patch
new file mode 100644
index 000000000000..038322bf6464
--- /dev/null
+++ b/0005-Correct-bounds-check-of-blitClip-array-access.patch
@@ -0,0 +1,38 @@
+From 933dd8f860883c613acb5bcdf6b66100dbdfa952 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <alan.coopersmith@sun.com>
+Date: Fri, 1 May 2009 16:57:22 -0700
+Subject: [PATCH 05/10] Correct bounds check of blitClip array access
+
+Array is defined as blitClip[NUM_BLIT_PORTS], so invalid indexes
+are >= NUM_BLIT_PORTS, not just > NUM_BLIT_PORTS
+
+[This bug was found by the Parfait bug checking tool.
+ For more information see http://research.sun.com/projects/parfait ]
+
+Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+---
+ src/sis_video.c | 4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+Index: xf86-video-sis-0.9.1/src/sis_video.c
+===================================================================
+--- xf86-video-sis-0.9.1.orig/src/sis_video.c
++++ xf86-video-sis-0.9.1/src/sis_video.c
+@@ -4656,7 +4656,7 @@ SISStopVideoBlit(ScrnInfoPtr pScrn, ULon
+ * adapt->flags but we provide it anyway.
+ */
+
+- if(index > NUM_BLIT_PORTS) return;
++ if(index >= NUM_BLIT_PORTS) return;
+
+ REGION_EMPTY(pScrn->pScreen, &pPriv->blitClip[index]);
+
+@@ -4698,7 +4698,7 @@ SISPutImageBlit_671(
+ int xoffset = 0, yoffset = 0;
+ Bool first;
+
+- if(index > NUM_BLIT_PORTS)
++ if(index >= NUM_BLIT_PORTS)
+ return BadMatch;
+
+ if(!height || !width)
diff --git a/0005-Fix-backlight-off-on-SiS30x.-video-bridges.patch b/0005-Fix-backlight-off-on-SiS30x.-video-bridges.patch
new file mode 100644
index 000000000000..f023c774eb69
--- /dev/null
+++ b/0005-Fix-backlight-off-on-SiS30x.-video-bridges.patch
@@ -0,0 +1,25 @@
+From 910073e0ab3a7bf9e5c9d97437a879d97edc2714 Mon Sep 17 00:00:00 2001
+From: root <root@greentea.conectiva>
+Date: Wed, 1 Jul 2009 09:59:39 -0400
+Subject: [PATCH] Fix backlight off on SiS30x. video bridges.
+
+---
+ src/init301.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/init301.c b/src/init301.c
+index c179ae8..70a6aab 100644
+--- a/src/init301.c
++++ b/src/init301.c
+@@ -9261,7 +9261,7 @@ void
+ SiS_SiS30xBLOff(struct SiS_Private *SiS_Pr)
+ {
+ /* Switch off LCD backlight on SiS30xLV */
+- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFE);
++ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFC);
+ SiS_DDC2Delay(SiS_Pr,0xff00);
+ }
+
+--
+1.5.4.3
+
diff --git a/0006-Add-IgnoreHotkeyFlag-driver-option.patch b/0006-Add-IgnoreHotkeyFlag-driver-option.patch
new file mode 100644
index 000000000000..8ebc799a7aa4
--- /dev/null
+++ b/0006-Add-IgnoreHotkeyFlag-driver-option.patch
@@ -0,0 +1,89 @@
+From 072af02d180c1965f30246ea269d208292ed6f05 Mon Sep 17 00:00:00 2001
+From: root <root@greentea.conectiva>
+Date: Wed, 1 Jul 2009 14:13:52 -0400
+Subject: [PATCH] Add IgnoreHotkeyFlag driver option.
+
+Some BIOSes do not set the hotkey flag correctly. Without this option
+set, the driver won't change the mirroring state of LCD and VGA
+connections if the BIOS did not set this flag.
+---
+ src/sis.h | 3 +++
+ src/sis_driver.c | 2 +-
+ src/sis_opt.c | 13 ++++++++++++-
+ 3 files changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/src/sis.h b/src/sis.h
+index c50690b..c82c302 100644
+--- a/src/sis.h
++++ b/src/sis.h
+@@ -1565,6 +1565,9 @@ typedef struct {
+
+ /* Enable special 1366x768x60hz mode of LVDS panel. Ivans@090109 */
+ Bool EnablePanel_1366x768;
++
++ /* Ignore hotkey flag on capability changed APM events */
++ Bool IgnoreHotkeyFlag;
+
+ } SISRec, *SISPtr;
+
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index c935c11..2a5001c 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -11370,7 +11370,7 @@ SISPMEvent(int scrnIndex, pmEvent event, Bool undo)
+ inSISIDXREG(SISCR,0x3d,hotkeyflag);/*check device switch flag from BIOS CR 0x3d bit[2].*/
+
+
+- if(hotkeyflag & 0x04)
++ if(pSiS->IgnoreHotkeyFlag || (hotkeyflag & 0x04))
+ {
+
+ SISCRT1PreInit(pScrn); /*redetecting CRT1, pSiS->CRT1detected will update.*/
+diff --git a/src/sis_opt.c b/src/sis_opt.c
+index 4b79f7f..7f726ea 100644
+--- a/src/sis_opt.c
++++ b/src/sis_opt.c
+@@ -159,7 +159,8 @@ typedef enum {
+ OPTION_PSEUDO,
+ OPTION_FUTRO_TIMING, /*chaoyu's modified: for Fuji-Siemans specail timing*/
+ OPTION_TRACEVGAMISCW,
+- OPTION_USETIMING1366 /*option of enable 1366x768 timing for LVDS panel. Ivans@090109*/
++ OPTION_USETIMING1366, /*option of enable 1366x768 timing for LVDS panel. Ivans@090109*/
++ OPTION_IGNOREHOTKEYFLAG
+ } SISOpts;
+
+ static const OptionInfoRec SISOptions[] = {
+@@ -305,6 +306,7 @@ static const OptionInfoRec SISOptions[] = {
+ { OPTION_FUTRO_TIMING, "FutroTiming", OPTV_BOOLEAN, {0}, FALSE },/*chaoyu's modified: for Fuji-seimans special timing*/
+ { OPTION_TRACEVGAMISCW, "TraceVgaMISCW", OPTV_BOOLEAN, {0}, FALSE },/*Ivans added for helping detected CRT1 using BIOS setting.*/
+ { OPTION_USETIMING1366, "UseTiming1366", OPTV_BOOLEAN, {0}, FALSE },/*enable 1366 timing on LVDS, Ivans@090109*/
++ { OPTION_IGNOREHOTKEYFLAG, "IgnoreHotkeyFlag", OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE }
+ };
+
+@@ -624,6 +626,7 @@ SiSOptions(ScrnInfoPtr pScrn)
+ pSiS->CRT2IsScrn0 = FALSE;
+ #endif
+ #endif
++ pSiS->IgnoreHotkeyFlag = FALSE;
+
+ /* Chipset dependent defaults */
+
+@@ -2419,6 +2422,14 @@ SiSOptions(ScrnInfoPtr pScrn)
+ pSiS->EnablePanel_1366x768 = TRUE;
+ }
+ }
++ /* Ignore hotkey flag for video switch, switch on every
++ * XF86_APM_CAPABILITY_CHANGED event */
++ if(xf86GetOptValBool(pSiS->Options, OPTION_IGNOREHOTKEYFLAG, &val)){
++ if(val){
++ xf86DrvMsg(pScrn->scrnIndex, X_INFO,"Ignoring hotkey flag\n");
++ pSiS->IgnoreHotkeyFlag = TRUE;
++ }
++ }
+
+ }
+
+--
+1.5.4.3
+
diff --git a/0007-Remove-useless-loader-symbol-lists.patch b/0007-Remove-useless-loader-symbol-lists.patch
new file mode 100644
index 000000000000..3952133753a6
--- /dev/null
+++ b/0007-Remove-useless-loader-symbol-lists.patch
@@ -0,0 +1,249 @@
+From ae1a7dcebdac904c8068cc38fb77648c548f5075 Mon Sep 17 00:00:00 2001
+From: Paulo Ricardo Zanoni <pzanoni@mandriva.com>
+Date: Thu, 22 Apr 2010 11:19:29 -0300
+Subject: [PATCH] Remove useless loader symbol lists
+
+Adaption of xf86-video-sis patch 74553b5ee476a0dd28e136f5a33a546ea0c3ef28
+---
+ src/sis_driver.c | 150 +-----------------------------------------------------
+ 1 files changed, 1 insertions(+), 149 deletions(-)
+
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index d56182f..96255d3 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -227,126 +227,6 @@ static PciChipsets XGIPciChipsets[] = {
+ { -1, -1, RES_UNDEFINED }
+ };
+
+-#ifdef SIS_USE_XAA
+-static const char *xaaSymbols[] = {
+- "XAACreateInfoRec",
+- "XAADestroyInfoRec",
+- "XAAHelpPatternROP",
+- "XAAInit",
+- NULL
+-};
+-#endif
+-
+-#ifdef SIS_USE_EXA
+-static const char *exaSymbols[] = {
+- "exaGetVersion",
+- "exaDriverInit",
+- "exaDriverFini",
+- "exaOffscreenAlloc",
+- "exaOffscreenFree",
+- NULL
+-};
+-#endif
+-
+-static const char *fbSymbols[] = {
+- "fbPictureInit",
+- "fbScreenInit",
+- NULL
+-};
+-
+-static const char *shadowSymbols[] = {
+- "ShadowFBInit",
+- NULL
+-};
+-
+-static const char *ramdacSymbols[] = {
+- "xf86CreateCursorInfoRec",
+- "xf86DestroyCursorInfoRec",
+- "xf86InitCursor",
+- NULL
+-};
+-
+-static const char *ddcSymbols[] = {
+- "xf86PrintEDID",
+- "xf86InterpretEDID",
+- NULL
+-};
+-
+-static const char *int10Symbols[] = {
+- "xf86FreeInt10",
+- "xf86InitInt10",
+- NULL
+-};
+-
+-static const char *vbeSymbols[] = {
+-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
+- "VBEInit",
+-#else
+- "VBEExtendedInit",
+-#endif
+- "vbeDoEDID",
+- "vbeFree",
+- "VBEGetVBEInfo",
+- "VBEFreeVBEInfo",
+- "VBEGetModeInfo",
+- "VBEFreeModeInfo",
+- "VBESaveRestore",
+- "VBESetVBEMode",
+- "VBEGetVBEMode",
+- "VBESetDisplayStart",
+- "VBESetGetLogicalScanlineLength",
+- NULL
+-};
+-
+-#ifdef XF86DRI
+-static const char *drmSymbols[] = {
+- "drmAddMap",
+- "drmAgpAcquire",
+- "drmAgpRelease",
+- "drmAgpAlloc",
+- "drmAgpFree",
+- "drmAgpBase",
+- "drmAgpBind",
+- "drmAgpUnbind",
+- "drmAgpEnable",
+- "drmAgpGetMode",
+- "drmCtlInstHandler",
+- "drmCtlUninstHandler",
+- "drmGetInterruptFromBusID",
+-#ifndef SISHAVEDRMWRITE
+- "drmSiSAgpInit",
+-#else
+- "drmCommandWrite",
+-#endif
+-#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0)
+- "drmGetVersion",
+- "drmFreeVersion",
+-#endif
+- NULL
+-};
+-
+-static const char *driSymbols[] = {
+- "DRICreateInfoRec",
+- "DRIScreenInit",
+- "DRIFinishScreenInit",
+- "DRIDestroyInfoRec",
+- "DRICloseScreen",
+- "DRIGetSAREAPrivate",
+- "DRILock",
+- "DRIUnlock",
+- "DRIQueryVersion",
+- "GlxSetVisualConfigs",
+- NULL
+-};
+-
+-#ifdef XFree86LOADER
+-static const char *driRefSymbols[] = {
+- "DRICreatePCIBusID", /* not REQUIRED, but eventually referenced */
+- NULL
+-};
+-#endif
+-#endif /* XF86DRI */
+-
+ #ifdef XFree86LOADER
+
+ static MODULESETUPPROTO(sisSetup);
+@@ -382,19 +262,6 @@ sisSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+ if(!setupDone) {
+ setupDone = TRUE;
+ xf86AddDriver(&SIS, module, SIS_HaveDriverFuncs);
+- LoaderRefSymLists(fbSymbols,
+-#ifdef SIS_USE_XAA
+- xaaSymbols,
+-#endif
+-#ifdef SIS_USE_EXA
+- exaSymbols,
+-#endif
+- shadowSymbols, ramdacSymbols,
+- vbeSymbols, int10Symbols,
+-#ifdef XF86DRI
+- drmSymbols, driSymbols, driRefSymbols,
+-#endif
+- NULL);
+ return (pointer)TRUE;
+ }
+
+@@ -1068,7 +935,6 @@ SiS_LoadInitVBE(ScrnInfoPtr pScrn)
+ return;
+
+ if(xf86LoadSubModule(pScrn, "vbe")) {
+- xf86LoaderReqSymLists(vbeSymbols, NULL);
+ #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
+ pSiS->pVbe = VBEInit(pSiS->pInt, pSiS->pEnt->index);
+ #else
+@@ -1092,7 +958,6 @@ SiSLoadInitDDCModule(ScrnInfoPtr pScrn)
+ return TRUE;
+
+ if(xf86LoadSubModule(pScrn, "ddc")) {
+- xf86LoaderReqSymLists(ddcSymbols, NULL);
+ pSiS->haveDDC = TRUE;
+ return TRUE;
+ }
+@@ -3586,7 +3451,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Initializing adapter through int10\n");
+ if(xf86LoadSubModule(pScrn, "int10")) {
+- xf86LoaderReqSymLists(int10Symbols, NULL);
+ pSiS->pInt = xf86InitInt10(pSiS->pEnt->index);
+ } else {
+ SISErrorLog(pScrn, "Failed to load int10 module\n");
+@@ -3683,7 +3547,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ SISErrorLog(pScrn, "Could not load ramdac module\n");
+ goto my_error_1;
+ }
+- xf86LoaderReqSymLists(ramdacSymbols, NULL);
+
+ /* Set pScrn->monitor */
+ pScrn->monitor = pScrn->confScreen->monitor;
+@@ -5868,22 +5731,18 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ SISErrorLog(pScrn, "Unsupported framebuffer bpp (%d)\n", pScrn->bitsPerPixel);
+ goto my_error_1;
+ }
+- xf86LoaderReqSymLists(fbSymbols, NULL);
+
+ /* Load XAA/EXA (if needed) */
+ if(!pSiS->NoAccel) {
+ char *modName = NULL;
+- const char **symNames = NULL;
+ #ifdef SIS_USE_XAA
+ if(!pSiS->useEXA) {
+ modName = "xaa";
+- symNames = xaaSymbols;
+ }
+ #endif
+ #ifdef SIS_USE_EXA
+ if(pSiS->useEXA) {
+ modName = "exa";
+- symNames = exaSymbols;
+ }
+ #endif
+ if(modName && (!xf86LoadSubModule(pScrn, modName))) {
+@@ -5894,9 +5753,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ pSiS->NoXvideo = TRUE;
+ }
+ #endif
+- } else if(symNames) {
+- xf86LoaderReqSymLists(symNames, NULL);
+- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "2D acceleration enabled, modename %s\n",modName);
+ }
+ }
+
+@@ -5909,8 +5765,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ pSiS->ShadowFB = FALSE;
+ pSiS->Rotate = pSiS->Reflect = 0;
+ }
+- } else {
+- xf86LoaderReqSymLists(shadowSymbols, NULL);
+ }
+ }
+
+@@ -5920,9 +5774,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ if(!xf86LoaderCheckSymbol("DRIScreenInit")) {
+ if(xf86LoadSubModule(pScrn, "dri")) {
+ if(!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) {
+- if(xf86LoadSubModule(pScrn, "glx")) {
+- xf86LoaderReqSymLists(driSymbols, drmSymbols, NULL);
+- } else {
++ if(! xf86LoadSubModule(pScrn, "glx")) {
+ SISErrorLog(pScrn, "Failed to load glx module\n");
+ }
+ }
+--
+1.6.4.4
+
diff --git a/0008-update-to-xextproto-7-1-support.patch b/0008-update-to-xextproto-7-1-support.patch
new file mode 100644
index 000000000000..1dcbdf05c869
--- /dev/null
+++ b/0008-update-to-xextproto-7-1-support.patch
@@ -0,0 +1,45 @@
+From 59ea80738d22c69a2850fd7ff89bd75330cc310b Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Thu, 16 Jul 2009 01:55:25 +0000
+Subject: Update to xextproto 7.1 support.
+
+DPMS header was split into dpms.h (client) and dpmsconst.h (server). Drivers
+need to include dpmsconst.h if xextproto 7.1 is available.
+
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+---
+diff --git a/configure.ac b/configure.ac
+index 089c5fa..f19c1b7 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -62,6 +62,10 @@ 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])
++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)
+
+ # Checks for libraries.
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index ef7b522..a1ced97 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -78,8 +78,13 @@
+
+ #include "globals.h"
+
++#ifdef HAVE_XEXTPROTO_71
++#include <X11/extensions/dpmsconst.h>
++#else
+ #define DPMS_SERVER
+ #include <X11/extensions/dpms.h>
++#endif
++
+
+ #ifdef XF86DRI
+ #include "dri.h"
+--
+cgit v0.8.3-6-g21f6
diff --git a/0009-update-for-rac-removal.patch b/0009-update-for-rac-removal.patch
new file mode 100644
index 000000000000..df1421798d07
--- /dev/null
+++ b/0009-update-for-rac-removal.patch
@@ -0,0 +1,69 @@
+From 9e1ebb9530bbb71be7fcab9e6f8f9a475be72efe Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied@redhat.com>
+Date: Tue, 28 Jul 2009 03:32:37 +0000
+Subject: sis: update for resources/RAC API removal
+
+---
+diff --git a/src/sis.h b/src/sis.h
+index 773f709..e859c78 100644
+--- a/src/sis.h
++++ b/src/sis.h
+@@ -77,7 +77,9 @@
+ #include "xf86Pci.h"
+ #include "xf86Priv.h"
+ #include "xf86_OSproc.h"
++#ifndef XSERVER_LIBPCIACCESS
+ #include "xf86Resources.h"
++#endif
+ #include "xf86.h"
+ #include "xf86PciInfo.h"
+ #include "xf86Cursor.h"
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index a1ced97..bb11cbb 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -49,7 +49,9 @@
+
+ #include "sis.h"
+
++#ifndef XSERVER_LIBPCIACCESS
+ #include "xf86RAC.h"
++#endif
+ #include "dixstruct.h"
+ #include "shadowfb.h"
+ #include "fb.h"
+@@ -3552,6 +3554,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ SiS_MapVGAMem(pScrn);
+ #endif
+
++#ifndef XSERVER_LIBPCIACCESS
+ /* Set operating state */
+
+ /* 1. memory */
+@@ -3581,6 +3584,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ /* Operations for which I/O access is required */
+ pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
+
++#endif
++
+ /* Load ramdac module */
+ if(!xf86LoadSubModule(pScrn, "ramdac")) {
+ SISErrorLog(pScrn, "Could not load ramdac module\n");
+@@ -4424,6 +4429,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX (size %ldK)\n",
+ (ULong)pSiS->IOAddress, pSiS->mmioSize);
+
++#ifndef XSERVER_LIBPCIACCESS
+ /* Register the PCI-assigned resources */
+ if(xf86RegisterResources(pSiS->pEnt->index, NULL, ResExclusive)) {
+ SISErrorLog(pScrn, "PCI resource conflicts detected\n");
+@@ -4435,6 +4441,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ SISFreeRec(pScrn);
+ return FALSE;
+ }
++#endif
+
+ from = X_PROBED;
+ if(pSiS->pEnt->device->videoRam != 0) {
+--
+cgit v0.8.3-6-g21f6
diff --git a/0010-change-to-use-abi-version-check.patch b/0010-change-to-use-abi-version-check.patch
new file mode 100644
index 000000000000..cb9fd7ea5d12
--- /dev/null
+++ b/0010-change-to-use-abi-version-check.patch
@@ -0,0 +1,34 @@
+From 8c3eca873717e877048c2bde345c02b1e9099e50 Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied@redhat.com>
+Date: Tue, 28 Jul 2009 05:22:41 +0000
+Subject: sis: change to using ABI version check
+
+---
+diff --git a/src/sis.h b/src/sis.h
+index e859c78..400b83f 100644
+--- a/src/sis.h
++++ b/src/sis.h
+@@ -77,7 +77,7 @@
+ #include "xf86Pci.h"
+ #include "xf86Priv.h"
+ #include "xf86_OSproc.h"
+-#ifndef XSERVER_LIBPCIACCESS
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
+ #include "xf86Resources.h"
+ #endif
+ #include "xf86.h"
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index bb11cbb..994b02d 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -49,7 +49,7 @@
+
+ #include "sis.h"
+
+-#ifndef XSERVER_LIBPCIACCESS
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
+ #include "xf86RAC.h"
+ #endif
+ #include "dixstruct.h"
+--
+cgit v0.8.3-6-g21f6
diff --git a/0011-more-rac-removal.patch b/0011-more-rac-removal.patch
new file mode 100644
index 000000000000..8175dea98d23
--- /dev/null
+++ b/0011-more-rac-removal.patch
@@ -0,0 +1,13 @@
+diff -Nrup xf86-video-sis-0.9.1/src/sis_hwmc.c patched/src/sis_hwmc.c
+--- xf86-video-sis-0.9.1/src/sis_hwmc.c 2008-03-04 14:31:10.000000000 -0300
++++ patched/src/sis_hwmc.c 2010-04-20 17:10:21.073690167 -0300
+@@ -43,7 +43,9 @@ THE USE OR OTHER DEALINGS IN THE SOFTWAR
+
+ #include "xf86.h"
+ #include "xf86_OSproc.h"
++#ifndef GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
+ #include "xf86Resources.h"
++#endif
+ #include "compiler.h"
+ #include "xf86PciInfo.h"
+ #include "xf86Pci.h"
diff --git a/COPYING b/COPYING
new file mode 100644
index 000000000000..d643012d7966
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,139 @@
+Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
+
+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 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR 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.
+
+Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England.
+Parts Copyright (C) 2001-2005 Thomas Winischhofer, Vienna, Austria.
+
+Licensed under the following terms:
+
+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 appears in all copies and that both that copyright
+notice and this permission notice appear in supporting documentation, and
+and that the name of the copyright holder not be used in advertising
+or publicity pertaining to distribution of the software without specific,
+written prior permission. The copyright holder makes no representations
+about the suitability of this software for any purpose. It is provided
+"as is" without expressed or implied warranty.
+
+THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
+EVENT SHALL THE COPYRIGHT HOLDER 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 (C) 2003 Eric Anholt
+
+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 appears in all copies and that both that copyright
+notice and this permission notice appear in supporting documentation, and
+and that the name of the copyright holder not be used in advertising
+or publicity pertaining to distribution of the software without specific,
+written prior permission. The copyright holder makes no representations
+about the suitability of this software for any purpose. It is provided
+"as is" without expressed or implied warranty.
+
+THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
+EVENT SHALL THE COPYRIGHT HOLDER 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 (C) 2000 by Alan Hourihane, Sychdyn, North Wales, UK.
+Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
+
+Portions from radeon_dga.c which is
+ Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
+ VA Linux Systems Inc., Fremont, California.
+
+Licensed under the following terms:
+
+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 the providers not be used in
+advertising or publicity pertaining to distribution of the software without
+specific, written prior permission. The providers make no representations
+about the suitability of this software for any purpose. It is provided
+"as is" without express or implied warranty.
+
+THE PROVIDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL THE PROVIDERS 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) 1999-2004 by The XFree86 Project, Inc.
+based on code written by Mark Vojkovich
+Copyright (C) 2003-2005 Thomas Winischhofer
+
+Licensed under the following terms:
+
+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 appears in all copies and that both that copyright
+notice and this permission notice appear in supporting documentation, and
+and that the name of the copyright holder not be used in advertising
+or publicity pertaining to distribution of the software without specific,
+written prior permission. The copyright holder makes no representations
+about the suitability of this software for any purpose. It is provided
+"as is" without expressed or implied warranty.
+
+THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
+EVENT SHALL THE COPYRIGHT HOLDER 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/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..60f230899947
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,128 @@
+# $Id: PKGBUILD 231243 2015-02-10 21:19:58Z lcarlier $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgname=xf86-video-sisimedia
+pkgver=0.9.1
+pkgrel=10
+pkgdesc="X.org SiS 671 video driver"
+arch=(i686 x86_64)
+url="http://www.linuxconsulting.ro/xorg-drivers/"
+license=('custom')
+depends=('glibc')
+makedepends=('xorg-server-devel' 'X-ABI-VIDEODRV_VERSION=19' 'xf86dgaproto')
+conflicts=('xorg-server<1.16' 'X-ABI-VIDEODRV_VERSION<19' 'X-ABI-VIDEODRV_VERSION>=20')
+source=(https://sources.archlinux.org/other/xf86-video-sisimedia/xf86-video-sisimedia-0.9.1_20091203.tar.bz2
+ xf86-video-sis-0.9.1-20102701.patch
+ 0002-Remove-XFree86-Misc-PassMessage-support.patch
+ 0003-Fix-build-with-Werror-format-security.patch
+ 0005-Fix-backlight-off-on-SiS30x.-video-bridges.patch
+ 0006-Add-IgnoreHotkeyFlag-driver-option.patch
+ xf86-video-sis-0.9.1-dump-regs-after-video-init.patch
+ 0007-Remove-useless-loader-symbol-lists.patch
+ 0008-update-to-xextproto-7-1-support.patch
+ 0009-update-for-rac-removal.patch
+ 0010-change-to-use-abi-version-check.patch
+ 0011-more-rac-removal.patch
+ 0001-Remove-xorgconfig-xorgcfg-from-See-Also-list-in-man-.patch
+ 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
+ sisimedia-no-xaa.patch
+ sisimedia-xorg-1.13.patch
+ deprecated-sym2.patch
+ disable-UploadToScreen-DownloadFromScreen.patch
+ remove_mibstore.h.patch
+ COPYING)
+sha1sums=('22e6616df49ec82755daae08043a29aaf92fa430'
+ '61715bb86180decde55a56fad9a12d841c89fbb2'
+ '33fdea57187a2758802bcb9572d3a864aaab4d59'
+ '6f05eae535b099b01c2819e63c68d4489b940267'
+ 'a6cb5da9312d32d729ad2619d8ae50cb26ba7d4d'
+ 'df728052a89c4152abbe89826756040dac23b624'
+ '4bed1c2455ed447f7053cb0729e99cbe598b3274'
+ 'd7802db5c49540ab136e71450cc846cfccd8b8d1'
+ 'e2236d2d00338f1658c66d9b972919af39897071'
+ '0c6b9322e6cb22c67e04d50a0b818a2dd4585cf2'
+ '802829a8ebd2b7e35fcc86665d842b1594a8ba30'
+ 'c26afe7508183735b7568b435be9c270ceeb62f1'
+ 'd2fa2a21454f3a161bcd8ae4d349657561049edd'
+ '5e288526bfa2c534f1feabdb571da16da8a1c7a6'
+ 'e86d702cb0b5e9bf43ff732696229965e176db7c'
+ 'b5f260bed7e705808ec05620316e503ed5d52ee5'
+ 'ca25df590590284161cd68440fc4f0cfeb8618b2'
+ 'ce60625b915e8bd82a6ab2c78e52eb589f27a083'
+ '963ef59ecd0ca478434623efb68fce9ee832501d'
+ '5f686c54383c6677b043c6ca0b565b023c1907f9'
+ '4ea8d76b3e74172109e7013a2931e571d3a2f4e1'
+ '1d29504466840d2fbe1fc355d78666c1a9cd9b76'
+ '1fdd74a2aef9455ac5c37d1fe0146d81aa905d2d'
+ '370af234867df98206a98c8cd0a6c89323593f6b'
+ '4ea333d659abe2b78f07511467c5356f39bf8695'
+ '9bef0b61c0505cc64464073d73684e6933d3f84c'
+ 'ff95fd41be43560245caa40adc6b481f2dafca7d'
+ 'e130b4b4cafa0d54426a9b9c4735ad4bf46686f5'
+ 'a64e244f274bcb155f892d0488a1a4b1b2f7d70d')
+
+prepare() {
+ cd "${srcdir}/xf86-video-sis-${pkgver}"
+ patch -Np1 -i "${srcdir}/xf86-video-sis-0.9.1-20102701.patch"
+ patch -Np1 -i "${srcdir}/0002-Remove-XFree86-Misc-PassMessage-support.patch"
+ patch -Np1 -i "${srcdir}/0003-Fix-build-with-Werror-format-security.patch"
+ patch -Np1 -i "${srcdir}/0005-Fix-backlight-off-on-SiS30x.-video-bridges.patch"
+ patch -Np1 -i "${srcdir}/0006-Add-IgnoreHotkeyFlag-driver-option.patch"
+ patch -Np1 -i "${srcdir}/xf86-video-sis-0.9.1-dump-regs-after-video-init.patch"
+ patch -Np1 -i "${srcdir}/0007-Remove-useless-loader-symbol-lists.patch"
+ patch -Np1 -i "${srcdir}/0008-update-to-xextproto-7-1-support.patch"
+ patch -Np1 -i "${srcdir}/0009-update-for-rac-removal.patch"
+ patch -Np1 -i "${srcdir}/0010-change-to-use-abi-version-check.patch"
+ patch -Np1 -i "${srcdir}/0011-more-rac-removal.patch"
+ patch -Np1 -i "${srcdir}/0001-Remove-xorgconfig-xorgcfg-from-See-Also-list-in-man-.patch"
+ 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"
+ patch -Np1 -i "${srcdir}/sisimedia-no-xaa.patch"
+ patch -Np1 -i "${srcdir}/sisimedia-xorg-1.13.patch"
+ patch -Np1 -i "${srcdir}/remove_mibstore.h.patch"
+
+ patch -Np1 -i "${srcdir}/deprecated-sym2.patch"
+ patch -Np1 -i "${srcdir}/disable-UploadToScreen-DownloadFromScreen.patch"
+
+ sed -i -e 's,sis_drv,sisimedia_drv,g' src/Makefile.am
+ sed -i -e 's,\"sis\",\"sisimedia\",g' src/sis.h
+ sed -i -e 's,sisModuleData,sisimediaModuleData,g' src/sis_driver.c
+
+ sed -i -e 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/' configure.ac
+
+ autoreconf -fi
+}
+
+build() {
+ cd "${srcdir}/xf86-video-sis-${pkgver}"
+
+ ./configure --prefix=/usr --disable-dri
+ make
+}
+
+package() {
+ cd "${srcdir}/xf86-video-sis-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ rm -rf "${pkgdir}/usr/share/man"
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -m644 "${srcdir}/COPYING" "${pkgdir}/usr/share/licenses/${pkgname}/"
+}
diff --git a/Untangle-XF86DRI.patch b/Untangle-XF86DRI.patch
new file mode 100644
index 000000000000..55b9c9deb546
--- /dev/null
+++ b/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/deprecated-sym2.patch b/deprecated-sym2.patch
new file mode 100644
index 000000000000..f02682333430
--- /dev/null
+++ b/deprecated-sym2.patch
@@ -0,0 +1,1068 @@
+This patch for remove all depreceated / obselete symbol on compiling
+Contributor saa7_go < saa7.go@gmail.com >
+
+diff -u xf86-video-sismedia-0.9.1/src/initextx.c xf86-video-sismedia-0.9.1-dep-clean/src/initextx.c
+--- xf86-video-sismedia-0.9.1/src/initextx.c 2011-03-06 11:27:56.368767584 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/initextx.c 2011-03-06 11:34:50.298266877 +0700
+@@ -284,10 +284,10 @@
+ }
+ }
+
+- 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;
+@@ -436,11 +436,11 @@
+ }
+ }
+
+- 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;
+@@ -521,11 +521,11 @@
+
+ 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 -u xf86-video-sismedia-0.9.1/src/sis6326_video.c xf86-video-sismedia-0.9.1-dep-clean/src/sis6326_video.c
+--- xf86-video-sismedia-0.9.1/src/sis6326_video.c 2011-03-06 11:27:56.376768671 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis6326_video.c 2011-03-06 12:24:06.324251591 +0700
+@@ -171,7 +171,7 @@
+ 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));
+@@ -186,7 +186,7 @@
+ xf86XVScreenInit(pScreen, adaptors, num_adaptors);
+
+ if(newAdaptors)
+- xfree(newAdaptors);
++ free(newAdaptors);
+ }
+
+ /* client libraries expect an encoding */
+@@ -532,7 +532,7 @@
+ return NULL;
+ #endif
+
+- if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
++ if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
+ sizeof(SISPortPrivRec) +
+ sizeof(DevUnion))))
+ return NULL;
+diff -u xf86-video-sismedia-0.9.1/src/sis_cursor.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_cursor.c
+--- xf86-video-sismedia-0.9.1/src/sis_cursor.c 2011-03-06 11:27:56.376768671 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_cursor.c 2011-03-06 12:24:06.400262694 +0700
+@@ -1253,11 +1253,11 @@
+ SISPtr pSiS = SISPTR(pScrn);
+ xf86CursorInfoPtr infoPtr;
+
+- if(!(pSiS->CursorScratch = xcalloc(1, max(2048, pSiS->CursorSize))))
++ if(!(pSiS->CursorScratch = calloc(1, max(2048, pSiS->CursorSize))))
+ return FALSE;
+
+ if(!(infoPtr = xf86CreateCursorInfoRec())) {
+- xfree(pSiS->CursorScratch);
++ free(pSiS->CursorScratch);
+ pSiS->CursorScratch = NULL;
+ return FALSE;
+ }
+diff -u xf86-video-sismedia-0.9.1/src/sis_dga.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_dga.c
+--- xf86-video-sismedia-0.9.1/src/sis_dga.c 2011-03-06 11:27:56.380769214 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_dga.c 2011-03-06 11:34:50.458289501 +0700
+@@ -156,18 +156,18 @@
+
+ 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;
+@@ -353,12 +353,12 @@
+ newdgamodes = SISDGAMakeModes(pScrn, &newdgamodenum, TRUE);
+
+ if(DGAReInitModes(screenInfo.screens[pScrn->scrnIndex], newdgamodes, newdgamodenum)) {
+- xfree(pSiS->DGAModes);
++ free(pSiS->DGAModes);
+ pSiS->DGAModes = newdgamodes;
+ pSiS->numDGAModes = newdgamodenum;
+ return TRUE;
+ } else {
+- xfree(newdgamodes);
++ free(newdgamodes);
+ return FALSE;
+ }
+ #else
+diff -u xf86-video-sismedia-0.9.1/src/sis_dri.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_dri.c
+--- xf86-video-sismedia-0.9.1/src/sis_dri.c 2011-03-06 11:27:56.380769214 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_dri.c 2011-03-06 12:24:06.456270873 +0700
+@@ -156,19 +156,19 @@
+ 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];
+@@ -330,7 +330,7 @@
+ 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
+@@ -389,7 +389,7 @@
+ 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;
+@@ -407,7 +407,7 @@
+
+ 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;
+@@ -867,7 +867,7 @@
+
+ if(pSIS->pDRIInfo) {
+ if(pSIS->pDRIInfo->devPrivate) {
+- xfree(pSIS->pDRIInfo->devPrivate);
++ free(pSIS->pDRIInfo->devPrivate);
+ pSIS->pDRIInfo->devPrivate = NULL;
+ }
+ DRIDestroyInfoRec(pSIS->pDRIInfo);
+@@ -875,12 +875,12 @@
+ }
+
+ 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 -u xf86-video-sismedia-0.9.1/src/sis_driver.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_driver.c
+--- xf86-video-sismedia-0.9.1/src/sis_driver.c 2011-03-06 11:27:56.384769757 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_driver.c 2011-03-06 12:24:06.512279052 +0700
+@@ -497,7 +497,7 @@
+ numDevSections, drv, &usedChipsXGI);
+
+ /* Free it since we don't need that list after this */
+- xfree(devSections);
++ free(devSections);
+
+ numUsed = numUsedSiS + numUsedXGI;
+ xf86DrvMsg(0, X_INFO, "SISPRobe - test1\n");
+@@ -595,8 +595,8 @@
+
+ }
+
+- if(usedChipsSiS) xfree(usedChipsSiS);
+- if(usedChipsXGI) xfree(usedChipsXGI);
++ if(usedChipsSiS) free(usedChipsSiS);
++ if(usedChipsXGI) free(usedChipsXGI);
+ xf86DrvMsg(0, X_INFO, "SISProbe end\n");
+ return foundScreen;
+ }
+@@ -642,12 +642,12 @@
+ #endif
+
+ if(pSiS->pstate) {
+- xfree(pSiS->pstate);
++ free(pSiS->pstate);
+ pSiS->pstate = NULL;
+ }
+
+ if(pSiS->fonts) {
+- xfree(pSiS->fonts);
++ free(pSiS->fonts);
+ pSiS->fonts = NULL;
+ }
+
+@@ -660,15 +660,15 @@
+ * head.
+ */
+ if(pSiSEnt->BIOS)
+- xfree(pSiSEnt->BIOS);
++ free(pSiSEnt->BIOS);
+ pSiSEnt->BIOS = pSiS->BIOS = NULL;
+
+ if(pSiSEnt->SiS_Pr)
+- xfree(pSiSEnt->SiS_Pr);
++ free(pSiSEnt->SiS_Pr);
+ pSiSEnt->SiS_Pr = pSiS->SiS_Pr = NULL;
+
+ if(pSiSEnt->RenderAccelArray)
+- xfree(pSiSEnt->RenderAccelArray);
++ free(pSiSEnt->RenderAccelArray);
+ pSiSEnt->RenderAccelArray = pSiS->RenderAccelArray = NULL;
+
+ pSiSEnt->pScrn_1 = NULL;
+@@ -681,17 +681,17 @@
+ } else {
+ #endif
+ if(pSiS->BIOS) {
+- xfree(pSiS->BIOS);
++ free(pSiS->BIOS);
+ pSiS->BIOS = NULL;
+ }
+
+ if(pSiS->SiS_Pr) {
+- xfree(pSiS->SiS_Pr);
++ free(pSiS->SiS_Pr);
+ pSiS->SiS_Pr = NULL;
+ }
+
+ if(pSiS->RenderAccelArray) {
+- xfree(pSiS->RenderAccelArray);
++ free(pSiS->RenderAccelArray);
+ pSiS->RenderAccelArray = NULL;
+ }
+ #ifdef SISDUALHEAD
+@@ -699,17 +699,17 @@
+ #endif
+ #ifdef SISMERGED
+ if(pSiS->CRT2HSync) {
+- xfree(pSiS->CRT2HSync);
++ free(pSiS->CRT2HSync);
+ pSiS->CRT2HSync = NULL;
+ }
+
+ if(pSiS->CRT2VRefresh) {
+- xfree(pSiS->CRT2VRefresh);
++ free(pSiS->CRT2VRefresh);
+ pSiS->CRT2VRefresh = NULL;
+ }
+
+ if(pSiS->MetaModes) {
+- xfree(pSiS->MetaModes);
++ free(pSiS->MetaModes);
+ pSiS->MetaModes = NULL;
+ }
+
+@@ -721,9 +721,9 @@
+ while(pSiS->CRT2pScrn->monitor->Modes) {
+ xf86DeleteMode(&pSiS->CRT2pScrn->monitor->Modes, pSiS->CRT2pScrn->monitor->Modes);
+ }
+- xfree(pSiS->CRT2pScrn->monitor);
++ free(pSiS->CRT2pScrn->monitor);
+ }
+- xfree(pSiS->CRT2pScrn);
++ free(pSiS->CRT2pScrn);
+ pSiS->CRT2pScrn = NULL;
+ }
+
+@@ -735,10 +735,10 @@
+ do {
+ DisplayModePtr p = pScrn->currentMode->next;
+ if(pScrn->currentMode->Private)
+- xfree(pScrn->currentMode->Private);
++ free(pScrn->currentMode->Private);
+ if(pScrn->currentMode->name)
+- xfree(pScrn->currentMode->name);
+- xfree(pScrn->currentMode);
++ free(pScrn->currentMode->name);
++ free(pScrn->currentMode);
+ pScrn->currentMode = p;
+ } while(pScrn->currentMode != pScrn->modes);
+ }
+@@ -758,22 +758,22 @@
+ }
+
+ if(pSiS->currcrt1analogedid) {
+- xfree(pSiS->currcrt1analogedid);
++ free(pSiS->currcrt1analogedid);
+ pSiS->currcrt1analogedid = NULL;
+ }
+
+ if(pSiS->currcrt1digitaledid) {
+- xfree(pSiS->currcrt1digitaledid);
++ free(pSiS->currcrt1digitaledid);
+ pSiS->currcrt1digitaledid = NULL;
+ }
+
+ if(pSiS->currcrt2analogedid) {
+- xfree(pSiS->currcrt2analogedid);
++ free(pSiS->currcrt2analogedid);
+ pSiS->currcrt2analogedid = NULL;
+ }
+
+ if(pSiS->currcrt2digitaledid) {
+- xfree(pSiS->currcrt2digitaledid);
++ free(pSiS->currcrt2digitaledid);
+ pSiS->currcrt2digitaledid = NULL;
+ }
+
+@@ -784,7 +784,7 @@
+
+ while(pSiS->SISVESAModeList) {
+ sisModeInfoPtr mp = pSiS->SISVESAModeList->next;
+- xfree(pSiS->SISVESAModeList);
++ free(pSiS->SISVESAModeList);
+ pSiS->SISVESAModeList = mp;
+ }
+
+@@ -801,7 +801,7 @@
+ if(pScrn->driverPrivate == NULL)
+ return;
+
+- xfree(pScrn->driverPrivate);
++ free(pScrn->driverPrivate);
+ pScrn->driverPrivate = NULL;
+ }
+
+@@ -1017,22 +1017,22 @@
+ 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;
+ }
+ }
+@@ -1171,7 +1171,7 @@
+ }
+ }
+ }
+- xfree(mysisfbinfo);
++ free(mysisfbinfo);
+ mysisfbinfo = NULL;
+ }
+ close (fd);
+@@ -1250,7 +1250,7 @@
+ }
+ #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 {
+@@ -1352,7 +1352,7 @@
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Could not find/read video BIOS\n");
+- xfree(pSiS->BIOS);
++ free(pSiS->BIOS);
+ pSiS->BIOS = NULL;
+ }
+ }
+@@ -1851,7 +1851,7 @@
+ {
+ if((*ptr)) {
+ memcpy((*ptr), pMonitor, sizeof(xf86Monitor));
+- xfree(pMonitor);
++ free(pMonitor);
+ } else {
+ (*ptr) = pMonitor;
+ }
+@@ -1882,7 +1882,7 @@
+ }
+ #endif
+
+- xfree((*ptr));
++ free((*ptr));
+ *ptr = NULL;
+
+ }
+@@ -2158,7 +2158,7 @@
+ xf86PrintEDID(pMonitor);
+ if(pMonitor->rawData) {
+ /* Get rid of raw data */
+- xfree(pMonitor->rawData);
++ free(pMonitor->rawData);
+ pMonitor->rawData = NULL;
+ }
+ pScrn->monitor->DDC = pMonitor = SiSSetEDIDPtr(&pSiS->currcrt1analogedid, pMonitor);
+@@ -2821,12 +2821,12 @@
+ DisplayModePtr dest = NULL;
+
+ if(source) {
+- if((dest = xalloc(sizeof(DisplayModeRec)))) {
++ if((dest = malloc(sizeof(DisplayModeRec)))) {
+ memcpy(dest, source, sizeof(DisplayModeRec));
+ dest->name = NULL;
+ dest->next = dest->prev = NULL;
+- if(!(dest->name = xalloc(strlen(source->name) + 1))) {
+- xfree(dest);
++ if(!(dest->name = malloc(strlen(source->name) + 1))) {
++ free(dest);
+ dest = NULL;
+ } else {
+ strcpy(dest->name, source->name);
+@@ -5256,7 +5256,7 @@
+ /* MergedFB: Create CRT2 pScrn and make it a copy of pScrn */
+ #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;
+@@ -5292,7 +5292,7 @@
+ } else {
+ SISErrorLog(pScrn, mergednocrt1, mergeddisstr);
+ }
+- if(pSiS->CRT2pScrn) xfree(pSiS->CRT2pScrn);
++ if(pSiS->CRT2pScrn) free(pSiS->CRT2pScrn);
+ pSiS->CRT2pScrn = NULL;
+ pSiS->MergedFB = FALSE;
+ }
+@@ -5341,7 +5341,7 @@
+ } else {
+ SISErrorLog(pScrn, mergednocrt2, mergeddisstr);
+ }
+- if(pSiS->CRT2pScrn) xfree(pSiS->CRT2pScrn);
++ if(pSiS->CRT2pScrn) free(pSiS->CRT2pScrn);
+ pSiS->CRT2pScrn = NULL;
+ pSiS->MergedFB = FALSE;
+ }
+@@ -5711,7 +5711,7 @@
+ #endif
+
+ /* Don't need the clock ranges from here on */
+- xfree(clockRanges);
++ free(clockRanges);
+
+ /* Set display resolution */
+ #ifdef SISMERGED
+@@ -6719,7 +6719,7 @@
+ (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);
+ }
+@@ -9086,10 +9086,10 @@
+ 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;
+ }
+ }
+@@ -9149,9 +9149,9 @@
+
+ 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
+@@ -9442,7 +9442,7 @@
+
+ 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 {
+@@ -9626,14 +9626,14 @@
+
+ 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;
+ }
+@@ -10810,7 +10810,7 @@
+ if(pSiS->useEXA) {
+ if(pSiS->EXADriverPtr) {
+ exaDriverFini(pScreen);
+- xfree(pSiS->EXADriverPtr);
++ free(pSiS->EXADriverPtr);
+ pSiS->EXADriverPtr = NULL;
+ pSiS->exa_scratch = NULL;
+ }
+@@ -10823,38 +10823,38 @@
+ }
+
+ if(pSiS->CursorScratch) {
+- xfree(pSiS->CursorScratch);
++ free(pSiS->CursorScratch);
+ pSiS->CursorScratch = NULL;
+ }
+
+ 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 -u xf86-video-sismedia-0.9.1/src/sis_hwmc.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_hwmc.c
+--- xf86-video-sismedia-0.9.1/src/sis_hwmc.c 2011-03-06 11:27:56.388770300 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_hwmc.c 2011-03-06 12:24:06.612293658 +0700
+@@ -274,7 +274,7 @@
+ * Set *num_priv to the number of 32bit words that make up the size of
+ * of the data that priv will point to.
+ *
+- * *priv = (long *) xcalloc (elements, sizeof(element))
++ * *priv = (long *) calloc (elements, sizeof(element))
+ * *num_priv = (elements * sizeof(element)) >> 2;
+ *
+ **************************************************************************/
+@@ -310,7 +310,7 @@
+ return BadAlloc;
+ }
+
+- *priv = xcalloc(1,sizeof(SiSXvMCCreateContextRec));
++ *priv = calloc(1,sizeof(SiSXvMCCreateContextRec));
+ contextRec = (SiSXvMCCreateContextRec *)*priv;
+
+ if(!*priv) {
+@@ -322,7 +322,7 @@
+ if(drmCreateContext(pSiS->drmSubFD, &(contextRec->drmcontext) ) < 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "[MC] SiSXvMCCreateContext: Unable to create DRMContext!\n");
+- xfree(*priv);
++ free(*priv);
+ return BadAlloc;
+ }
+
+@@ -336,7 +336,7 @@
+ DRM_FRAME_BUFFER, 0, &pSiS->fb_handle) < 0){
+
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"[MC] Frame buffer AddMap failed!\n");
+- xfree(*priv);
++ free(*priv);
+ *num_priv = 0;
+ return BadAlloc;
+ }
+@@ -357,7 +357,7 @@
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR," [MC] XvMC is not supposted on this chip! Stop.\n");
+- xfree(*priv);
++ free(*priv);
+ *num_priv = 0;
+ return BadValue;
+ }
+@@ -408,7 +408,7 @@
+ #endif
+
+
+- *priv = xcalloc(1,sizeof(SiSXvMCCreateSurfaceRec));
++ *priv = calloc(1,sizeof(SiSXvMCCreateSurfaceRec));
+
+
+ if(!*priv) {
+@@ -435,7 +435,7 @@
+ }
+
+
+- xfree(*priv);
++ free(*priv);
+ return BadAlloc;
+
+ }
+@@ -454,7 +454,7 @@
+ __FUNCTION__, __FILE__);
+ #endif
+
+- *priv = (long *)xcalloc(1,sizeof(long));
++ *priv = (long *)calloc(1,sizeof(long));
+
+ if(!*priv) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+diff -u xf86-video-sismedia-0.9.1/src/sis_memcpy.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_memcpy.c
+--- xf86-video-sismedia-0.9.1/src/sis_memcpy.c 2011-03-06 11:27:56.388770300 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_memcpy.c 2011-03-06 11:34:50.694322870 +0700
+@@ -637,13 +637,13 @@
+ (*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;
+ }
+@@ -1101,8 +1101,8 @@
+
+ /* 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 -u xf86-video-sismedia-0.9.1/src/sis_mergedfb.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_mergedfb.c
+--- xf86-video-sismedia-0.9.1/src/sis_mergedfb.c 2011-03-06 11:27:56.388770300 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_mergedfb.c 2011-03-06 22:18:01.785310903 +0700
+@@ -170,13 +170,13 @@
+ char namebuffer[32], namebuf1[64], namebuf2[64];
+ char printbuffer[256];
+
+- if(!((mode = xalloc(sizeof(DisplayModeRec)))))
++ 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;
+ }
+
+@@ -265,8 +265,8 @@
+ "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;
+ }
+@@ -306,7 +306,7 @@
+
+ /* Generate a mode name */
+ sprintf(namebuffer, "%dx%d", mode->HDisplay, mode->VDisplay);
+- if((mode->name = xalloc(strlen(namebuffer) + 1))) {
++ if((mode->name = malloc(strlen(namebuffer) + 1))) {
+ strcpy(mode->name, namebuffer);
+ }
+
+@@ -849,7 +849,7 @@
+
+ if(pSiS->MergedFB) {
+
+- pSiS->CRT2pScrn->monitor = xalloc(sizeof(MonRec));
++ pSiS->CRT2pScrn->monitor = malloc(sizeof(MonRec));
+
+ if(pSiS->CRT2pScrn->monitor) {
+
+@@ -889,7 +889,7 @@
+ } else {
+
+ SISErrorLog(pScrn, "Failed to allocate memory for CRT2 monitor, MergedFB mode disabled.\n");
+- if(pSiS->CRT2pScrn) xfree(pSiS->CRT2pScrn);
++ if(pSiS->CRT2pScrn) free(pSiS->CRT2pScrn);
+ pSiS->CRT2pScrn = NULL;
+ pSiS->MergedFB = FALSE;
+
+@@ -911,9 +911,9 @@
+ xf86DeleteMode(&pSiS->CRT2pScrn->monitor->Modes, pSiS->CRT2pScrn->monitor->Modes);
+ }
+ pSiS->CRT2pScrn->monitor->DDC = NULL;
+- xfree(pSiS->CRT2pScrn->monitor);
++ free(pSiS->CRT2pScrn->monitor);
+ }
+- xfree(pSiS->CRT2pScrn);
++ free(pSiS->CRT2pScrn);
+ pSiS->CRT2pScrn = NULL;
+ }
+ }
+@@ -1917,7 +1917,7 @@
+ ClientPtr client;
+ xXineramaLayoutChangeNotifyEvent se;
+
+- pHead = (SiSXineramaEventPtr *)LookupIDByType(pWin->drawable.id, EventType);
++ dixLookupResourceByType((pointer) &pHead, pWin->drawable.id, EventType, NullClient, DixUnknownAccess);
+ if(!pHead) {
+ return WT_WALKCHILDREN;
+ }
+@@ -2628,6 +2628,7 @@
+ WindowPtr pWin;
+ SiSXineramaEventPtr pXineramaEvent, pNewXineramaEvent, *pHead;
+ XID clientResource;
++ int lookup_ret;
+
+ REQUEST_SIZE_MATCH(xXineramaSelectInputReq);
+ /*IvansLee define NEW_XORG_VERSION.*/
+@@ -2640,9 +2641,10 @@
+ if(!pWin)
+ return BadWindow;
+ #if NEW_XORG_VERSION == 1 /*New Xorg Version >= 1.4 */
+- pHead = (SiSXineramaEventPtr *)SecurityLookupIDByType(client,
+- pWin->drawable.id, EventType,
+- DixWriteAccess);
++ lookup_ret = dixLookupResourceByType((pointer) &pHead,
++ pWin->drawable.id, EventType,
++ client, DixWriteAccess);
++ pHead = (lookup_ret == Success ? pHead : NULL);
+ #else
+ pHead = (SiSXineramaEventPtr *)SecurityLookupIDByType(client,
+ pWin->drawable.id, EventType,
+@@ -2661,7 +2663,7 @@
+ }
+
+ /* Build a new entry */
+- if(!(pNewXineramaEvent = (SiSXineramaEventPtr)xalloc(sizeof(SiSXineramaEventRec)))) {
++ if(!(pNewXineramaEvent = (SiSXineramaEventPtr)malloc(sizeof(SiSXineramaEventRec)))) {
+ return BadAlloc;
+ }
+ pNewXineramaEvent->next = 0;
+@@ -2686,7 +2688,7 @@
+ * done through the resource database.
+ */
+ if(!pHead) {
+- pHead = (SiSXineramaEventPtr *)xalloc(sizeof(SiSXineramaEventPtr));
++ pHead = (SiSXineramaEventPtr *)malloc(sizeof(SiSXineramaEventPtr));
+ if(!pHead || !AddResource(pWin->drawable.id, EventType, (pointer)pHead)) {
+ FreeResource(clientResource, RT_NONE);
+ return BadAlloc;
+@@ -2715,7 +2717,7 @@
+ } else {
+ *pHead = pXineramaEvent->next;
+ }
+- xfree(pXineramaEvent);
++ free(pXineramaEvent);
+ SiSXineramaClientsListening--;
+ }
+ }
+@@ -2854,7 +2856,7 @@
+ {
+ /* Called by CloseDownExtensions() */
+ if(SiSXineramadataPtr) {
+- Xfree(SiSXineramadataPtr);
++ free(SiSXineramadataPtr);
+ SiSXineramadataPtr = NULL;
+ }
+ }
+@@ -2866,7 +2868,7 @@
+ SiSXineramaEventPtr *pHead, pCur, pPrev;
+ WindowPtr pWin = pXineramaEvent->window;
+
+- pHead = (SiSXineramaEventPtr *)LookupIDByType(pWin->drawable.id, EventType);
++ dixLookupResourceByType((pointer) &pHead, pWin->drawable.id, EventType, NullClient, DixUnknownAccess);
+ if(pHead) {
+ pPrev = NULL;
+ for(pCur = *pHead; pCur && pCur != pXineramaEvent; pCur = pCur->next) {
+@@ -2877,7 +2879,7 @@
+ else *pHead = pXineramaEvent->next;
+ }
+ }
+- xfree((pointer)pXineramaEvent);
++ free((pointer)pXineramaEvent);
+ return 1;
+ }
+
+@@ -2890,9 +2892,9 @@
+ for(pCur = *pHead; pCur; pCur = pNext) {
+ pNext = pCur->next;
+ FreeResource(pCur->clientResource, ClientType);
+- xfree((pointer)pCur);
++ free((pointer)pCur);
+ }
+- xfree((pointer)pHead);
++ free((pointer)pHead);
+ return 1;
+ }
+
+@@ -2965,7 +2967,7 @@
+ if(!pSiS->XineramaExtEntry) break;
+
+ if(!(SiSXineramadataPtr = (SiSXineramaData *)
+- xcalloc(SiSXineramaNumScreens, sizeof(SiSXineramaData)))) break;
++ calloc(SiSXineramaNumScreens, sizeof(SiSXineramaData)))) break;
+
+ SiSXineramaEventbase = pSiS->XineramaExtEntry->eventBase;
+ EventSwapVector[SiSXineramaEventbase + XineramaLayoutChangeNotify] =
+diff -u xf86-video-sismedia-0.9.1/src/sis_opt.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_opt.c
+--- xf86-video-sismedia-0.9.1/src/sis_opt.c 2011-03-06 11:27:56.388770300 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_opt.c 2011-03-06 11:34:50.818340404 +0700
+@@ -459,7 +459,7 @@
+ 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));
+
+@@ -920,7 +920,7 @@
+ 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")) {
+@@ -978,18 +978,18 @@
+ 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))) {
+@@ -1009,8 +1009,8 @@
+ }
+ if(pSiS->UseSiSXinerama) {
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SCR0))) {
+- char *tempstr1 = xalloc(strlen(strptr) + 1);
+- char *tempstr2 = xalloc(strlen(strptr) + 1);
++ char *tempstr1 = malloc(strlen(strptr) + 1);
++ char *tempstr2 = malloc(strlen(strptr) + 1);
+ char *tempstr;
+ int i, result;
+ pSiS->MFBScr0LR = pSiS->MFBScr0TB = -1;
+@@ -1037,8 +1037,8 @@
+ "Bad or incomplete argument(s) for Option \"%s\"\n",
+ pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_SCR0)].name);
+ }
+- xfree(tempstr1);
+- xfree(tempstr2);
++ free(tempstr1);
++ free(tempstr2);
+ } else if(xf86GetOptValBool(pSiS->Options, OPTION_CRT2ISSCRN0, &val)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Option \"%s\" is deprecated, use \"%s\"\n",
+diff -u xf86-video-sismedia-0.9.1/src/sis_utility.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_utility.c
+--- xf86-video-sismedia-0.9.1/src/sis_utility.c 2011-03-06 11:27:56.392770842 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_utility.c 2011-03-06 12:24:06.740312353 +0700
+@@ -2185,7 +2185,7 @@
+ * in SiSCtrlExtUnregister())
+ */
+ if(extEntry->extPrivate) {
+- xfree(extEntry->extPrivate);
++ free(extEntry->extPrivate);
+ extEntry->extPrivate = NULL;
+ }
+ }
+@@ -2206,7 +2206,7 @@
+
+ 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,
+@@ -2216,7 +2216,7 @@
+ StandardMinorOpcode))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to add SISCTRL extension\n");
+- xfree(myctrl);
++ free(myctrl);
+ return;
+ }
+
+diff -u xf86-video-sismedia-0.9.1/src/sis_vga.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_vga.c
+--- xf86-video-sismedia-0.9.1/src/sis_vga.c 2011-03-06 11:27:56.396771384 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_vga.c 2011-03-06 11:34:51.038371506 +0700
+@@ -1450,7 +1450,7 @@
+ 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;
+diff -u xf86-video-sismedia-0.9.1/src/sis_video.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_video.c
+--- xf86-video-sismedia-0.9.1/src/sis_video.c 2011-03-06 11:27:56.396771384 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_video.c 2011-03-06 12:24:06.824324624 +0700
+@@ -349,7 +349,7 @@
+ 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));
+@@ -379,7 +379,7 @@
+ }
+
+ if(newAdaptors) {
+- xfree(newAdaptors);
++ free(newAdaptors);
+ }
+
+ #ifdef ENABLEXvMC
+@@ -1049,7 +1049,7 @@
+ }
+ #endif
+
+- if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
++ if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
+ sizeof(SISPortPrivRec) +
+ sizeof(DevUnion)))) {
+ return NULL;
+@@ -4543,7 +4543,7 @@
+ }
+ #endif
+
+- if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
++ if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
+ (sizeof(DevUnion) * NUM_BLIT_PORTS) +
+ sizeof(SISBPortPrivRec)))) {
+ return NULL;
+Common subdirectories: xf86-video-sismedia-0.9.1/src/xvmc and xf86-video-sismedia-0.9.1-dep-clean/src/xvmc
diff --git a/disable-UploadToScreen-DownloadFromScreen.patch b/disable-UploadToScreen-DownloadFromScreen.patch
new file mode 100644
index 000000000000..4cc75989fa6d
--- /dev/null
+++ b/disable-UploadToScreen-DownloadFromScreen.patch
@@ -0,0 +1,64 @@
+diff -ruN xf86-video-sis-0.9.1.orig/src/sis300_accel.c xf86-video-sis-0.9.1/src/sis300_accel.c
+--- xf86-video-sis-0.9.1.orig/src/sis300_accel.c 2012-11-26 12:27:14.151119857 +0100
++++ xf86-video-sis-0.9.1/src/sis300_accel.c 2012-11-26 12:36:19.227926454 +0100
+@@ -1284,8 +1284,8 @@
+ /* Composite not supported */
+
+ /* Upload, download to/from Screen */
+- pSiS->EXADriverPtr->accel.UploadToScreen = SiSUploadToScreen;
+- pSiS->EXADriverPtr->accel.DownloadFromScreen = SiSDownloadFromScreen;
++ //pSiS->EXADriverPtr->accel.UploadToScreen = SiSUploadToScreen;
++ //pSiS->EXADriverPtr->accel.DownloadFromScreen = SiSDownloadFromScreen;
+ }
+ #else /*xorg>7.0*/
+
+@@ -1332,8 +1332,8 @@
+ /* Composite not supported */
+
+ /* Upload, download to/from Screen */
+- pSiS->EXADriverPtr->UploadToScreen = SiSUploadToScreen;
+- pSiS->EXADriverPtr->DownloadFromScreen = SiSDownloadFromScreen;
++ //pSiS->EXADriverPtr->UploadToScreen = SiSUploadToScreen;
++ //pSiS->EXADriverPtr->DownloadFromScreen = SiSDownloadFromScreen;
+
+ }
+ #endif
+diff -ruN xf86-video-sis-0.9.1.orig/src/sis310_accel.c xf86-video-sis-0.9.1/src/sis310_accel.c
+--- xf86-video-sis-0.9.1.orig/src/sis310_accel.c 2012-11-26 12:27:14.151119857 +0100
++++ xf86-video-sis-0.9.1/src/sis310_accel.c 2012-11-26 12:35:58.597921440 +0100
+@@ -1819,8 +1819,8 @@
+ #endif
+
+ /* Upload, download to/from Screen */
+- pSiS->EXADriverPtr->accel.UploadToScreen = SiSUploadToScreen;
+- pSiS->EXADriverPtr->accel.DownloadFromScreen = SiSDownloadFromScreen;
++ //pSiS->EXADriverPtr->accel.UploadToScreen = SiSUploadToScreen;
++ //pSiS->EXADriverPtr->accel.DownloadFromScreen = SiSDownloadFromScreen;
+
+ #else /*Xorg>= 7.0*/
+
+@@ -1869,8 +1869,8 @@
+ #endif
+
+ /* Upload, download to/from Screen */
+- pSiS->EXADriverPtr->UploadToScreen = SiSUploadToScreen;
+- pSiS->EXADriverPtr->DownloadFromScreen = SiSDownloadFromScreen;
++ //pSiS->EXADriverPtr->UploadToScreen = SiSUploadToScreen;
++ //pSiS->EXADriverPtr->DownloadFromScreen = SiSDownloadFromScreen;
+ #endif /*end of Xorg>=7.0*/
+
+ }
+diff -ruN xf86-video-sis-0.9.1.orig/src/sis_accel.c xf86-video-sis-0.9.1/src/sis_accel.c
+--- xf86-video-sis-0.9.1.orig/src/sis_accel.c 2012-11-26 12:27:14.154453191 +0100
++++ xf86-video-sis-0.9.1/src/sis_accel.c 2012-11-26 12:36:44.464598873 +0100
+@@ -862,8 +862,8 @@
+ /* Composite not supported */
+
+ /* Upload, download to/from Screen */
+- pSiS->EXADriverPtr->UploadToScreen = SiSUploadToScreen;
+- pSiS->EXADriverPtr->DownloadFromScreen = SiSDownloadFromScreen;
++ //pSiS->EXADriverPtr->UploadToScreen = SiSUploadToScreen;
++ //pSiS->EXADriverPtr->DownloadFromScreen = SiSDownloadFromScreen;
+
+ #endif /*end of Xorg>=7.0 EXA Setting*/
+ }
diff --git a/fix-xv-crash.patch b/fix-xv-crash.patch
new file mode 100644
index 000000000000..57e6adec567c
--- /dev/null
+++ b/fix-xv-crash.patch
@@ -0,0 +1,11 @@
+--- src/sis_video.c 2008-10-01 09:44:01.000000000 +0200
++++ src/sis_video.c.new 2011-10-17 14:23:07.000000000 +0200
+@@ -1121,7 +1121,7 @@
+ adapt->GetPortAttribute = SISGetPortAttribute;
+ adapt->QueryBestSize = SISQueryBestSize;
+ adapt->PutImage = SISPutImage;
+- adapt->ReputImage = SISReputImage;
++ adapt->ReputImage = NULL;
+ adapt->QueryImageAttributes = SISQueryImageAttributes;
+
+ /* gotta uninit this someplace */
diff --git a/pciTag-removal-workaround.patch b/pciTag-removal-workaround.patch
new file mode 100644
index 000000000000..b41f3c71baa4
--- /dev/null
+++ b/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/remove_mibstore.h.patch b/remove_mibstore.h.patch
new file mode 100644
index 000000000000..ebfa74f5a225
--- /dev/null
+++ b/remove_mibstore.h.patch
@@ -0,0 +1,18 @@
+--- xf86-video-sis-0.9.1/src/sis_driver.c 2013-03-10 13:02:25.000000000 +0100
++++ xf86-video-sis-0.9.1/src/sis_driver.c.new 2013-03-10 13:04:24.349309791 +0100
+@@ -86,7 +86,6 @@
+ #include "fb.h"
+ #include "micmap.h"
+ #include "mipointer.h"
+-#include "mibstore.h"
+ #include "edid.h"
+
+ #define SIS_NEED_inSISREG
+@@ -9637,7 +9636,6 @@
+ }
+ pSiS->SiSFastVidCopyDone = TRUE;
+
+- miInitializeBackingStore(pScreen);
+ xf86SetBackingStore(pScreen);
+ xf86SetSilkenMouse(pScreen);
+
diff --git a/sisimedia-no-xaa.patch b/sisimedia-no-xaa.patch
new file mode 100644
index 000000000000..d97ca5a2b765
--- /dev/null
+++ b/sisimedia-no-xaa.patch
@@ -0,0 +1,11 @@
+--- xf86-video-sis-0.9.1/src/Makefile.am.0202~ 2007-05-30 04:12:02.000000000 +0200
++++ xf86-video-sis-0.9.1/src/Makefile.am 2012-10-19 23:24:31.954954666 +0200
+@@ -23,7 +23,7 @@
+ # -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@ @DRI_CFLAGS@
++AM_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@ -DSIS_USE_EXA
+ sis_drv_la_LTLIBRARIES = sis_drv.la
+ sis_drv_la_LDFLAGS = -module -avoid-version
+ sis_drv_ladir = @moduledir@/drivers
diff --git a/sisimedia-xorg-1.13.patch b/sisimedia-xorg-1.13.patch
new file mode 100644
index 000000000000..25cc94fb1d0e
--- /dev/null
+++ b/sisimedia-xorg-1.13.patch
@@ -0,0 +1,654 @@
+diff -ur xf86-video-sis-0.9.1/src/sis_config.h xf86-video-sis-0.9.1-bero/src/sis_config.h
+--- xf86-video-sis-0.9.1/src/sis_config.h 2007-05-30 04:12:02.000000000 +0200
++++ xf86-video-sis-0.9.1-bero/src/sis_config.h 2012-10-19 23:27:16.178901583 +0200
+@@ -67,7 +67,7 @@
+ #endif
+
+ #if 1
+-#define SIS_USE_XAA /* Include support for XAA */
++#undef SIS_USE_XAA /* Don't include support for XAA, current xorg servers don't support it */
+ #endif
+
+ #ifdef SISVRAMQ
+diff -ur xf86-video-sis-0.9.1/src/sis_dga.c xf86-video-sis-0.9.1-bero/src/sis_dga.c
+--- xf86-video-sis-0.9.1/src/sis_dga.c 2012-10-20 00:10:10.325720321 +0200
++++ xf86-video-sis-0.9.1-bero/src/sis_dga.c 2012-10-19 23:34:00.514846689 +0200
+@@ -421,8 +421,8 @@
+ pScrn->currentMode = pSiS->CurrentLayout.mode;
+ pSiS->DGAactive = FALSE;
+
+- (*pScrn->SwitchMode)(index, pScrn->currentMode, 0);
+- (*pScrn->AdjustFrame)(index, pScrn->frameX0, pScrn->frameY0, 0);
++ (*pScrn->SwitchMode)(pScrn, pScrn->currentMode);
++ (*pScrn->AdjustFrame)(pScrn, pScrn->frameX0, pScrn->frameY0);
+
+ } else { /* set new mode */
+
+@@ -444,10 +444,10 @@
+ pSiS->CurrentLayout.displayWidth = pMode->bytesPerScanline / (pMode->bitsPerPixel >> 3);
+ pSiS->CurrentLayout.displayHeight = pMode->imageHeight;
+
+- (*pScrn->SwitchMode)(index, pMode->mode, 0);
++ (*pScrn->SwitchMode)(pScrn, pMode->mode);
+ /* Adjust viewport to 0/0 after mode switch */
+ /* This fixes the vmware-in-dualhead problems */
+- (*pScrn->AdjustFrame)(index, 0, 0, 0);
++ (*pScrn->AdjustFrame)(pScrn, 0, 0);
+ pSiS->CurrentLayout.DGAViewportX = pSiS->CurrentLayout.DGAViewportY = 0;
+ }
+
+@@ -471,7 +471,7 @@
+ ){
+ SISPtr pSiS = SISPTR(pScrn);
+
+- (*pScrn->AdjustFrame)(pScrn->pScreen->myNum, x, y, flags);
++ (*pScrn->AdjustFrame)(pScrn, x, y);
+ pSiS->DGAViewportStatus = 0; /* There are never pending Adjusts */
+ pSiS->CurrentLayout.DGAViewportX = x;
+ pSiS->CurrentLayout.DGAViewportY = y;
+diff -ur xf86-video-sis-0.9.1/src/sis_driver.c xf86-video-sis-0.9.1-bero/src/sis_driver.c
+--- xf86-video-sis-0.9.1/src/sis_driver.c 2012-10-20 00:10:10.379719645 +0200
++++ xf86-video-sis-0.9.1-bero/src/sis_driver.c 2012-10-20 00:06:35.196409807 +0200
+@@ -8546,9 +8546,9 @@
+ /* No need to go through pScrn->AdjustFrame; the coords
+ * didn't change
+ */
+- SISAdjustFrame(pSiSEnt->pScrn_2->scrnIndex,
++ SISAdjustFrame(pSiSEnt->pScrn_2,
+ pSiSEnt->pScrn_2->frameX0,
+- pSiSEnt->pScrn_2->frameY0, 0);
++ pSiSEnt->pScrn_2->frameY0);
+ }
+ } else {
+ /* Head 2 (slave) is always CRT1 */
+@@ -8565,9 +8565,9 @@
+ /* No need to go through pScrn->AdjustFrame; the coords
+ * didn't change
+ */
+- SISAdjustFrame(pSiSEnt->pScrn_1->scrnIndex,
++ SISAdjustFrame(pSiSEnt->pScrn_1,
+ pSiSEnt->pScrn_1->frameX0,
+- pSiSEnt->pScrn_1->frameY0, 0);
++ pSiSEnt->pScrn_1->frameY0);
+ }
+ }
+
+@@ -8613,7 +8613,7 @@
+
+ SiS_SiSLVDSBackLight(pSiS, TRUE);
+
+- (*pScrn->AdjustFrame)(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
++ (*pScrn->AdjustFrame)(pScrn, pScrn->frameX0, pScrn->frameY0);
+
+ } else {
+ #endif
+@@ -8723,14 +8723,13 @@
+ /*******************************************************/
+
+ static void
+-SISBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
++SISBlockHandler(ScreenPtr pScreen, pointer pTimeout, pointer pReadmask)
+ {
+- ScreenPtr pScreen = screenInfo.screens[i];
+- ScrnInfoPtr pScrn = xf86Screens[i];
++ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ SISPtr pSiS = SISPTR(pScrn);
+
+ pScreen->BlockHandler = pSiS->BlockHandler;
+- (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
++ (*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask);
+ pScreen->BlockHandler = SISBlockHandler;
+
+ #ifdef SISDUALHEAD
+@@ -8747,7 +8746,7 @@
+ #endif
+
+ if(pSiS->AdjustFramePending && pSiS->AdjustFrame) {
+- (*pSiS->AdjustFrame)(i, pSiS->AdjustFrameX, pSiS->AdjustFrameY, pSiS->AdjustFrameFlags);
++ (*pSiS->AdjustFrame)(pScrn, pSiS->AdjustFrameX, pSiS->AdjustFrameY);
+ /* Reset it since Xv insists on installing its own every time. */
+ pScrn->AdjustFrame = SISNewAdjustFrame;
+ pSiS->AdjustFramePending = FALSE;
+@@ -9230,7 +9229,7 @@
+ * depth, bitsPerPixel)
+ */
+ static Bool
+-SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
++SISScreenInit(ScreenPtr pScreen, int argc, char **argv)
+ {
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ SISPtr pSiS = SISPTR(pScrn);
+@@ -9409,7 +9408,7 @@
+ pScrn->frameY1 = pScrn->frameY0 + pScrn->currentMode->VDisplay - 1;
+ }
+ }
+- SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
++ SISAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
+
+ /* Reset visual list. */
+ miClearVisualTypes();
+@@ -9841,7 +9840,7 @@
+ pSiS->SiS_SD_Flags |= SiS_SD_PSEUDOXINERAMA;
+ if(pSiS->HaveNonRect) {
+ /* Reset the viewport (now eventually non-recangular) */
+- SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
++ SISAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
+ }
+ }
+ } else {
+@@ -10177,9 +10176,8 @@
+ }
+
+ static ModeStatus
+-SISValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
++SISValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags)
+ {
+- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+
+ if(pSiS->UseVESA) {
+@@ -10335,9 +10333,8 @@
+ #endif
+
+ Bool
+-SISSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
++SISSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ {
+- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+ /* This is part 2 of the ugly hack in sis_shadow.c:
+ * There we set pScrn->currentMode to something
+@@ -10353,7 +10350,7 @@
+ */
+
+ if(!pSiS->skipswitchcheck) {
+- if(SISValidMode(scrnIndex, mode, TRUE, flags) != MODE_OK) {
++ if(SISValidMode(pScrn, mode, TRUE, 0) != MODE_OK) {
+ return FALSE;
+ }
+ }
+@@ -10368,7 +10365,7 @@
+
+ (*pSiS->SyncAccel)(pScrn);
+
+- if(!(SISModeInit(xf86Screens[scrnIndex], mode)))
++ if(!(SISModeInit(pScrn, mode)))
+ return FALSE;
+
+ /* Since RandR (indirectly) uses SwitchMode(), we need to
+@@ -10485,21 +10482,18 @@
+ }
+
+ static void
+-SISNewAdjustFrame(int scrnIndex, int x, int y, int flags)
++SISNewAdjustFrame(ScrnInfoPtr pScrn, int x, int y)
+ {
+- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+
+ pSiS->AdjustFramePending = TRUE;
+ pSiS->AdjustFrameX = x;
+ pSiS->AdjustFrameY = y;
+- pSiS->AdjustFrameFlags = flags;
+ }
+
+ void
+-SISAdjustFrame(int scrnIndex, int x, int y, int flags)
++SISAdjustFrame(ScrnInfoPtr pScrn, int x, int y)
+ {
+- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+ UChar temp, cr11backup;
+ ULong base;
+@@ -10511,7 +10505,7 @@
+
+ #ifdef SISMERGED
+ if(pSiS->MergedFB) {
+- SISMFBAdjustFrame(scrnIndex, x, y, flags);
++ SISMFBAdjustFrame(pScrn, x, y);
+ return;
+ }
+ #endif
+@@ -10578,9 +10572,8 @@
+
+
+ static Bool
+-SISEnterVT(int scrnIndex, int flags)
++SISEnterVT(ScrnInfoPtr pScrn)
+ {
+- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+ SiS_SiSFB_Lock(pScrn, TRUE);
+
+@@ -10596,7 +10589,7 @@
+ /* No need to go through pScrn->AdjustFrame; Xv's
+ * EnterVT handles the overlay(s) anyway.
+ */
+- SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
++ SISAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
+
+
+ /* Mark for 3D full-screen bug */
+@@ -10625,15 +10618,14 @@
+
+
+ static void
+-SISLeaveVT(int scrnIndex, int flags)
++SISLeaveVT(ScrnInfoPtr pScrn)
+ {
+- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+ #ifdef SISDRI
+ ScreenPtr pScreen;
+
+ if(pSiS->directRenderingEnabled) {
+- pScreen = screenInfo.screens[scrnIndex];
++ pScreen = xf86ScreenToScrn(pScrn);
+ /* Mark for 3D full-screen bug */
+ /* DRILock(pScreen, 0); */
+ }
+@@ -10702,9 +10694,9 @@
+
+
+ static Bool
+-SISCloseScreen(int scrnIndex, ScreenPtr pScreen)
++SISCloseScreen(ScreenPtr pScreen)
+ {
+- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
++ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ SISPtr pSiS = SISPTR(pScrn);
+ #ifdef SISDUALHEAD
+ SISEntPtr pSiSEnt = pSiS->entityPrivate;
+@@ -10872,7 +10864,7 @@
+
+ pScreen->CloseScreen = pSiS->CloseScreen;
+
+- return(*pScreen->CloseScreen)(scrnIndex, pScreen);
++ return(*pScreen->CloseScreen)(pScreen);
+ }
+
+
+@@ -10883,10 +10875,9 @@
+ /* Free up any per-generation data structures */
+
+ static void
+-SISFreeScreen(int scrnIndex, int flags)
++SISFreeScreen(ScrnInfoPtr pScrn)
+ {
+ #ifdef SIS_NEED_MAP_IOP
+- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+
+ if(pSiS) {
+@@ -10900,7 +10891,7 @@
+ }
+ #endif
+
+- SISFreeRec(xf86Screens[scrnIndex]);
++ SISFreeRec(pScrn);
+ }
+
+
+@@ -11134,7 +11125,7 @@
+ pSiS->VBFlags3 = pSiS->VBFlags_backup3 = newvbflags3;
+
+ pSiS->skipswitchcheck = TRUE;
+- if(!((*pScrn->SwitchMode)(pScrn->scrnIndex,pScrn->currentMode,0)))
++ if(!((*pScrn->SwitchMode)(pScrn,pScrn->currentMode)))
+ {
+ pSiS->skipswitchcheck = FALSE;
+ return FALSE;
+@@ -11143,7 +11134,7 @@
+
+ /*xf86DrvMsg(0,X_INFO,"frameX0=%d, frameY0=%d.\n",pScrn->frameX0,pScrn->frameY0);*/
+
+- SISAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0,0);
++ SISAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
+
+ return TRUE;
+
+@@ -11204,14 +11195,14 @@
+ (*pSiS->SyncAccel)(pScrn);
+
+ pSiS->skipswitchcheck = TRUE;
+- if(!((*pScrn->SwitchMode)(pScrn->scrnIndex,pScrn->currentMode,0)))
++ if(!((*pScrn->SwitchMode)(pScrn,pScrn->currentMode)))
+ {
+ pSiS->skipswitchcheck = FALSE;
+ return FALSE;
+ }
+ pSiS->skipswitchcheck = FALSE;
+
+- SISAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0,0);
++ SISAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
+
+ return TRUE;
+ }
+@@ -11259,7 +11250,7 @@
+
+ xf86ZoomViewport(pScreen,1);
+
+- SISAdjustFrame(pScrn->scrnIndex,0,0,0);
++ SISAdjustFrame(pScrn,0,0);
+
+
+ return TRUE;
+@@ -11268,9 +11259,8 @@
+
+ /**************************************************************************/
+ static Bool
+-SISPMEvent(int scrnIndex, pmEvent event, Bool undo)
++SISPMEvent(ScrnInfoPtr pScrn, pmEvent event, Bool undo)
+ {
+- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+ unsigned char hotkeyflag = 0;/*check BIOS flag.*/
+ unsigned char checkflag = 0;/*just for test using.*/
+@@ -11287,13 +11277,13 @@
+ {
+ xf86DrvMsg(0,X_INFO,"PM_EVENT:event=%d,undo=%d.\n",event,undo);
+ if (!undo && !pSiS->suspended) {
+- pScrn->LeaveVT(scrnIndex, 0);
++ pScrn->LeaveVT(pScrn);
+ pSiS->suspended = TRUE;
+ sleep(0);
+ }
+ else if (undo && pSiS->suspended) {
+ sleep(0);
+- pScrn->EnterVT(scrnIndex, 0);
++ pScrn->EnterVT(pScrn);
+ pSiS->suspended = FALSE;
+ }
+ }
+@@ -11305,7 +11295,7 @@
+ {
+ if (pSiS->suspended) {
+ sleep(0);
+- pScrn->EnterVT(scrnIndex, 0);
++ pScrn->EnterVT(pScrn);
+ pSiS->suspended = FALSE;
+ SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
+ }
+diff -ur xf86-video-sis-0.9.1/src/sis_driver.h xf86-video-sis-0.9.1-bero/src/sis_driver.h
+--- xf86-video-sis-0.9.1/src/sis_driver.h 2012-10-20 00:10:10.296720683 +0200
++++ xf86-video-sis-0.9.1-bero/src/sis_driver.h 2012-10-20 00:04:47.586755113 +0200
+@@ -770,14 +770,14 @@
+ static void SISIdentify(int flags);
+ static Bool SISProbe(DriverPtr drv, int flags);
+ static Bool SISPreInit(ScrnInfoPtr pScrn, int flags);
+-static Bool SISScreenInit(int Index, ScreenPtr pScreen, int argc, char **argv);
+-static Bool SISEnterVT(int scrnIndex, int flags);
+-static void SISLeaveVT(int scrnIndex, int flags);
+-static Bool SISCloseScreen(int scrnIndex, ScreenPtr pScreen);
++static Bool SISScreenInit(ScreenPtr pScreen, int argc, char **argv);
++static Bool SISEnterVT(ScrnInfoPtr pScrn);
++static void SISLeaveVT(ScrnInfoPtr pScrn);
++static Bool SISCloseScreen(ScreenPtr pScreen);
+ static Bool SISSaveScreen(ScreenPtr pScreen, int mode);
+-static Bool SISSwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
+-static void SISNewAdjustFrame(int scrnIndex, int x, int y, int flags);
+-static Bool SISPMEvent(int scrnIndex, pmEvent event, Bool undo);/*APM-ACPI, adding by Ivans.*/
++static Bool SISSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
++static void SISNewAdjustFrame(ScrnInfoPtr pScrn, int x, int y);
++static Bool SISPMEvent(ScrnInfoPtr pScrn, pmEvent event, Bool undo);/*APM-ACPI, adding by Ivans.*/
+
+ #if XSERVER_LIBPCIACCESS
+ static Bool SIS_pci_probe(DriverPtr driver, int entity_num, struct pci_device *device, intptr_t match_data);
+@@ -791,8 +791,8 @@
+ #ifdef SISDUALHEAD
+ static Bool SISSaveScreenDH(ScreenPtr pScreen, int mode);
+ #endif
+-static void SISFreeScreen(int scrnIndex, int flags);
+-static ModeStatus SISValidMode(int scrnIndex, DisplayModePtr mode,
++static void SISFreeScreen(ScrnInfoPtr pScrn);
++static ModeStatus SISValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode,
+ Bool verbose, int flags);
+ #ifdef SIS_HAVE_RR_FUNC
+ #ifdef SIS_HAVE_DRIVER_FUNC
+@@ -811,7 +811,7 @@
+ static Bool SISMapIOPMem(ScrnInfoPtr pScrn);
+ static Bool SISUnmapIOPMem(ScrnInfoPtr pScrn);
+ #endif
+-void SISAdjustFrame(int scrnIndex, int x, int y, int flags);
++void SISAdjustFrame(ScrnInfoPtr pScrn, int x, int y);
+ UChar SISSearchCRT1Rate(ScrnInfoPtr pScrn, DisplayModePtr mode);
+ UShort SiS_CheckModeCRT1(ScrnInfoPtr pScrn, DisplayModePtr mode,
+ unsigned int VBFlags, unsigned int VBFlags3, Bool hcm);
+@@ -858,7 +858,7 @@
+ extern Bool SiSVGASaveScreen(ScreenPtr pScreen, int mode);
+
+ /* shadow, randr, randr-rotation */
+-extern void SISPointerMoved(int index, int x, int y);
++extern void SISPointerMoved(ScrnInfoPtr pScrn, int x, int y);
+ extern void SISRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
+ extern void SISRefreshAreaReflect(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
+ extern void SISRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
+@@ -922,8 +922,8 @@
+ extern Bool SiSMFBRebuildModelist(ScrnInfoPtr pScrn, ClockRangePtr clockRanges);
+ extern Bool SiSMFBRevalidateModelist(ScrnInfoPtr pScrn, ClockRangePtr clockRanges);
+ extern void SiSMFBSetDpi(ScrnInfoPtr pScrn1, ScrnInfoPtr pScrn2, SiSScrn2Rel srel);
+-extern void SISMFBPointerMoved(int scrnIndex, int x, int y);
+-extern void SISMFBAdjustFrame(int scrnIndex, int x, int y, int flags);
++extern void SISMFBPointerMoved(ScrnInfoPtr pScrn, int x, int y);
++extern void SISMFBAdjustFrame(ScrnInfoPtr pScrn, int x, int y);
+ #ifdef SISXINERAMA
+ extern void SiSXineramaExtensionInit(ScrnInfoPtr pScrn);
+ extern Bool SiSnoPanoramiXExtension;
+diff -ur xf86-video-sis-0.9.1/src/sis.h xf86-video-sis-0.9.1-bero/src/sis.h
+--- xf86-video-sis-0.9.1/src/sis.h 2012-10-20 00:10:10.361719870 +0200
++++ xf86-video-sis-0.9.1-bero/src/sis.h 2012-10-19 23:56:46.635767827 +0200
+@@ -73,6 +73,7 @@
+ #include "xf86Cursor.h"
+ #include "xf86cmap.h"
+ #include "vbe.h"
++#include "xf86fbman.h"
+
+ /*I.L. modified*/
+ #include "sispcirename.h"
+@@ -241,7 +242,7 @@
+ #define SIS_MAX_SUBPICTURES 2
+
+ #if !defined(SIS_USE_XAA) && !defined(SIS_USE_EXA)
+-#define SIS_USE_XAA
++#define SIS_USE_EXA
+ #endif
+
+ #ifdef SIS_USE_XAA
+@@ -1319,8 +1320,8 @@
+ #ifdef SIS_USE_XAA
+ void (*RenderCallback)(ScrnInfoPtr);
+ Time RenderTime;
+- FBLinearPtr AccelLinearScratch;
+ #endif
++ FBLinearPtr AccelLinearScratch;
+ #ifdef SIS_USE_EXA
+ void (*ExaRenderCallback)(ScrnInfoPtr);
+ Time ExaRenderTime;
+@@ -1342,7 +1343,7 @@
+ int SiSDPIVX, SiSDPIVY;
+ int virtualX, virtualY;
+ int Rotate, Reflect;
+- void (*PointerMoved)(int index, int x, int y);
++ void (*PointerMoved)(ScrnInfoPtr pScrn, int x, int y);
+
+ /* ShadowFB support */
+ Bool ShadowFB;
+@@ -1420,7 +1421,6 @@
+ Bool AdjustFramePending;
+ int AdjustFrameX;
+ int AdjustFrameY;
+- int AdjustFrameFlags;
+
+ /* DGA */
+ DGAModePtr DGAModes;
+diff -ur xf86-video-sis-0.9.1/src/sis_hwmc.c xf86-video-sis-0.9.1-bero/src/sis_hwmc.c
+--- xf86-video-sis-0.9.1/src/sis_hwmc.c 2012-10-20 00:10:10.348720033 +0200
++++ xf86-video-sis-0.9.1-bero/src/sis_hwmc.c 2012-10-19 23:38:25.482534137 +0200
+@@ -58,8 +58,10 @@
+ #include "xf86xvmc.h"
+ #include <X11/extensions/Xv.h>
+ #include <X11/extensions/XvMC.h>
++#ifdef SIS_USE_XAA
+ #include "xaa.h"
+ #include "xaalocal.h"
++#endif
+ #include "dixstruct.h"
+ #include "fourcc.h"
+ #include "sis_common.h"
+diff -ur xf86-video-sis-0.9.1/src/sis_mergedfb.c xf86-video-sis-0.9.1-bero/src/sis_mergedfb.c
+--- xf86-video-sis-0.9.1/src/sis_mergedfb.c 2012-10-20 00:10:10.351719996 +0200
++++ xf86-video-sis-0.9.1-bero/src/sis_mergedfb.c 2012-10-20 00:07:08.475993754 +0200
+@@ -1706,7 +1706,7 @@
+ /* Need to go the official way to avoid hw access and
+ * to update Xv's overlays
+ */
+- (pScrn1->AdjustFrame)(scrnIndex, pScrn1->frameX0, pScrn1->frameY0, 0);
++ (pScrn1->AdjustFrame)(pScrn1, pScrn1->frameX0, pScrn1->frameY0);
+ }
+ }
+
+diff -ur xf86-video-sis-0.9.1/src/sis_shadow.c xf86-video-sis-0.9.1-bero/src/sis_shadow.c
+--- xf86-video-sis-0.9.1/src/sis_shadow.c 2007-05-30 04:12:02.000000000 +0200
++++ xf86-video-sis-0.9.1-bero/src/sis_shadow.c 2012-10-20 00:08:12.018199367 +0200
+@@ -81,11 +81,11 @@
+ }
+
+ if(framechanged && pScrn->AdjustFrame)
+- pScrn->AdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
++ pScrn->AdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
+
+ } else {
+
+- (*pSiS->PointerMoved)(index, x, y);
++ (*pSiS->PointerMoved)(pScrn, x, y);
+
+ }
+ }
+diff -ur xf86-video-sis-0.9.1/src/sis_utility.c xf86-video-sis-0.9.1-bero/src/sis_utility.c
+--- xf86-video-sis-0.9.1/src/sis_utility.c 2012-10-20 00:10:10.352719983 +0200
++++ xf86-video-sis-0.9.1-bero/src/sis_utility.c 2012-10-20 00:09:45.884025883 +0200
+@@ -273,7 +273,7 @@
+ unsigned int VBFlags, unsigned int VBFlags3, Bool hcm);
+ extern UShort SiS_CheckModeCRT2(ScrnInfoPtr pScrn, DisplayModePtr mode,
+ unsigned int VBFlags, unsigned int VBFlags3, Bool hcm);
+-extern void SISAdjustFrame(int scrnIndex, int x, int y, int flags);
++extern void SISAdjustFrame(ScrnInfoPtr pScrn, int x, int y);
+ extern float SiSCalcVRate(DisplayModePtr mode);
+ extern void SiS_UpdateGammaCRT2(ScrnInfoPtr pScrn);
+ #ifdef SISGAMMARAMP
+@@ -427,7 +427,7 @@
+ (*pSiS->SyncAccel)(pScrn);
+
+ pSiS->skipswitchcheck = TRUE;
+- if(!((*pScrn->SwitchMode)(pScrn->scrnIndex, pScrn->currentMode, 0))) {
++ if(!((*pScrn->SwitchMode)(pScrn, pScrn->currentMode))) {
+ pSiS->skipswitchcheck = FALSE;
+ return FALSE;
+ }
+@@ -436,7 +436,7 @@
+ /* No need to go through pScrn->AdjustFrame; the coords
+ * didn't change
+ */
+- SISAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
++ SISAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
+
+ return TRUE;
+ }
+@@ -480,7 +480,7 @@
+ /* Sync the accelerators */
+ (*pSiS->SyncAccel)(pScrn);
+ pSiS->skipswitchcheck = TRUE;
+- if(!((*pScrn->SwitchMode)(pScrn->scrnIndex, pScrn->currentMode, 0))) {
++ if(!((*pScrn->SwitchMode)(pScrn, pScrn->currentMode))) {
+ pSiS->skipswitchcheck = FALSE;
+ return FALSE;
+ }
+@@ -489,7 +489,7 @@
+ /* No need to go through pScrn->AdjustFrame; the coords
+ * didn't change
+ */
+- SISAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
++ SISAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
+ }
+
+ return TRUE;
+@@ -624,7 +624,7 @@
+ pSiS->VBFlags3 = pSiS->VBFlags_backup3 = newvbflags3;
+
+ pSiS->skipswitchcheck = TRUE;
+- if(!(pScrn->SwitchMode(pScrn->scrnIndex, pScrn->currentMode, 0))) {
++ if(!(pScrn->SwitchMode(pScrn, pScrn->currentMode))) {
+ pSiS->skipswitchcheck = FALSE;
+ return FALSE;
+ }
+@@ -633,7 +633,7 @@
+ /* No need to go through pScrn->AdjustFrame; the coords
+ * didn't change
+ */
+- SISAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
++ SISAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
+
+ return TRUE;
+ }
+--- xf86-video-sis-0.9.1/src/sis6326_video.c.bero 2012-10-20 00:13:59.712852587 +0200
++++ xf86-video-sis-0.9.1/src/sis6326_video.c 2012-10-20 00:15:51.035460862 +0200
+@@ -72,7 +72,7 @@ static void SIS6326QueryBestSize(ScrnIn
+ short, unsigned int *,unsigned int *, pointer);
+ static int SIS6326PutImage( ScrnInfoPtr,
+ short, short, short, short, short, short, short, short,
+- int, unsigned char*, short, short, Bool, RegionPtr, pointer);
++ int, unsigned char*, short, short, Bool, RegionPtr, pointer, DrawablePtr);
+ static int SIS6326QueryImageAttributes(ScrnInfoPtr,
+ int, unsigned short *, unsigned short *, int *, int *);
+ static void SIS6326VideoTimerCallback(ScrnInfoPtr pScrn, Time now);
+@@ -1231,7 +1231,7 @@ SIS6326PutImage(
+ int id, unsigned char* buf,
+ short width, short height,
+ Bool sync,
+- RegionPtr clipBoxes, pointer data
++ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw
+ ){
+ SISPtr pSiS = SISPTR(pScrn);
+ SISPortPrivPtr pPriv = (SISPortPrivPtr)data;
+--- xf86-video-sis-0.9.1/src/sis_video.c.bero 2012-10-20 00:16:13.212183614 +0200
++++ xf86-video-sis-0.9.1/src/sis_video.c 2012-10-20 00:20:38.099872064 +0200
+@@ -3948,7 +3948,7 @@ SISPutImage(
+ int id, UChar *buf,
+ short width, short height,
+ Bool sync,
+- RegionPtr clipBoxes, pointer data
++ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw
+ ){
+ SISPtr pSiS = SISPTR(pScrn);
+ SISPortPrivPtr pPriv = (SISPortPrivPtr)data;
+@@ -4089,8 +4089,11 @@ SISPutImage(
+ static int
+ SISReputImage(
+ ScrnInfoPtr pScrn,
++ short src_x, short src_y,
+ short drw_x, short drw_y,
+- RegionPtr clipBoxes, pointer data
++ short src_w, short src_h,
++ short drw_w, short drw_h,
++ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw
+ ){
+ SISPtr pSiS = SISPTR(pScrn);
+ SISPortPrivPtr pPriv = (SISPortPrivPtr)data;
+--- xf86-video-sis-0.9.1/src/sis_video.h.bero 2012-10-20 00:16:58.076622733 +0200
++++ xf86-video-sis-0.9.1/src/sis_video.h 2012-10-20 00:20:18.443117807 +0200
+@@ -107,10 +107,13 @@ static void SISQueryBestSize(ScrnInfoPt
+ short, unsigned int *,unsigned int *, pointer);
+ static int SISPutImage(ScrnInfoPtr,
+ short, short, short, short, short, short, short, short,
+- int, UChar *, short, short, Bool, RegionPtr, pointer);
++ int, UChar *, short, short, Bool, RegionPtr, pointer, DrawablePtr);
+ static int SISReputImage(ScrnInfoPtr pScrn,
++ short src_x, short src_y,
+ short drw_x, short drw_y,
+- RegionPtr clipBoxes, pointer data);
++ short src_w, short src_h,
++ short drw_w, short drw_h,
++ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw);
+ static int SISQueryImageAttributes(ScrnInfoPtr,
+ int, UShort *, UShort *, int *, int *);
+ static void SISVideoTimerCallback(ScrnInfoPtr pScrn, Time now);
diff --git a/swap-func-rename.patch b/swap-func-rename.patch
new file mode 100644
index 000000000000..e22b388966f9
--- /dev/null
+++ b/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/sync-with-freedesktop.patch b/sync-with-freedesktop.patch
new file mode 100644
index 000000000000..eb15814ff238
--- /dev/null
+++ b/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/xf86-video-sis-0.9.1-20102701.patch b/xf86-video-sis-0.9.1-20102701.patch
new file mode 100644
index 000000000000..944eceb12b1a
--- /dev/null
+++ b/xf86-video-sis-0.9.1-20102701.patch
@@ -0,0 +1,1376 @@
+diff -p -up xf86-video-sis-0.9.1/src/sis.h.orig xf86-video-sis-0.9.1/src/sis.h
+--- xf86-video-sis-0.9.1/src/sis.h.orig 2010-01-27 15:27:11.000000000 -0500
++++ xf86-video-sis-0.9.1/src/sis.h 2010-01-27 15:22:42.000000000 -0500
+@@ -98,6 +98,7 @@
+ #define XF86_VERSION_CURRENT XF86_VERSION_NUMERIC(4,3,99,902,0)
+ #endif
+
++#if 0
+ /*** Xorg Version Path <= X-Server 2.0 ***/
+ /* K.T for xorg 1.3 */
+ #if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(2,0,0,0,0)
+@@ -109,33 +110,36 @@
+ #define NEW_XORG_VERSION 1
+ #endif
+ #endif
++#endif
++#define NEW_XORG_VERSION 1
+
+-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,0,0,0)
++//#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,0,0,0)
+ #define SIS_HAVE_RR_FUNC
+ #ifdef HaveDriverFuncs
+ #undef SIS_HaveDriverFuncs
+ #define SIS_HaveDriverFuncs HaveDriverFuncs
+ #define SIS_HAVE_DRIVER_FUNC
+ #endif /* HaveDriverFuncs */
+-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,99,900,0)
++//#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,99,900,0)
+ #define SISISXORG6899900
+-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,99,901,0)
++//#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,99,901,0)
+ #define SISISXORG6899901
+ #ifdef RANDR
+ #define SIS_HAVE_RR_GET_MODE_MM
+ #define SIS_HAVE_RANDR_SIZE_PATCH
+ #endif /* RANDR */
+-#endif /* >= 6.8.99.901 */
+-#endif /* >= 6.8.99.900 */
+-#endif /* >= 6.8.0.0 */
+-#else /* XORG_VERSION_CURRENT */
+-#include "xf86Version.h"
+-#define SISMYSERVERNAME "XFree86"
++//#endif /* >= 6.8.99.901 */
++//#endif /* >= 6.8.99.900 */
++//#endif /* >= 6.8.0.0 */
++//#else /* XORG_VERSION_CURRENT */
++//#include "xf86Version.h"
++//#define SISMYSERVERNAME "XFree86"
+ #endif
+
+ /*I.L. modified*/
+ //#define NEC_CASE /*It used the old Xorg_Version with new PCI structure.*/
+
++#if 0
+ #ifdef XSERVER_LIBPCIACCESS
+ #ifdef NEC_CASE
+ #define XORG_VERSION_CURRENT (((7) * 10000000) + ((1) * 100000) + ((0) * 1000) + 0)
+@@ -143,6 +147,7 @@
+ #define XORG_VERSION_CURRENT (((7) * 10000000) + ((4) * 100000) + ((0) * 1000) + 0)
+ #endif
+ #endif
++#endif
+
+
+ #define SIS_NAME "SIS"
+@@ -268,16 +273,16 @@
+
+ #undef SISCHECKOSSSE
+ #ifdef XORG_VERSION_CURRENT
+-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,99,13,0)
++//#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,99,13,0)
+ #define SISCHECKOSSSE /* Automatic check OS for SSE; requires SigIll facility */
+-#endif
++//#endif
+ #endif
+
+ #undef SISGAMMARAMP
+ #ifdef XORG_VERSION_CURRENT
+-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,99,13,0)
++//#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,99,13,0)
+ #define SISGAMMARAMP /* Driver can set gamma ramp; requires additional symbols in xf86sym.h */
+-#endif
++//#endif
+ #endif
+
+ #if 0 /* Perhaps for future use */
+@@ -1031,6 +1036,7 @@ typedef struct {
+ #endif
+
+ PCITAG PciTag;
++
+ int PciBus, PciDevice, PciFunc;
+ EntityInfoPtr pEnt;
+ int Chipset;
+diff -p -up xf86-video-sis-0.9.1/src/sis300_accel.c.orig xf86-video-sis-0.9.1/src/sis300_accel.c
+--- xf86-video-sis-0.9.1/src/sis300_accel.c.orig 2007-05-29 22:12:02.000000000 -0400
++++ xf86-video-sis-0.9.1/src/sis300_accel.c 2010-01-27 15:21:54.000000000 -0500
+@@ -1231,8 +1231,8 @@ SiS300AccelInit(ScreenPtr pScreen)
+
+ #ifdef SIS_USE_EXA /* ----------------------- EXA ----------------------- */
+ if(pSiS->useEXA) {
+-#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
+-
++//#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
++#if 0
+ if(pSiS->scrnOffset < 8192) {
+ int obase = 0;
+ /* data */
+@@ -1430,7 +1430,8 @@ SiS300AccelInit(ScreenPtr pScreen)
+ pSiS->exa_scratch = exaOffscreenAlloc(pScreen, 128 * 1024, 16, TRUE,
+ SiSScratchSave, pSiS);
+
+- #if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
++// #if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
++ #if 0
+ if(pSiS->exa_scratch) {
+ pSiS->exa_scratch_next = pSiS->exa_scratch->offset;
+ pSiS->EXADriverPtr->accel.UploadToScratch = SiSUploadToScratch;
+diff -p -up xf86-video-sis-0.9.1/src/sis310_accel.c.orig xf86-video-sis-0.9.1/src/sis310_accel.c
+--- xf86-video-sis-0.9.1/src/sis310_accel.c.orig 2007-09-29 05:13:12.000000000 -0400
++++ xf86-video-sis-0.9.1/src/sis310_accel.c 2010-01-27 15:21:54.000000000 -0500
+@@ -65,9 +65,9 @@
+ # define SIS_NEED_ARRAY
+ # undef SISNEWRENDER
+ # ifdef XORG_VERSION_CURRENT
+-# if XORG_VERSION_CURRENT > XORG_VERSION_NUMERIC(6,7,0,0,0)
++//# if XORG_VERSION_CURRENT > XORG_VERSION_NUMERIC(6,7,0,0,0)
+ # define SISNEWRENDER
+-# endif
++//# endif
+ # endif
+ # endif
+ #endif
+@@ -1463,7 +1463,7 @@ SiSUploadToScratch(PixmapPtr pSrc, Pixma
+ int dst_pitch, size, w, h, bytes;
+
+ w = pSrc->drawable.width;
+-
++/*
+ #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(6,8,2,0,0)
+ dst_pitch = ((w * (pSrc->drawable.bitsPerPixel >> 3)) +
+ pSiS->EXADriverPtr->card.offscreenPitch - 1) &
+@@ -1472,17 +1472,17 @@ SiSUploadToScratch(PixmapPtr pSrc, Pixma
+ dst_pitch = ((w * (pSrc->drawable.bitsPerPixel >> 3)) +
+ pSiS->EXADriverPtr->card.pixmapPitchAlign - 1) &
+ ~(pSiS->EXADriverPtr->card.pixmapPitchAlign - 1);
+-#else
++#else*/
+ dst_pitch = ((w * (pSrc->drawable.bitsPerPixel >> 3)) +
+ pSiS->EXADriverPtr->pixmapPitchAlign - 1) &
+ ~(pSiS->EXADriverPtr->pixmapPitchAlign - 1);
+
+-#endif
++//#endif
+ size = dst_pitch * pSrc->drawable.height;
+
+ if(size > pSiS->exa_scratch->size)
+ return FALSE;
+-
++/*
+ #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(6,8,2,0,0)
+ pSiS->exa_scratch_next = (pSiS->exa_scratch_next +
+ pSiS->EXADriverPtr->card.offscreenByteAlign - 1) &
+@@ -1491,34 +1491,34 @@ SiSUploadToScratch(PixmapPtr pSrc, Pixma
+ pSiS->exa_scratch_next = (pSiS->exa_scratch_next +
+ pSiS->EXADriverPtr->card.pixmapOffsetAlign - 1) &
+ ~(pSiS->EXADriverPtr->card.pixmapOffsetAlign - 1);
+-#else
++#else*/
+ pSiS->exa_scratch_next = (pSiS->exa_scratch_next +
+ pSiS->EXADriverPtr->pixmapOffsetAlign - 1) &
+ ~(pSiS->EXADriverPtr->pixmapOffsetAlign - 1);
+-#endif
+-
++//#endif
++/*
+ #if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
+ if(pSiS->exa_scratch_next + size >
+ pSiS->exa_scratch->offset + pSiS->exa_scratch->size) {
+ (pSiS->EXADriverPtr->accel.WaitMarker)(pSrc->drawable.pScreen, 0);
+ pSiS->exa_scratch_next = pSiS->exa_scratch->offset;
+ }
+-#else
++#else*/
+ if(pSiS->exa_scratch_next + size >
+ pSiS->exa_scratch->offset + pSiS->exa_scratch->size) {
+ (pSiS->EXADriverPtr->WaitMarker)(pSrc->drawable.pScreen, 0);
+ pSiS->exa_scratch_next = pSiS->exa_scratch->offset;
+ }
+-#endif
++//#endif
+
+ memcpy(pDst, pSrc, sizeof(*pDst));
+ pDst->devKind = dst_pitch;
+
+-#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
+- pDst->devPrivate.ptr = pSiS->EXADriverPtr->card.memoryBase + pSiS->exa_scratch_next;
+-#else
++//#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
++// pDst->devPrivate.ptr = pSiS->EXADriverPtr->card.memoryBase + pSiS->exa_scratch_next;
++//#else
+ pDst->devPrivate.ptr = pSiS->EXADriverPtr->memoryBase + pSiS->exa_scratch_next;
+-#endif
++//#endif
+
+ pSiS->exa_scratch_next += size;
+
+@@ -1762,7 +1762,8 @@ SiS315AccelInit(ScreenPtr pScreen)
+
+ #ifdef SIS_USE_EXA /* ----------------------- EXA ----------------------- */
+ if(pSiS->useEXA) {
+-#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
++#if 0
++//#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
+
+ int obase = 0;
+
+@@ -1952,11 +1953,11 @@ SiS315AccelInit(ScreenPtr pScreen)
+ SiSScratchSave, pSiS);
+ if(pSiS->exa_scratch) {
+ pSiS->exa_scratch_next = pSiS->exa_scratch->offset;
+- #if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
+- pSiS->EXADriverPtr->accel.UploadToScratch = SiSUploadToScratch;
+- #else
++ //#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
++ // pSiS->EXADriverPtr->accel.UploadToScratch = SiSUploadToScratch;
++ //#else
+ pSiS->EXADriverPtr->UploadToScratch = SiSUploadToScratch;
+- #endif
++ //#endif
+ }
+
+ } else {
+diff -p -up xf86-video-sis-0.9.1/src/sis_3daccel.c.orig xf86-video-sis-0.9.1/src/sis_3daccel.c
+--- xf86-video-sis-0.9.1/src/sis_3daccel.c.orig 2007-08-10 04:22:16.000000000 -0400
++++ xf86-video-sis-0.9.1/src/sis_3daccel.c 2010-01-27 15:21:54.000000000 -0500
+@@ -64,9 +64,9 @@
+ # define SIS_NEED_ARRAY
+ # undef SISNEWRENDER
+ # ifdef XORG_VERSION_CURRENT
+-# if XORG_VERSION_CURRENT > XORG_VERSION_NUMERIC(6,7,0,0,0)
++//# if XORG_VERSION_CURRENT > XORG_VERSION_NUMERIC(6,7,0,0,0)
+ # define SISNEWRENDER
+-# endif
++//# endif
+ # endif
+ # endif
+ #endif
+diff -p -up xf86-video-sis-0.9.1/src/sis_accel.c.orig xf86-video-sis-0.9.1/src/sis_accel.c
+--- xf86-video-sis-0.9.1/src/sis_accel.c.orig 2007-05-29 22:12:02.000000000 -0400
++++ xf86-video-sis-0.9.1/src/sis_accel.c 2010-01-27 15:21:54.000000000 -0500
+@@ -781,50 +781,50 @@ SiSAccelInit(ScreenPtr pScreen)
+
+ #ifdef SIS_USE_EXA /* ----------------------- EXA ----------------------- */
+ if(pSiS->useEXA) {
+-#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
++//#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
+
+ /* data */
+- pSiS->EXADriverPtr->card.memoryBase = pSiS->FbBase;
+- pSiS->EXADriverPtr->card.memorySize = pSiS->maxxfbmem;
+- pSiS->EXADriverPtr->card.offScreenBase = pScrn->displayWidth * pScrn->virtualY
+- * (pScrn->bitsPerPixel >> 3);
+- if(pSiS->EXADriverPtr->card.memorySize > pSiS->EXADriverPtr->card.offScreenBase) {
+- pSiS->EXADriverPtr->card.flags = EXA_OFFSCREEN_PIXMAPS;
+- } else {
+- pSiS->NoXvideo = TRUE;
+- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+- "Not enough video RAM for offscreen memory manager. Xv disabled\n");
+- }
+-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(6,8,2,0,0)
+- pSiS->EXADriverPtr->card.offscreenByteAlign = 8; /* src/dst: double quad word boundary */
+- pSiS->EXADriverPtr->card.offscreenPitch = 1;
+-#else
+- pSiS->EXADriverPtr->card.pixmapOffsetAlign = 8; /* src/dst: double quad word boundary */
+- pSiS->EXADriverPtr->card.pixmapPitchAlign = 8; /* could possibly be 1, but who knows for sure */
+-#endif
+- pSiS->EXADriverPtr->card.maxX = 2047;
+- pSiS->EXADriverPtr->card.maxY = 2047;
++// pSiS->EXADriverPtr->card.memoryBase = pSiS->FbBase;
++// pSiS->EXADriverPtr->card.memorySize = pSiS->maxxfbmem;
++// pSiS->EXADriverPtr->card.offScreenBase = pScrn->displayWidth * pScrn->virtualY
++// * (pScrn->bitsPerPixel >> 3);
++// if(pSiS->EXADriverPtr->card.memorySize > pSiS->EXADriverPtr->card.offScreenBase) {
++// pSiS->EXADriverPtr->card.flags = EXA_OFFSCREEN_PIXMAPS;
++// } else {
++// pSiS->NoXvideo = TRUE;
++// xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
++// "Not enough video RAM for offscreen memory manager. Xv disabled\n");
++// }
++//#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(6,8,2,0,0)
++// pSiS->EXADriverPtr->card.offscreenByteAlign = 8; /* src/dst: double quad word boundary */
++// pSiS->EXADriverPtr->card.offscreenPitch = 1;
++//#else
++// pSiS->EXADriverPtr->card.pixmapOffsetAlign = 8; /* src/dst: double quad word boundary */
++// pSiS->EXADriverPtr->card.pixmapPitchAlign = 8; /* could possibly be 1, but who knows for sure */
++//#endif
++// pSiS->EXADriverPtr->card.maxX = 2047;
++// pSiS->EXADriverPtr->card.maxY = 2047;
+
+ /* Sync */
+- pSiS->EXADriverPtr->accel.WaitMarker = SiSEXASync;
++// pSiS->EXADriverPtr->accel.WaitMarker = SiSEXASync;
+
+ /* Solid fill */
+- pSiS->EXADriverPtr->accel.PrepareSolid = SiSPrepareSolid;
+- pSiS->EXADriverPtr->accel.Solid = SiSSolid;
+- pSiS->EXADriverPtr->accel.DoneSolid = SiSDoneSolid;
++// pSiS->EXADriverPtr->accel.PrepareSolid = SiSPrepareSolid;
++// pSiS->EXADriverPtr->accel.Solid = SiSSolid;
++// pSiS->EXADriverPtr->accel.DoneSolid = SiSDoneSolid;
+
+ /* Copy */
+- pSiS->EXADriverPtr->accel.PrepareCopy = SiSPrepareCopy;
+- pSiS->EXADriverPtr->accel.Copy = SiSCopy;
+- pSiS->EXADriverPtr->accel.DoneCopy = SiSDoneCopy;
++// pSiS->EXADriverPtr->accel.PrepareCopy = SiSPrepareCopy;
++// pSiS->EXADriverPtr->accel.Copy = SiSCopy;
++// pSiS->EXADriverPtr->accel.DoneCopy = SiSDoneCopy;
+
+ /* Composite not supported */
+
+ /* Upload, download to/from Screen */
+- pSiS->EXADriverPtr->accel.UploadToScreen = SiSUploadToScreen;
+- pSiS->EXADriverPtr->accel.DownloadFromScreen = SiSDownloadFromScreen;
++// pSiS->EXADriverPtr->accel.UploadToScreen = SiSUploadToScreen;
++// pSiS->EXADriverPtr->accel.DownloadFromScreen = SiSDownloadFromScreen;
+
+-#else /*xorg>=7.0*/
++//#else /*xorg>=7.0*/
+
+ pSiS->EXADriverPtr->exa_major = 2;
+ pSiS->EXADriverPtr->exa_minor = 0;
+@@ -867,7 +867,7 @@ SiSAccelInit(ScreenPtr pScreen)
+
+ #endif /*end of Xorg>=7.0 EXA Setting*/
+ }
+-#endif /* EXA */
++//#endif /* EXA */
+
+ } /* NoAccel */
+
+@@ -946,11 +946,11 @@ SiSAccelInit(ScreenPtr pScreen)
+ SiSScratchSave, pSiS);
+ if(pSiS->exa_scratch) {
+ pSiS->exa_scratch_next = pSiS->exa_scratch->offset;
+- #if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
+- pSiS->EXADriverPtr->accel.UploadToScratch = SiSUploadToScratch;
+- #else
++ //#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
++ // pSiS->EXADriverPtr->accel.UploadToScratch = SiSUploadToScratch;
++ //#else
+ pSiS->EXADriverPtr->UploadToScratch = SiSUploadToScratch;
+- #endif
++ //#endif
+ }
+
+ } else {
+diff -p -up xf86-video-sis-0.9.1/src/sis_dri.c.orig xf86-video-sis-0.9.1/src/sis_dri.c
+--- xf86-video-sis-0.9.1/src/sis_dri.c.orig 2008-11-04 08:27:14.000000000 -0500
++++ xf86-video-sis-0.9.1/src/sis_dri.c 2010-01-27 15:21:54.000000000 -0500
+@@ -56,7 +56,8 @@ extern Bool drmSiSAgpInit(int driSubFD,
+
+ #ifdef XORG_VERSION_CURRENT
+ #define SISHAVECREATEBUSID
+-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(6,7,99,1,0)
++#if 0
++//#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(6,7,99,1,0)
+ /*I.L. modified*/
+ #ifndef XSERVER_LIBPCIACCESS
+ extern char *DRICreatePCIBusID(pciVideoPtr PciInfo);
+diff -p -up xf86-video-sis-0.9.1/src/sis_driver.c.orig xf86-video-sis-0.9.1/src/sis_driver.c
+--- xf86-video-sis-0.9.1/src/sis_driver.c.orig 2009-06-22 08:15:54.000000000 -0400
++++ xf86-video-sis-0.9.1/src/sis_driver.c 2010-01-27 15:21:54.000000000 -0500
+@@ -140,6 +140,17 @@ static int pix24bpp = 0;
+ * an upper-case version of the driver name.
+ */
+
++#if XSERVER_LIBPCIACCESS
++#define SIS_DEVICE_MATCH(d, i)\
++ {PCI_VENDOR_SIS, (d), PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, (i) }
++
++static const struct pci_id_match SIS_device_match[] = {
++ SIS_DEVICE_MATCH (PCI_CHIP_SIS670, 0),
++ SIS_DEVICE_MATCH (PCI_CHIP_SIS671, 0),
++ {0, 0, 0 },
++ };
++#endif
++
+ #ifdef _X_EXPORT
+ _X_EXPORT
+ #endif
+@@ -147,7 +158,11 @@ DriverRec SIS = {
+ SIS_CURRENT_VERSION,
+ SIS_DRIVER_NAME,
+ SISIdentify,
++#if XSERVER_LIBPCIACCESS
++ NULL,
++#else
+ SISProbe,
++#endif
+ SISAvailableOptions,
+ NULL,
+ 0
+@@ -155,6 +170,11 @@ DriverRec SIS = {
+ ,
+ SISDriverFunc
+ #endif
++#if XSERVER_LIBPCIACCESS
++ ,
++ SIS_device_match,
++ SIS_pci_probe
++#endif
+ };
+
+ static SymTabRec SISChipsets[] = {
+@@ -453,7 +473,94 @@ SISDriverFunc(ScrnInfoPtr pScrn, SISDRIV
+ /****************************************************/
+ /* Probe() */
+ /****************************************************/
++static Bool SIS_pci_probe (DriverPtr driver, int entity_num, struct pci_device *device, intptr_t match_data)
++{
++ ScrnInfoPtr pScrn;
++#ifdef SISDUALHEAD
++ EntityInfoPtr pEnt;
++ Bool foundScreen = FALSE;
++#endif
++xf86DrvMsg(0, X_INFO, "SIS_pci_probe - begin, entity_num=%d\n", entity_num);
++xf86DrvMsg(0, X_INFO, " vendor_id=0x%x\n", device->vendor_id);
++xf86DrvMsg(0, X_INFO, " device_id=0x%x\n", device->device_id);
++xf86DrvMsg(0, X_INFO, " bus=%d\n", device->bus);
++xf86DrvMsg(0, X_INFO, " dev=%d\n", device->dev);
++xf86DrvMsg(0, X_INFO, " func=%d\n", device->func);
++ pScrn = NULL;
++ if((pScrn = xf86ConfigPciEntity(pScrn, 0,
++ entity_num,
++ SISPciChipsets,
++ NULL, NULL, NULL, NULL, NULL))) {
++ xf86DrvMsg(0, X_INFO, "SIS_pci_probe - ConfigPciEntity found\n");
++ /* Fill in what we can of the ScrnInfoRec */
++ pScrn->driverVersion = SIS_CURRENT_VERSION;
++ pScrn->driverName = SIS_DRIVER_NAME;
++ pScrn->name = SIS_NAME;
++ pScrn->Probe = NULL;//SISProbe;
++ pScrn->PreInit = SISPreInit;
++ pScrn->ScreenInit = SISScreenInit;
++ pScrn->SwitchMode = SISSwitchMode;
++ pScrn->AdjustFrame = SISAdjustFrame;
++ pScrn->EnterVT = SISEnterVT;
++ pScrn->LeaveVT = SISLeaveVT;
++ pScrn->FreeScreen = SISFreeScreen;
++ pScrn->ValidMode = SISValidMode;
++ pScrn->PMEvent = SISPMEvent; /*add PM function for ACPI hotkey,Ivans*/
++#ifdef X_XF86MiscPassMessage
++// if(xf86GetVersion() >= XF86_VERSION_NUMERIC(4,3,99,2,0)) {
++// pScrn->HandleMessage = SISHandleMessage;
++// }
++#endif
++ foundScreen = TRUE;
++ }
++ #ifdef SISDUALHEAD
++ pEnt = xf86GetEntityInfo(entity_num);
++xf86DrvMsg(0, X_INFO, "SIS_pci_probe - GetEntityInfo chipset is 0x%x\n",pEnt->chipset);
++ switch(pEnt->chipset) {
++ case PCI_CHIP_SIS300:
++ case PCI_CHIP_SIS540:
++ case PCI_CHIP_SIS630:
++ case PCI_CHIP_SIS550:
++ case PCI_CHIP_SIS315:
++ case PCI_CHIP_SIS315H:
++ case PCI_CHIP_SIS315PRO:
++ case PCI_CHIP_SIS650:
++ case PCI_CHIP_SIS330:
++ case PCI_CHIP_SIS660:
++ case PCI_CHIP_SIS340:
++ case PCI_CHIP_SIS670:
++ case PCI_CHIP_SIS671:
++ case PCI_CHIP_XGIXG40:
++ {
++ SISEntPtr pSiSEnt = NULL;
++ DevUnion *pPriv;
++
++ xf86SetEntitySharable(entity_num);
++ if(SISEntityIndex < 0) {
++ SISEntityIndex = xf86AllocateEntityPrivateIndex();
++ }
++ pPriv = xf86GetEntityPrivate(pScrn->entityList[0], SISEntityIndex);
++ if(!pPriv->ptr) {
++ pPriv->ptr = xnfcalloc(sizeof(SISEntRec), 1);
++ pSiSEnt = pPriv->ptr;
++ memset(pSiSEnt, 0, sizeof(SISEntRec));
++ pSiSEnt->lastInstance = -1;
++ } else {
++ pSiSEnt = pPriv->ptr;
++ }
++ pSiSEnt->lastInstance++;
++ xf86SetEntityInstanceForScreen(pScrn, pScrn->entityList[0],
++ pSiSEnt->lastInstance);
++ }
++ break;
+
++ default:
++ break;
++ }
++#endif /* DUALHEAD */
++xf86DrvMsg(0, X_INFO, "SIS_pci_probe - end\n");
++ return foundScreen;
++}
+
+ static Bool
+ SISProbe(DriverPtr drv, int flags)
+@@ -464,7 +571,7 @@ SISProbe(DriverPtr drv, int flags)
+ int numDevSections;
+ int numUsed, numUsedSiS, numUsedXGI;
+ Bool foundScreen = FALSE;
+-
++xf86DrvMsg(0, X_INFO, "SISPRobe() begin, flags=%d\n", flags);
+ /*
+ * The aim here is to find all cards that this driver can handle,
+ * and for the ones not already claimed by another driver, claim
+@@ -490,6 +597,7 @@ SISProbe(DriverPtr drv, int flags)
+ * There's no matching device section in the config file, so quit
+ * now.
+ */
++ xf86DrvMsg(0, X_INFO, "SISProbe - MatchDevice fail\n");
+ return FALSE;
+ }
+
+@@ -526,14 +634,16 @@ SISProbe(DriverPtr drv, int flags)
+ xfree(devSections);
+
+ numUsed = numUsedSiS + numUsedXGI;
+-
+- if(numUsed <= 0)
++xf86DrvMsg(0, X_INFO, "SISPRobe - test1\n");
++ if(numUsed <= 0) {
++ xf86DrvMsg(0, X_INFO, "SISProbe - MatchPciInstances fail\n");
+ return FALSE;
++ }
+
+ if(flags & PROBE_DETECT) {
+
+ foundScreen = TRUE;
+-
++ xf86DrvMsg(0, X_INFO, "SISProbe - flags already probe");
+ } else for(i = 0; i < numUsed; i++) {
+
+ ScrnInfoPtr pScrn;
+@@ -548,6 +658,7 @@ SISProbe(DriverPtr drv, int flags)
+ (i < numUsedSiS) ? usedChipsSiS[i] : usedChipsXGI[i-numUsedSiS],
+ (i < numUsedSiS) ? SISPciChipsets : XGIPciChipsets,
+ NULL, NULL, NULL, NULL, NULL))) {
++ xf86DrvMsg(0, X_INFO, "SISProbe - ConfigPciEntity found\n");
+ /* Fill in what we can of the ScrnInfoRec */
+ pScrn->driverVersion = SIS_CURRENT_VERSION;
+ pScrn->driverName = SIS_DRIVER_NAME;
+@@ -563,16 +674,16 @@ SISProbe(DriverPtr drv, int flags)
+ pScrn->ValidMode = SISValidMode;
+ pScrn->PMEvent = SISPMEvent; /*add PM function for ACPI hotkey,Ivans*/
+ #ifdef X_XF86MiscPassMessage
+- if(xf86GetVersion() >= XF86_VERSION_NUMERIC(4,3,99,2,0)) {
+- pScrn->HandleMessage = SISHandleMessage;
++ if(xf86GetVersion() >= XF86_VERSION_NUMERIC(4,3,99,2,0)) {
++// pScrn->HandleMessage = SISHandleMessage;
+ }
+ #endif
+ foundScreen = TRUE;
+ }
+-
++xf86DrvMsg(0, X_INFO, "SISProbe - test2\n");
+ #ifdef SISDUALHEAD
+ pEnt = xf86GetEntityInfo((i < numUsedSiS) ? usedChipsSiS[i] : usedChipsXGI[i-numUsedSiS]);
+-
++ xf86DrvMsg(0, X_INFO, "SISProbe - GetEntityInfo done\n");
+ switch(pEnt->chipset) {
+ case PCI_CHIP_SIS300:
+ case PCI_CHIP_SIS540:
+@@ -620,7 +731,7 @@ SISProbe(DriverPtr drv, int flags)
+
+ if(usedChipsSiS) xfree(usedChipsSiS);
+ if(usedChipsXGI) xfree(usedChipsXGI);
+-
++xf86DrvMsg(0, X_INFO, "SISProbe end\n");
+ return foundScreen;
+ }
+
+@@ -1306,7 +1417,11 @@ SiSReadROM(ScrnInfoPtr pScrn)
+ }
+
+ if(readpci) {
++#ifndef XSERVER_LIBPCIACCESS
+ xf86ReadPciBIOS(0, pSiS->PciTag, 0, pSiS->BIOS, biossize);
++#else
++ pci_device_read_rom(pSiS->PciInfo, pSiS->BIOS);
++#endif
+ if(SISCheckBIOS(pSiS, mypciid, mypcivendor, biossize)) {
+ found = TRUE;
+ }
+@@ -2224,8 +2339,7 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScr
+ { 2, 0x04, 56.6 },
+ { 2, 0x02, 60.1 },
+ { 2, 0x01, 80.1 }
+- };
+-
++ };
+ const myvddctiming myvtiming[11] = {
+ { 1, 0x02, 56 },
+ { 1, 0x01, 60 },
+@@ -2240,11 +2354,6 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScr
+ { 2, 0x01, 75 }
+ };
+
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSSetSyncRangeFromEdid\n");
+-#endif
+-
+ if(flag) { /* HSync */
+
+ for(i = 0; i < 4; i++) {
+@@ -2350,12 +2459,6 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScr
+ static Bool
+ SiSAllowSyncOverride(SISPtr pSiS, Bool fromDDC, int mfbcrt)
+ {
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSAllowSyncOverride\n");
+-#endif
+-// return TRUE;
+-
+ if(!(pSiS->VBFlags2 & VB2_VIDEOBRIDGE)) return FALSE;
+
+ #ifdef SISDUALHEAD
+@@ -2382,11 +2485,10 @@ SiSAllowSyncOverride(SISPtr pSiS, Bool f
+ }
+ #endif
+
+-// PCF
+-// if(!(pSiS->VBFlags & DISPTYPE_CRT1)) {
++ if(!(pSiS->VBFlags & DISPTYPE_CRT1)) {
+ if( (pSiS->VBFlags & CRT2_TV) ||
+ ((pSiS->VBFlags & CRT2_LCD) && (!fromDDC)) ) return TRUE;
+-// } else if((pSiS->VBFlags & CRT1_LCDA) && (!fromDDC)) return TRUE;
++ } else if((pSiS->VBFlags & CRT1_LCDA) && (!fromDDC)) return TRUE;
+
+ return FALSE;
+ }
+@@ -2394,8 +2496,6 @@ SiSAllowSyncOverride(SISPtr pSiS, Bool f
+ static Bool
+ SiSCheckForH(float hsync, MonPtr monitor)
+ {
+-
+-
+ int i;
+ for(i = 0; i < monitor->nHsync; i++) {
+ if((hsync > monitor->hsync[i].lo * (1.0 - SYNC_TOLERANCE)) &&
+@@ -2409,7 +2509,6 @@ SiSCheckForH(float hsync, MonPtr monitor
+ static Bool
+ SiSCheckForV(float vrefresh, MonPtr monitor)
+ {
+-
+ int i;
+ for(i = 0; i < monitor->nVrefresh; i++) {
+ if((vrefresh > monitor->vrefresh[i].lo * (1.0 - SYNC_TOLERANCE)) &&
+@@ -2424,21 +2523,11 @@ static Bool
+ SiSCheckAndOverruleH(ScrnInfoPtr pScrn, MonPtr monitor)
+ {
+ DisplayModePtr mode = monitor->Modes;
+-// PCF
+ float mymin = 30.0, mymax = 80.0, hsync;
+-
+ Bool doit = FALSE;
+
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSCheckAndOverruleH\n");
+-#endif
+-
+ for(hsync = mymin; hsync <= mymax; hsync += .5) {
+- if(!SiSCheckForH(hsync, monitor))
+- {
+- doit = TRUE;
+- }
++ if(!SiSCheckForH(hsync, monitor)) doit = TRUE;
+ }
+
+ if(mode) {
+@@ -2461,7 +2550,6 @@ SiSCheckAndOverruleH(ScrnInfoPtr pScrn,
+ return TRUE;
+ }
+
+-
+ return FALSE;
+ }
+
+@@ -2469,20 +2557,11 @@ static Bool
+ SiSCheckAndOverruleV(ScrnInfoPtr pScrn, MonPtr monitor)
+ {
+ DisplayModePtr mode = monitor->Modes;
+-// PCF
+- float mymin = 57.0, mymax = 63.0, vrefresh;
++ float mymin = 59.0, mymax = 61.0, vrefresh;
+ Bool doit = FALSE, ret = FALSE;
+-
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSCheckAndOverruleV\n");
+-#endif
+
+ for(vrefresh = mymin; vrefresh <= mymax; vrefresh += 1.0) {
+- if(!SiSCheckForV(vrefresh, monitor))
+- {
+- doit = TRUE;
+- }
++ if(!SiSCheckForV(vrefresh, monitor)) doit = TRUE;
+ }
+
+ if(mode) {
+@@ -2515,7 +2594,6 @@ SiSCheckAndOverruleV(ScrnInfoPtr pScrn,
+ monitor->nVrefresh++;
+ ret = TRUE;
+ }
+-
+ return ret;
+ }
+
+@@ -2529,11 +2607,6 @@ SiSFixupHVRanges(ScrnInfoPtr pScrn, int
+ static const char *saneh = "Correcting %s CRT%d monitor HSync range\n";
+ static const char *sanev = "Correcting %s CRT%d monitor VRefresh range\n";
+ int crtnum;
+-
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSFixupHVRanges\n");
+-#endif
+
+ #ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode) {
+@@ -2610,8 +2683,7 @@ SiSFixupHVRanges(ScrnInfoPtr pScrn, int
+ }
+ }
+ }
+-// PCF
+-// return TRUE;
++
+ return freqoverruled;
+ }
+
+@@ -2623,11 +2695,6 @@ SiSMakeOwnModeList(ScrnInfoPtr pScrn, Bo
+ Bool isfordvi, Bool *havecustommodes, Bool fakecrt2modes, Bool IsForCRT2)
+ {
+ DisplayModePtr tempmode, delmode, mymodes;
+-
+- // PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSMakeOwnModeList\n");
+-#endif
+
+ if((mymodes = SiSBuildBuiltInModeList(pScrn, includelcdmodes, isfordvi, fakecrt2modes, IsForCRT2))) {
+ if(!acceptcustommodes) {
+@@ -2676,11 +2743,6 @@ SiSSetupModeListParmsCRT1(SISPtr pSiS, u
+ Bool *acceptcustommodes, Bool *includelcdmodes, Bool *isfordvi,
+ Bool *fakecrt2modes, Bool *IsForCRT2, Bool *AllowInterlace)
+ {
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSSetupModeListParmsCRT1\n");
+-#endif
+-
+ (*acceptcustommodes) = TRUE; /* Accept user modelines */
+ (*includelcdmodes) = TRUE; /* Include modes reported by DDC */
+ (*isfordvi) = FALSE; /* Is for digital DVI output */
+@@ -2815,11 +2877,6 @@ SiSReplaceModeList(ScrnInfoPtr pScrn, Cl
+ * -) crt2 device is not TV, and
+ * -) crt1 is not LCDA, unless bridge is TMDS/LCDA capable (301C)
+ */
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSReplaceModeList\n");
+-#endif
+-
+
+ if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
+
+@@ -2881,11 +2938,6 @@ SiSClearModesPrivate(DisplayModePtr mode
+ {
+ DisplayModePtr tempmode;
+
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSClearModesPrivate\n");
+-#endif
+-
+ /* Make sure that the Private field is NULL */
+ /* (This way we don't have to care for MergedFB
+ * when freeing the mode; just check the Private
+@@ -2904,11 +2956,6 @@ SiSDuplicateMode(DisplayModePtr source)
+ {
+ DisplayModePtr dest = NULL;
+
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSDuplicateMode\n");
+-#endif
+-
+ if(source) {
+ if((dest = xalloc(sizeof(DisplayModeRec)))) {
+ memcpy(dest, source, sizeof(DisplayModeRec));
+@@ -2972,11 +3019,6 @@ SiSBuildVesaModeList(ScrnInfoPtr pScrn,
+ SISPtr pSiS = SISPTR(pScrn);
+ int i = 0;
+
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSBuildVesaModeList\n");
+-#endif
+-
+ while(vbe->VideoModePtr[i] != 0xffff) {
+ sisModeInfoPtr m;
+ VbeModeInfoBlock *mode;
+@@ -3014,7 +3056,7 @@ SiSSetMinMaxPixelClock(ScrnInfoPtr pScrn
+ {
+ SISPtr pSiS = SISPTR(pScrn);
+ MessageType from;
+-
++
+ /* Set the min pixel clock */
+ pSiS->MinClock = 5000;
+ if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
+@@ -3061,11 +3103,6 @@ SiSRemoveUnsuitableModes(ScrnInfoPtr pSc
+ int maxUsedClock = 0;
+ static const char *notsuitablestr = "Not using mode \"%s\" (not suitable for %s mode)\n";
+
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSRemoveUnsuitableModes\n");
+-#endif
+-
+ if((p = first = initial)) {
+
+ do {
+@@ -3222,11 +3259,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ static const char *crtsetupstr = "*************************** CRT%d setup ***************************\n";
+ #endif
+
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SISPreInit Start\n");
+-#endif
+-
+ if(flags & PROBE_DETECT) {
+
+ vbeInfoPtr pVbe;
+@@ -4716,10 +4748,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ mymax = 8192 * 1024;
+ else if(total <= 32768) /* <= 32MB: Use 16MB for X */
+ mymax = 16384 * 1024;
+- else
+-// PCF /* Otherwise: Use 20MB for X */
+-// mymax = 20 * 1024 * 1024;
+- mymax = 20 * 1024 *1024;
++ else /* Otherwise: Use 20MB for X */
++ mymax = 20 * 1024 * 1024;
+ /* availMem is right now adjusted to not use the UMA
+ * area. Make sure that our default doesn't reach
+ * into the UMA area either.
+@@ -4758,9 +4788,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ if(pScrn->videoRam <= 65536)
+ pSiS->maxxfbmem = 16384 * 1024; /* On >=315 series and <=64MB, use 16MB */
+ else
+-// PCF
+-// pSiS->maxxfbmem = 20 * 1024 * 1024; /* On >=315 series and > 64MB, use 20MB */
+- pSiS->maxxfbmem = 20 * 1024 * 1024;
++ pSiS->maxxfbmem = 20 * 1024 * 1024; /* On >=315 series and > 64MB, use 20MB */
+ } else
+ pSiS->maxxfbmem = 12288 * 1024; /* On <315 series, use 12MB */
+
+@@ -4980,7 +5008,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ * via CRT2.)
+ * (TODO: This might need some modification for the
+ * 307 bridges, if these are capable of driving
+- * LCDs > via channel B)
++ * LCDs > 1600 via channel B)
+ */
+ if((pSiS->SiS_SD_Flags & SiS_SD_SUPPORTLCDA) &&
+ (pSiS->VBFlags & CRT2_LCD) &&
+@@ -4995,10 +5023,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ */
+ if(pSiS->ChipType < SIS_662 || pSiS->ChipType >= XGI_20) pSiS->ForceCRT1Type = CRT1_LCDA;
+ pSiS->ForceCRT2Type = CRT2_TV;
+-// PCF
+-// } else if(pSiS->LCDwidth > 1600) {
+- } else if(pSiS->LCDwidth > 1920) {
+-
++ } else if(pSiS->LCDwidth > 1600) {
+ /* If LCD is > 1600, default to LCDA if we don't need CRT1/VGA for other head */
+ Bool NeedCRT1VGA = FALSE;
+ #ifdef SISDUALHEAD
+@@ -5591,11 +5616,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ clockRanges->minClock = pSiS->MinClock;
+ clockRanges->maxClock = pSiS->MaxClock;
+ clockRanges->clockIndex = -1; /* programmable */
+-// PCF
+-// clockRanges->interlaceAllowed = TRUE;
+-// clockRanges->doubleScanAllowed = TRUE;
+- clockRanges->interlaceAllowed = FALSE;
+- clockRanges->doubleScanAllowed = FALSE;
++ clockRanges->interlaceAllowed = TRUE;
++ clockRanges->doubleScanAllowed = TRUE;
+
+ /* Replace default mode list */
+ SiSReplaceModeList(pScrn, clockRanges, FALSE);
+@@ -5623,11 +5645,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ break;
+ case SIS_300_VGA:
+ case SIS_315_VGA:
+-// PCF
+ maxpitch = 4088;
+- maxheight = 4096;
+-// maxpitch = 1600;
+-// maxheight = 1200;
++ maxheight = 4096;
+ break;
+ default:
+ maxpitch = 2048;
+@@ -5688,12 +5707,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ pScrn->monitor->DDC = NULL;
+ }
+ #endif
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"xf86ValidateModes Start\n");
+- xf86DrvMsg(0, X_INFO,"virtualX = %d, virtualY = %d, maxpitch = %d, maxheight = %d, maxxfbmem = %ld \n",
+- pScrn->display->virtualX,pScrn->display->virtualY,maxpitch,maxheight,pSiS->maxxfbmem/1024);
+-#endif
++
+ i = xf86ValidateModes(pScrn,
+ pScrn->monitor->Modes,
+ pScrn->display->modes,
+@@ -5703,13 +5717,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ pScrn->bitsPerPixel * 8,
+ minheight, maxheight,
+ pScrn->display->virtualX,
+- pScrn->display->virtualY,
++ pScrn->display->virtualY,
+ pSiS->maxxfbmem,
+ LOOKUP_BEST_REFRESH);
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"xf86ValidateModes End\n");
+-#endif
+
+ pScrn->monitor->DDC = backupddc;
+ }
+@@ -5745,28 +5755,17 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ #endif
+
+ /* Prune the modes marked as invalid */
+-// PCF
+-// xf86DrvMsg(0, X_INFO,"xf86PruneDriverModes Start\n");
+ xf86PruneDriverModes(pScrn);
+-// xf86DrvMsg(0, X_INFO,"xf86PruneDriverModes End\n");
+-
+
+ if(i == 0 || pScrn->modes == NULL) {
+ SISErrorLog(pScrn, "No valid modes found - check VertRefresh/HorizSync\n");
+ goto my_error_1;
+ }
+
+-// PCF
+-// xf86DrvMsg(0, X_INFO,"xf86SetCrtcForModes Start\n");
+ xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V);
+-// xf86DrvMsg(0, X_INFO,"xf86SetCrtcForModes End\n");
+-
+
+ /* Clear the modes' Private field */
+-// PCF
+-// xf86DrvMsg(0, X_INFO,"SiSClearModesPrivate Start\n");
+ SiSClearModesPrivate(pScrn->modes);
+-// xf86DrvMsg(0, X_INFO,"SiSClearModesPrivate End\n");
+
+ /* Save virtualX/Y calculated by ValidateModes
+ * and overwrite them with our values assumed to
+@@ -5823,23 +5822,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ }
+
+ if(usemyprint) {
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SiSPrintModes Start\n");
+-#endif
+ SiSPrintModes(pScrn, printfreq);
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SiSPrintModes End\n");
+-#endif
+ } else {
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"xf86PrintModes Start\n");
+-#endif
+ xf86PrintModes(pScrn);
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"xf86PrintModes End\n");
+-#endif
+ }
+ }
+
+@@ -6072,10 +6057,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+
+ /*xf86DrvMsg(0,X_INFO,"CurrentMode=%d. \n",pSiS->Hkey_Device_Switch_State);
+ xf86DrvMsg(0,X_INFO,"Init_VBFlags=0X%x. \n",pSiS->VBFlags);*/
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0,X_INFO,"SISPreInit End\n");
+-#endif
++
+ return TRUE;
+
+ /* ---- */
+@@ -7523,9 +7505,7 @@ SiSPreSetMode(ScrnInfoPtr pScrn, Display
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, SISVERBLEVEL, "VBFlags=0x%x\n", pSiS->VBFlags);
+
+ CR30 = 0x00;
+-// PCF
+-// CR31 &= ~0x60; /* Clear VB_Drivermode & VB_OutputDisable */
+- CR31 &= ~0x20; /* Clear VB_Drivermode & VB_OutputDisable */
++ CR31 &= ~0x60; /* Clear VB_Drivermode & VB_OutputDisable */
+ CR31 |= 0x04; /* Set VB_NotSimuMode (not for 30xB/1400x1050?) */
+ CR35 = 0x00;
+
+@@ -8633,11 +8613,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ SISEntPtr pSiSEnt = NULL;
+ #endif
+
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit\n");
+-#endif
+-
+ andSISIDXREG(SISCR,0x11,0x7f); /* Unlock CRTC registers */
+
+ SISModifyModeInfo(mode); /* Quick check of the mode parameters */
+@@ -8647,14 +8622,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ }
+
+ if(pSiS->UseVESA) { /* With VESA: */
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit UseVESA\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit UseVESA\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit UseVESA\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit UseVESA\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit UseVESA\n");
+-#endif
+
+ #ifdef SISDUALHEAD
+ /* No dual head mode when using VESA */
+@@ -8679,7 +8646,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ SISErrorLog(pScrn, "SiSSetVESAMode() failed\n");
+ return FALSE;
+ }
+-
+ sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
+ if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
+ SiSPreSetMode(pScrn, mode, SIS_MODE_SIMU);
+@@ -8697,21 +8663,11 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ SiSVGAProtect(pScrn, TRUE);
+ (*pSiS->SiSRestore)(pScrn, &pSiS->ModeReg);
+ SiSVGAProtect(pScrn, FALSE);
+-// xf86DrvMsg(0, X_INFO,"VESA DualHeadMode SetMode\n");
++
+ } else { /* Without VESA: */
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit Without VESA\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit Without VESA\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit Without VESA\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit Without VESA\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit Without VESA\n");
+-#endif
+
+ #ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode) {
+-
+- xf86DrvMsg(0, X_INFO,"SISModeInit DualHeadMode\n");
+
+ if(!(*pSiS->ModeInit)(pScrn, mode)) {
+ SISErrorLog(pScrn, "ModeInit() failed\n");
+@@ -8730,10 +8686,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ SISErrorLog(pScrn, "SiSBIOSSetModeCRT2() failed\n");
+ return FALSE;
+ }
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"DualHeadMode SetCRT2\n");
+-#endif
+ SiSPostSetMode(pScrn, &pSiS->ModeReg);
+ if(pSiSEnt->pScrn_2) {
+ /* No need to go through pScrn->AdjustFrame; the coords
+@@ -8752,11 +8704,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ SISErrorLog(pScrn, "SiSBIOSSetModeCRT1() failed\n");
+ return FALSE;
+ }
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"DualHeadMode SetCRT1\n");
+-#endif
+-
+ SiS_SiSLVDSBackLight(pSiS, TRUE);
+ SiSPostSetMode(pScrn, &pSiS->ModeReg);
+ if(pSiSEnt->pScrn_1) {
+@@ -8771,20 +8718,8 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+
+ } else {
+ #endif
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit Other\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit Other\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit Other\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit Other\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit Other\n");
+-#endif
+
+ if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit SIS_315_VGA\n");
+-#endif
+
+ if(!(*pSiS->ModeInit)(pScrn, mode)) {
+ SISErrorLog(pScrn, "ModeInit() failed\n");
+@@ -8795,10 +8730,7 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+
+ #ifdef SISMERGED
+ if(pSiS->MergedFB) {
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit SISMERGED\n");
+-#endif
++
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting MergedFB mode %dx%d\n",
+ mode->HDisplay, mode->VDisplay);
+
+@@ -8813,10 +8745,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ SISErrorLog(pScrn, "SiSBIOSSetModeCRT1() failed\n");
+ return FALSE;
+ }
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISMERGED SetCRT1\n");
+-#endif
+
+ SiSPreSetMode(pScrn, mode, SIS_MODE_CRT2);
+
+@@ -8827,10 +8755,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ SISErrorLog(pScrn, "SiSBIOSSetModeCRT2() failed\n");
+ return FALSE;
+ }
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISMERGED SetCRT2\n");
+-#endif
+
+ SiS_SiSLVDSBackLight(pSiS, TRUE);
+
+@@ -8838,25 +8762,9 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+
+ } else {
+ #endif
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit Not SISMERGED\n");
+-#endif
+
+ if((pSiS->VBFlags & CRT1_LCDA) || (!(mode->type & M_T_DEFAULT))) {
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit #1\n");
+- if(pSiS->VBFlags & CRT1_LCDA)
+- {
+- xf86DrvMsg(0, X_INFO,"SISModeInit #1 LCDA\n");
+-
+- }
+- else
+- {
+- xf86DrvMsg(0, X_INFO,"SISModeInit #1 LCDB\n");
+- }
+-#endif
++
+ pSiS->SiS_Pr->SiS_EnableBackLight = FALSE;
+
+ SiSPreSetMode(pScrn, mode, SIS_MODE_CRT1);
+@@ -8867,10 +8775,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ SISErrorLog(pScrn, "SiSBIOSSetModeCRT1() failed\n");
+ return FALSE;
+ }
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"NoVESA SetCRT1\n");
+-#endif
+
+ SiSPreSetMode(pScrn, mode, SIS_MODE_CRT2);
+
+@@ -8880,28 +8784,10 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ SISErrorLog(pScrn, "SiSBIOSSetModeCRT2() failed\n");
+ return FALSE;
+ }
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"NoVESA SetCRT2\n");
+-#endif
+-
+
+ SiS_SiSLVDSBackLight(pSiS, TRUE);
+
+ } else {
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit #2\n");
+-
+- if(pSiS->VBFlags & CRT1_LCDA)
+- {
+- xf86DrvMsg(0, X_INFO,"SISModeInit #2 LCDA\n");
+- }
+- else
+- {
+- xf86DrvMsg(0, X_INFO,"SISModeInit #2 LCDB\n");
+- }
+-#endif
+
+ pSiS->SiS_Pr->SiS_EnableBackLight = TRUE;
+
+@@ -8918,11 +8804,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ #ifdef SISMERGED
+ }
+ #endif
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit #3\n");
+-#endif
+-
+ SiSPostSetMode(pScrn, &pSiS->ModeReg);
+ #ifdef TWDEBUG
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VBFlags %lx\n", pSiS->VBFlags);
+@@ -8932,10 +8813,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ #endif
+
+ } else {
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit Old method\n");
+-#endif
+
+ /* For other chipsets, use the old method */
+
+@@ -9147,7 +9024,7 @@ SISSaveScreenDH(ScreenPtr pScreen, int m
+ static void
+ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags)
+ {
+- SISPtr pSiS = SISPTR(pScrn);
++ SISPtr pSiS = SISPTR(pScrn);
+ Bool docrt1 = TRUE, docrt2 = TRUE, backlight = TRUE;
+ UChar sr1=0, cr17=0, cr63=0, pmreg=0, sr7=0;
+ UChar p1_13=0, p2_0=0, oldpmreg=0;
+@@ -10237,7 +10114,6 @@ SISScreenInit(int scrnIndex, ScreenPtr p
+ static Bool
+ SiSValidLCDUserMode(SISPtr pSiS, unsigned int VBFlags, DisplayModePtr mode, Bool isforlcda)
+ {
+-
+ if(mode->Flags & V_INTERLACE) return FALSE;
+
+ if(mode->HDisplay > 2048) return FALSE;
+@@ -10352,7 +10228,7 @@ SiS_CheckModeCRT1(ScrnInfoPtr pScrn, Dis
+ }
+
+ }
+-
++
+ return(SiS_GetModeID(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay,
+ i, pSiS->FSTN, pSiS->LCDwidth, pSiS->LCDheight));
+ }
+@@ -10370,12 +10246,8 @@ SiS_CheckModeCRT2(ScrnInfoPtr pScrn, Dis
+ xf86DrvMsg(0, X_INFO, "Inside CheckCalcModeIndex (VBFlags %lx, mode %dx%d)\n",
+ VBFlags,mode->HDisplay, mode->VDisplay);
+ #endif
++
+ if(VBFlags & CRT2_LCD) { /* CRT2 is LCD */
+-
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiS_CheckModeCRT2 LCDwidth= %d, LCDheight= %d\n",pSiS->LCDwidth,pSiS->LCDheight);
+-#endif
+
+ if((pSiS->VBFlags2 & VB2_SISTMDSBRIDGE) && (!(pSiS->VBFlags2 & VB2_30xBDH))) {
+
+@@ -10403,7 +10275,6 @@ SiS_CheckModeCRT2(ScrnInfoPtr pScrn, Dis
+ return 0xfe;
+
+ }
+-// PCF
+
+ if( ((mode->HDisplay <= pSiS->LCDwidth) &&
+ (mode->VDisplay <= pSiS->LCDheight)) ||
+@@ -10415,15 +10286,11 @@ SiS_CheckModeCRT2(ScrnInfoPtr pScrn, Dis
+ (((mode->HDisplay == 1024) && (mode->HDisplay == 768)) ||
+ ((mode->HDisplay == 800) && (mode->HDisplay == 600)))) ||
+ ((pSiS->EnablePanel_1366x768)&&(pSiS->LCDwidth==1366)&&(mode->HDisplay==1368))) {/*let 1366x768 mode valid. Ivans@090109*/
+-/*
+- if( (mode->HDisplay <= pSiS->LCDwidth) &&
+- (mode->VDisplay <= pSiS->LCDheight)) {
+-*/
++
+ ModeIndex = SiS_GetModeID_LCD(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay, i,
+ pSiS->FSTN, pSiS->SiS_Pr->SiS_CustomT, pSiS->LCDwidth, pSiS->LCDheight,
+ pSiS->VBFlags2);
+-// PCF
+-// xf86DrvMsg(0, X_INFO, "SiS_CheckModeCRT2 LCDwidth= %d, LCDheight= %d, ModeID= %x\n",pSiS->LCDwidth,pSiS->LCDheight,ModeIndex);
++
+ }
+
+ } else if(VBFlags & CRT2_TV) { /* CRT2 is TV */
+@@ -10514,7 +10381,7 @@ SISValidMode(int scrnIndex, DisplayModeP
+ if(SiS_CheckModeCRT2(pScrn, mode, pSiS->VBFlags,
+ pSiS->VBFlags3, pSiS->HaveCustomModes) < 0x14){
+ #ifdef TWDEBUG
+- xf86DrvMsg(0,X_INFO,"[SISValidMode()]: else condition. passing CheckModeCRT2 and MODE_Fail.\n");
++ xf86DrvMsg(0,X_INFO,"[SISValidMode()]: else condition. passing CheckModeCRT2 and MODE_OK.\n");
+ #endif
+ return MODE_BAD;
+ }
+@@ -10629,18 +10496,12 @@ SISSwitchMode(int scrnIndex, DisplayMode
+ * (In non-MergedFB mode this is also here in order
+ * to get a cheap update of the HWCursor image)
+ */
+-
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0,X_INFO,"SISSwitchMode\n");
+-#endif
+
+ if(!pSiS->skipswitchcheck) {
+ if(SISValidMode(scrnIndex, mode, TRUE, flags) != MODE_OK) {
+ return FALSE;
+ }
+ }
+-
+ /* Mark for 3D full-screen bug */
+ /*
+ #ifdef XF86DRI
+@@ -11510,12 +11371,6 @@ SISHotkeySwitchMode(ScrnInfoPtr pScrn, B
+ int dotclock=65146;
+ int hdisplay=1024;
+
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0,X_INFO,"SISHotkeySwitchMode\n");
+-#endif
+-
+-
+ if(!VidModeGetCurrentModeline(pScrn->scrnIndex,&hkeymode,&dotClock))
+ return FALSE;
+
+diff -p -up xf86-video-sis-0.9.1/src/sis_driver.h.orig xf86-video-sis-0.9.1/src/sis_driver.h
+--- xf86-video-sis-0.9.1/src/sis_driver.h.orig 2008-09-02 10:19:02.000000000 -0400
++++ xf86-video-sis-0.9.1/src/sis_driver.h 2010-01-27 15:21:54.000000000 -0500
+@@ -779,6 +779,9 @@ static Bool SISSwitchMode(int scrnIndex,
+ static void SISNewAdjustFrame(int scrnIndex, int x, int y, int flags);
+ static Bool SISPMEvent(int scrnIndex, pmEvent event, Bool undo);/*APM-ACPI, adding by Ivans.*/
+
++#if XSERVER_LIBPCIACCESS
++static Bool SIS_pci_probe(DriverPtr driver, int entity_num, struct pci_device *device, intptr_t match_data);
++#endif
+ /* ACPI Device Switch functions */
+ static Bool SISHotkeySwitchCRT1Status(ScrnInfoPtr pScrn,int onoff);/*hotkey pressing: switch CRT1 on/off*/
+ static Bool SISHotkeySwitchCRT2Status(ScrnInfoPtr pScrn,ULong newvbflags ,ULong newvbflags3);/*LCD on/off*/
diff --git a/xf86-video-sis-0.9.1-dump-regs-after-video-init.patch b/xf86-video-sis-0.9.1-dump-regs-after-video-init.patch
new file mode 100644
index 000000000000..41598592107d
--- /dev/null
+++ b/xf86-video-sis-0.9.1-dump-regs-after-video-init.patch
@@ -0,0 +1,89 @@
+--- xf86-video-sis-0.9.1/src/sis_driver.c.orig 2010-01-18 13:17:56.000000000 -0500
++++ xf86-video-sis-0.9.1/src/sis_driver.c 2010-01-25 16:35:40.000000000 -0500
+@@ -11677,7 +11677,64 @@ SISPMEvent(int scrnIndex, pmEvent event,
+ return 1;/*TRUE*/
+ }
+
++void
++sis_print_registers(SISPtr pSiS)
++{
++#define print(...) xf86ErrorFVerb(1, __VA_ARGS__)
++ auto void print_range(char *name, int base, int first, int last) {
++ int i, j;
++ unsigned char c;
++ char buffer[9];
++ print("%s:\n", name);
++ buffer[8] = 0;
++ for (i = first; i <= last; i++) {
++ inSISIDXREG(base, i, c);
++ for (j = 0; j < 8; j++)
++ buffer[7 - j] = c & (1 << j) ? '1' : '0';
++ print("\t%02x: %02x:%s\n", i, c, buffer);
++ }
++ }
+
++ auto void print_range_int(char *name, int base, int first, int last) {
++ int i, j;
++ unsigned int l;
++ char buffer[33];
++ print("%s:\n", name);
++ buffer[32] = 0;
++ for (i = first; i <= last; i += 4) {
++ l = inSISREGL(base + i);
++ for (j = 0; j < 32; j++)
++ buffer[31 - j] = l & (1 << j) ? '1' : '0';
++ print("\t%02x: %08x:%s\n", i, l, buffer);
++ }
++ }
+
+-
+-
++ print_range_int ("PCI: CNF00 - CNF1B", pSiS->RelIO, 0x00, 0x1b);
++ print_range_int ("PCI: CNF2C - CNF47", pSiS->RelIO, 0x2C, 0x47);
++ print_range_int ("AGP: CNF50 - CNF5B", pSiS->RelIO, 0x50, 0x5B);
++ print_range ("CRT1: SR05 - SR12", SISSR, 0x05, 0x12);
++ print_range ("CRT1: SR13 - SR16 (reserved)", SISSR, 0x13, 0x16);
++ print ("CRT1: SR19 - SR1A (reserved)\n");
++ print_range ("CRT1: SR1B - SR3A", SISSR, 0x1b, 0x3a);
++ print ("CRT1: SR3B (reserved)\n");
++ print_range ("CRT1: SR3C - SR3F", SISSR, 0x3c, 0x3f);
++ print_range ("CRT1: CR19 - CR1A", SISCR, 0x19, 0x1a);
++ print ("CRT1: CR1B - CR27 (undocumented?)\n");
++ print_range ("CRT1: CR28 - CR2E", SISCR, 0x28, 0x2e);
++ print ("CRT1: CR2F (reserved)\n");
++ print_range ("VGA BIOS: CR30 - CR3F", SISCR, 0x30, 0x3f);
++ print_range ("CRT1: CR40 - CR43", SISCR, 0x40, 0x43);
++ print ("CRT1: CR44 - CR45 (reserved)\n");
++ print_range ("CRT1: CR46 - CR67", SISCR, 0x46, 0x67);
++ print ("CRT1: CR68 - CR6F (DRAM registers reserved for backward compatibility with 760)\n");
++ print ("CRT1: CR70 - CR77 (undocumented?)\n");
++ print_range ("SMA BIOS: CR78 - CR7F", SISCR, 0x78, 0x7f);
++ print_range_int ("CRT1: CR80 - CR9B", SISCR, 0x80, 0xb3);
++ print_range_int ("CRT1: CRC0 - CRF3", SISCR, 0xc0, 0xf3);
++ print_range ("CRT2: SIGNAL REGISTERS, PART1 00 - 45", SISPART1, 0x00, 0x45);
++ print_range ("CRT2: TV SIGNAL REGISTERS, PART2 00 - 4d", SISPART2, 0x00, 0x4d);
++ print_range ("CRT2: TV COPY PROTECTION, PART3 00 - 40", SISPART3, 0x00, 0x40);
++ print_range ("CRT2: SIGNAL REGISTERS, PART4 00 - 3A", SISPART4, 0x00, 0x3a);
++ print_range ("CRT2: PALETTE SIGNAL REGISTERS, PART5 00 - 00 (?)", SISPART5, 0x00, 0x00);
++#undef print
++}
+--- xf86-video-sis-0.9.1/src/sis_video.c.orig 2010-01-18 13:17:56.000000000 -0500
++++ xf86-video-sis-0.9.1/src/sis_video.c 2010-01-26 13:38:13.000000000 -0500
+@@ -129,6 +129,8 @@
+
+ #include "sis_video.h"
+
++extern void sis_print_registers(SISPtr pSiS);
++
+ void SiSInitMC(ScreenPtr pScreen);
+
+ /*********************************
+@@ -712,6 +714,8 @@ SISResetVideo(ScrnInfoPtr pScrn)
+ #ifdef SISMERGED
+ pPriv->mustresettap2 = TRUE;
+ #endif
++
++ sis_print_registers(pSiS);
+ }
+
+
diff --git a/xf86MapDomainMemory-pci_device_map_legacy.patch b/xf86MapDomainMemory-pci_device_map_legacy.patch
new file mode 100644
index 000000000000..7a39cf2df5a2
--- /dev/null
+++ b/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/xserver112.patch b/xserver112.patch
new file mode 100644
index 000000000000..f0dff46b5e3a
--- /dev/null
+++ b/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;
diff --git a/xserver19.patch b/xserver19.patch
new file mode 100644
index 000000000000..67ef6f585ebf
--- /dev/null
+++ b/xserver19.patch
@@ -0,0 +1,30 @@
+Index: xf86-video-sis-0.9.1/src/sis_driver.c
+===================================================================
+--- xf86-video-sis-0.9.1.orig/src/sis_driver.c
++++ xf86-video-sis-0.9.1/src/sis_driver.c
+@@ -85,7 +85,6 @@
+ #include "shadowfb.h"
+ #include "fb.h"
+ #include "micmap.h"
+-#include "mibank.h"
+ #include "mipointer.h"
+ #include "mibstore.h"
+ #include "edid.h"
+Index: xf86-video-sis-0.9.1/src/sis_mergedfb.c
+===================================================================
+--- xf86-video-sis-0.9.1.orig/src/sis_mergedfb.c
++++ xf86-video-sis-0.9.1/src/sis_mergedfb.c
+@@ -2948,11 +2948,11 @@ SiSXineramaExtensionInit(ScrnInfoPtr pSc
+
+ while(SiSXineramaGeneration != serverGeneration) {
+
+- ClientType = CreateNewResourceType(SiSXineramaFreeClient);
++ ClientType = CreateNewResourceType(SiSXineramaFreeClient, "XineramaClient");
+ if(!ClientType)
+ break;
+
+- EventType = CreateNewResourceType(SiSXineramaFreeEvents);
++ EventType = CreateNewResourceType(SiSXineramaFreeEvents, "XineramaEvents");
+ if(!EventType)
+ break;
+