summaryrefslogtreecommitdiff
path: root/source/x/x11/patch
diff options
context:
space:
mode:
Diffstat (limited to 'source/x/x11/patch')
-rw-r--r--source/x/x11/patch/xf86-video-chips.patch4
-rw-r--r--source/x/x11/patch/xf86-video-chips/0001-chips-gut-the-overlay-8-16-support-from-driver.patch588
-rw-r--r--source/x/x11/patch/xf86-video-chips/0002-PciTag-is-unused-when-using-libpciaccess.patch29
-rw-r--r--source/x/x11/patch/xf86-video-chips/0003-Use-malloc-calloc-realloc-free-directly.patch50
-rw-r--r--source/x/x11/patch/xf86-video-chips/0004-configure.ac-Remove-AM_PROG_CC_C_O.patch27
-rw-r--r--source/x/x11/patch/xf86-video-chips/0005-util-Consolidate-common-macros.patch283
-rw-r--r--source/x/x11/patch/xf86-video-chips/0006-Fix-implicit-declaration-of-iopl.patch35
-rw-r--r--source/x/x11/patch/xf86-video-chips/0007-Build-fix-for-ABI-Version-12.patch51
-rw-r--r--source/x/x11/patch/xf86-video-chips/0008-Fall-back-to-shadowfb-if-XAA-is-unavailable.patch31
-rw-r--r--source/x/x11/patch/xf86-video-chips/0009-Fix-for-new-vgaHW-ABI.patch25
-rw-r--r--source/x/x11/patch/xorg-server.patch2
-rw-r--r--source/x/x11/patch/xorg-server/x11.startwithblackscreen.diff21
-rw-r--r--source/x/x11/patch/xorg-server/xorg-server.fb.fbpict.c.mod.diff11
-rw-r--r--source/x/x11/patch/xorg-server/xorg-server.try_nouveau.diff11
14 files changed, 1134 insertions, 34 deletions
diff --git a/source/x/x11/patch/xf86-video-chips.patch b/source/x/x11/patch/xf86-video-chips.patch
new file mode 100644
index 00000000..a5a54ac0
--- /dev/null
+++ b/source/x/x11/patch/xf86-video-chips.patch
@@ -0,0 +1,4 @@
+for patchfile in $CWD/patch/xf86-video-chips/*.patch ; do
+ cat $patchfile | patch -p1 --verbose \
+ || { touch ${SLACK_X_BUILD_DIR}/${PKGNAME}.failed ; continue ; } ;
+done
diff --git a/source/x/x11/patch/xf86-video-chips/0001-chips-gut-the-overlay-8-16-support-from-driver.patch b/source/x/x11/patch/xf86-video-chips/0001-chips-gut-the-overlay-8-16-support-from-driver.patch
new file mode 100644
index 00000000..a52e4103
--- /dev/null
+++ b/source/x/x11/patch/xf86-video-chips/0001-chips-gut-the-overlay-8-16-support-from-driver.patch
@@ -0,0 +1,588 @@
+From e4bd864898fd276a62dac05cdfff394e98434f02 Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied@redhat.com>
+Date: Tue, 29 Mar 2011 13:53:31 +1000
+Subject: [PATCH 1/9] chips: gut the overlay 8/16 support from driver.
+
+This driver is for chips that were bought by Intel in 1997,
+this feature means maintaining a lot of code in the X server
+for little gain.
+
+Drop it like its hot.
+
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Reviewed-by: Adam Jackson <ajax@redhat.com>
+---
+ man/chips.man | 3 -
+ src/ct_accel.c | 46 ++---------
+ src/ct_driver.c | 234 ++++++-------------------------------------------------
+ src/ct_driver.h | 1 -
+ src/ct_video.c | 3 +-
+ 5 files changed, 28 insertions(+), 259 deletions(-)
+
+diff --git a/man/chips.man b/man/chips.man
+index 740af38..0c022ee 100644
+--- a/man/chips.man
++++ b/man/chips.man
+@@ -165,9 +165,6 @@ Force the use of memory mapped IO where it can be used. Default: off
+ Force driver to leave centering and stretching registers alone. This
+ can fix some laptop suspend/resume problems. Default: off
+ .TP
+-.BI "Option \*qOverlay\*q"
+-Enable 8+24 overlay mode. Only appropriate for depth 24. Default: off.
+-.TP
+ .BI "Option \*qColorKey\*q \*q" integer \*q
+ Set the colormap index used for the transparency key for the depth 8 plane
+ when operating in 8+16 overlay mode. The value must be in the range
+diff --git a/src/ct_accel.c b/src/ct_accel.c
+index 3920b0a..4b5776a 100644
+--- a/src/ct_accel.c
++++ b/src/ct_accel.c
+@@ -428,19 +428,7 @@ chips_imagewrite:
+ infoPtr->ImageWriteFlags |= NO_PLANEMASK;
+ #endif
+
+-
+-#ifdef CHIPS_HIQV
+- if (XAAInit(pScreen, infoPtr)) {
+- if (cPtr->Flags & ChipsOverlay8plus16)
+- return(XAAInitDualFramebufferOverlay(pScreen,
+- CTNAME(DepthChange)));
+- else
+- return TRUE;
+- } else
+- return FALSE;
+-#else
+ return(XAAInit(pScreen, infoPtr));
+-#endif
+ }
+
+ #ifdef CHIPS_HIQV
+@@ -1243,11 +1231,6 @@ CTNAME(SubsequentScreenToScreenColorExpandFill)(ScrnInfoPtr pScrn,
+ #endif
+ w *= cAcl->BytesPerPixel;
+ ctBLTWAIT;
+-#ifdef CHIPS_HIQV
+- if ((y >= pScrn->virtualY) && (cPtr->Flags & ChipsOverlay8plus16) &&
+- (pScrn->depth == 8))
+- ctSETPITCH(cAcl->PitchInBytes << 1, cAcl->PitchInBytes);
+-#endif
+ ctSETSRCADDR(srcaddr);
+ ctSETDSTADDR(destaddr);
+ #ifdef CHIPS_HIQV
+@@ -1271,10 +1254,6 @@ CTNAME(SetupForColor8x8PatternFill)(ScrnInfoPtr pScrn, int patx, int paty,
+ patternaddr = (paty * pScrn->displayWidth +
+ (patx & ~0x3F)) * cAcl->BytesPerPixel;
+ cAcl->patternyrot = (patx & 0x3F) >> 3;
+-#ifdef CHIPS_HIQV
+- if (cPtr->Flags & ChipsOverlay8plus16)
+- patternaddr += cPtr->FbOffset16;
+-#endif
+
+ ctBLTWAIT;
+ ctSETPATSRCADDR(patternaddr);
+@@ -1338,10 +1317,7 @@ CTNAME(SetupForMono8x8PatternFill)(ScrnInfoPtr pScrn, int patx, int paty,
+
+ #ifdef CHIPS_HIQV
+ patternaddr = paty * pScrn->displayWidth + patx;
+- if (cPtr->Flags & ChipsOverlay8plus16)
+- patternaddr = patternaddr * 2 + cPtr->FbOffset16;
+- else
+- patternaddr *= cAcl->BytesPerPixel;
++ patternaddr *= cAcl->BytesPerPixel;
+ #else
+ patternaddr = (paty * pScrn->displayWidth + patx) * cAcl->BytesPerPixel;
+ #endif
+@@ -1593,10 +1569,7 @@ CTNAME(WritePixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ dwords = (((skipleft + bytesPerLine + 0x7) & ~0x7)) >> 2;
+ destaddr = (y * pScrn->displayWidth + x) * (bpp >> 3);
+ destpitch = pScrn->displayWidth * (bpp >> 3);
+- if ((y >= pScrn->virtualY) && (cPtr->Flags & ChipsOverlay8plus16))
+- destaddr += cPtr->FbOffset16;
+- else
+- destaddr += cAcl->FbOffset;
++ destaddr += cAcl->FbOffset;
+
+ ctBLTWAIT;
+
+@@ -1681,10 +1654,7 @@ CTNAME(WritePixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ y++;
+
+ destaddr = (y * pScrn->displayWidth + x) * (bpp >> 3);
+- if ((y >= pScrn->virtualY) && (cPtr->Flags & ChipsOverlay8plus16))
+- destaddr += cPtr->FbOffset16;
+- else
+- destaddr += cAcl->FbOffset;
++ destaddr += cAcl->FbOffset;
+
+ ctBLTWAIT;
+ ctSETDSTADDR(destaddr);
+@@ -1717,10 +1687,7 @@ CTNAME(ReadPixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ dwords = (((bytesPerLine + 0x7) & ~0x7)) >> 2;
+ srcaddr = (y * pScrn->displayWidth + x) * (bpp >> 3);
+ srcpitch = pScrn->displayWidth * (bpp >> 3);
+- if ((y >= pScrn->virtualY) && (cPtr->Flags & ChipsOverlay8plus16))
+- srcaddr += cPtr->FbOffset16;
+- else
+- srcaddr += cAcl->FbOffset;
++ srcaddr += cAcl->FbOffset;
+
+ ctBLTWAIT;
+ ctSETROP( ctDSTSYSTEM | ctLEFT2RIGHT | ctTOP2BOTTOM |
+@@ -1755,10 +1722,7 @@ CTNAME(ReadPixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ dst += dstwidth;
+ y++;
+ srcaddr = (y * pScrn->displayWidth + x) * (bpp >> 3);
+- if ((y >= pScrn->virtualY) && (cPtr->Flags & ChipsOverlay8plus16))
+- srcaddr += cPtr->FbOffset16;
+- else
+- srcaddr += cAcl->FbOffset;
++ srcaddr += cAcl->FbOffset;
+ ctBLTWAIT;
+ ctSETSRCADDR(srcaddr);
+ ctSETHEIGHTWIDTHGO(h, bytesPerLine);
+diff --git a/src/ct_driver.c b/src/ct_driver.c
+index 6624b79..08df050 100644
+--- a/src/ct_driver.c
++++ b/src/ct_driver.c
+@@ -1639,55 +1639,15 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags)
+ }
+ }
+
+- if ((s = xf86GetOptValString(cPtr->Options, OPTION_OVERLAY))) {
+- if (!*s || !xf86NameCmp(s, "8,16") || !xf86NameCmp(s, "16,8")) {
+- if (pScrn->bitsPerPixel == 16) {
+- if (cPtr->Flags & ChipsLinearSupport) {
+- cPtr->Flags |= ChipsOverlay8plus16;
+- if(!xf86GetOptValInteger(
+- cPtr->Options, OPTION_COLOR_KEY, &(pScrn->colorKey)))
+- pScrn->colorKey = TRANSPARENCY_KEY;
+- pScrn->overlayFlags = OVERLAY_8_16_DUALFB;
+- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+- "PseudoColor overlay enabled.\n");
+- if (!xf86IsOptionSet(cPtr->Options, OPTION_LCD_STRETCH))
+- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+- " - Forcing option \"Stretch\" \"ON\".\n");
+- if (!xf86IsOptionSet(cPtr->Options, OPTION_LCD_CENTER))
+- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+- " - Forcing option \"LcdCenter\" \"OFF\".\n");
+- if (cPtr->Flags & ChipsShadowFB) {
+- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+- " - Disabling \"Shadow Framebuffer\".\n");
+- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+- " Not support with option \"8Plus16\".\n");
+- cPtr->Flags &= ~ChipsShadowFB;
+- cPtr->Rotate = 0;
+- }
+- } else {
+- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Option \"Overlay\" ignored. Not supported without linear addressing\n");
+- }
+- } else {
+- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+- "Option \"Overlay\" is not supported in this configuration\n");
+- }
+- } else {
+- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+- "\"%s\" is not a valid value for Option \"Overlay\"\n", s);
+- }
+- }
+-
+- if (!(cPtr->Flags & ChipsOverlay8plus16)) {
+- if(xf86GetOptValInteger(cPtr->Options, OPTION_VIDEO_KEY,
+- &(cPtr->videoKey))) {
+- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n",
++ if(xf86GetOptValInteger(cPtr->Options, OPTION_VIDEO_KEY,
++ &(cPtr->videoKey))) {
++ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n",
+ cPtr->videoKey);
+- } else {
+- cPtr->videoKey = (1 << pScrn->offset.red) |
++ } else {
++ cPtr->videoKey = (1 << pScrn->offset.red) |
+ (1 << pScrn->offset.green) |
+ (((pScrn->mask.blue >> pScrn->offset.blue) - 1)
+ << pScrn->offset.blue);
+- }
+ }
+
+ if (cPtr->Flags & ChipsShadowFB) {
+@@ -2335,28 +2295,16 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags)
+ /* and 32bits on the others. Thus multiply by a suitable factor */
+ if (cPtr->Flags & Chips64BitMemory) {
+ if (cPtr->FrameBufferSize && (cPtr->PanelType & ChipsLCD))
+- if (cPtr->Flags & ChipsOverlay8plus16 )
+- cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 8 * 0.7 / 4);
+- else
+ cPtr->MaxClock = min(cPtr->MaxClock,
+ MemClk->Clk * 8 * 0.7 / (bytesPerPixel + 1));
+ else
+- if (cPtr->Flags & ChipsOverlay8plus16)
+- cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 8 * 0.7 / 3);
+- else
+ cPtr->MaxClock = min(cPtr->MaxClock,
+ MemClk->Clk * 8 * 0.7 / bytesPerPixel);
+ } else {
+ if (cPtr->FrameBufferSize && (cPtr->PanelType & ChipsLCD))
+- if (cPtr->Flags & ChipsOverlay8plus16 )
+- cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 4 * 0.7 / 4);
+- else
+ cPtr->MaxClock = min(cPtr->MaxClock,
+ MemClk->Clk * 4 * 0.7 / (bytesPerPixel + 1));
+ else
+- if (cPtr->Flags & ChipsOverlay8plus16)
+- cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 4 * 0.7 / 3);
+- else
+ cPtr->MaxClock = min(cPtr->MaxClock,
+ MemClk->Clk * 4 * 0.7 / bytesPerPixel);
+ }
+@@ -3736,8 +3684,7 @@ CHIPSEnterVT(int scrnIndex, int flags)
+ /* Should we re-save the text mode on each VT enter? */
+ if(!chipsModeInit(pScrn, pScrn->currentMode))
+ return FALSE;
+- if ((!(cPtr->Flags & ChipsOverlay8plus16))
+- && (cPtr->Flags & ChipsVideoSupport)
++ if ((cPtr->Flags & ChipsVideoSupport)
+ && (cPtr->Flags & ChipsLinearSupport))
+ CHIPSResetVideo(pScrn);
+
+@@ -3788,8 +3735,7 @@ chipsLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
+ int i, index, shift ;
+ CHIPSEntPtr cPtrEnt;
+
+- shift = ((pScrn->depth == 15) &&
+- (!(cPtr->Flags & ChipsOverlay8plus16))) ? 3 : 0;
++ shift = (pScrn->depth == 15) ? 3 : 0;
+
+ if (cPtr->UseDualChannel) {
+ cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0],
+@@ -3895,18 +3841,6 @@ chipsLoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices,
+ hwp->disablePalette(hwp);
+ }
+
+-static Bool
+-cfb8_16ScreenInit(ScreenPtr pScreen, pointer pbits16, pointer pbits8,
+- int xsize, int ysize, int dpix, int dpiy,
+- int width16, int width8)
+-{
+- return
+- (fbOverlaySetupScreen(pScreen, pbits16, pbits8, xsize, ysize,
+- dpix, dpiy, width16, width8, 16, 8) &&
+- fbOverlayFinishScreenInit(pScreen, pbits16, pbits8, xsize, ysize,
+- dpix, dpiy, width16, width8, 16, 8, 16, 8));
+-}
+-
+ /* Mandatory */
+ static Bool
+ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+@@ -3947,22 +3881,6 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ if (!chipsMapMem(pScrn))
+ return FALSE;
+
+- /* Setup a pointer to the overlay if needed */
+- if (cPtr->Flags & ChipsOverlay8plus16) {
+- cPtr->FbOffset16 = pScrn->displayWidth * pScrn->virtualY;
+- cPtr->FbSize16 = (pScrn->displayWidth << 1) * pScrn->virtualY;
+- if (cPtr->FbSize16 > (cPtr->FbMapSize - cPtr->FrameBufferSize)) {
+- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+- "Too little memory for overlay. Disabling.\n");
+- cPtr->Flags &= ~ChipsOverlay8plus16;
+- }
+- if ((pScrn->displayWidth > 1024) || (pScrn->virtualY > 1024)) {
+- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+- "Max overlay Width/Height 1024 pixels. Disabling.\n");
+- cPtr->Flags &= ~ChipsOverlay8plus16;
+- }
+- }
+-
+ /* Setup the MMIO register access functions if need */
+ if (cPtr->UseFullMMIO && cPtr->MMIOBaseVGA) {
+ CHIPSSetMmioExtFuncs(cPtr);
+@@ -4035,18 +3953,10 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ miClearVisualTypes();
+
+ /* Setup the visuals we support. */
+- if ((pScrn->bitsPerPixel == 16) && (cPtr->Flags & ChipsOverlay8plus16)){
+- if (!miSetVisualTypes(8, PseudoColorMask | GrayScaleMask,
+- pScrn->rgbBits, PseudoColor))
+- return FALSE;
+- if (!miSetVisualTypes(16, TrueColorMask, pScrn->rgbBits, TrueColor))
+- return FALSE;
+- } else {
+- if (!miSetVisualTypes(pScrn->depth,
++ if (!miSetVisualTypes(pScrn->depth,
+ miGetDefaultVisualMask(pScrn->depth),
+ pScrn->rgbBits, pScrn->defaultVisual))
+- return FALSE;
+- }
++ return FALSE;
+ miSetPixmapDepths ();
+
+ /*
+@@ -4090,13 +4000,6 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ break;
+ #endif
+ case 16:
+- if (cPtr->Flags & ChipsOverlay8plus16) {
+- ret = cfb8_16ScreenInit(pScreen, (unsigned char *)FBStart +
+- cPtr->FbOffset16, FBStart, width,
+- height, pScrn->xDpi, pScrn->yDpi,
+- displayWidth, displayWidth);
+- break;
+- }
+ default:
+ ret = fbScreenInit(pScreen, FBStart,
+ width,height,
+@@ -4244,9 +4147,6 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ if (pScrn->bitsPerPixel < 8)
+ freespace = allocatebase - pScrn->displayWidth *
+ pScrn->virtualY / 2;
+- else if ((pScrn->bitsPerPixel == 16) && (cPtr->Flags & ChipsOverlay8plus16))
+- freespace = allocatebase - pScrn->displayWidth *
+- pScrn->virtualY - cPtr->FbSize16;
+ else
+ freespace = allocatebase - pScrn->displayWidth *
+ pScrn->virtualY * (pScrn->bitsPerPixel >> 3);
+@@ -4369,9 +4269,7 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ AvailFBArea.y2 = cAcl->CacheEnd /
+ (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3));
+
+- if (!(cPtr->Flags & ChipsOverlay8plus16)) {
+- xf86InitFBManager(pScreen, &AvailFBArea);
+- }
++ xf86InitFBManager(pScreen, &AvailFBArea);
+ }
+ if (cPtr->Flags & ChipsAccelSupport) {
+ if (IS_HiQV(cPtr)) {
+@@ -4425,16 +4323,10 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ if (!miCreateDefColormap(pScreen))
+ return FALSE;
+
+- if ((cPtr->Flags & ChipsOverlay8plus16) && (pScrn->bitsPerPixel == 16)) {
+- if(!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, chipsLoadPalette,
+- NULL, CMAP_RELOAD_ON_MODE_SWITCH))
+- return FALSE;
+- } else {
+- if(!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits,
++ if(!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits,
+ (pScrn->depth == 16 ? chipsLoadPalette16 : chipsLoadPalette),
+ NULL, CMAP_RELOAD_ON_MODE_SWITCH | CMAP_PALETTED_TRUECOLOR))
+- return FALSE;
+- }
++ return FALSE;
+
+ #ifndef XSERVER_LIBPCIACCESS
+ racflag = RAC_COLORMAP;
+@@ -4448,8 +4340,7 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ xf86SetSilkenMouse(pScreen);
+ #endif
+
+- if ((!(cPtr->Flags & ChipsOverlay8plus16))
+- && (cPtr->Flags & ChipsVideoSupport)
++ if ((cPtr->Flags & ChipsVideoSupport)
+ && (cPtr->Flags & ChipsLinearSupport)) {
+ CHIPSInitVideo(pScreen);
+ }
+@@ -4522,10 +4413,7 @@ CHIPSAdjustFrame(int scrnIndex, int x, int y, int flags)
+ Base >>= 3;
+ break;
+ case 16:
+- if (!(cPtr->Flags & ChipsOverlay8plus16))
+- Base >>= 1;
+- else
+- Base >>= 2;
++ Base >>= 1;
+ break;
+ case 24:
+ if (!IS_HiQV(cPtr))
+@@ -4581,14 +4469,6 @@ CHIPSAdjustFrame(int scrnIndex, int x, int y, int flags)
+ cPtr->writeMSS(cPtr, hwp, MSS);
+ }
+
+- if (cPtr->Flags & ChipsOverlay8plus16) {
+- Base = (Base << 3) & ~(unsigned long)0xF;
+-
+- cPtr->writeMR(cPtr, 0x22, (cPtr->FbOffset16 + Base) & 0xF8);
+- cPtr->writeMR(cPtr, 0x23, ((cPtr->FbOffset16 + Base) >> 8) & 0xFF);
+- cPtr->writeMR(cPtr, 0x24, ((cPtr->FbOffset16 + Base) >> 16) & 0xFF);
+- }
+-
+ }
+
+ /* Mandatory */
+@@ -4652,13 +4532,6 @@ CHIPSValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ CHIPSPtr cPtr = CHIPSPTR(pScrn);
+
+- if (flags & MODECHECK_FINAL) {
+- /* Don't subtract FrambufferSize here as it should be subtracted already */
+- if ((cPtr->Flags & ChipsOverlay8plus16)
+- && ((pScrn->videoRam<<10) - pScrn->displayWidth * 3 * pScrn->virtualY
+- < 0))
+- return MODE_MEM;
+- }
+ /* The tests here need to be expanded */
+ if ((mode->Flags & V_INTERLACE) && (cPtr->PanelType & ChipsLCD))
+ return MODE_NO_INTERLACE;
+@@ -5544,12 +5417,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ } else {
+ ChipsStd->Attribute[0x10] = 0x01; /* mode */
+ }
+- if ((pScrn->bitsPerPixel == 16) && (cPtr->Flags & ChipsOverlay8plus16)) {
+- /* Make sure that the overlay isn't visible in the overscan region */
+- if (ChipsStd->Attribute[0x11] == pScrn->colorKey)
+- ChipsStd->Attribute[0x11] = pScrn->colorKey - 1;
+- } else
+- ChipsStd->Attribute[0x11] = 0x00; /* overscan (border) color */
++ ChipsStd->Attribute[0x11] = 0x00; /* overscan (border) color */
+ ChipsStd->Attribute[0x12] = 0x0F; /* enable all color planes */
+ ChipsStd->Attribute[0x13] = 0x00; /* horiz pixel panning 0 */
+
+@@ -5558,8 +5426,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ /* set virtual screen width */
+ tmp = pScrn->displayWidth >> 3;
+ if (pScrn->bitsPerPixel == 16) {
+- if (!(cPtr->Flags & ChipsOverlay8plus16))
+- tmp <<= 1; /* double the width of the buffer */
++ tmp <<= 1; /* double the width of the buffer */
+ } else if (pScrn->bitsPerPixel == 24) {
+ tmp += tmp << 1;
+ } else if (pScrn->bitsPerPixel == 32) {
+@@ -5688,8 +5555,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
+
+ /* centering/stretching */
+ if (!xf86ReturnOptValBool(cPtr->Options, OPTION_SUSPEND_HACK, FALSE)) {
+- if (!xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_STRETCH, FALSE) ||
+- (cPtr->Flags & ChipsOverlay8plus16)) {
++ if (!xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_STRETCH, FALSE)) {
+ ChipsNew->FR[0x40] &= 0xDF; /* Disable Horizontal stretching */
+ ChipsNew->FR[0x48] &= 0xFB; /* Disable vertical stretching */
+ ChipsNew->XR[0xA0] = 0x10; /* Disable cursor stretching */
+@@ -5709,8 +5575,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ }
+ }
+
+- if ((xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_CENTER, TRUE))
+- || (cPtr->Flags & ChipsOverlay8plus16)) {
++ if (xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_CENTER, TRUE)) {
+ ChipsNew->FR[0x40] |= 0x3; /* Enable Horizontal centering */
+ ChipsNew->FR[0x48] |= 0x3; /* Enable Vertical centering */
+ } else {
+@@ -5723,8 +5588,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ ChipsNew->XR[0x82] |=0x02;
+
+ /* software mode flag */
+- ChipsNew->XR[0xE2] = chipsVideoMode(((cPtr->Flags & ChipsOverlay8plus16) ?
+- 8 : pScrn->depth), (cPtr->PanelType & ChipsLCD) ?
++ ChipsNew->XR[0xE2] = chipsVideoMode((pScrn->depth), (cPtr->PanelType & ChipsLCD) ?
+ min(mode->CrtcHDisplay, cPtr->PanelSize.HDisplay) :
+ mode->CrtcHDisplay, mode->CrtcVDisplay);
+ #ifdef DEBUG
+@@ -5762,7 +5626,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ }
+ }
+ /* bpp depend */
+- if ((pScrn->bitsPerPixel == 16) && (!(cPtr->Flags & ChipsOverlay8plus16))) {
++ if (pScrn->bitsPerPixel == 16) {
+ ChipsNew->XR[0x81] = (ChipsNew->XR[0x81] & 0xF0) | 0x4;
+ if (cPtr->Flags & ChipsGammaSupport)
+ ChipsNew->XR[0x82] |= 0x0C;
+@@ -5915,60 +5779,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ /* Turn off multimedia by default as it degrades performance */
+ ChipsNew->XR[0xD0] &= 0x0f;
+
+- /* Setup the video/overlay */
+- if (cPtr->Flags & ChipsOverlay8plus16) {
+- ChipsNew->XR[0xD0] |= 0x10; /* Force the Multimedia engine on */
+-#ifdef SAR04
+- ChipsNew->XR[0x4F] = 0x2A; /* SAR04 >352 pixel overlay width */
+-#endif
+- ChipsNew->MR[0x1E] &= 0xE0; /* Set Zoom and Direction */
+- if ((!(cPtr->PanelType & ChipsLCD)) && (mode->Flags & V_INTERLACE))
+- ChipsNew->MR[0x1E] |= 0x10; /* Interlace */
+- ChipsNew->MR[0x1F] &= 0x14; /* Mask reserved bits */
+- ChipsNew->MR[0x1F] |= 0x08; /* RGB 16bpp */
+- if (pScrn->weight.green == 5)
+- ChipsNew->MR[0x1F] |= 0x01; /* RGB 15bpp */
+-
+- ChipsNew->MR[0x20] &= 0x03; /* Mask reserved bits */
+- ChipsNew->MR[0x20] |= 0x80; /* Auto Centre, Use mem ptr1 */
+- ChipsNew->MR[0x22] = cPtr->FbOffset16 & 0xF8; /* Setup Pointer 1 */
+- ChipsNew->MR[0x23] = (cPtr->FbOffset16 >> 8) & 0xFF;
+- ChipsNew->MR[0x24] = (cPtr->FbOffset16 >> 16) & 0xFF;
+- ChipsNew->MR[0x25] = cPtr->FbOffset16 & 0xF8; /* Setup Pointer 2 */
+- ChipsNew->MR[0x26] = (cPtr->FbOffset16 >> 8) & 0xFF;
+- ChipsNew->MR[0x27] = (cPtr->FbOffset16 >> 16) & 0xFF;
+- ChipsNew->MR[0x28] = (pScrn->displayWidth >> 2) - 1; /* Width */
+- ChipsNew->MR[0x34] = (pScrn->displayWidth >> 2) - 1;
+-
+- /* Left Edge of Overlay */
+- ChipsNew->MR[0x2A] = cPtr->OverlaySkewX;
+- ChipsNew->MR[0x2B] &= 0xF8; /* Mask reserved bits */
+- ChipsNew->MR[0x2B] |= ((cPtr->OverlaySkewX >> 8) & 0x7);
+- /* Right Edge of Overlay */
+- ChipsNew->MR[0x2C] = (cPtr->OverlaySkewX + pScrn->displayWidth -
+- 1) & 0xFF;
+- ChipsNew->MR[0x2D] &= 0xF8; /* Mask reserved bits */
+- ChipsNew->MR[0x2D] |= ((cPtr->OverlaySkewX + pScrn->displayWidth -
+- 1) >> 8) & 0x07;
+- /* Top Edge of Overlay */
+- ChipsNew->MR[0x2E] = cPtr->OverlaySkewY;
+- ChipsNew->MR[0x2F] &= 0xF8;
+- ChipsNew->MR[0x2F] |= ((cPtr->OverlaySkewY >> 8) & 0x7);
+- /* Bottom Edge of Overlay*/
+- ChipsNew->MR[0x30] = (cPtr->OverlaySkewY + pScrn->virtualY - 1 )& 0xFF;
+- ChipsNew->MR[0x31] &= 0xF8; /* Mask reserved bits */
+- ChipsNew->MR[0x31] |= ((cPtr->OverlaySkewY + pScrn->virtualY -
+- 1 ) >> 8) & 0x07;
+-
+- ChipsNew->MR[0x3C] &= 0x18; /* Mask reserved bits */
+- ChipsNew->MR[0x3C] |= 0x07; /* Enable keyed overlay window */
+- ChipsNew->MR[0x3D] = 0x00;
+- ChipsNew->MR[0x3E] = 0x00;
+- ChipsNew->MR[0x3F] = pScrn->colorKey; /* 8bpp transparency key */
+- ChipsNew->MR[0x40] = 0xFF;
+- ChipsNew->MR[0x41] = 0xFF;
+- ChipsNew->MR[0x42] = 0x00;
+- } else if (cPtr->Flags & ChipsVideoSupport) {
++ if (cPtr->Flags & ChipsVideoSupport) {
+ #if 0 /* if we do this even though video isn't playing we kill performance */
+ ChipsNew->XR[0xD0] |= 0x10; /* Force the Multimedia engine on */
+ #endif
+@@ -6877,8 +6688,7 @@ chipsRestoreExtendedRegs(ScrnInfoPtr pScrn, CHIPSRegPtr Regs)
+ }
+
+ /* Set SAR04 multimedia register correctly */
+- if ((cPtr->Flags & ChipsOverlay8plus16)
+- || (cPtr->Flags & ChipsVideoSupport)) {
++ if ((cPtr->Flags & ChipsVideoSupport)) {
+ #ifdef SAR04
+ cPtr->writeXR(cPtr, 0x4E, 0x04);
+ if (cPtr->readXR(cPtr, 0x4F) != Regs->XR[0x4F])
+diff --git a/src/ct_driver.h b/src/ct_driver.h
+index d8ce228..10a24d4 100644
+--- a/src/ct_driver.h
++++ b/src/ct_driver.h
+@@ -114,7 +114,6 @@ typedef struct {
+ /* Options flags for the C&T chipsets */
+ #define ChipsHWCursor 0x00001000
+ #define ChipsShadowFB 0x00002000
+-#define ChipsOverlay8plus16 0x00004000
+ #define ChipsUseNewFB 0x00008000
+
+ /* Architecture type flags */
+diff --git a/src/ct_video.c b/src/ct_video.c
+index a68acb9..c9e5bb4 100644
+--- a/src/ct_video.c
++++ b/src/ct_video.c
+@@ -56,8 +56,7 @@ CHIPSInitVideo(ScreenPtr pScreen)
+ CHIPSPtr cPtr = CHIPSPTR(pScrn);
+ int num_adaptors;
+
+- if (!(cPtr->Flags & ChipsOverlay8plus16) &&
+- (cPtr->Flags & ChipsVideoSupport)) {
++ if ((cPtr->Flags & ChipsVideoSupport)) {
+ newAdaptor = CHIPSSetupImageVideo(pScreen);
+ CHIPSInitOffscreenImages(pScreen);
+ }
+--
+1.7.9.4
+
diff --git a/source/x/x11/patch/xf86-video-chips/0002-PciTag-is-unused-when-using-libpciaccess.patch b/source/x/x11/patch/xf86-video-chips/0002-PciTag-is-unused-when-using-libpciaccess.patch
new file mode 100644
index 00000000..6caaa210
--- /dev/null
+++ b/source/x/x11/patch/xf86-video-chips/0002-PciTag-is-unused-when-using-libpciaccess.patch
@@ -0,0 +1,29 @@
+From 5f8a7320123255408b393eab9ecfae783920622a Mon Sep 17 00:00:00 2001
+From: Mark Kettenis <kettenis@openbsd.org>
+Date: Mon, 26 Sep 2011 21:26:26 +0200
+Subject: [PATCH 2/9] PciTag is unused when using libpciaccess
+
+Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
+Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
+Reviewed-by: Julien Cristau <jcristau@debian.org>
+---
+ src/ct_driver.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/ct_driver.h b/src/ct_driver.h
+index 10a24d4..39eeb6e 100644
+--- a/src/ct_driver.h
++++ b/src/ct_driver.h
+@@ -271,7 +271,9 @@ typedef struct {
+
+ typedef struct _CHIPSRec {
+ pciVideoPtr PciInfo;
++#ifndef XSERVER_LIBPCIACCESS
+ PCITAG PciTag;
++#endif
+ int Chipset;
+ EntityInfoPtr pEnt;
+ IOADDRESS PIOBase;
+--
+1.7.9.4
+
diff --git a/source/x/x11/patch/xf86-video-chips/0003-Use-malloc-calloc-realloc-free-directly.patch b/source/x/x11/patch/xf86-video-chips/0003-Use-malloc-calloc-realloc-free-directly.patch
new file mode 100644
index 00000000..de379e4d
--- /dev/null
+++ b/source/x/x11/patch/xf86-video-chips/0003-Use-malloc-calloc-realloc-free-directly.patch
@@ -0,0 +1,50 @@
+From 7ca1840f39d0216e44fe1ca938cfc3ced048da1d Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Tue, 18 Oct 2011 22:24:54 -0700
+Subject: [PATCH 3/9] Use malloc/calloc/realloc/free directly
+
+Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+---
+ src/ct_driver.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/ct_driver.c b/src/ct_driver.c
+index 08df050..e6538c6 100644
+--- a/src/ct_driver.c
++++ b/src/ct_driver.c
+@@ -949,7 +949,7 @@ CHIPSProbe(DriverPtr drv, int flags)
+ }
+
+ }
+- xfree(usedChips);
++ free(usedChips);
+ }
+ }
+
+@@ -981,12 +981,12 @@ CHIPSProbe(DriverPtr drv, int flags)
+ pScrn->ValidMode = CHIPSValidMode;
+ foundScreen = TRUE;
+ }
+- xfree(usedChips);
++ free(usedChips);
+ }
+ }
+ #endif
+
+- xfree(devSections);
++ free(devSections);
+ return foundScreen;
+ }
+ #endif
+@@ -4126,7 +4126,7 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ }
+ if (!miInitializeBanking(pScreen, pScrn->virtualX, pScrn->virtualY,
+ pScrn->displayWidth, pBankInfo)) {
+- xfree(pBankInfo);
++ free(pBankInfo);
+ pBankInfo = NULL;
+ return FALSE;
+ }
+--
+1.7.9.4
+
diff --git a/source/x/x11/patch/xf86-video-chips/0004-configure.ac-Remove-AM_PROG_CC_C_O.patch b/source/x/x11/patch/xf86-video-chips/0004-configure.ac-Remove-AM_PROG_CC_C_O.patch
new file mode 100644
index 00000000..bcf6355a
--- /dev/null
+++ b/source/x/x11/patch/xf86-video-chips/0004-configure.ac-Remove-AM_PROG_CC_C_O.patch
@@ -0,0 +1,27 @@
+From f5191838b70d67e991bef3491d2a60915988079c Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Tue, 18 Oct 2011 22:37:00 -0700
+Subject: [PATCH 4/9] configure.ac: Remove AM_PROG_CC_C_O
+
+Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+---
+ configure.ac | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 225e516..c0ed508 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -44,9 +44,6 @@ XORG_DEFAULT_OPTIONS
+ AC_DISABLE_STATIC
+ AC_PROG_LIBTOOL
+
+-# Checks for programs.
+-AM_PROG_CC_C_O
+-
+ AH_TOP([#include "xorg-server.h"])
+
+ # Define a configure option for an alternate module directory
+--
+1.7.9.4
+
diff --git a/source/x/x11/patch/xf86-video-chips/0005-util-Consolidate-common-macros.patch b/source/x/x11/patch/xf86-video-chips/0005-util-Consolidate-common-macros.patch
new file mode 100644
index 00000000..77d0d5bc
--- /dev/null
+++ b/source/x/x11/patch/xf86-video-chips/0005-util-Consolidate-common-macros.patch
@@ -0,0 +1,283 @@
+From 94a8b34528b42a4fe6f81c8b8bd1ddb6bebaeea9 Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Tue, 18 Oct 2011 23:04:32 -0700
+Subject: [PATCH 5/9] util: Consolidate common macros
+
+Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+---
+ util/dRegs.c | 57 +------------------------------------------------------
+ util/iopl.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++
+ util/mRegs.c | 57 +------------------------------------------------------
+ util/modClock.c | 53 ++-------------------------------------------------
+ 4 files changed, 58 insertions(+), 163 deletions(-)
+ create mode 100644 util/iopl.h
+
+diff --git a/util/dRegs.c b/util/dRegs.c
+index b7edc8f..0d2f0cb 100644
+--- a/util/dRegs.c
++++ b/util/dRegs.c
+@@ -1,63 +1,8 @@
+-
+-
+-
+-
+-
+-
+-#ifdef __NetBSD__
+-# include <sys/types.h>
+-# include <machine/pio.h>
+-# include <machine/sysarch.h>
+-#else
+-# if defined(SVR4) && defined(i386)
+-# include <sys/types.h>
+-# ifdef NCR
+- /* broken NCR <sys/sysi86.h> */
+-# define __STDC
+-# include <sys/sysi86.h>
+-# undef __STDC
+-# else
+-# include <sys/sysi86.h>
+-# endif
+-# ifdef SVR4
+-# if !defined(sun)
+-# include <sys/seg.h>
+-# endif
+-# endif
+-# include <sys/v86.h>
+-# if defined(sun)
+-# include <sys/psw.h>
+-# endif
+-# endif
+-# include "AsmMacros.h"
+-#endif /* NetBSD */
+-
+ #include <unistd.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+
+-#ifdef __NetBSD__
+-# define SET_IOPL() i386_iopl(3)
+-# define RESET_IOPL() i386_iopl(0)
+-#else
+-# if defined(SVR4) && defined(i386)
+-# ifndef SI86IOPL
+-# define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
+-# define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
+-# else
+-# define SET_IOPL() sysi86(SI86IOPL,3)
+-# define RESET_IOPL() sysi86(SI86IOPL,0)
+-# endif
+-# else
+-# ifdef linux
+-# define SET_IOPL() iopl(3)
+-# define RESET_IOPL() iopl(0)
+-# else
+-# define SET_IOPL() (void)0
+-# define RESET_IOPL() (void)0
+-# endif
+-# endif
+-#endif
++#include "iopl.h"
+
+ int main(void)
+ {
+diff --git a/util/iopl.h b/util/iopl.h
+new file mode 100644
+index 0000000..d7890b3
+--- /dev/null
++++ b/util/iopl.h
+@@ -0,0 +1,54 @@
++#ifdef __NetBSD__
++# include <sys/types.h>
++# include <machine/pio.h>
++# include <machine/sysarch.h>
++#else
++# if defined(SVR4) && defined(i386)
++# include <sys/types.h>
++# ifdef NCR
++ /* broken NCR <sys/sysi86.h> */
++# define __STDC
++# include <sys/sysi86.h>
++# undef __STDC
++# else
++# include <sys/sysi86.h>
++# endif
++# ifdef SVR4
++# if !defined(sun)
++# include <sys/seg.h>
++# endif
++# endif
++# include <sys/v86.h>
++# if defined(sun)
++# include <sys/psw.h>
++# endif
++# endif
++# include "AsmMacros.h"
++#endif /* NetBSD */
++
++#include <unistd.h>
++#include <stdio.h>
++#include <stdlib.h>
++
++#ifdef __NetBSD__
++# define SET_IOPL() i386_iopl(3)
++# define RESET_IOPL() i386_iopl(0)
++#else
++# if defined(SVR4) && defined(i386)
++# ifndef SI86IOPL
++# define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
++# define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
++# else
++# define SET_IOPL() sysi86(SI86IOPL,3)
++# define RESET_IOPL() sysi86(SI86IOPL,0)
++# endif
++# else
++# ifdef linux
++# define SET_IOPL() iopl(3)
++# define RESET_IOPL() iopl(0)
++# else
++# define SET_IOPL() (void)0
++# define RESET_IOPL() (void)0
++# endif
++# endif
++#endif
+diff --git a/util/mRegs.c b/util/mRegs.c
+index f359738..843d01d 100644
+--- a/util/mRegs.c
++++ b/util/mRegs.c
+@@ -1,63 +1,8 @@
+-
+-
+-
+-
+-
+-
+-#ifdef __NetBSD__
+-# include <sys/types.h>
+-# include <machine/pio.h>
+-# include <machine/sysarch.h>
+-#else
+-# if defined(SVR4) && defined(i386)
+-# include <sys/types.h>
+-# ifdef NCR
+- /* broken NCR <sys/sysi86.h> */
+-# define __STDC
+-# include <sys/sysi86.h>
+-# undef __STDC
+-# else
+-# include <sys/sysi86.h>
+-# endif
+-# ifdef SVR4
+-# if !defined(sun)
+-# include <sys/seg.h>
+-# endif
+-# endif
+-# include <sys/v86.h>
+-# if defined(sun)
+-# include <sys/psw.h>
+-# endif
+-# endif
+-# include "AsmMacros.h"
+-#endif /* NetBSD */
+-
+ #include <unistd.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+
+-#ifdef __NetBSD__
+-# define SET_IOPL() i386_iopl(3)
+-# define RESET_IOPL() i386_iopl(0)
+-#else
+-# if defined(SVR4) && defined(i386)
+-# ifndef SI86IOPL
+-# define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
+-# define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
+-# else
+-# define SET_IOPL() sysi86(SI86IOPL,3)
+-# define RESET_IOPL() sysi86(SI86IOPL,0)
+-# endif
+-# else
+-# ifdef linux
+-# define SET_IOPL() iopl(3)
+-# define RESET_IOPL() iopl(0)
+-# else
+-# define SET_IOPL() (void)0
+-# define RESET_IOPL() (void)0
+-# endif
+-# endif
+-#endif
++#include "iopl.h"
+
+ int hex2int(char* str);
+
+diff --git a/util/modClock.c b/util/modClock.c
+index 89a291a..45af19b 100644
+--- a/util/modClock.c
++++ b/util/modClock.c
+@@ -1,61 +1,12 @@
+-
+-#ifdef __NetBSD__
+-# include <sys/types.h>
+-# include <machine/pio.h>
+-# include <machine/sysarch.h>
+-#else
+-# if defined(SVR4) && defined(i386)
+-# include <sys/types.h>
+-# ifdef NCR
+- /* broken NCR <sys/sysi86.h> */
+-# define __STDC
+-# include <sys/sysi86.h>
+-# undef __STDC
+-# else
+-# include <sys/sysi86.h>
+-# endif
+-# ifdef SVR4
+-# if !defined(sun)
+-# include <sys/seg.h>
+-# endif
+-# endif
+-# include <sys/v86.h>
+-# if defined(sun)
+-# include <sys/psw.h>
+-# endif
+-# endif
+-# include "AsmMacros.h"
+-#endif /* NetBSD */
+-
+ #include <unistd.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++
+ #ifndef Lynx
+ #include <fnmatch.h>
+ #endif
+
+-#ifdef __NetBSD__
+-# define SET_IOPL() i386_iopl(3)
+-# define RESET_IOPL() i386_iopl(0)
+-#else
+-# if defined(SVR4) && defined(i386)
+-# ifndef SI86IOPL
+-# define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
+-# define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
+-# else
+-# define SET_IOPL() sysi86(SI86IOPL,3)
+-# define RESET_IOPL() sysi86(SI86IOPL,0)
+-# endif
+-# else
+-# ifdef linux
+-# define SET_IOPL() iopl(3)
+-# define RESET_IOPL() iopl(0)
+-# else
+-# define SET_IOPL() (void)0
+-# define RESET_IOPL() (void)0
+-# endif
+-# endif
+-#endif
++#include "iopl.h"
+
+ #define tolerance 0.01 /* +/- 1% */
+
+--
+1.7.9.4
+
diff --git a/source/x/x11/patch/xf86-video-chips/0006-Fix-implicit-declaration-of-iopl.patch b/source/x/x11/patch/xf86-video-chips/0006-Fix-implicit-declaration-of-iopl.patch
new file mode 100644
index 00000000..a0b4bb4b
--- /dev/null
+++ b/source/x/x11/patch/xf86-video-chips/0006-Fix-implicit-declaration-of-iopl.patch
@@ -0,0 +1,35 @@
+From c421f2477c99990d0dc712d6aece981fa6c961e5 Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Tue, 18 Oct 2011 23:09:09 -0700
+Subject: [PATCH 6/9] Fix implicit declaration of iopl
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+warning: implicit declaration of function ‘iopl’ [-Wimplicit-function-declaration]
+
+Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+---
+ util/iopl.h | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/util/iopl.h b/util/iopl.h
+index d7890b3..e08207c 100644
+--- a/util/iopl.h
++++ b/util/iopl.h
+@@ -3,6 +3,12 @@
+ # include <machine/pio.h>
+ # include <machine/sysarch.h>
+ #else
++# if defined(__linux__)
++/* Can't because <sys/iopl.h> provides conflicting inb, outb, etc
++ * # include <sys/io.h>
++ */
++int iopl(int level);
++# endif
+ # if defined(SVR4) && defined(i386)
+ # include <sys/types.h>
+ # ifdef NCR
+--
+1.7.9.4
+
diff --git a/source/x/x11/patch/xf86-video-chips/0007-Build-fix-for-ABI-Version-12.patch b/source/x/x11/patch/xf86-video-chips/0007-Build-fix-for-ABI-Version-12.patch
new file mode 100644
index 00000000..12dc5131
--- /dev/null
+++ b/source/x/x11/patch/xf86-video-chips/0007-Build-fix-for-ABI-Version-12.patch
@@ -0,0 +1,51 @@
+From 8a5ea07f30cc71ecc413fad0713facff72f77472 Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Tue, 18 Oct 2011 23:21:33 -0700
+Subject: [PATCH 7/9] Build fix for ABI Version 12
+
+ABI Version 12 removes support for multiple PCI domains. If you need to
+use this driver on a system with more than one PCI domain, you should
+either port this driver to using libpciaccess directly or stick with an
+older server.
+
+Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+---
+ src/ct_driver.c | 5 +++++
+ src/ct_driver.h | 4 ++--
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/src/ct_driver.c b/src/ct_driver.c
+index e6538c6..a2e5c94 100644
+--- a/src/ct_driver.c
++++ b/src/ct_driver.c
+@@ -1446,7 +1446,12 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags)
+
+ hwp = VGAHWPTR(pScrn);
+ vgaHWGetIOBase(hwp);
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+ cPtr->PIOBase = hwp->PIOOffset;
++#else
++ cPtr->PIOBase = 0;
++#endif
++
+ /*
+ * Must allow ensure that storage for the 2nd set of vga registers is
+ * allocated for dual channel cards
+diff --git a/src/ct_driver.h b/src/ct_driver.h
+index 39eeb6e..9033867 100644
+--- a/src/ct_driver.h
++++ b/src/ct_driver.h
+@@ -276,8 +276,8 @@ typedef struct _CHIPSRec {
+ #endif
+ int Chipset;
+ EntityInfoPtr pEnt;
+- IOADDRESS PIOBase;
+- CARD32 IOAddress;
++ unsigned long PIOBase;
++ unsigned long IOAddress;
+ unsigned long FbAddress;
+ unsigned int IOBase;
+ unsigned char * FbBase;
+--
+1.7.9.4
+
diff --git a/source/x/x11/patch/xf86-video-chips/0008-Fall-back-to-shadowfb-if-XAA-is-unavailable.patch b/source/x/x11/patch/xf86-video-chips/0008-Fall-back-to-shadowfb-if-XAA-is-unavailable.patch
new file mode 100644
index 00000000..3478fa34
--- /dev/null
+++ b/source/x/x11/patch/xf86-video-chips/0008-Fall-back-to-shadowfb-if-XAA-is-unavailable.patch
@@ -0,0 +1,31 @@
+From 5d5753551609f1483801e5edd8d42b11713c981e Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Mon, 19 Dec 2011 16:18:34 -0500
+Subject: [PATCH 8/9] Fall back to shadowfb if XAA is unavailable
+
+Signed-off-by: Adam Jackson <ajax@redhat.com>
+---
+ src/ct_driver.c | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/src/ct_driver.c b/src/ct_driver.c
+index a2e5c94..95092a2 100644
+--- a/src/ct_driver.c
++++ b/src/ct_driver.c
+@@ -1345,10 +1345,9 @@ CHIPSPreInit(ScrnInfoPtr pScrn, int flags)
+
+ if (cPtr->Flags & ChipsAccelSupport) {
+ if (!xf86LoadSubModule(pScrn, "xaa")) {
+- vbeFree(cPtr->pVbe);
+- cPtr->pVbe = NULL;
+- CHIPSFreeRec(pScrn);
+- return FALSE;
++ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Falling back to shadowfb\n");
++ cPtr->Flags &= ~(ChipsAccelSupport);
++ cPtr->Flags |= ChipsShadowFB;
+ }
+ }
+
+--
+1.7.9.4
+
diff --git a/source/x/x11/patch/xf86-video-chips/0009-Fix-for-new-vgaHW-ABI.patch b/source/x/x11/patch/xf86-video-chips/0009-Fix-for-new-vgaHW-ABI.patch
new file mode 100644
index 00000000..74ec3722
--- /dev/null
+++ b/source/x/x11/patch/xf86-video-chips/0009-Fix-for-new-vgaHW-ABI.patch
@@ -0,0 +1,25 @@
+From 989cf4f1fb2ac57f38d363734b71a5cf749db146 Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Mon, 19 Dec 2011 17:45:41 -0500
+Subject: [PATCH 9/9] Fix for new vgaHW ABI
+
+Signed-off-by: Adam Jackson <ajax@redhat.com>
+---
+ src/ct_driver.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/ct_driver.c b/src/ct_driver.c
+index 95092a2..08ccd72 100644
+--- a/src/ct_driver.c
++++ b/src/ct_driver.c
+@@ -1444,6 +1444,7 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags)
+ return FALSE;
+
+ hwp = VGAHWPTR(pScrn);
++ vgaHWSetStdFuncs(hwp);
+ vgaHWGetIOBase(hwp);
+ #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+ cPtr->PIOBase = hwp->PIOOffset;
+--
+1.7.9.4
+
diff --git a/source/x/x11/patch/xorg-server.patch b/source/x/x11/patch/xorg-server.patch
index e3218a03..01be43a3 100644
--- a/source/x/x11/patch/xorg-server.patch
+++ b/source/x/x11/patch/xorg-server.patch
@@ -1,3 +1 @@
zcat $CWD/patch/xorg-server/x11.startwithblackscreen.diff.gz | patch -p1 --verbose || { touch ${SLACK_X_BUILD_DIR}/${PKGNAME}.failed ; continue ; }
-zcat $CWD/patch/xorg-server/xorg-server.fb.fbpict.c.mod.diff.gz | patch -p1 --verbose || { touch ${SLACK_X_BUILD_DIR}/${PKGNAME}.failed ; continue ; }
-zcat $CWD/patch/xorg-server/xorg-server.try_nouveau.diff.gz | patch -p1 --verbose || { touch ${SLACK_X_BUILD_DIR}/${PKGNAME}.failed ; continue ; }
diff --git a/source/x/x11/patch/xorg-server/x11.startwithblackscreen.diff b/source/x/x11/patch/xorg-server/x11.startwithblackscreen.diff
index bfa9c305..8c0e3b54 100644
--- a/source/x/x11/patch/xorg-server/x11.startwithblackscreen.diff
+++ b/source/x/x11/patch/xorg-server/x11.startwithblackscreen.diff
@@ -1,13 +1,14 @@
---- ./dix/window.c.orig 2007-01-22 23:39:15.000000000 -0600
-+++ ./dix/window.c 2007-02-14 03:21:03.000000000 -0600
-@@ -140,8 +140,8 @@
- *
- ******/
+diff -Nur xorg-server-1.12.1.orig/dix/window.c xorg-server-1.12.1/dix/window.c
+--- xorg-server-1.12.1.orig/dix/window.c 2012-03-29 21:57:25.000000000 -0500
++++ xorg-server-1.12.1/dix/window.c 2012-04-13 22:01:24.456073603 -0500
+@@ -145,8 +145,8 @@
--static unsigned char _back_lsb[4] = {0x88, 0x22, 0x44, 0x11};
--static unsigned char _back_msb[4] = {0x11, 0x44, 0x22, 0x88};
-+static unsigned char _back_lsb[4] = {0x00, 0x00, 0x00, 0x00};
-+static unsigned char _back_msb[4] = {0x00, 0x00, 0x00, 0x00};
+ Bool bgNoneRoot = FALSE;
- _X_EXPORT int screenIsSaved = SCREEN_SAVER_OFF;
+-static unsigned char _back_lsb[4] = { 0x88, 0x22, 0x44, 0x11 };
+-static unsigned char _back_msb[4] = { 0x11, 0x44, 0x22, 0x88 };
++static unsigned char _back_lsb[4] = { 0x00, 0x00, 0x00, 0x00 };
++static unsigned char _back_msb[4] = { 0x00, 0x00, 0x00, 0x00 };
+ static Bool WindowParentHasDeviceCursor(WindowPtr pWin,
+ DeviceIntPtr pDev, CursorPtr pCurs);
diff --git a/source/x/x11/patch/xorg-server/xorg-server.fb.fbpict.c.mod.diff b/source/x/x11/patch/xorg-server/xorg-server.fb.fbpict.c.mod.diff
deleted file mode 100644
index f8abdccb..00000000
--- a/source/x/x11/patch/xorg-server/xorg-server.fb.fbpict.c.mod.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./fb/fbpict.c.orig 2010-03-11 22:38:21.000000000 -0600
-+++ ./fb/fbpict.c 2010-04-29 14:14:52.000000000 -0500
-@@ -37,7 +37,7 @@
- #include "mipict.h"
- #include "fbpict.h"
-
--#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
-+#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-(a)) % (b))
-
- void
- fbWalkCompositeRegion (CARD8 op,
diff --git a/source/x/x11/patch/xorg-server/xorg-server.try_nouveau.diff b/source/x/x11/patch/xorg-server/xorg-server.try_nouveau.diff
deleted file mode 100644
index 74f799a1..00000000
--- a/source/x/x11/patch/xorg-server/xorg-server.try_nouveau.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./hw/xfree86/common/xf86pciBus.c.orig 2010-07-01 12:17:35.000000000 -0500
-+++ ./hw/xfree86/common/xf86pciBus.c 2010-11-18 16:56:57.633003654 -0600
-@@ -1118,7 +1118,7 @@
- break;
- case 0x102b: driverList[0] = "mga"; break;
- case 0x10c8: driverList[0] = "neomagic"; break;
-- case 0x10de: case 0x12d2: driverList[0] = "nv"; break;
-+ case 0x10de: case 0x12d2: driverList[0] = "nouveau" ; driverList[1] = "nv"; break;
- case 0x1106: driverList[0] = "openchrome"; break;
- case 0x1b36: driverList[0] = "qxl"; break;
- case 0x1163: driverList[0] = "rendition"; break;