+++ /dev/null
---- XFree86-3.3.5/xc/config/cf/xfree86.cf.3dfxalpha Wed Dec 1 09:57:15 1999
-+++ XFree86-3.3.5/xc/config/cf/xfree86.cf Wed Dec 1 09:58:24 1999
-@@ -121,7 +121,7 @@
- #endif
- #endif
- #ifndef XF86SvgaDrivers
--#define XF86SvgaDrivers mga s3v
-+#define XF86SvgaDrivers mga s3v tdfx
- #endif
- #ifndef XF86Vga2Drivers
- #define XF86Vga2Drivers generic
+++ /dev/null
-diff -ur xc.orig/programs/Xserver/hw/xfree86/common/compiler.h xc/programs/Xserver/hw/xfree86/common/compiler.h
---- xc.orig/programs/Xserver/hw/xfree86/common/compiler.h Fri Dec 8 22:58:34 2000
-+++ xc/programs/Xserver/hw/xfree86/common/compiler.h Sun Mar 18 17:23:33 2001
-@@ -1514,19 +1514,17 @@
- /* Changed to kill noise generated by gcc's -Wcast-align */
- #define MMIO_IN8(base, offset) (*xf86ReadMmio8)(base, offset)
- #define MMIO_IN16(base, offset) (*xf86ReadMmio16)(base, offset)
--# if defined (JENSEN_SUPPORT)
- #define MMIO_IN32(base, offset) (*xf86ReadMmio32)(base, offset)
-+# if defined (JENSEN_SUPPORT)
- #define MMIO_OUT32(base, offset, val) \
- (*xf86WriteMmio32)((CARD32)(val), base, offset)
- #define MMIO_ONB32(base, offset, val) \
- (*xf86WriteMmioNB32)((CARD32)(val), base, offset)
- # else
--#define MMIO_IN32(base, offset) \
-- *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset))
- #define MMIO_OUT32(base, offset, val) \
- do { \
-- *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \
- write_mem_barrier(); \
-+ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \
- } while (0)
- #define MMIO_ONB32(base, offset, val) \
- *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c
---- xc.orig/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c Mon Dec 4 19:55:22 2000
-+++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c Sun Apr 1 20:51:03 2001
-@@ -838,6 +838,7 @@
- if (info->scanline_direct) return;
- --info->scanline_h;
- while (left) {
-+ write_mem_barrier();
- if (left <= 8) {
- /* Last scanline - finish write to DATA_LAST */
- if (info->scanline_h == 0) {
-@@ -980,6 +981,7 @@
- if (info->scanline_direct) return;
- --info->scanline_h;
- while (left) {
-+ write_mem_barrier();
- if (left <= 8) {
- /* Last scanline - finish write to DATA_LAST */
- if (info->scanline_h == 0) {
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c
---- xc.orig/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c Sat Mar 17 17:57:15 2001
-+++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c Sun Mar 18 16:51:29 2001
-@@ -1016,8 +1016,8 @@
- if (!xf86LoadSubModule(pScrn, "ddc")) return FALSE;
- xf86LoaderReqSymLists(ddcSymbols, NULL);
-
--#if defined(__powerpc__)
-- /* Int10 is broken on PPC */
-+#if defined(__powerpc__) || defined(__alpha__)
-+ /* Int10 is broken on PPC and some Alphas */
- return TRUE;
- #else
- if (xf86LoadSubModule(pScrn, "vbe")) {
-@@ -1156,7 +1156,8 @@
- static Bool R128PreInitInt10(ScrnInfoPtr pScrn)
- {
- R128InfoPtr info = R128PTR(pScrn);
--#if 1
-+#if 1 && !defined(__alpha__)
-+ /* int10 is broken on some Alphas */
- if (xf86LoadSubModule(pScrn, "int10")) {
- xf86Int10InfoPtr pInt;
- xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n");
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c
---- xc.orig/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c Wed Nov 29 11:42:11 2000
-+++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c Fri Mar 23 16:20:46 2001
-@@ -585,7 +585,13 @@
- info->scanline_h = h;
- info->scanline_words = (w + 31) >> 5;
-
-- if ((info->scanline_words * h) <= 9) {
-+#ifdef __alpha__
-+ /* always indirect for Alpha */
-+ if (0)
-+#else
-+ if ((info->scanline_words * h) <= 9)
-+#endif
-+ {
- /* Turn on direct for less than 9 dword colour expansion */
- info->scratch_buffer[0]
- = (unsigned char *)(ADDRREG(RADEON_HOST_DATA_LAST)
-@@ -621,6 +627,7 @@
- if (info->scanline_direct) return;
- --info->scanline_h;
- while (left) {
-+ write_mem_barrier();
- if (left <= 8) {
- /* Last scanline - finish write to DATA_LAST */
- if (info->scanline_h == 0) {
-@@ -699,7 +706,13 @@
- info->scanline_h = h;
- info->scanline_words = (w * info->scanline_bpp + 31) >> 5;
-
-- if ((info->scanline_words * h) <= 9) {
-+#ifdef __alpha__
-+ /* always indirect for Alpha */
-+ if (0)
-+#else
-+ if ((info->scanline_words * h) <= 9)
-+#endif
-+ {
- /* Turn on direct for less than 9 dword colour expansion */
- info->scratch_buffer[0]
- = (unsigned char *)(ADDRREG(RADEON_HOST_DATA_LAST)
-@@ -735,6 +748,7 @@
- if (info->scanline_direct) return;
- --info->scanline_h;
- while (left) {
-+ write_mem_barrier();
- if (left <= 8) {
- /* Last scanline - finish write to DATA_LAST */
- if (info->scanline_h == 0) {
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/glint/dualmx_accel.c xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_accel.c
---- xc.orig/programs/Xserver/hw/xfree86/drivers/glint/dualmx_accel.c Sat Jun 24 14:19:54 2000
-+++ xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_accel.c Sun Mar 18 16:53:54 2001
-@@ -324,28 +324,6 @@
- GLINT_WRITE_REG(d<<16,dY);
- }
-
--static void MoveDWORDS(
-- register CARD32* dest,
-- register CARD32* src,
-- register int dwords )
--{
-- while(dwords & ~0x03) {
-- *dest = *src;
-- *(dest + 1) = *(src + 1);
-- *(dest + 2) = *(src + 2);
-- *(dest + 3) = *(src + 3);
-- src += 4;
-- dest += 4;
-- dwords -= 4;
-- }
-- if (!dwords) return;
-- *dest = *src;
-- if (dwords == 1) return;
-- *(dest + 1) = *(src + 1);
-- if (dwords == 2) return;
-- *(dest + 2) = *(src + 2);
--}
--
- #define Sync_tag 0x188
-
- static void
-@@ -572,7 +550,8 @@
- while (dwords >= infoRec->ColorExpandRange) {
- GLINT_WAIT(infoRec->ColorExpandRange);
- GLINT_WRITE_REG((infoRec->ColorExpandRange - 2)<<16 | 0x0D, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,
- infoRec->ColorExpandRange - 1);
- dwords -= (infoRec->ColorExpandRange - 1);
- src += (infoRec->ColorExpandRange - 1);
-@@ -580,7 +559,8 @@
- if (dwords) {
- GLINT_WAIT(dwords);
- GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,dwords);
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,dwords);
- }
- pGlint->cpucount += 1;
- #if 0
-@@ -887,7 +867,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, infoRec->ColorExpandRange - 1);
- count -= infoRec->ColorExpandRange - 1;
- srcp += infoRec->ColorExpandRange - 1;
-@@ -897,7 +878,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/glint/glint.h xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h
---- xc.orig/programs/Xserver/hw/xfree86/drivers/glint/glint.h Wed Nov 29 11:42:16 2000
-+++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h Sun Mar 18 21:36:41 2001
-@@ -120,6 +120,7 @@
- Bool UseBlockWrite;
- Bool UseFireGL3000;
- Bool VGAcore;
-+ Bool ScanlineDirect;
- int MXFbSize;
- CARD32 rasterizerMode;
- int MinClock;
-@@ -141,6 +142,7 @@
- DrawablePtr CurrentDrawable;
- I2CBusPtr DDCBus, VSBus;
- CARD8* XAAScanlineColorExpandBuffers[2];
-+ CARD8* ScratchBuffer;
- CARD32 RasterizerSwap;
- int PM3_Config2D;
- int PM3_Render2D;
-@@ -282,6 +284,10 @@
- LOCO *colors, VisualPtr pVisual);
- void Permedia2LoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices,
- LOCO *colors, VisualPtr pVisual);
-+void Permedia3LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
-+ LOCO *colors, VisualPtr pVisual);
-+void Permedia3LoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices,
-+ LOCO *colors, VisualPtr pVisual);
- void Permedia2I2CUDelay(I2CBusPtr b, int usec);
- void Permedia2I2CPutBits(I2CBusPtr b, int scl, int sda);
- void Permedia2I2CGetBits(I2CBusPtr b, int *scl, int *sda);
-@@ -314,4 +320,8 @@
- CARD32 GLINT_VERB_READ_REG(GLINTPtr, CARD32 r, char *file, int line);
-
- void GLINTRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
-+
-+void GLINT_MoveBYTES(CARD32* dest, unsigned char* src, int dwords);
-+void GLINT_MoveWORDS(CARD32* dest, unsigned short* src, int dwords);
-+void GLINT_MoveDWORDS(CARD32* dest, CARD32* src, int dwords);
- #endif /* _GLINT_H_ */
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c
---- xc.orig/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c Fri Dec 8 22:58:55 2000
-+++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c Sun Mar 18 21:39:59 2001
-@@ -2610,8 +2610,17 @@
- if (!miCreateDefColormap(pScreen))
- return FALSE;
-
-+ if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) {
-+ if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits,
-+ (pGlint->FBDev) ? fbdevHWLoadPalette :
-+ ((pScrn->depth == 16) ? Permedia3LoadPalette16:Permedia3LoadPalette),
-+ NULL,
-+ CMAP_RELOAD_ON_MODE_SWITCH |
-+ ((pScrn->overlayFlags & OVERLAY_8_32_PLANAR)
-+ ? 0 : CMAP_PALETTED_TRUECOLOR)))
-+ return FALSE;
-+ } else
- if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) ||
-- (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) ||
- (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2) ||
- (pGlint->Chipset == PCI_VENDOR_TI_CHIP_PERMEDIA2)) {
- if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits,
-@@ -3051,16 +3060,86 @@
- {
- if (xf86GetVerbosity() > 2)
- ErrorF("[0x%04x] <- 0x%08x (%s, %d)\n", r, v, file, line);
-+#if defined(__alpha__)
-+ GLINT_WRITE_REG(v, r);
-+#else
- *(volatile CARD32 *)((char *) pGlint->IOBase + r) = v;
-+#endif
- }
-
- CARD32
- GLINT_VERB_READ_REG(GLINTPtr pGlint, CARD32 r, char *file, int line)
- {
-- CARD32 v = *(volatile CARD32 *)((char *) pGlint->IOBase + r);
-+ CARD32 v;
-
-+#if defined(__alpha__)
-+ v = GLINT_READ_REG(r);
-+#else
-+ v = *(volatile CARD32 *)((char *) pGlint->IOBase + r);
-+#endif
- if (xf86GetVerbosity() > 2)
- ErrorF("[0x%04x] -> 0x%08x (%s, %d)\n", r, v, file, line);
- return v;
- }
- #endif
-+
-+void GLINT_MoveBYTES(
-+ register CARD32* dest,
-+ register unsigned char* src,
-+ register int dwords)
-+{
-+#if defined(__alpha__)
-+ write_mem_barrier();
-+#endif
-+ while(dwords) {
-+ *dest = *src;
-+ src += 1;
-+ dest += 1;
-+ dwords -= 1;
-+ }
-+}
-+
-+void GLINT_MoveWORDS(
-+ register CARD32* dest,
-+ register unsigned short* src,
-+ register int dwords)
-+{
-+#if defined(__alpha__)
-+ write_mem_barrier();
-+#endif
-+ while(dwords & ~0x01) {
-+ *dest = *src;
-+ *(dest + 1) = *(src + 1);
-+ src += 2;
-+ dest += 2;
-+ dwords -= 2;
-+ }
-+ if(dwords)
-+ *dest = *src;
-+ return;
-+}
-+
-+void GLINT_MoveDWORDS(
-+ register CARD32* dest,
-+ register CARD32* src,
-+ register int dwords)
-+{
-+#if defined(__alpha__)
-+ write_mem_barrier();
-+#endif
-+ while(dwords & ~0x03) {
-+ *dest = *src;
-+ *(dest + 1) = *(src + 1);
-+ *(dest + 2) = *(src + 2);
-+ *(dest + 3) = *(src + 3);
-+ src += 4;
-+ dest += 4;
-+ dwords -= 4;
-+ }
-+ if (!dwords) return;
-+ *dest = *src;
-+ if (dwords == 1) return;
-+ *(dest + 1) = *(src + 1);
-+ if (dwords == 2) return;
-+ *(dest + 2) = *(src + 2);
-+}
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h
---- xc.orig/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h Fri Oct 27 21:23:07 2000
-+++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h Sun Mar 18 17:05:13 2001
-@@ -1201,10 +1201,17 @@
-
- #define GLINT_SLOW_WRITE_REG(v,r) \
- do{ \
-- GLINTDACDelay(5); \
-+ mem_barrier(); \
-+ GLINT_WAIT(1); \
-+ mem_barrier(); \
- GLINT_WRITE_REG(v,r); \
-- GLINTDACDelay(5); \
- }while(0)
-+
-+#define GLINT_SET_INDEX(index) \
-+do{ \
-+ GLINT_SLOW_WRITE_REG(((index)>>8)&0xff,PM2VDACIndexRegHigh); \
-+ GLINT_SLOW_WRITE_REG((index)&0xff,PM2VDACIndexRegLow); \
-+} while(0)
-
- #define GLINT_SECONDARY_SLOW_WRITE_REG(v,r) \
- do{ \
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c
---- xc.orig/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c Fri Mar 31 17:55:43 2000
-+++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c Sun Mar 18 16:55:14 2001
-@@ -356,8 +356,6 @@
- Permedia2SubsequentColorExpandScanline;
- }
-
-- infoPtr->ColorExpandRange = MAX_FIFO_ENTRIES;
--
- infoPtr->WriteBitmap = Permedia2WriteBitmap;
-
- if (pScrn->bitsPerPixel == 8)
-@@ -427,10 +425,14 @@
- CHECKCLIPPING;
-
- while (GLINT_READ_REG(DMACount) != 0);
-- GLINT_WAIT(1);
-- GLINT_WRITE_REG(0, GlintSync);
-+
-+ GLINT_SLOW_WRITE_REG(0xc00, FilterMode);
-+
-+ GLINT_WAIT(2);
-+ GLINT_SLOW_WRITE_REG(0, GlintSync);
-+
- do {
-- while(GLINT_READ_REG(OutFIFOWords) == 0);
-+ while(GLINT_READ_REG(OutFIFOWords) == 0);
- #define Sync_tag 0x188
- } while (GLINT_READ_REG(OutputFIFO) != Sync_tag);
- }
-@@ -733,63 +735,6 @@
- TRACE_EXIT("Permedia2SubsequentFillRectSolid");
- }
-
--static void MoveBYTE(
-- register CARD32* dest,
-- register unsigned char* src,
-- register int dwords
--)
--{
-- while(dwords) {
-- *dest = *src;
-- src += 1;
-- dest += 1;
-- dwords -= 1;
-- }
--}
--
--static void MoveWORDS(
-- register CARD32* dest,
-- register unsigned short* src,
-- register int dwords
--)
--{
-- while(dwords & ~0x01) {
-- *dest = *src;
-- *(dest + 1) = *(src + 1);
-- src += 2;
-- dest += 2;
-- dwords -= 2;
-- }
-- switch(dwords) {
-- case 0: return;
-- case 1: *dest = *src;
-- return;
-- }
--}
--
--static void MoveDWORDS(
-- register CARD32* dest,
-- register CARD32* src,
-- register int dwords )
--{
-- while(dwords & ~0x03) {
-- *dest = *src;
-- *(dest + 1) = *(src + 1);
-- *(dest + 2) = *(src + 2);
-- *(dest + 3) = *(src + 3);
-- src += 4;
-- dest += 4;
-- dwords -= 4;
-- }
-- if (!dwords) return;
-- *dest = *src;
-- if (dwords == 1) return;
-- *(dest + 1) = *(src + 1);
-- if (dwords == 2) return;
-- *(dest + 2) = *(src + 2);
--}
--
--
- static void
- Permedia2SetupForMono8x8PatternFill24bpp(ScrnInfoPtr pScrn,
- int patternx, int patterny,
-@@ -1117,10 +1062,10 @@
- Permedia2SetClippingRectangle(pScrn,x+skipleft,y,x+w,y+h);
-
- if (pScrn->bitsPerPixel == 24) {
-- GLINT_WAIT(10);
-+ GLINT_WAIT(10);
- } else {
- GLINT_WAIT(11);
-- DO_PLANEMASK(planemask);
-+ DO_PLANEMASK(planemask);
- }
- LOADROP(rop);
- Permedia2LoadCoord(pScrn, x&0xFFFF, y, w, h);
-@@ -1137,39 +1082,40 @@
- mode = 0;
- GLINT_WRITE_REG(UNIT_ENABLE, ColorDDAMode);
- GLINT_WRITE_REG(BitMaskPackingEachScanline|
-- pGlint->RasterizerSwap,RasterizerMode);
-+ pGlint->RasterizerSwap,RasterizerMode);
- }
-
- if(bg == -1) {
- /* >>>>> set fg <<<<<<<< */
- REPLICATE(fg);
-- if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) {
-- GLINT_WRITE_REG(fg, FBBlockColor);
-+ if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) {
-+ GLINT_WRITE_REG(fg, FBBlockColor);
- } else {
-- GLINT_WRITE_REG(fg, ConstantColor);
-+ GLINT_WRITE_REG(fg, ConstantColor);
- }
- } else if(rop == GXcopy) {
-- /* >>>>> set bg <<<<<<< */
-- /* >>>>> draw rect (x,y,w,h) */
-- REPLICATE(bg);
-- if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) {
-+ /* >>>>> set bg <<<<<<< */
-+ /* >>>>> draw rect (x,y,w,h) */
-+ REPLICATE(bg);
-+ if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) {
- GLINT_WRITE_REG(bg, FBBlockColor);
- } else {
- GLINT_WRITE_REG(bg, ConstantColor);
- }
-- GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive |mode,Render);
-+ GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive |mode,
-+ Render);
- /* >>>>>> set fg <<<<<< */
- REPLICATE(fg);
-- if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) {
-+ if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) {
- GLINT_WRITE_REG(fg, FBBlockColor);
- } else {
- GLINT_WRITE_REG(fg, ConstantColor);
- }
- } else {
-- SecondPass = TRUE;
-+ SecondPass = TRUE;
- /* >>>>> set fg <<<<<<< */
- REPLICATE(fg);
-- if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) {
-+ if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) {
- GLINT_WRITE_REG(fg, FBBlockColor);
- } else {
- GLINT_WRITE_REG(fg, ConstantColor);
-@@ -1188,8 +1134,8 @@
- GLINT_WAIT(dwords);
- /* 0x0D is the TAG value for BitMaskPattern */
- GLINT_WRITE_REG(((dwords - 1) << 16) | 0x0D, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-- (CARD32 *)srcpntr, dwords);
-+ GLINT_MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ (CARD32 *)srcpntr, dwords);
- srcpntr += srcwidth;
- }
-
-@@ -1198,12 +1144,13 @@
- /* >>>>>> invert bitmask and set bg <<<<<<<< */
- REPLICATE(bg);
- GLINT_WAIT(3);
-- if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) {
-- GLINT_WRITE_REG(InvertBitMask|pGlint->RasterizerSwap,RasterizerMode);
-+ if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) {
-+ GLINT_WRITE_REG(InvertBitMask|pGlint->RasterizerSwap,
-+ RasterizerMode);
- GLINT_WRITE_REG(bg, FBBlockColor);
- } else {
-- GLINT_WRITE_REG(InvertBitMask|BitMaskPackingEachScanline|
-- pGlint->RasterizerSwap, RasterizerMode);
-+ GLINT_WRITE_REG(InvertBitMask|BitMaskPackingEachScanline|
-+ pGlint->RasterizerSwap, RasterizerMode);
- GLINT_WRITE_REG(bg, ConstantColor);
- }
- goto SECOND_PASS;
-@@ -1276,13 +1223,15 @@
- count = dwords;
- address = ((y * pScrn->displayWidth) + x) >> 2;
- srcp = (CARD32*)src;
-+ GLINT_WAIT(1);
- GLINT_WRITE_REG(address, TextureDownloadOffset);
- while(count >= MAX_FIFO_ENTRIES) {
- GLINT_WAIT(MAX_FIFO_ENTRIES);
- /* (0x11 << 4) | 0x0D is the TAG for TextureData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x11 << 4) |
- 0x0D, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- address += MAX_FIFO_ENTRIES - 1;
-@@ -1293,7 +1242,8 @@
- /* (0x11 << 4) | 0x0D is the TAG for TextureData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x11 << 4) | 0x0D,
- OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
-@@ -1304,7 +1254,7 @@
- } else {
- char align = (x & pGlint->bppalign);
-
--
-+ GLINT_WAIT(1);
- GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode);
- if (rop == GXcopy) {
- GLINT_WAIT(6);
-@@ -1329,7 +1279,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- srcp += MAX_FIFO_ENTRIES - 1;
-@@ -1339,7 +1290,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
-@@ -1353,7 +1305,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveBYTES(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (unsigned char *)srcpbyte, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- srcpbyte += MAX_FIFO_ENTRIES - 1;
-@@ -1363,7 +1316,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveBYTES(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (unsigned char *)srcpbyte, count);
- }
- src += srcwidth;
-@@ -1435,13 +1389,15 @@
- count = dwords;
- address = ((y * pScrn->displayWidth) + x) >> 1;
- srcp = (CARD32*)src;
-+ GLINT_WAIT(1);
- GLINT_WRITE_REG(address, TextureDownloadOffset);
- while(count >= MAX_FIFO_ENTRIES) {
- GLINT_WAIT(MAX_FIFO_ENTRIES);
- /* (0x11 << 4) | 0x0D is the TAG for TextureData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x11 << 4) |
- 0x0D, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- address += MAX_FIFO_ENTRIES - 1;
-@@ -1452,7 +1408,8 @@
- /* (0x11 << 4) | 0x0D is the TAG for TextureData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x11 << 4) | 0x0D,
- OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
-@@ -1488,7 +1445,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- srcp += MAX_FIFO_ENTRIES - 1;
-@@ -1498,7 +1456,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
-@@ -1512,7 +1471,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (unsigned short *)srcpword, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- srcpword += MAX_FIFO_ENTRIES - 1;
-@@ -1522,7 +1482,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (unsigned short *)srcpword, count);
- }
- src += srcwidth;
-@@ -1590,7 +1551,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveBYTES(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (unsigned char *)srcpbyte, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- srcpbyte += MAX_FIFO_ENTRIES - 1;
-@@ -1600,7 +1562,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveBYTES(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (unsigned char *)srcpbyte, count);
- }
- src += srcwidth;
-@@ -1613,7 +1576,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- srcp += MAX_FIFO_ENTRIES - 1;
-@@ -1623,7 +1587,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
-@@ -1689,13 +1654,15 @@
- count = dwords;
- address = (y * pScrn->displayWidth) + x;
- srcp = (CARD32*)src;
-+ GLINT_WAIT(1);
- GLINT_WRITE_REG(address, TextureDownloadOffset);
- while(count >= MAX_FIFO_ENTRIES) {
- GLINT_WAIT(MAX_FIFO_ENTRIES);
- /* (0x11 << 4) | 0x0D is the TAG for TextureData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x11 << 4) |
- 0x0D, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- address += MAX_FIFO_ENTRIES - 1;
-@@ -1706,7 +1673,8 @@
- /* (0x11 << 4) | 0x0D is the TAG for TextureData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x11 << 4) | 0x0D,
- OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
-@@ -1732,7 +1700,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- srcp += MAX_FIFO_ENTRIES - 1;
-@@ -1742,7 +1711,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/glint/pm2ramdac.c xc/programs/Xserver/hw/xfree86/drivers/glint/pm2ramdac.c
---- xc.orig/programs/Xserver/hw/xfree86/drivers/glint/pm2ramdac.c Sat Jul 17 23:26:57 1999
-+++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm2ramdac.c Sun Mar 18 22:26:08 2001
-@@ -104,16 +104,21 @@
- VisualPtr pVisual
- ){
- GLINTPtr pGlint = GLINTPTR(pScrn);
-- int i, index, shift;
-+ int i, index, shift = 0, j, repeat = 1;
-
-- shift = (pScrn->depth == 15) ? 3 : 0;
-+ if (pScrn->depth == 15) {
-+ repeat = 8;
-+ shift = 3;
-+ }
-
- for(i = 0; i < numColors; i++) {
- index = indices[i];
-- Permedia2WriteAddress(pScrn, index << shift);
-- Permedia2WriteData(pScrn, colors[index].red);
-- Permedia2WriteData(pScrn, colors[index].green);
-- Permedia2WriteData(pScrn, colors[index].blue);
-+ for (j = 0; j < repeat; j++) {
-+ Permedia2WriteAddress(pScrn, (index << shift)+j);
-+ Permedia2WriteData(pScrn, colors[index].red);
-+ Permedia2WriteData(pScrn, colors[index].green);
-+ Permedia2WriteData(pScrn, colors[index].blue);
-+ }
- /* for video i/o */
- GLINT_SLOW_WRITE_REG(index, TexelLUTIndex);
- GLINT_SLOW_WRITE_REG((colors[index].red & 0xFF) |
-@@ -132,14 +137,16 @@
- VisualPtr pVisual
- ){
- GLINTPtr pGlint = GLINTPTR(pScrn);
-- int i, index;
-+ int i, index, j;
-
- for(i = 0; i < numColors; i++) {
- index = indices[i];
-- Permedia2WriteAddress(pScrn, index << 2);
-- Permedia2WriteData(pScrn, colors[index >> 1].red);
-- Permedia2WriteData(pScrn, colors[index].green);
-- Permedia2WriteData(pScrn, colors[index >> 1].blue);
-+ for (j = 0; j < 4; j++) {
-+ Permedia2WriteAddress(pScrn, (index << 2)+j);
-+ Permedia2WriteData(pScrn, colors[index >> 1].red);
-+ Permedia2WriteData(pScrn, colors[index].green);
-+ Permedia2WriteData(pScrn, colors[index >> 1].blue);
-+ }
- GLINT_SLOW_WRITE_REG(index, TexelLUTIndex);
- GLINT_SLOW_WRITE_REG((colors[index].red & 0xFF) |
- ((colors[index].green & 0xFF) << 8) |
-@@ -147,10 +154,12 @@
- TexelLUTData);
-
- if(index <= 31) {
-- Permedia2WriteAddress(pScrn, index << 3);
-- Permedia2WriteData(pScrn, colors[index].red);
-- Permedia2WriteData(pScrn, colors[(index << 1) + 1].green);
-- Permedia2WriteData(pScrn, colors[index].blue);
-+ for (j = 0; j < 4; j++) {
-+ Permedia2WriteAddress(pScrn, (index << 3)+j);
-+ Permedia2WriteData(pScrn, colors[index].red);
-+ Permedia2WriteData(pScrn, colors[(index << 1) + 1].green);
-+ Permedia2WriteData(pScrn, colors[index].blue);
-+ }
- }
- }
- }
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c
---- xc.orig/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c Sat Mar 17 17:57:15 2001
-+++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c Sun Mar 18 17:43:30 2001
-@@ -406,7 +406,10 @@
- int bg, int fg
- )
- {
-- /* A 2 color cursor uses last 2 indexes into hardware cursor palette */
-+ GLINTPtr pGlint = GLINTPTR(pScrn);
-+
-+ if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) {
-+ /* PM3 uses last 2 indexes into hardware cursor palette fg first...*/
- Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+39, 0x00, (fg>>16)&0xff);
- Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+40, 0x00, (fg>>8)&0xff);
- Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+41, 0x00, fg & 0xff);
-@@ -414,6 +417,16 @@
- Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+42, 0x00, (bg>>16)&0xff);
- Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+43, 0x00, (bg>>8)&0xff);
- Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+44, 0x00, bg & 0xff);
-+ } else {
-+ /* PM2v uses first 2 indexes into hardware cursor palette bg first...*/
-+ Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+0, 0x00, (bg>>16)&0xff);
-+ Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+1, 0x00, (bg>>8)&0xff);
-+ Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+2, 0x00, bg & 0xff);
-+
-+ Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+3, 0x00, (fg>>16)&0xff);
-+ Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+4, 0x00, (fg>>8)&0xff);
-+ Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+5, 0x00, fg & 0xff);
-+ }
- }
-
- static Bool
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/glint/pm2vramdac.c xc/programs/Xserver/hw/xfree86/drivers/glint/pm2vramdac.c
---- xc.orig/programs/Xserver/hw/xfree86/drivers/glint/pm2vramdac.c Fri Feb 12 17:52:05 1999
-+++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm2vramdac.c Sun Mar 18 16:51:30 2001
-@@ -43,8 +43,7 @@
- GLINTPtr pGlint = GLINTPTR(pScrn);
- unsigned char tmp = 0x00;
-
-- GLINT_SLOW_WRITE_REG((reg>>8) & 0xff, PM2VDACIndexRegHigh);
-- GLINT_SLOW_WRITE_REG(reg&0xff, PM2VDACIndexRegLow);
-+ GLINT_SET_INDEX(reg);
-
- if (mask != 0x00)
- tmp = GLINT_READ_REG (PM2VDACIndexData) & mask;
-@@ -58,8 +57,7 @@
- GLINTPtr pGlint = GLINTPTR(pScrn);
- unsigned char ret;
-
-- GLINT_SLOW_WRITE_REG (reg&0xff, PM2VDACIndexRegLow);
-- GLINT_SLOW_WRITE_REG((reg>>8) & 0xff, PM2VDACIndexRegHigh);
-+ GLINT_SET_INDEX(reg);
- ret = GLINT_READ_REG (PM2VDACIndexData);
-
- return (ret);
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c
---- xc.orig/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c Wed Nov 29 11:42:17 2000
-+++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c Sun Mar 18 20:15:21 2001
-@@ -47,7 +47,6 @@
- #include "xaalocal.h" /* For replacements */
-
- #define DEBUG 0
--#define USE_DIRECT_FIFO_WRITES 1
-
- #if DEBUG
- # define TRACE_ENTER(str) ErrorF("pm3_accel: " str " %d\n",pScrn->scrnIndex)
-@@ -86,26 +85,35 @@
- int x_offset, int y_offset, int x, int y,
- int w, int h);
- /* Color Expansion Fills */
--static void Permedia3SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
-- int fg, int bg, int rop,unsigned int planemask);
--static void Permedia3SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
-- int x, int y, int w, int h, int skipleft);
-+static void Permedia3SetupForScanlineCPUToScreenColorExpandFill(
-+ ScrnInfoPtr pScrn,
-+ int fg, int bg, int rop,
-+ unsigned int planemask);
-+static void Permedia3SubsequentScanlineCPUToScreenColorExpandFill(
-+ ScrnInfoPtr pScrn, int x,
-+ int y, int w, int h, int skipleft);
-+static void Permedia3SubsequentColorExpandScanline(
-+ ScrnInfoPtr pScrn,
-+ int bufno);
- /* Direct Fifo Bitmap Writes */
- static void Permedia3WriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int skipleft,
- int fg, int bg, int rop,unsigned int planemask);
- /* Images Writes */
--static void Permedia3SetupForImageWrite(ScrnInfoPtr pScrn, int rop,
-+static void Permedia3SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int trans_color,
- int bpp, int depth);
--static void Permedia3SubsequentImageWriteRect(ScrnInfoPtr pScrn,
-+static void Permedia3SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft);
-+static void Permedia3SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno);
- /* Direct Fifo Pixmap Writes */
- static void Permedia3WritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int rop,
- unsigned int planemask, int transparency_color,
- int bpp, int depth);
-
-+#define MAX_FIFO_ENTRIES 120
-+
- void
- Permedia3InitializeEngine(ScrnInfoPtr pScrn)
- {
-@@ -407,51 +415,52 @@
- infoPtr->SubsequentMono8x8PatternFillRect =
- Permedia3SubsequentMono8x8PatternFillRect;
-
--#if USE_DIRECT_FIFO_WRITES
-- /* Direct Fifo Bitmap Writes */
-+ /* Bitmap Writes */
- infoPtr->WriteBitmapFlags = 0;
- infoPtr->WriteBitmap = Permedia3WriteBitmap;
--#endif
--
-- /* Color Expand Fills */
-- infoPtr->CPUToScreenColorExpandFillFlags =
-- /*
-- SYNC_AFTER_COLOR_EXPAND |
-- */
-- LEFT_EDGE_CLIPPING |
-- BIT_ORDER_IN_BYTE_LSBFIRST |
-- CPU_TRANSFER_BASE_FIXED |
-- CPU_TRANSFER_PAD_DWORD;
-- infoPtr->ColorExpandBase = pGlint->IOBase + BitMaskPattern;
-- infoPtr->ColorExpandRange = 4;
-- infoPtr->SetupForCPUToScreenColorExpandFill =
-- Permedia3SetupForCPUToScreenColorExpandFill;
-- infoPtr->SubsequentCPUToScreenColorExpandFill =
-- Permedia3SubsequentCPUToScreenColorExpandFill;
-
--#if USE_DIRECT_FIFO_WRITES
-- /* Direct Fifo Images Writes */
-+ /* Pixmap Writes */
- infoPtr->WritePixmapFlags = 0;
- infoPtr->WritePixmap = Permedia3WritePixmap;
--#else
-+
-+ /* Color Expand Fills */
-+ infoPtr->ScanlineCPUToScreenColorExpandFillFlags =
-+ LEFT_EDGE_CLIPPING |
-+ LEFT_EDGE_CLIPPING_NEGATIVE_X |
-+ BIT_ORDER_IN_BYTE_LSBFIRST |
-+ CPU_TRANSFER_PAD_DWORD;
-+
-+ infoPtr->NumScanlineColorExpandBuffers = 1;
-+ pGlint->ScratchBuffer = xalloc(((pScrn->virtualX+62)/32*4)
-+ + (pScrn->virtualX
-+ * pScrn->bitsPerPixel / 8));
-+ infoPtr->ScanlineColorExpandBuffers =
-+ pGlint->XAAScanlineColorExpandBuffers;
-+ pGlint->XAAScanlineColorExpandBuffers[0] =
-+ pGlint->IOBase + OutputFIFO + 4;
-+
-+ infoPtr->SetupForScanlineCPUToScreenColorExpandFill =
-+ Permedia3SetupForScanlineCPUToScreenColorExpandFill;
-+ infoPtr->SubsequentScanlineCPUToScreenColorExpandFill =
-+ Permedia3SubsequentScanlineCPUToScreenColorExpandFill;
-+ infoPtr->SubsequentColorExpandScanline =
-+ Permedia3SubsequentColorExpandScanline;
-+
- /* Images Writes */
-- infoPtr->ImageWriteFlags =
-- NO_GXCOPY |
-- /*
-- SYNC_AFTER_IMAGE_WRITE |
-- */
-- LEFT_EDGE_CLIPPING |
-- LEFT_EDGE_CLIPPING_NEGATIVE_X |
-- BIT_ORDER_IN_BYTE_LSBFIRST |
-- CPU_TRANSFER_BASE_FIXED |
-- CPU_TRANSFER_PAD_DWORD;
-- infoPtr->ImageWriteBase = pGlint->IOBase + PM3FBSourceData;
-- infoPtr->ImageWriteRange = 4;
-- infoPtr->SetupForImageWrite =
-- Permedia3SetupForImageWrite;
-- infoPtr->SubsequentImageWriteRect =
-- Permedia3SubsequentImageWriteRect;
--#endif
-+ infoPtr->ScanlineImageWriteFlags = NO_GXCOPY |
-+ LEFT_EDGE_CLIPPING |
-+ LEFT_EDGE_CLIPPING_NEGATIVE_X |
-+ BIT_ORDER_IN_BYTE_LSBFIRST |
-+ CPU_TRANSFER_PAD_DWORD;
-+ infoPtr->NumScanlineImageWriteBuffers = 1;
-+ infoPtr->ScanlineImageWriteBuffers =
-+ pGlint->XAAScanlineColorExpandBuffers;
-+ infoPtr->SetupForScanlineImageWrite =
-+ Permedia3SetupForScanlineImageWrite;
-+ infoPtr->SubsequentScanlineImageWriteRect =
-+ Permedia3SubsequentScanlineImageWriteRect;
-+ infoPtr->SubsequentImageWriteScanline =
-+ Permedia3SubsequentImageWriteScanline;
-
- /* Available Framebuffer Area for XAA. */
- AvailFBArea.x1 = 0;
-@@ -461,7 +470,7 @@
- pScrn->bitsPerPixel / 8);
- /* Alan does this ???
- AvailFBArea.y2 = ((pGlint->FbMapSize > 16384*1024) ? 16384*1024 :
-- pGlint->FbMapSize) / (pScrn->displayWidth
-+ pGlint->FbMapSize) / (pScrn->displayWidth *
- pScrn->bitsPerPixel / 8);
- */
-
-@@ -491,8 +500,12 @@
- CHECKCLIPPING;
-
- while (GLINT_READ_REG(DMACount) != 0);
-- GLINT_WAIT(1);
-+
-+ GLINT_WAIT(3);
-+ GLINT_WRITE_REG(3, BroadcastMask); /* hack! this shouldn't be needed */
-+ GLINT_WRITE_REG(0x400, FilterMode);
- GLINT_WRITE_REG(0, GlintSync);
-+
- do {
- while(GLINT_READ_REG(OutFIFOWords) == 0);
- } while (GLINT_READ_REG(OutputFIFO) != PM3SyncTag);
-@@ -700,11 +713,15 @@
- }
-
- /* Color Expansion Fills */
--static void Permedia3SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
-- int fg, int bg, int rop,unsigned int planemask)
--{
-+static void
-+Permedia3SetupForScanlineCPUToScreenColorExpandFill(
-+ ScrnInfoPtr pScrn,
-+ int fg, int bg,
-+ int rop,
-+ unsigned int planemask
-+){
- GLINTPtr pGlint = GLINTPTR(pScrn);
-- TRACE_ENTER("Permedia3SetupForCPUToScreenColorExpandFill");
-+
- REPLICATE(fg);
- pGlint->PM3_Render2D =
- PM3Render2D_SpanOperation |
-@@ -729,14 +746,23 @@
- GLINT_WRITE_REG(fg, PM3ForegroundColor);
- DO_PLANEMASK(planemask);
- GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D);
-- TRACE_EXIT("Permedia3SetupForCPUToScreenColorExpandFill");
- }
--static void Permedia3SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
-- int x, int y, int w, int h, int skipleft)
--{
-+
-+static void
-+Permedia3SubsequentScanlineCPUToScreenColorExpandFill(
-+ ScrnInfoPtr pScrn,
-+ int x, int y, int w, int h,
-+ int skipleft
-+){
- GLINTPtr pGlint = GLINTPTR(pScrn);
-- TRACE_ENTER("Permedia3SubsequentCPUToScreenColorExpandFill");
-- GLINT_WAIT(4);
-+
-+ TRACE_ENTER("Permedia2SubsequentScanlineCPUToScreenColorExpandFill");
-+
-+ pGlint->dwords = ((w + 31) >> 5); /* dwords per scanline */
-+
-+ pGlint->cpucount = h;
-+
-+ GLINT_WAIT(5);
- GLINT_WRITE_REG(((y&0x0fff)<<16)|((x+skipleft)&0x0fff), ScissorMinXY);
- GLINT_WRITE_REG((((y+h)&0x0fff)<<16)|((x+w)&0x0fff), ScissorMaxXY);
- GLINT_WRITE_REG(
-@@ -746,16 +772,60 @@
- GLINT_WRITE_REG(pGlint->PM3_Render2D |
- PM3Render2D_Width(w) | PM3Render2D_Height(h),
- PM3Render2D);
-- TRACE_EXIT("Permedia3SubsequentCPUToScreenColorExpandFill");
-+
-+#ifdef __alpha__
-+ if (0) /* force ALPHA to use indirect always */
-+#else
-+ if ((pGlint->dwords*h) < MAX_FIFO_ENTRIES)
-+#endif
-+ {
-+ /* Turn on direct for less than 120 dword colour expansion */
-+ pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->IOBase+OutputFIFO+4;
-+ pGlint->ScanlineDirect = 1;
-+ GLINT_WRITE_REG(((pGlint->dwords*h)-1)<<16 | 0x0D, OutputFIFO);
-+ GLINT_WAIT(pGlint->dwords*h);
-+ } else {
-+ /* Use indirect for anything else */
-+ pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->ScratchBuffer;
-+ pGlint->ScanlineDirect = 0;
-+ }
-+
-+ pGlint->cpucount--;
- }
-
-+static void
-+Permedia3SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
-+{
-+ GLINTPtr pGlint = GLINTPTR(pScrn);
-+ CARD32 *srcp = (CARD32*)pGlint->XAAScanlineColorExpandBuffers[bufno];
-+ int dwords = pGlint->dwords;
-+
-+ if (!pGlint->ScanlineDirect) {
-+ while(dwords >= MAX_FIFO_ENTRIES) {
-+ GLINT_WAIT(MAX_FIFO_ENTRIES);
-+ GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | 0x0D, OutputFIFO);
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ (CARD32*)srcp, MAX_FIFO_ENTRIES - 1);
-+ dwords -= MAX_FIFO_ENTRIES - 1;
-+ srcp += MAX_FIFO_ENTRIES - 1;
-+ }
-+ if(dwords) {
-+ GLINT_WAIT(dwords + 1);
-+ GLINT_WRITE_REG(((dwords - 1) << 16) | 0x0D, OutputFIFO);
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ (CARD32*)srcp, dwords);
-+ }
-+ }
-+}
-
- /* Images Writes */
--static void Permedia3SetupForImageWrite(ScrnInfoPtr pScrn, int rop,
-+static void Permedia3SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int trans_color, int bpp, int depth)
- {
- GLINTPtr pGlint = GLINTPTR(pScrn);
-- TRACE_ENTER("Permedia3SetupForImageWrite");
-+ TRACE_ENTER("Permedia3SetupForScanlineImageWrite");
- pGlint->PM3_Render2D =
- PM3Render2D_SpanOperation |
- PM3Render2D_XPositive |
-@@ -771,14 +841,18 @@
- GLINT_WAIT(2);
- DO_PLANEMASK(planemask);
- GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D);
-- TRACE_EXIT("Permedia3SetupForImageWrite");
-+ TRACE_EXIT("Permedia3SetupForScanlineImageWrite");
- }
--static void Permedia3SubsequentImageWriteRect(ScrnInfoPtr pScrn,
-+
-+static void Permedia3SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft)
- {
- GLINTPtr pGlint = GLINTPTR(pScrn);
-- TRACE_ENTER("Permedia3SubsequentImageWrite");
-- GLINT_WAIT(4);
-+ TRACE_ENTER("Permedia3SubsequentScanlineImageWrite");
-+ pGlint->dwords = (((w * pScrn->bitsPerPixel) + 3) >> 2); /* per scanline */
-+
-+ pGlint->cpucount = h;
-+ GLINT_WAIT(5);
- GLINT_WRITE_REG(((y&0x0fff)<<16)|((x+skipleft)&0x0fff), ScissorMinXY);
- GLINT_WRITE_REG((((y+h)&0x0fff)<<16)|((x+w)&0x0fff), ScissorMaxXY);
- GLINT_WRITE_REG(
-@@ -788,18 +862,63 @@
- GLINT_WRITE_REG(pGlint->PM3_Render2D |
- PM3Render2D_Width(w) | PM3Render2D_Height(h),
- PM3Render2D);
-- TRACE_EXIT("Permedia3SubsequentImageWrite");
--}
-
-+#ifdef __alpha__
-+ if (0) /* force ALPHA to use indirect always */
-+#else
-+ if (pGlint->dwords < MAX_FIFO_ENTRIES)
-+#endif
-+ {
-+ /* Turn on direct for less than 120 dword colour expansion */
-+ pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->IOBase+OutputFIFO+4;
-+ pGlint->ScanlineDirect = 1;
-+ GLINT_WRITE_REG(((pGlint->dwords*h)-1)<<16 | (0x15<<4) | 0x05,
-+ OutputFIFO);
-+ GLINT_WAIT(pGlint->dwords);
-+ } else {
-+ /* Use indirect for anything else */
-+ pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->ScratchBuffer;
-+ pGlint->ScanlineDirect = 0;
-+ }
-
--/* Defines for Direct Fifo access */
-+ pGlint->cpucount--;
-+ TRACE_EXIT("Permedia3SubsequentScanlineImageWrite");
-+}
-
--#define WriteRange 120
--#define PciRetryWriteRange 1023
--#define WriteBase_Fixed ((CARD32 *)(pGlint->IOBase + PM3FBSourceData))
--#define WriteBase ((CARD32 *)(pGlint->IOBase + OutputFIFO + 4))
-+static void
-+Permedia3SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
-+{
-+ GLINTPtr pGlint = GLINTPTR(pScrn);
-+ int dwords = pGlint->dwords;
-
--/* Direct Fifo Bitmap Writes */
-+ if (pGlint->ScanlineDirect) {
-+ if (pGlint->cpucount--)
-+ GLINT_WAIT(dwords);
-+ return;
-+ } else {
-+ while(dwords >= MAX_FIFO_ENTRIES) {
-+ GLINT_WAIT(MAX_FIFO_ENTRIES);
-+ GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) |
-+ 0x05, OutputFIFO);
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ (CARD32*)pGlint->XAAScanlineColorExpandBuffers[bufno],
-+ MAX_FIFO_ENTRIES - 1);
-+ dwords -= MAX_FIFO_ENTRIES - 1;
-+ }
-+ if(dwords) {
-+ GLINT_WAIT(dwords + 1);
-+ GLINT_WRITE_REG(((dwords - 1) << 16) | (0x15 << 4) |
-+ 0x05, OutputFIFO);
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ (CARD32*)pGlint->XAAScanlineColorExpandBuffers[bufno],
-+ dwords);
-+ }
-+ }
-+}
-+
-+/* Bitmap Writes */
-
- static void
- Permedia3WriteBitmap(ScrnInfoPtr pScrn,
-@@ -810,59 +929,85 @@
- unsigned int planemask
- )
- {
-- int dwords;
-- int ApertureRange;
-+ int dwords, count;
-+ CARD32 *srcp;
- GLINTPtr pGlint = GLINTPTR(pScrn);
- TRACE_ENTER("Permedia3WriteBitmap");
-
- w += skipleft;
- x -= skipleft;
-- dwords = (w + 31) >>5;
-- if (pGlint->UsePCIRetry) ApertureRange = PciRetryWriteRange;
-- else ApertureRange = WriteRange;
-
- /* width of the stuff to copy in 32 bit words */
-- Permedia3SetupForCPUToScreenColorExpandFill(pScrn, fg, bg, rop, planemask);
-- Permedia3SubsequentCPUToScreenColorExpandFill(pScrn, x, y, w, h, skipleft);
-+ dwords = (w + 31) >>5;
-
-- if (dwords > ApertureRange) {
-- while(h--) {
-- XAAMoveDWORDS_FixedBase(WriteBase_Fixed, (CARD32*)src, dwords);
-- src += srcwidth;
-- }
-- } else {
-- /* the src is exatcly as wide as the target rectangle. We copy all
-- * of it, so no need to separate stuff by scanline */
-- if(srcwidth == (dwords << 5)) {
-- /* decrement contains the number of lines that can be
-- * put in the fifo */
-- int decrement = ApertureRange/dwords;
--
-- while(h > decrement) {
-- GLINT_WAIT(dwords * decrement);
-- GLINT_WRITE_REG((((dwords * decrement)-1) << 16) | 0xd,
-- OutputFIFO);
-- XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords * decrement);
-- src += (srcwidth * decrement);
-- h -= decrement;
-- }
-- if(h) {
-- GLINT_WAIT(dwords * h);
-- GLINT_WRITE_REG((((dwords * h)-1) << 16) | 0xd, OutputFIFO);
-- XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords * h);
-- }
-- } else {
-- while(h--) {
-- GLINT_WAIT(dwords);
-- GLINT_WRITE_REG(((dwords-1) << 16) | 0xd, OutputFIFO);
-- XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords);
-- src += srcwidth;
-- }
-- }
-+ REPLICATE(fg);
-+ pGlint->PM3_Render2D =
-+ PM3Render2D_SpanOperation |
-+ PM3Render2D_XPositive |
-+ PM3Render2D_YPositive |
-+ PM3Render2D_Operation_SyncOnBitMask;
-+ pGlint->PM3_Config2D =
-+ PM3Config2D_UserScissorEnable |
-+ PM3Config2D_UseConstantSource |
-+ PM3Config2D_ForegroundROPEnable |
-+ PM3Config2D_ForegroundROP(rop) |
-+ PM3Config2D_FBWriteEnable;
-+ if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted))
-+ pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable;
-+ if (bg != -1) {
-+ REPLICATE(bg);
-+ pGlint->PM3_Config2D |= PM3Config2D_OpaqueSpan;
-+ GLINT_WAIT(8);
-+ GLINT_WRITE_REG(bg, BackgroundColor);
-+ }
-+ else GLINT_WAIT(7);
-+ GLINT_WRITE_REG(fg, PM3ForegroundColor);
-+ DO_PLANEMASK(planemask);
-+ GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D);
-+ GLINT_WRITE_REG(((y&0x0fff)<<16)|((x+skipleft)&0x0fff), ScissorMinXY);
-+ GLINT_WRITE_REG((((y+h)&0x0fff)<<16)|((x+w)&0x0fff), ScissorMaxXY);
-+ GLINT_WRITE_REG(
-+ PM3RectanglePosition_XOffset(x) |
-+ PM3RectanglePosition_YOffset(y),
-+ PM3RectanglePosition);
-+ GLINT_WRITE_REG(pGlint->PM3_Render2D |
-+ PM3Render2D_Width(w) | PM3Render2D_Height(h),
-+ PM3Render2D);
-+
-+#ifdef __alpha__
-+ mem_barrier(); /* dunno why, but this helps on older Alpha CPUs */
-+#endif
-+
-+ while(h--) {
-+ count = dwords;
-+ srcp = (CARD32*)src;
-+ while(count >= MAX_FIFO_ENTRIES) {
-+ GLINT_WAIT(MAX_FIFO_ENTRIES);
-+ GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) |
-+ 0x0D, OutputFIFO);
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ (CARD32*)srcp, MAX_FIFO_ENTRIES - 1);
-+ count -= MAX_FIFO_ENTRIES - 1;
-+ srcp += MAX_FIFO_ENTRIES - 1;
-+ }
-+ if(count) {
-+ GLINT_WAIT(count + 1);
-+ GLINT_WRITE_REG(((count - 1) << 16) | 0x0D, OutputFIFO);
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ (CARD32*)srcp, count);
-+ }
-+ src += srcwidth;
- }
-+
-+ Permedia3DisableClipping(pScrn);
-+ Permedia3Sync(pScrn);
-+
- TRACE_EXIT("Permedia3WriteBitmap");
- }
--/* Direct Fifo Images Writes */
-+
-+/* Pixmap Writes */
-
- static void
- Permedia3WritePixmap(
-@@ -876,10 +1021,10 @@
- int bpp, int depth
- )
- {
-- int dwords;
-+ int dwords, count;
- int skipleft = (long)src & 0x03L;
- int Bpp = bpp >> 3;
-- int ApertureRange;
-+ CARD32 *srcp;
- GLINTPtr pGlint = GLINTPTR(pScrn);
- TRACE_ENTER("Permedia3WritePixmap");
-
-@@ -896,48 +1041,67 @@
-
- src = (unsigned char*)((long)src & ~0x03L);
- }
-- Permedia3SetupForImageWrite(pScrn, rop, planemask, trans, bpp, depth);
-- Permedia3SubsequentImageWriteRect(pScrn, x, y, w, h, skipleft);
-+
-+ pGlint->PM3_Render2D =
-+ PM3Render2D_SpanOperation |
-+ PM3Render2D_XPositive |
-+ PM3Render2D_YPositive |
-+ PM3Render2D_Operation_SyncOnHostData;
-+ pGlint->PM3_Config2D =
-+ PM3Config2D_UserScissorEnable |
-+ PM3Config2D_ForegroundROPEnable |
-+ PM3Config2D_ForegroundROP(rop) |
-+ PM3Config2D_FBWriteEnable;
-+ if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted))
-+ pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable;
-+ GLINT_WAIT(6);
-+ DO_PLANEMASK(planemask);
-+ GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D);
-+ GLINT_WRITE_REG(((y&0x0fff)<<16)|((x+skipleft)&0x0fff), ScissorMinXY);
-+ GLINT_WRITE_REG((((y+h)&0x0fff)<<16)|((x+w)&0x0fff), ScissorMaxXY);
-+ GLINT_WRITE_REG(
-+ PM3RectanglePosition_XOffset(x) |
-+ PM3RectanglePosition_YOffset(y),
-+ PM3RectanglePosition);
-+ GLINT_WRITE_REG(pGlint->PM3_Render2D |
-+ PM3Render2D_Width(w) | PM3Render2D_Height(h),
-+ PM3Render2D);
-+
-+#ifdef __alpha__
-+ mem_barrier(); /* dunno why, but this helps on older Alpha CPUs */
-+#endif
-
- /* width of the stuff to copy in 32 bit words */
- dwords = ((w * Bpp) + 3) >> 2;
-- if (pGlint->UsePCIRetry) ApertureRange = PciRetryWriteRange;
-- else ApertureRange = WriteRange;
-
-- if (dwords > ApertureRange) {
-- while(h--) {
-- XAAMoveDWORDS_FixedBase(WriteBase_Fixed, (CARD32*)src, dwords);
-- src += srcwidth;
-- }
-- } else {
-- /* the src is exatcly as wide as the target rectangle. We copy all
-- * of it, so no need to separate stuff by scanline */
-- if(srcwidth == (dwords << 2)) {
-- /* decrement contains the number of lines that can be
-- * put in the fifo */
-- int decrement = ApertureRange/dwords;
--
-- while(h > decrement) {
-- GLINT_WAIT(dwords * decrement);
-- GLINT_WRITE_REG((((dwords * decrement)-1) << 16) | 0x155,
-- OutputFIFO);
-- XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords * decrement);
-- src += (srcwidth * decrement);
-- h -= decrement;
-- }
-- if(h) {
-- GLINT_WAIT(dwords * h);
-- GLINT_WRITE_REG((((dwords * h)-1) << 16) | 0x155, OutputFIFO);
-- XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords * h);
-- }
-- } else {
-- while(h--) {
-- GLINT_WAIT(dwords);
-- GLINT_WRITE_REG(((dwords-1) << 16) | 0x155, OutputFIFO);
-- XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords);
-- src += srcwidth;
-- }
-- }
-+ while(h--) {
-+ count = dwords;
-+ srcp = (CARD32*)src;
-+ while(count >= MAX_FIFO_ENTRIES) {
-+ GLINT_WAIT(MAX_FIFO_ENTRIES);
-+ /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
-+ GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) |
-+ 0x05, OutputFIFO);
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ (CARD32*)srcp, MAX_FIFO_ENTRIES - 1);
-+ count -= MAX_FIFO_ENTRIES - 1;
-+ srcp += MAX_FIFO_ENTRIES - 1;
-+ }
-+ if(count) {
-+ GLINT_WAIT(count + 1);
-+ /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
-+ GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
-+ 0x05, OutputFIFO);
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ (CARD32*)srcp, count);
-+ }
-+ src += srcwidth;
- }
-+
-+ Permedia3DisableClipping(pScrn);
-+ Permedia3Sync(pScrn);
-+
- TRACE_EXIT("Permedia3WritePixmap");
- }
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c
---- xc.orig/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c Sat Mar 17 17:57:15 2001
-+++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c Sun Mar 18 21:35:54 2001
-@@ -320,7 +320,7 @@
- pReg->glintRegs[VClkCtl >> 3] = (GLINT_READ_REG(VClkCtl) & 0xFFFFFFFC);
- pReg->glintRegs[PMScreenBase >> 3] = 0;
-
-- pReg->glintRegs[ChipConfig >> 3] = GLINT_READ_REG(ChipConfig) & 0xFFFFFFDD;
-+ pReg->glintRegs[ChipConfig >> 3] = GLINT_READ_REG(ChipConfig) & 0xFFFFFFFD;
- pReg->DacRegs[PM2VDACRDDACControl] = 0x00;
-
- {
-@@ -524,4 +524,80 @@
- Permedia2vOutIndReg(pScrn, PM2VDACRDDClk0PostScale, 0x00,
- glintReg->DacRegs[PM2VDACRDDClk0PostScale]);
- Permedia2vOutIndReg(pScrn, PM2VDACIndexClockControl, 0x00, temp|0x03);
-+}
-+
-+void Permedia3LoadPalette(
-+ ScrnInfoPtr pScrn,
-+ int numColors,
-+ int *indices,
-+ LOCO *colors,
-+ VisualPtr pVisual
-+){
-+#if 0 /* NOT YET */
-+ GLINTPtr pGlint = GLINTPTR(pScrn);
-+#endif
-+ int i, index, shift = 0, j, repeat = 1;
-+
-+ if (pScrn->depth == 15) {
-+ repeat = 8;
-+ shift = 3;
-+ }
-+
-+ for(i = 0; i < numColors; i++) {
-+ index = indices[i];
-+ for (j = 0; j < repeat; j++) {
-+ Permedia2WriteAddress(pScrn, (index << shift)+j);
-+ Permedia2WriteData(pScrn, colors[index].red);
-+ Permedia2WriteData(pScrn, colors[index].green);
-+ Permedia2WriteData(pScrn, colors[index].blue);
-+ }
-+ /* for video i/o */
-+#if 0 /* NOT YET */
-+ GLINT_SLOW_WRITE_REG(index, PM3LUTIndex);
-+ GLINT_SLOW_WRITE_REG((colors[index].red & 0xFF) |
-+ ((colors[index].green & 0xFF) << 8) |
-+ ((colors[index].blue & 0xFF) << 16),
-+ PM3LUTData);
-+#endif
-+ }
-+}
-+
-+/* special one for 565 mode */
-+void Permedia3LoadPalette16(
-+ ScrnInfoPtr pScrn,
-+ int numColors,
-+ int *indices,
-+ LOCO *colors,
-+ VisualPtr pVisual
-+){
-+#if 0 /* NOT YET */
-+ GLINTPtr pGlint = GLINTPTR(pScrn);
-+#endif
-+ int i, index, j;
-+
-+ for(i = 0; i < numColors; i++) {
-+ index = indices[i];
-+ for (j = 0; j < 4; j++) {
-+ Permedia2WriteAddress(pScrn, (index << 2)+j);
-+ Permedia2WriteData(pScrn, colors[index >> 1].red);
-+ Permedia2WriteData(pScrn, colors[index].green);
-+ Permedia2WriteData(pScrn, colors[index >> 1].blue);
-+ }
-+#if 0 /* NOT YET */
-+ GLINT_SLOW_WRITE_REG(index, PM3LUTIndex);
-+ GLINT_SLOW_WRITE_REG((colors[index].red & 0xFF) |
-+ ((colors[index].green & 0xFF) << 8) |
-+ ((colors[index].blue & 0xFF) << 16),
-+ PM3LUTData);
-+#endif
-+
-+ if(index <= 31) {
-+ for (j = 0; j < 4; j++) {
-+ Permedia2WriteAddress(pScrn, (index << 3)+j);
-+ Permedia2WriteData(pScrn, colors[index].red);
-+ Permedia2WriteData(pScrn, colors[(index << 1) + 1].green);
-+ Permedia2WriteData(pScrn, colors[index].blue);
-+ }
-+ }
-+ }
- }
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/glint/pm_accel.c xc/programs/Xserver/hw/xfree86/drivers/glint/pm_accel.c
---- xc.orig/programs/Xserver/hw/xfree86/drivers/glint/pm_accel.c Sat Jun 24 14:19:55 2000
-+++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm_accel.c Sun Mar 18 16:57:17 2001
-@@ -301,62 +301,6 @@
- return (XAAInit(pScreen, infoPtr));
- }
-
--static void MoveBYTE(
-- register CARD32* dest,
-- register unsigned char* src,
-- register int dwords
--)
--{
-- while(dwords) {
-- *dest = *src;
-- src += 1;
-- dest += 1;
-- dwords -= 1;
-- }
--}
--
--static void MoveWORDS(
-- register CARD32* dest,
-- register unsigned short* src,
-- register int dwords
--)
--{
-- while(dwords & ~0x01) {
-- *dest = *src;
-- *(dest + 1) = *(src + 1);
-- src += 2;
-- dest += 2;
-- dwords -= 2;
-- }
-- switch(dwords) {
-- case 0: return;
-- case 1: *dest = *src;
-- return;
-- }
--}
--
--static void MoveDWORDS(
-- register CARD32* dest,
-- register CARD32* src,
-- register int dwords )
--{
-- while(dwords & ~0x03) {
-- *dest = *src;
-- *(dest + 1) = *(src + 1);
-- *(dest + 2) = *(src + 2);
-- *(dest + 3) = *(src + 3);
-- src += 4;
-- dest += 4;
-- dwords -= 4;
-- }
-- if (!dwords) return;
-- *dest = *src;
-- if (dwords == 1) return;
-- *(dest + 1) = *(src + 1);
-- if (dwords == 2) return;
-- *(dest + 2) = *(src + 2);
--}
--
- static void PermediaLoadCoord(
- ScrnInfoPtr pScrn,
- int x, int y,
-@@ -779,15 +723,16 @@
- while (dwords >= infoRec->ColorExpandRange) {
- GLINT_WAIT(infoRec->ColorExpandRange);
- GLINT_WRITE_REG((infoRec->ColorExpandRange - 2)<<16 | 0x0D, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,
-- infoRec->ColorExpandRange - 1);
-+ GLINT_MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ src, infoRec->ColorExpandRange - 1);
- dwords -= (infoRec->ColorExpandRange - 1);
- src += (infoRec->ColorExpandRange - 1);
- }
- if (dwords) {
- GLINT_WAIT(dwords);
- GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,dwords);
-+ GLINT_MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ src,dwords);
- }
- pGlint->cpucount += 1;
- #if 0
-@@ -915,7 +860,8 @@
- /* (0x11 << 4) | 0x0D is the TAG for TextureData */
- GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16)
- | (0x11 << 4) | 0x0D, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, infoRec->ColorExpandRange - 1);
- count -= infoRec->ColorExpandRange - 1;
- address += infoRec->ColorExpandRange - 1;
-@@ -926,7 +872,8 @@
- /* (0x11 << 4) | 0x0D is the TAG for TextureData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x11 << 4) | 0x0D,
- OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
-@@ -955,7 +902,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) |
- (0x15 << 4) | 0x05, OutputFIFO);
-- MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveBYTES(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (unsigned char *)srcpbyte, infoRec->ColorExpandRange-1);
- count -= infoRec->ColorExpandRange - 1;
- srcpbyte += infoRec->ColorExpandRange - 1;
-@@ -965,7 +913,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveBYTES(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (unsigned char *)srcpbyte, count);
- }
- src += srcwidth;
-@@ -1038,7 +987,8 @@
- /* (0x11 << 4) | 0x0D is the TAG for TextureData */
- GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) |
- (0x11 << 4) | 0x0D, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, infoRec->ColorExpandRange - 1);
- count -= infoRec->ColorExpandRange - 1;
- address += infoRec->ColorExpandRange - 1;
-@@ -1049,7 +999,8 @@
- /* (0x11 << 4) | 0x0D is the TAG for TextureData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x11 << 4) | 0x0D,
- OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
-@@ -1078,7 +1029,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) |
- (0x15 << 4) | 0x05, OutputFIFO);
-- MoveWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (unsigned short *)srcpword,infoRec->ColorExpandRange-1);
- count -= infoRec->ColorExpandRange - 1;
- srcpword += infoRec->ColorExpandRange - 1;
-@@ -1088,7 +1040,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (unsigned short *)srcpword, count);
- }
- src += srcwidth;
-@@ -1162,7 +1115,8 @@
- /* (0x11 << 4) | 0x0D is the TAG for TextureData */
- GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) |
- (0x11 << 4) | 0x0D, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, infoRec->ColorExpandRange - 1);
- count -= infoRec->ColorExpandRange - 1;
- address += infoRec->ColorExpandRange - 1;
-@@ -1173,7 +1127,8 @@
- /* (0x11 << 4) | 0x0D is the TAG for TextureData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x11 << 4) | 0x0D,
- OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
-@@ -1196,7 +1151,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) |
- (0x15 << 4) | 0x05, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, infoRec->ColorExpandRange - 1);
- count -= infoRec->ColorExpandRange - 1;
- srcp += infoRec->ColorExpandRange - 1;
-@@ -1206,7 +1162,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c
---- xc.orig/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c Wed Apr 12 10:44:41 2000
-+++ xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c Sun Mar 18 16:57:36 2001
-@@ -298,28 +298,6 @@
- }
- }
-
--static void MoveDWORDS(
-- register CARD32* dest,
-- register CARD32* src,
-- register int dwords )
--{
-- while(dwords & ~0x03) {
-- *dest = *src;
-- *(dest + 1) = *(src + 1);
-- *(dest + 2) = *(src + 2);
-- *(dest + 3) = *(src + 3);
-- src += 4;
-- dest += 4;
-- dwords -= 4;
-- }
-- if (!dwords) return;
-- *dest = *src;
-- if (dwords == 1) return;
-- *(dest + 1) = *(src + 1);
-- if (dwords == 2) return;
-- *(dest + 2) = *(src + 2);
--}
--
- static void
- SXSync(
- ScrnInfoPtr pScrn
-@@ -519,7 +497,8 @@
- while (dwords >= infoRec->ColorExpandRange) {
- GLINT_WAIT(infoRec->ColorExpandRange);
- GLINT_WRITE_REG((infoRec->ColorExpandRange - 2)<<16 | 0x0D, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,
- infoRec->ColorExpandRange - 1);
- dwords -= (infoRec->ColorExpandRange - 1);
- src += (infoRec->ColorExpandRange - 1);
-@@ -527,7 +506,8 @@
- if (dwords) {
- GLINT_WAIT(dwords);
- GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,dwords);
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,dwords);
- }
- pGlint->cpucount += 1;
- }
-@@ -809,7 +789,8 @@
- /* (0x0f << 4) | 0x0e is the TAG for GLINTColor */
- GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) | (0x0F << 4) |
- 0x0E, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, infoRec->ColorExpandRange - 1);
- count -= infoRec->ColorExpandRange - 1;
- srcp += infoRec->ColorExpandRange - 1;
-@@ -819,7 +800,8 @@
- /* (0x0F << 4) | 0x0E is the TAG for GLINTColor */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x0f << 4) |
- 0x0e, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c
---- xc.orig/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c Wed May 10 16:01:32 2000
-+++ xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c Sun Mar 18 16:57:58 2001
-@@ -326,28 +326,6 @@
- #endif
- }
-
--static void MoveDWORDS(
-- register CARD32* dest,
-- register CARD32* src,
-- register int dwords )
--{
-- while(dwords & ~0x03) {
-- *dest = *src;
-- *(dest + 1) = *(src + 1);
-- *(dest + 2) = *(src + 2);
-- *(dest + 3) = *(src + 3);
-- src += 4;
-- dest += 4;
-- dwords -= 4;
-- }
-- if (!dwords) return;
-- *dest = *src;
-- if (dwords == 1) return;
-- *(dest + 1) = *(src + 1);
-- if (dwords == 2) return;
-- *(dest + 2) = *(src + 2);
--}
--
- static void
- TXSync(
- ScrnInfoPtr pScrn
-@@ -541,7 +519,8 @@
- while (dwords >= infoRec->ColorExpandRange) {
- GLINT_WAIT(infoRec->ColorExpandRange);
- GLINT_WRITE_REG((infoRec->ColorExpandRange - 2)<<16 | 0x0D, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,
- infoRec->ColorExpandRange - 1);
- dwords -= (infoRec->ColorExpandRange - 1);
- src += (infoRec->ColorExpandRange - 1);
-@@ -549,7 +528,8 @@
- if (dwords) {
- GLINT_WAIT(dwords);
- GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,dwords);
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,dwords);
- }
- pGlint->cpucount += 1;
- }
-@@ -848,7 +828,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, infoRec->ColorExpandRange - 1);
- count -= infoRec->ColorExpandRange - 1;
- srcp += infoRec->ColorExpandRange - 1;
-@@ -858,7 +839,8 @@
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
-- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
-+ GLINT_MoveDWORDS(
-+ (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c
---- xc.orig/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c Sat Mar 17 17:57:15 2001
-+++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c Sun Mar 18 17:19:13 2001
-@@ -37,6 +37,16 @@
- #include "mga_dri.h"
- #endif
-
-+#if defined(__alpha__)
-+#define MGAMoveDWORDS(d,s,c) \
-+do { \
-+ write_mem_barrier(); \
-+ XAAMoveDWORDS((d),(s),(c)); \
-+} while (0)
-+#else
-+#define MGAMoveDWORDS(d,s,c) XAAMoveDWORDS((d),(s),(c))
-+#endif
-+
- static void MGANAME(SubsequentScreenToScreenCopy)(ScrnInfoPtr pScrn,
- int srcX, int srcY, int dstX, int dstY,
- int w, int h);
-@@ -964,6 +974,8 @@
-
- CHECK_DMA_QUIESCENT(pMga, pScrn);
-
-+ mem_barrier(); /*??*/
-+
- while(MGAISBUSY());
- /* flush cache before a read (mga-1064g 5.1.6) */
- OUTREG8(MGAREG_CRTC_INDEX, 0);
-@@ -1599,7 +1611,13 @@
- OUTREG(MGAREG_FXBNDRY, ((x + w - 1) << 16) | (x & 0xFFFF));
- OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h);
-
-- if(pMga->expandDWORDs > pMga->FifoSize) {
-+#ifdef __alpha__
-+ /* force Alpha to always use indirect */
-+ if(1)
-+#else
-+ if(pMga->expandDWORDs > pMga->FifoSize)
-+#endif
-+ {
- pMga->AccelInfoRec->SubsequentColorExpandScanline =
- MGANAME(SubsequentColorExpandScanlineIndirect);
- pMga->AccelInfoRec->ScanlineColorExpandBuffers =
-@@ -1624,13 +1642,13 @@
-
- while(dwords > pMga->FifoSize) {
- WAITFIFO(pMga->FifoSize);
-- XAAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, pMga->FifoSize);
-+ MGAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, pMga->FifoSize);
- src += pMga->FifoSize;
- dwords -= pMga->FifoSize;
- }
-
- WAITFIFO(dwords);
-- XAAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, dwords);
-+ MGAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, dwords);
-
- if(!(--pMga->expandRows)) {
- if(pMga->expandRemaining) {
-@@ -1726,13 +1744,13 @@
-
- while(dwords > pMga->FifoSize) {
- WAITFIFO(pMga->FifoSize);
-- XAAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, pMga->FifoSize);
-+ MGAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, pMga->FifoSize);
- src += pMga->FifoSize;
- dwords -= pMga->FifoSize;
- }
-
- WAITFIFO(dwords);
-- XAAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, dwords);
-+ MGAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, dwords);
-
- if(!(--pMga->expandRows)) {
- DISABLE_CLIP();
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/tga/IBM561ramdac.c xc/programs/Xserver/hw/xfree86/drivers/tga/IBM561ramdac.c
---- xc.orig/programs/Xserver/hw/xfree86/drivers/tga/IBM561ramdac.c Mon Oct 23 17:16:50 2000
-+++ xc/programs/Xserver/hw/xfree86/drivers/tga/IBM561ramdac.c Sun Mar 18 16:51:30 2001
-@@ -533,7 +533,6 @@
- TGAPtr pTga = TGAPTR(pScrn);
-
- unsigned int temp1[6] = {0,0,0,0,0,0};
-- struct monitor_data * c_table = &crystal_table;
-
- /*
- * Set-up av9110 to 14.3 Mhz as reference for 561's PLL
-@@ -555,10 +554,10 @@
- IBM561WriteReg(pScrn, IBM561_CONFIG_REG_4, 0x20 );
-
- /* IBM561WriteReg(pScrn, IBM561_PLL_VCO_DIV_REG, 0xc8 ); */
-- IBM561WriteReg(pScrn, IBM561_PLL_VCO_DIV_REG, c_table->ibm561_vco_div);
-+ IBM561WriteReg(pScrn, IBM561_PLL_VCO_DIV_REG, tga_c_table->ibm561_vco_div);
-
- /* IBM561WriteReg(pScrn, IBM561_PLL_REF_REG, 0x08 ); */
-- IBM561WriteReg(pScrn, IBM561_PLL_REF_REG, c_table->ibm561_ref );
-+ IBM561WriteReg(pScrn, IBM561_PLL_REF_REG, tga_c_table->ibm561_ref );
-
- IBM561WriteReg(pScrn, IBM561_DIV_DOT_CLK_REG, 0xb0 );
-
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/tga/tga.h xc/programs/Xserver/hw/xfree86/drivers/tga/tga.h
---- xc.orig/programs/Xserver/hw/xfree86/drivers/tga/tga.h Fri Oct 27 21:23:37 2000
-+++ xc/programs/Xserver/hw/xfree86/drivers/tga/tga.h Sun Mar 18 16:51:30 2001
-@@ -120,7 +120,9 @@
- unsigned int ibm561_ref;
- };
-
--extern struct monitor_data crystal_table;
-+extern struct monitor_data tga_crystal_table[];
-+extern int tga_crystal_table_entries;
-+extern struct monitor_data *tga_c_table;
-
- /* Prototypes */
-
-@@ -131,6 +133,7 @@
- Bool saveFonts*/);
- Bool DEC21030Init(ScrnInfoPtr pScrn, DisplayModePtr mode);
- void write_av9110(ScrnInfoPtr pScrn, unsigned int *);
-+void TGA2SetupMode(ScrnInfoPtr pScrn);
-
- /* tga_accel.c */
- Bool DEC21030AccelInit(ScreenPtr pScreen);
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/tga/tga_dac.c xc/programs/Xserver/hw/xfree86/drivers/tga/tga_dac.c
---- xc.orig/programs/Xserver/hw/xfree86/drivers/tga/tga_dac.c Fri Oct 27 21:23:37 2000
-+++ xc/programs/Xserver/hw/xfree86/drivers/tga/tga_dac.c Sun Mar 18 16:51:30 2001
-@@ -49,45 +49,114 @@
- /* There lies an ICS1562 Clock Generator. */
- ICS1562_CalcClockBits(freq, pll_bits);
-
-- switch (pTga->Chipset) {
-- case PCI_CHIP_DEC21030:
-- /*
-- * For the DEC 21030 TGA:
-- * This requires the 55 clock bits be written in a serial manner to
-- * bit 0 of the CLOCK register and on the 56th bit set the hold flag.
-- */
-- for (i = 0;i <= 6; i++) {
-- for (j = 0; j <= 7; j++) {
-- temp = (pll_bits[i] >> (7-j)) & 1;
-- if (i == 6 && j == 7)
-- temp |= 2;
-- TGA_WRITE_REG(temp, TGA_CLOCK_REG);
-- }
-+ /*
-+ * For the DEC 21030 TGA:
-+ * This requires the 55 clock bits be written in a serial manner to
-+ * bit 0 of the CLOCK register and on the 56th bit set the hold flag.
-+ */
-+ for (i = 0;i <= 6; i++) {
-+ for (j = 0; j <= 7; j++) {
-+ temp = (pll_bits[i] >> (7-j)) & 1;
-+ if (i == 6 && j == 7)
-+ temp |= 2;
-+ TGA_WRITE_REG(temp, TGA_CLOCK_REG);
- }
-- break;
--
-- case PCI_CHIP_TGA2:
-- /*
-- * For the DEC TGA2:
-- * This requires the 55 clock bits be written in a serial manner to
-- * bit 0 of the CLOCK register and on the 56th bit set the hold flag.
-- */
--#if 0
-- /* ?? FIXME FIXME FIXME ?? */
-- for (i = 0;i <= 6; i++) {
-- for (j = 0; j <= 7; j++) {
-- temp = (pll_bits[i] >> (7-j)) & 1;
-- if (i == 6 && j == 7)
-- temp |= 2;
-- TGA_WRITE_REG(temp, TGA_CLOCK_REG);
-- }
-- }
--#endif
-- break;
- }
- }
-
--struct monitor_data crystal_table =
-+struct monitor_data tga_crystal_table[] = {
-+{
-+/* Option 0 Monitor Info 130.8 */
-+1024, /* rows */
-+1280, /* columns */
-+130, /* 130.8 Mhz */
-+72, /* refresh rate */
-+1024, /* v scanlines */
-+3, /* v front porch */
-+3, /* v sync */
-+33, /* v back porch */
-+1280, /* h pixels */
-+32, /* h front porch */
-+160, /* h sync */
-+232, /* h back porch */
-+/* AV9110 clock serial load information 130.808 */
-+0x40, /* 0:6 VCO frequency divider N */
-+0x7, /* 7:13 Reference frequency divide M */
-+0x0, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8)
-+*/
-+0x1, /* 15:16 CLK/X output divide X */
-+0x1, /* 17:18 VCO output divide R */
-+1, /* 19 CLK Output enable. */
-+1, /* 20 CLK/X Output enable */
-+0, /* reserved, should be set to 0 */
-+0, /* Reference clock select on CLK 1=ref */
-+1, /* reserved, should be set to 1 */
-+/* IBM561 PLL setup data 130.808 */
-+0xC8, /* VCO Div: PFR=0x3, M-65=49 */
-+0x8 /* REF: N=0x8 */
-+},
-+{
-+/* Option 3 Monitor Info 104.00 Mhz */
-+900, /* rows */
-+1152, /* columns */
-+104, /* 104 Mhz */
-+72, /* refresh rate */
-+900, /* v scanlines */
-+6, /* v front porch */
-+10, /* v sync */
-+44, /* v back porch */
-+1152, /* h pixels */
-+64, /* h front porch */
-+112, /* h sync */
-+176, /* h back porch */
-+/* 103.994 MHz av9110 clock serial load information */
-+0x6d, /* 0:6 VCO frequency divider N */
-+0xf, /* 7:13 Reference frequency divide M */
-+0x0, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8)
-+*/
-+0x1, /* 15:16 CLK/X output divide X */
-+0x1, /* 17:18 VCO output divide R */
-+1, /* 19 CLK Output enable. */
-+1, /* 20 CLK/X Output enable */
-+0, /* reserved, should be set to 0 */
-+0, /* Reference clock select on CLK 1=ref */
-+1, /* reserved, should be set to 1 */
-+/* 104.00 MHz IBM561 PLL setup data */
-+0x96, /* VCO Div: PFR=2, M=57 */
-+0x6 /* REF: N=6 */
-+},
-+#if 1
-+{
-+/* Option 6 Monitor Info 74.00 Mhz */
-+768, /* rows */
-+1024, /* columns */
-+74, /* 74 Mhz */
-+72, /* refresh rate */
-+768, /* v scanlines */
-+1, /* v front porch */
-+6, /* v sync */
-+22, /* v back porch */
-+1024, /* h pixels */
-+16, /* h front porch */
-+128, /* h sync */
-+128, /* h back porch */
-+/* 74.00 MHz AV9110 clock serial load information */
-+0x2a, /* 0:6 VCO frequency divider N */
-+0x41, /* 7:13 Reference frequency divide M */
-+0x1, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8)
-+*/
-+0x1, /* 15:16 CLK/X output divide X */
-+0x1, /* 17:18 VCO output divide R */
-+1, /* 19 CLK Output enable. */
-+1, /* 20 CLK/X Output enable */
-+0, /* reserved, should be set to 0 */
-+0, /* Reference clock select on CLK 1=ref */
-+1, /* reserved, should be set to 1 */
-+/* 74.00 MHz IBM561 PLL setup data */
-+0x9C, /* VCO Div: PFR=2, M=0x5D*/
-+0x9 /* REF: N=0x9 */
-+},
-+#else
- {
- /* Option 5 Monitor Info 75.00 Mhz */
- 768, /* rows */
-@@ -117,8 +186,406 @@
- /* 75.00 MHz IBM561 PLL setup data */
- 0x93, /* VCO Div: PFR=2, M=0x54 */
- 0x8 /* REF: N=0x8 */
-+},
-+#endif
-+{
-+/* Option 9 Monitor Info 50 Mhz ergo SVGA */
-+600, /* rows */
-+800, /* columns */
-+50, /* 50 Mhz */
-+72, /* refresh rate */
-+600, /* v scanlines */
-+37, /*(31 tga)v front porch */
-+6, /* v sync */
-+23, /*(29 tga)v back porch */
-+800, /* h pixels */
-+56, /* h front porch */
-+120, /* h sync */
-+64, /* h back porch */
-+/*50.00 Mhz AV9110 clock serial load information */
-+0x37, /* 0:6 VCO frequency divider N */
-+0x3f, /* 7:13 Reference frequency divide M */
-+0x1, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8)
-+*/
-+0x1, /* 15:16 CLK/X output divide X */
-+0x2, /* 17:18 VCO output divide R */
-+1, /* 19 CLK Output enable. */
-+1, /* 20 CLK/X Output enable */
-+0, /* reserved, should be set to 0 */
-+0, /* Reference clock select on CLK 1=ref */
-+1, /* reserved, should be set to 1 */
-+/* 50.00 MHz IBM561 PLL setup data */
-+0x45, /* VCO Div: PFR=1, M=46*/
-+0x5 /* REF: N=5 */
-+},
-+{
-+/* Option B Monitor Info 31.5 Mhz ergo VGA */
-+480, /* rows */
-+640, /* columns */
-+32, /* 32 Mhz */
-+72, /* refresh rate */
-+480, /* v scanlines */
-+9, /* v front porch */
-+3, /* v sync */
-+28, /* v back porch */
-+640, /* h pixels */
-+24, /* h front porch */
-+40, /* h sync */
-+128, /* h back porch */
-+/* 31.50 MHz AV9110 clock serial load information */
-+0x16, /* 0:6 VCO frequency divider N */
-+0x05, /* 7:13 Reference frequency divide M */
-+0x0, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8)
-+*/
-+0x1, /* 15:16 CLK/X output divide X */
-+0x2, /* 17:18 VCO output divide R */
-+1, /* 19 CLK Output enable. */
-+1, /* 20 CLK/X Output enable */
-+0, /* reserved, should be set to 0 */
-+0, /* Reference clock select on CLK 1=ref */
-+1, /* reserved, should be set to 1 */
-+/* 31.50 MHz IBM561 PLL setup data */
-+0x17, /* VCO Div: PFR=0, M=0x58 */
-+0x5 /* REF: N=0x5 */
-+},
-+#ifdef ALLOW_LT_72_HZ
-+{
-+/* Option 1 Monitor Info 119.84 Mhz */
-+1024, /* rows */
-+1280, /* columns */
-+119, /* 119 Mhz */
-+66, /* refresh rate */
-+1024, /* v scanlines */
-+3, /* v front porch */
-+3, /* v sync */
-+33, /* v back porch */
-+1280, /* h pixels */
-+32, /* h front porch */
-+160, /* h sync */
-+232, /* h back porch */
-+/* 119.84MHz AV9110 clock serial load information */
-+0x2d, /* 0:6 VCO frequency divider N */
-+0x2b, /* 7:13 Reference frequency divide M */
-+0x1, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) */
-+0x1, /* 15:16 CLK/X output divide X */
-+0x1, /* 17:18 VCO output divide R */
-+1, /* 19 CLK Output enable. */
-+1, /* 20 CLK/X Output enable */
-+0, /* reserved, should be set to 0 */
-+0, /* Reference clock select on CLK 1=ref */
-+1, /* reserved, should be set to 1 */
-+/* IBM561 PLL setup data 119.84 */
-+0x82, /* VCO Div: PFR=0x2, M=0x43 */
-+0x4 /* REF: N=0x4 */
-+},
-+{
-+/* Option 2 Monitor Info 108.18 Mhz */
-+1024, /* rows */
-+1280, /* columns */
-+108, /* 108 Mhz */
-+60, /* refresh rate */
-+1024, /* v scanlines */
-+3, /* v front porch */
-+3, /* v sync */
-+26, /* v back porch */
-+1280, /* h pixels */
-+44, /* h front porch */
-+184, /* h sync */
-+200, /* h back porch */
-+/* 108.18 MHz av9110 Clk serial load information */
-+0x11, /* 0:6 VCO frequency divider N */
-+0x9, /* 7:13 Reference frequency divide M */
-+0x1, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8)
-+*/
-+0x1, /* 15:16 CLK/X output divide X */
-+0x2, /* 17:18 VCO output divide R */
-+1, /* 19 CLK Output enable. */
-+1, /* 20 CLK/X Output enable */
-+0, /* reserved, should be set to 0 */
-+0, /* Reference clock select on CLK 1=ref */
-+1, /* reserved, should be set to 1 */
-+/* 108.18 MHz IBM561 PLL setup data */
-+0xB8, /* VCO Div: PFR=2, M=79 */
-+0x8 /* REF: N=0x8 */
-+},
-+{
-+/* Option 5 Monitor Info 75.00 Mhz */
-+768, /* rows */
-+1024, /* columns */
-+75, /* 74 Mhz */
-+70, /* refresh rate */
-+768, /* v scanlines */
-+3, /* v front porch */
-+6, /* v sync */
-+29, /* v back porch */
-+1024, /* h pixels */
-+24, /* h front porch */
-+136, /* h sync */
-+144, /* h back porch */
-+/* 75.00 MHz AV9110 clock serial load information */
-+0x6e, /* 0:6 VCO frequency divider N */
-+0x15, /* 7:13 Reference frequency divide M */
-+0x0, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8)
-+*/
-+0x1, /* 15:16 CLK/X output divide X */
-+0x1, /* 17:18 VCO output divide R */
-+1, /* 19 CLK Output enable. */
-+1, /* 20 CLK/X Output enable */
-+0, /* reserved, should be set to 0 */
-+0, /* Reference clock select on CLK 1=ref */
-+1, /* reserved, should be set to 1 */
-+/* 75.00 MHz IBM561 PLL setup data */
-+0x93, /* VCO Div: PFR=2, M=0x54 */
-+0x8 /* REF: N=0x8 */
-+},
-+{
-+/* Option 7 Monitor Info 69 Mhz DEC 72 Hz */
-+864, /* rows */
-+1024, /* columns */
-+69, /* 69.x Mhz */
-+60, /* refresh rate */
-+864, /* v scanlines */
-+0, /* v front porch */
-+3, /* v sync */
-+34, /* v back porch */
-+1024, /* h pixels */
-+12, /* h front porch */
-+128, /* h sync */
-+116, /* h back porch */
-+/* 69.00 Mhz AV9110 clock serial load information */
-+0x35, /* 0:6 VCO frequency divider N */
-+0xb, /* 7:13 Reference frequency divide M */
-+0x0, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8)
-+*/
-+0x1, /* 15:16 CLK/X output divide X */
-+0x1, /* 17:18 VCO output divide R */
-+1, /* 19 CLK Output enable. */
-+1, /* 20 CLK/X Output enable */
-+0, /* reserved, should be set to 0 */
-+0, /* Reference clock select on CLK 1=ref */
-+1, /* reserved, should be set to 1 */
-+/* 69.00 MHz IBM561 PLL setup data */
-+0xA9, /* VCO Div: PFR=2, M=0x6A */
-+0xB /* REF: N=0xB */
-+},
-+{
-+/* Option 8 Monitor Info 65 Mhz */
-+768, /* rows */
-+1024, /* columns */
-+65, /* 65 Mhz */
-+60, /* refresh rate */
-+768, /* v scanlines */
-+7, /* v front porch */
-+9, /* v sync */
-+26, /* v back porch */
-+1024, /* h pixels */
-+56, /* h front porch */
-+64, /* h sync */
-+200, /* h back porch */
-+/* 65.00 MHz AV9110 clock serial load information */
-+0x6d, /* 0:6 VCO frequency divider N */
-+0x0c, /* 7:13 Reference frequency divide M */
-+0x0, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8)
-+*/
-+0x1, /* 15:16 CLK/X output divide X */
-+0x2, /* 17:18 VCO output divide R */
-+1, /* 19 CLK Output enable. */
-+1, /* 20 CLK/X Output enable */
-+0, /* reserved, should be set to 0 */
-+0, /* Reference clock select on CLK 1=ref */
-+1, /* reserved, should be set to 1 */
-+/* 65.00 MHz IBM561 PLL setup data */
-+0xAC, /* VCO Div: PFR=2, M=0x6D */
-+0xC /* REF: N=0xC */
-+},
-+{
-+/* Option A Monitor Info 40 Mhz SVGA */
-+600, /* rows */
-+800, /* columns */
-+40, /* 40 Mhz */
-+60, /* refresh rate */
-+600, /* v scanlines */
-+1, /* v front porch */
-+4, /* v sync */
-+23, /* v back porch */
-+800, /* h pixels */
-+40, /* h front porch */
-+128, /* h sync */
-+88, /* h back porch */
-+/* 40.00 MHz AV9110 clock serial load information */
-+0x5f, /* 0:6 VCO frequency divider N */
-+0x11, /* 7:13 Reference frequency divide M */
-+0x0, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8)
-+*/
-+0x1, /* 15:16 CLK/X output divide X */
-+0x2, /* 17:18 VCO output divide R */
-+1, /* 19 CLK Output enable. */
-+1, /* 20 CLK/X Output enable */
-+0, /* reserved, should be set to 0 */
-+0, /* Reference clock select on CLK 1=ref */
-+1, /* reserved, should be set to 1 */
-+/* 40.00 MHz IBM561 PLL setup data */
-+0x42, /* VCO Div: PFR=1, M=43 */
-+0x6 /* REF: N=0x6 */
-+},
-+{
-+/* Option C Monitor Info 25.175 Mhz VGA */
-+480, /* rows */
-+640, /* columns */
-+25, /* 25.175 Mhz */
-+60, /* refresh rate */
-+480, /* v scanlines */
-+10, /* v front porch */
-+2, /* v sync */
-+33, /* v back porch */
-+640, /* h pixels */
-+16, /* h front porch */
-+96, /* h sync */
-+48, /* h back porch */
-+/* 25.175 MHz AV9110 clock serial load information */
-+0x66, /* 0:6 VCO frequency divider N */
-+0x1d, /* 7:13 Reference frequency divide M */
-+0x0, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8)
-+*/
-+0x1, /* 15:16 CLK/X output divide X */
-+0x2, /* 17:18 VCO output divide R */
-+1, /* 19 CLK Output enable. */
-+1, /* 20 CLK/X Output enable */
-+0, /* reserved, should be set to 0 */
-+0, /* Reference clock select on CLK 1=ref */
-+1, /* reserved, should be set to 1 */
-+/* 25.175 MHz IBM561 PLL setup data */
-+0x3E, /* VCO Div: PFR=0, M=0x7F */
-+0x9 /* REF: N=0x9 */
-+},
-+{
-+/* Option E Monitor Info 110 Mhz */
-+1024, /* rows */
-+1280, /* columns */
-+110,
-+60, /* refresh rate */
-+1024, /* v scanlines */
-+6, /* v front porch */
-+7, /* v sync */
-+44, /* v back porch */
-+1280, /* h pixels */
-+19, /* h front porch */
-+163, /* h sync */
-+234, /* h back porch */
-+/* 110.0 MHz AV9110 clock serial load information */
-+0x60, /* 0:6 VCO frequency divider N */
-+0x32, /* 7:13 Reference frequency divide M */
-+0x1, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) */
-+0x1, /* 15:16 CLK/X output divide X */
-+0x2, /* 17:18 VCO output divide R */
-+1, /* 19 CLK Output enable. */
-+1, /* 20 CLK/X Output enable */
-+0, /* reserved, should be set to 0 */
-+0, /* Reference clock select on CLK 1=ref */
-+1, /* reserved, should be set to 1 */
-+/* 110.0 MHz IBM561 PLL setup data */
-+0xBA, /* VCO Div: PFR=0x2, M=0x7B */
-+0x8 /* REF: N=0x8 */
-+},
-+#endif /* ALLOW_LT_72_HZ */
-+#ifdef /* ALLOW_GT_72_HZ */
-+{
-+/* Option D Monitor Info 135 Mhz */
-+1024, /* rows */
-+1280, /* columns */
-+135, /* 135 Mhz */
-+75, /* refresh rate */
-+1024, /* v scanlines */
-+1, /* v front porch */
-+3, /* v sync */
-+38, /* v back porch */
-+1280, /* h pixels */
-+16, /* h front porch */
-+144, /* h sync */
-+248, /* h back porch */
-+/* 135.0 MHz AV9110 clock serial load information */
-+0x42, /* 0:6 VCO frequency divider N */
-+0x07, /* 7:13 Reference frequency divide M */
-+0x0, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) */
-+0x1, /* 15:16 CLK/X output divide X */
-+0x1, /* 17:18 VCO output divide R */
-+1, /* 19 CLK Output enable. */
-+1, /* 20 CLK/X Output enable */
-+0, /* reserved, should be set to 0 */
-+0, /* Reference clock select on CLK 1=ref */
-+1, /* reserved, should be set to 1 */
-+/* 135.0 MHz IBM561 PLL setup data */
-+0xC1, /* VCO Div: PFR=0x3, M=0x42 */
-+0x7 /* REF: N=0x7 */
-+},
-+#ifdef ALLOW_GT_1280x1024
-+{
-+/* Option 4 Monitor Info 175.5 Mhz (8-plane) */
-+1200, /* rows */
-+1600, /* columns */
-+175, /* clock */
-+65, /* refresh rate */
-+1200, /* v scanlines */
-+1, /* v front porch */
-+3, /* v sync */
-+46, /* v back porch */
-+1600, /* h pixels */
-+32, /* h front porch */
-+192, /* h sync */
-+336, /* h back porch */
-+/* 110.0 MHz AV9110 clock serial load information */
-+0x5F, /* 0:6 VCO frequency divider N */
-+0x3E, /* 7:13 Reference frequency divide M */
-+0x1, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8)
-+*/
-+0x1, /* 15:16 CLK/X output divide X */
-+0x1, /* 17:18 VCO output divide R */
-+1, /* 19 CLK Output enable. */
-+1, /* 20 CLK/X Output enable */
-+0, /* reserved, should be set to 0 */
-+0, /* Reference clock select on CLK 1=ref */
-+1, /* reserved, should be set to 1 */
-+/* 110.0 MHz IBM561 PLL setup data */
-+0xE1, /* VCO Div: PFR=0x3, M-65=0x21 */
-+0x8 /* REF: N=0x8 */
-+},
-+{
-+/* Option F Monitor Info (24-plane) */
-+1200, /* rows */
-+1600, /* columns */
-+202.5, /* 130.8 Mhz */
-+75, /* refresh rate */
-+1200, /* v scanlines */
-+1, /* v front porch */
-+3, /* v sync */
-+46, /* v back porch */
-+1600, /* h pixels */
-+32, /* h front porch */
-+192, /* h sync */
-+336, /* h back porch */
-+/* AV9110 clock serial load information 130.808 */
-+0x60, /* 0:6 VCO frequency divider N */
-+0x32, /* 7:13 Reference frequency divide M */
-+0x1, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) */
-+0x1, /* 15:16 CLK/X output divide X */
-+0x2, /* 17:18 VCO output divide R */
-+1, /* 19 CLK Output enable. */
-+1, /* 20 CLK/X Output enable */
-+0, /* reserved, should be set to 0 */
-+0, /* Reference clock select on CLK 1=ref */
-+1, /* reserved, should be set to 1 */
-+/* 110.0 MHz IBM561 PLL setup data */
-+0xE2, /* bogus VCO Div: PFR=0x2, M=0x7B */
-+0x7 /* bogus REF: N=0x8 */
-+}
-+#endif /* ALLOW_GT_1280x1024 */
-+#endif /* ALLOW_GT_72_HZ */
- };
-
-+int tga_crystal_table_entries = sizeof(tga_crystal_table)/sizeof(struct monitor_data);
-+
-+struct monitor_data *tga_c_table;
-+
- /* ICS av9110 is only used on TGA2 */
-
- void
-@@ -142,30 +609,58 @@
- TGA2_WRITE_CLOCK_REG(0x0, 0xf800);
- }
-
-+void TGA2SetupMode(ScrnInfoPtr pScrn)
-+{
-+ int i;
-+
-+ /*
-+ * HACK HACK HACK
-+ *
-+ * We do not know how to generate arbitrary clocks, so we search
-+ * the crystal_table above for a match. Sigh...
-+ */
-+ tga_c_table = tga_crystal_table;
-+ for (i = 0; i < tga_crystal_table_entries; i++, tga_c_table++) {
-+ if ((tga_c_table->max_rows == pScrn->currentMode->VDisplay) &&
-+ (tga_c_table->max_cols == pScrn->currentMode->HDisplay)) {
-+ ErrorF("Found a matching mode (%d)!\n", i);
-+ break;
-+ }
-+ }
-+ if (i == tga_crystal_table_entries) {
-+#ifdef FOR_NOW
-+ FatalError("Unable to find a workable mode");
-+#else
-+ ErrorF("Unable to find a matching mode!\n");
-+ /* tga_c_table = &tga_crystal_table[4]; *//* 640x480 @ 72 */
-+ tga_c_table = &tga_crystal_table[2]; /* 1024x768 @ 72 */
-+#endif
-+ }
-+ return;
-+}
-+
- static void
- ICS9110ClockSelect(ScrnInfoPtr pScrn, int freq)
- {
- unsigned int temp, temp1[6];
-- struct monitor_data *c_table;
-+ int i;
-
- /* There lies an ICS9110 Clock Generator. */
- /* ICS9110_CalcClockBits(freq, pll_bits); */
-
-- c_table = &crystal_table;
--
- /* the following is based on munge_ics() from the
- TRU64 kernel TGA driver */
-
-- temp = (unsigned int)(c_table->vco_div |
-- (c_table->ref_div << 7) |
-- (c_table->vco_pre << 14) |
-- (c_table->clk_div << 15) |
-- (c_table->vco_out_div << 17) |
-- (c_table->clk_out_en << 19) |
-- (c_table->clk_out_enX << 20) |
-- (c_table->res0 << 21) |
-- (c_table->clk_sel << 22) |
-- (c_table->res1 << 23));
-+ temp = (unsigned int)(tga_c_table->vco_div |
-+ (tga_c_table->ref_div << 7) |
-+ (tga_c_table->vco_pre << 14) |
-+ (tga_c_table->clk_div << 15) |
-+ (tga_c_table->vco_out_div << 17) |
-+ (tga_c_table->clk_out_en << 19) |
-+ (tga_c_table->clk_out_enX << 20) |
-+ (tga_c_table->res0 << 21) |
-+ (tga_c_table->clk_sel << 22) |
-+ (tga_c_table->res1 << 23));
-
- temp1[0] = (temp & 0x00000001) | ((temp & 0x00000002) << 7) |
- ((temp & 0x00000004) << 14) | ((temp & 0x00000008) << 21);
-diff -ur xc.orig/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c
---- xc.orig/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c Mon Dec 4 19:56:22 2000
-+++ xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c Sun Mar 18 16:51:30 2001
-@@ -954,6 +954,15 @@
- /* Set the current mode to the first in the list */
- pScrn->currentMode = pScrn->modes;
-
-+ /*
-+ This is a bit of a hack; we seem to have to init
-+ the TGA2 chipset knowing what the mode is, so we
-+ do this now as soon as we know it...
-+ */
-+ if (pTga->Chipset == PCI_CHIP_TGA2) {
-+ TGA2SetupMode(pScrn);
-+ }
-+
- /* Print the list of modes being used */
- xf86PrintModes(pScrn);
-
-diff -ur xc.orig/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c
---- xc.orig/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c Sat Mar 17 17:57:16 2001
-+++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c Sun Mar 18 16:51:30 2001
-@@ -10,28 +10,28 @@
- axpDevice lnxGetAXP(void);
-
- static AXP axpList[] = {
-- { "Tsunami", NULL, NULL, TSUNAMI },
-- { "Eiger", NULL, NULL, TSUNAMI },
-- {"Noname", NULL, NULL, LCA },
-- { "AlphaBook1", NULL, NULL, LCA },
-- {"EB66", NULL, NULL, LCA},
-- {"EB64+",NULL,NULL, APECS},
-+ {"Tsunami",NULL,NULL,TSUNAMI},
-+ {"Eiger",NULL,NULL,TSUNAMI},
-+ {"Noname",NULL,NULL,LCA},
-+ {"AlphaBook1",NULL,NULL,LCA},
-+ {"EB66",NULL,NULL,LCA},
-+ {"EB64+",NULL,NULL,APECS},
- {"Noritake",NULL,"EV5",CIA},
- {"Noritake",NULL,"EV56",CIA},
- {"Noritake",NULL,NULL,APECS},
-- {"XL",NULL,NULL,APECS},
-+ {"XL",NULL,NULL,APECS},
- {"Avanti",NULL,NULL,APECS},
- {"Mikasa",NULL,"EV5",CIA},
- {"Mikasa",NULL,"EV56",CIA},
- {"Mikasa",NULL,NULL,APECS},
- {"EB164","EB164",NULL,CIA},
-- {"EB164","PC164", NULL,CIA},
-- {"EB164","RX164",NULL, POLARIS},
-- {"EB164","SX164",NULL, PYXIS},
-- {"EB164","LX164",NULL, PYXIS},
-+ {"EB164","PC164",NULL,CIA},
-+ {"EB164","RX164",NULL,POLARIS},
-+ {"EB164","SX164",NULL,PYXIS},
-+ {"EB164","LX164",NULL,PYXIS},
- {"Alcor",NULL,NULL,CIA},
- {"Takara",NULL,NULL,CIA},
-- {"Sable",NULL, "EV5",T2_GAMMA},
-+ {"Sable",NULL,"EV5",T2_GAMMA},
- {"Sable",NULL,"EV56",T2_GAMMA},
- {"Sable",NULL,NULL,T2},
- {"Rawhide",NULL,NULL,MCPCIA},
-diff -ur xc.orig/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c
---- xc.orig/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c Thu Feb 17 08:45:49 2000
-+++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c Sun Mar 18 16:51:30 2001
-@@ -29,18 +29,21 @@
- int
- readDense8(pointer Base, register unsigned long Offset)
- {
-+ mem_barrier();
- return *(volatile CARD8*) ((unsigned long)Base+(Offset));
- }
-
- int
- readDense16(pointer Base, register unsigned long Offset)
- {
-+ mem_barrier();
- return *(volatile CARD16*) ((unsigned long)Base+(Offset));
- }
-
- int
- readDense32(pointer Base, register unsigned long Offset)
- {
-+ mem_barrier();
- return *(volatile CARD32*)((unsigned long)Base+(Offset));
- }
-
-@@ -65,20 +68,20 @@
- void
- writeDense8(int Value, pointer Base, register unsigned long Offset)
- {
-+ write_mem_barrier();
- *(volatile CARD8 *)((unsigned long)Base+(Offset)) = Value;
-- mem_barrier();
- }
-
- void
- writeDense16(int Value, pointer Base, register unsigned long Offset)
- {
-+ write_mem_barrier();
- *(volatile CARD16 *)((unsigned long)Base+(Offset)) = Value;
-- mem_barrier();
- }
-
- void
- writeDense32(int Value, pointer Base, register unsigned long Offset)
- {
-+ write_mem_barrier();
- *(volatile CARD32 *)((unsigned long)Base+(Offset)) = Value;
-- mem_barrier();
- }
-diff -ur xc.orig/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c
---- xc.orig/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c Fri Dec 8 22:59:56 2000
-+++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c Sun Mar 18 17:29:04 2001
-@@ -614,15 +614,16 @@
-
- Offset += (unsigned long)Base - (unsigned long)lnxBase;
- shift = (Offset & 0x3) << 3;
-- if (Offset >= (hae_thresh)) {
-+ if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
-- sethae(msb);
-- msb_set = msb;
-+ sethae(msb);
-+ msb_set = msb;
- }
-- }
-+ }
-
-+ mem_barrier();
- result = *(vuip) ((unsigned long)lnxSBase + (Offset << 5));
- result >>= shift;
- return 0xffUL & result;
-@@ -636,14 +637,16 @@
-
- Offset += (unsigned long)Base - (unsigned long)lnxBase;
- shift = (Offset & 0x2) << 3;
-- if (Offset >= hae_thresh) {
-+ if (Offset >= hae_thresh) {
- msb = Offset & hae_mask;
- Offset -= msb;
-- if (msb_set != msb) {
-- sethae(msb);
-- msb_set = msb;
-- }
-+ if (msb_set != msb) {
-+ sethae(msb);
-+ msb_set = msb;
-+ }
- }
-+
-+ mem_barrier();
- result = *(vuip)((unsigned long)lnxSBase+(Offset<<5)+(1<<(5-2)));
- result >>= shift;
- return 0xffffUL & result;
-@@ -652,6 +655,8 @@
- static int
- readSparse32(pointer Base, register unsigned long Offset)
- {
-+ /* note that this is actually doing a DENSE read... */
-+ mem_barrier();
- return *(vuip)((unsigned long)Base+(Offset));
- }
-
-@@ -670,8 +675,8 @@
- msb_set = msb;
- }
- }
-+ write_mem_barrier();
- *(vuip) ((unsigned long)lnxSBase + (Offset << 5)) = b * 0x01010101;
-- mem_barrier();
- }
-
- static void
-@@ -689,17 +694,16 @@
- msb_set = msb;
- }
- }
-- *(vuip)((unsigned long)lnxSBase+(Offset<<5)+(1<<(5-2))) =
-- w * 0x00010001;
-- mem_barrier();
--
-+ write_mem_barrier();
-+ *(vuip)((unsigned long)lnxSBase+(Offset<<5)+(1<<(5-2))) = w * 0x00010001;
- }
-
- static void
- writeSparse32(int Value, pointer Base, register unsigned long Offset)
- {
-+ /* note that this is actually doing a DENSE write... */
-+ write_mem_barrier();
- *(vuip)((unsigned long)Base + (Offset)) = Value;
-- mem_barrier();
- return;
- }
-
-diff -ur xc.orig/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h
---- xc.orig/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h Fri Dec 8 22:59:49 2000
-+++ xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h Sun Mar 18 16:51:30 2001
-@@ -194,13 +194,6 @@
- extern Bool xf86UnbindGARTMemory(int screenNum, int key);
- extern Bool xf86EnableAGP(int screenNum, CARD32 mode);
-
--#if defined(__alpha__)
--extern void xf86JensenMemToBus(char *, long, long, int);
--extern void xf86JensenBusToMem(char *, char *, unsigned long, int);
--extern void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int);
--extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
--#endif /* __alpha__ */
--
- /* These routines are in shared/sigio.c and are not loaded as part of the
- module. These routines are small, and the code if very POSIX-signal (or
- OS-signal) specific, so it seemed better to provide more complex
+++ /dev/null
---- XFree86-3.3.3.1/xc/lib/SM/sm_genid.c.ipv6 Sun Oct 4 16:36:38 1998
-+++ XFree86-3.3.3.1/xc/lib/SM/sm_genid.c Thu Jun 24 12:39:44 1999
-@@ -64,6 +64,7 @@
- #define XOS_USE_NO_LOCKING
- #define X_INCLUDE_NETDB_H
- #include <X11/Xos_r.h>
-+#include <resolv.h>
- #endif
-
- #else /* WIN32 */
-@@ -137,6 +138,7 @@
-
- #if defined(TCPCONN) || defined(STREAMSCONN)
- {
-+ u_long options;
- char* inet_addr;
- char temp[4], *ptr1, *ptr2;
- unsigned char decimal[4];
-@@ -144,7 +146,13 @@
- _Xgethostbynameparams hparams;
- struct hostent *hostp;
-
-- if ((hostp = _XGethostbyname (hostname,hparams)) != NULL)
-+ if ((_res.options & RES_INIT) == 0)
-+ (void) res_init ();
-+ options = _res.options;
-+ _res.options &= ~RES_USE_INET6;
-+ hostp = _XGethostbyname (hostname,hparams);
-+ _res.options = options;
-+ if (hostp != NULL)
- inet_addr = inet_ntoa (*(struct in_addr *)(hostp->h_addr));
- else
- return NULL;
---- XFree86-3.3.3.1/xc/lib/X11/ConnDis.c.ipv6 Sat Jan 18 07:51:49 1997
-+++ XFree86-3.3.3.1/xc/lib/X11/ConnDis.c Thu Jun 24 12:39:45 1999
-@@ -163,7 +163,9 @@
-
- if (!lastc) return NULL; /* must have a colon */
-
-- if ((lastp != lastc) && (*(lastc - 1) == ':')) {
-+ /* :: is DECnet, : and ::: are IPv6 */
-+ if ((lastp != lastc) && (*(lastc - 1) == ':') &&
-+ (lastp == lastc-1 || *(lastc - 2) != ':') ) {
- /* DECnet display specified */
-
- #ifndef DNETCONN
-@@ -334,7 +336,7 @@
- _X11TransGetPeerAddr(trans_conn, &family, &saddrlen, &saddr);
-
- /*
-- * The family is given in a socket format (ie AF_INET). This
-+ * The family is given in a socket format (ie AF_INET[6]). This
- * will convert it to the format used by the authorization and
- * X protocol (ie FamilyInternet).
- */
-@@ -1026,6 +1028,21 @@
- for(i=4; i<8; i++) /* do sin_addr */
- xdmcp_data[j++] = ((char *)addr)[i];
- for(i=2; i<4; i++) /* do sin_port */
-+ xdmcp_data[j++] = ((char *)addr)[i];
-+ break;
-+ }
-+#endif /* AF_INET */
-+#ifdef AF_INET6
-+ case AF_INET6:
-+ {
-+ /*
-+ * addr will contain a sockaddr_in6 with all
-+ * of the members already in network byte order.
-+ */
-+
-+ for(i=20; i<24; i++) /* do sin6_addr last 4 bytes */
-+ xdmcp_data[j++] = ((char *)addr)[i];
-+ for(i=2; i<4; i++) /* do sin6_port */
- xdmcp_data[j++] = ((char *)addr)[i];
- break;
- }
---- XFree86-3.3.3.1/xc/lib/X11/Imakefile.ipv6 Fri Nov 6 17:32:30 1998
-+++ XFree86-3.3.3.1/xc/lib/X11/Imakefile Thu Jun 24 12:39:46 1999
-@@ -947,6 +947,7 @@
- InstallLintLibrary(X11,$(LINTLIBDIR))
-
-
-+SpecialCLibObjectRule(AuGetBest,$(ICONFIGFILES),$(CONN_DEFINES))
- LinkSourceFile(AuDispose.c,$(XAUTHSRC))
- LinkSourceFile(AuGetBest.c,$(XAUTHSRC))
- LinkSourceFile(AuFileName.c,$(XAUTHSRC))
---- XFree86-3.3.3.1/xc/lib/Xau/AuGetBest.c.ipv6 Sun Dec 22 04:20:12 1996
-+++ XFree86-3.3.3.1/xc/lib/Xau/AuGetBest.c Thu Jun 24 12:39:46 1999
-@@ -49,6 +49,32 @@
- return 1;
- }
-
-+#if defined(TCPCONN)
-+#include <netinet/in.h>
-+#include <X11/X.h>
-+#define MAPTOIPV4(a) ((char *)(a) + sizeof(struct in6_addr) - \
-+ sizeof(struct in_addr))
-+#define acmp(a1, a2, len) memcmp((char *)(a1), (char *)(a2), len)
-+static int
-+inetMapEqual (a4, l4, a6, l6)
-+ char *a4, *a6;
-+ int l4, l6;
-+{
-+ /* compare IPv4 with special IPv6 : mapped, loopback */
-+ if (l4 == sizeof(struct in6_addr) && l6 == sizeof(struct in_addr)) {
-+ char *a = a4;
-+ a4 = a6;
-+ a6 = a;
-+ } else if (l6 != sizeof(struct in6_addr) || l4 != sizeof(struct in_addr))
-+ return 0;
-+ if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)a6))
-+ return !acmp(a4, MAPTOIPV4(a6), sizeof(*a4));
-+ else
-+ return (a4[0] == 127 && a4[1] == 0 && a4[2] == 0 && a4[3] == 1 &&
-+ acmp(a6, &in6addr_loopback, sizeof(*a6)) == 0);
-+}
-+#endif
-+
- #if NeedFunctionPrototypes
- Xauth *
- XauGetBestAuthByAddr (
-@@ -147,6 +173,13 @@
- (entry->family == family &&
- ((address_length == entry->address_length &&
- binaryEqual (entry->address, address, (int)address_length))
-+#if defined(TCPCONN)
-+ || (family == FamilyInternet &&
-+ address_length != entry->address_length &&
-+ inetMapEqual ((char *)entry->address,
-+ (int)entry->address_length,
-+ (char *)address, (int)address_length))
-+#endif
- #ifdef hpux
- || (family == FamilyLocal &&
- fully_qual_address_length == entry->address_length &&
---- XFree86-3.3.3.1/xc/lib/Xau/Imakefile.ipv6 Fri Nov 6 17:32:44 1998
-+++ XFree86-3.3.3.1/xc/lib/Xau/Imakefile Thu Jun 24 12:39:46 1999
-@@ -23,6 +23,9 @@
- INCLUDES =
- #endif
-
-+ CONN_DEFINES = ConnectionFlags
-+ DEPEND_DEFINES = $(CONN_DEFINES)
-+
- HEADERS = \
- Xauth.h
-
-@@ -33,6 +36,8 @@
- AuRead.o AuUnlock.o AuWrite.o $(K5ENCOBJ)
-
- #include <Library.tmpl>
-+
-+SpecialCLibObjectRule(AuGetBest,$(ICONFIGFILES),$(CONN_DEFINES))
-
- InstallLinkKitLibrary(Xau,$(LINKKITDIR)/lib)
-
---- XFree86-3.3.3.1/xc/lib/Xmu/CvtStdSel.c.ipv6 Sat Jan 18 07:52:13 1997
-+++ XFree86-3.3.3.1/xc/lib/Xmu/CvtStdSel.c Thu Jun 24 12:39:47 1999
-@@ -225,7 +225,9 @@
- if ((hostp = _XGethostbyname (hostname,hparams)) == NULL)
- return False;
-
-- if (hostp->h_addrtype != AF_INET) return False;
-+ if ((hostp->h_addrtype != AF_INET) &&
-+ (hostp->h_addrtype != AF_INET6))
-+ return False;
- *length = hostp->h_length;
- *value = XtMalloc(*length);
- (void) memmove (*value, hostp->h_addr, *length);
---- XFree86-3.3.3.1/xc/lib/xtrans/Xtrans.c.ipv6 Thu Jun 24 12:39:35 1999
-+++ XFree86-3.3.3.1/xc/lib/xtrans/Xtrans.c Thu Jun 24 12:39:47 1999
-@@ -218,7 +218,9 @@
- *
- * If the protocol part is missing, then assume INET.
- * If the protocol part and host part are missing, then assume local.
-- * If a "::" is found then assume DNET.
-+ * If a "host::" is found then assume DNET.
-+ * For IPv6, pb with possible : in host --> use rightmost : and test
-+ * x:y->inet, x::y->dnet, x:::y->inet(v6)
- */
-
- char *mybuf, *tmpptr;
-@@ -289,7 +291,23 @@
-
- _host = mybuf;
-
-- if ((mybuf = strchr (mybuf,':')) == NULL)
-+ /* For IPv6, we need the rightmost : in the non-catalog part */
-+ {
-+ char *p;
-+#if defined(FONT_t) || defined(FS_t)
-+ char *f = strchr (mybuf, '/');
-+ if (f) *f = 0;
-+#endif
-+ p = strrchr (mybuf,':');
-+ if (p && p > mybuf && p[-1] == ':')
-+ if (p-1 == mybuf || p[-2] != ':')
-+ p--;
-+ mybuf = p;
-+#if defined(FONT_t) || defined(FS_t)
-+ if (f) *f = '/';
-+#endif
-+ }
-+ if (mybuf == NULL)
- {
- *protocol = NULL;
- *host = NULL;
---- XFree86-3.3.3.1/xc/lib/xtrans/Xtranssock.c.ipv6 Thu Jun 24 12:39:42 1999
-+++ XFree86-3.3.3.1/xc/lib/xtrans/Xtranssock.c Thu Jun 24 12:39:47 1999
-@@ -70,6 +70,7 @@
- #define X_INCLUDE_NETDB_H
- #define XOS_USE_NO_LOCKING
- #include <X11/Xos_r.h>
-+#include <resolv.h>
- #endif
-
- #ifdef UNIXCONN
-@@ -190,8 +191,8 @@
-
- static Sockettrans2dev Sockettrans2devtab[] = {
- #ifdef TCPCONN
-- {"inet",AF_INET,SOCK_STREAM,SOCK_DGRAM,0},
-- {"tcp",AF_INET,SOCK_STREAM,SOCK_DGRAM,0},
-+ {"inet",AF_INET6,SOCK_STREAM,SOCK_DGRAM,0},
-+ {"tcp",AF_INET6,SOCK_STREAM,SOCK_DGRAM,0},
- #endif /* TCPCONN */
- #ifdef UNIXCONN
- {"unix",AF_UNIX,SOCK_STREAM,SOCK_DGRAM,0},
-@@ -294,7 +295,7 @@
- XtransConnInfo ciptr;
-
- {
-- struct sockaddr_in sockname;
-+ struct sockaddr_in6 sockname;
- #if defined(SVR4) || defined(SCO325)
- size_t namelen = sizeof sockname;
- #else
-@@ -322,7 +323,7 @@
- return -1;
- }
-
-- ciptr->family = sockname.sin_family;
-+ ciptr->family = sockname.sin6_family;
- ciptr->addrlen = namelen;
- memcpy (ciptr->addr, &sockname, ciptr->addrlen);
-
-@@ -341,7 +342,7 @@
- XtransConnInfo ciptr;
-
- {
-- struct sockaddr_in sockname;
-+ struct sockaddr_in6 sockname;
- #if defined(SVR4) || defined(SCO325)
- size_t namelen = sizeof sockname;
- #else
-@@ -410,10 +411,11 @@
- }
-
- #ifdef TCP_NODELAY
-- if (Sockettrans2devtab[i].family == AF_INET)
-+ if ((Sockettrans2devtab[i].family == AF_INET) ||
-+ (Sockettrans2devtab[i].family == AF_INET6))
- {
- /*
-- * turn off TCP coalescence for INET sockets
-+ * turn off TCP coalescence for INET[6] sockets
- */
-
- int tmp = 1;
-@@ -546,10 +548,11 @@
- #ifdef SO_REUSEADDR
-
- /*
-- * SO_REUSEADDR only applied to AF_INET
-+ * SO_REUSEADDR only applied to AF_INET6
- */
-
-- if (Sockettrans2devtab[i].family == AF_INET)
-+ if ((Sockettrans2devtab[i].family == AF_INET) ||
-+ (Sockettrans2devtab[i].family == AF_INET6))
- {
- int one = 1;
- setsockopt (ciptr->fd, SOL_SOCKET, SO_REUSEADDR,
-@@ -770,7 +773,8 @@
-
- PRMSG (3, "SocketCreateListener(%x,%d)\n", ciptr, fd, 0);
-
-- if (Sockettrans2devtab[ciptr->index].family == AF_INET)
-+ if ((Sockettrans2devtab[ciptr->index].family == AF_INET) ||
-+ (Sockettrans2devtab[ciptr->index].family == AF_INET6))
- retry = 20;
- else
- retry = 0;
-@@ -793,7 +797,8 @@
- #endif /* SO_REUSEDADDR */
- }
-
-- if (Sockettrans2devtab[ciptr->index].family == AF_INET) {
-+ if ((Sockettrans2devtab[ciptr->index].family == AF_INET) ||
-+ (Sockettrans2devtab[ciptr->index].family == AF_INET)) {
- #ifdef SO_DONTLINGER
- setsockopt (fd, SOL_SOCKET, SO_DONTLINGER, (char *) NULL, 0);
- #else
-@@ -830,7 +835,7 @@
- char *port;
-
- {
-- struct sockaddr_in sockname;
-+ struct sockaddr_in6 sockname;
- int namelen = sizeof(sockname);
- int status;
- short tmpport;
-@@ -878,22 +883,23 @@
- port, 0, 0);
- return TRANS_CREATE_LISTENER_FAILED;
- }
-- sockname.sin_port = servp->s_port;
-+ sockname.sin6_port = servp->s_port;
- }
- else
- {
- tmpport = (short) atoi (port);
-- sockname.sin_port = htons (tmpport);
-+ sockname.sin6_port = htons (tmpport);
- }
- }
- else
-- sockname.sin_port = htons (0);
-+ sockname.sin6_port = htons (0);
-
- #ifdef BSD44SOCKETS
-- sockname.sin_len = sizeof (sockname);
-+ sockname.sin6_len = sizeof (sockname);
- #endif
-- sockname.sin_family = AF_INET;
-- sockname.sin_addr.s_addr = htonl (INADDR_ANY);
-+ sockname.sin6_family = AF_INET6;
-+ sockname.sin6_flowinfo = 0;
-+ sockname.sin6_addr = in6addr_any;
-
- if ((status = TRANS(SocketCreateListener) (ciptr,
- (struct sockaddr *) &sockname, namelen)) < 0)
-@@ -1095,7 +1101,7 @@
-
- {
- XtransConnInfo newciptr;
-- struct sockaddr_in sockname;
-+ struct sockaddr_in6 sockname;
- int namelen = sizeof(sockname);
-
- PRMSG (2, "SocketINETAccept(%x,%d)\n", ciptr, ciptr->fd, 0);
-@@ -1258,7 +1264,7 @@
- char *port;
-
- {
-- struct sockaddr_in sockname;
-+ struct sockaddr_in6 sockname;
- #if defined(SVR4) || defined(SCO325)
- size_t namelen = sizeof sockname;
- #else
-@@ -1268,14 +1274,15 @@
- _Xgetservbynameparams sparams;
- struct hostent *hostp;
- struct servent *servp;
-+ u_long options;
-
- #define PORTBUFSIZE 64 /* what is a real size for this? */
- char portbuf[PORTBUFSIZE];
-
- int ret;
- short tmpport;
-- unsigned long tmpaddr;
- char hostnamebuf[256]; /* tmp space */
-+ char v[64]; /* Vixie's tmp space */
-
- PRMSG (2,"SocketINETConnect(%d,%s,%s)\n", ciptr->fd, host, port);
-
-@@ -1311,67 +1318,44 @@
- */
-
- #ifdef BSD44SOCKETS
-- sockname.sin_len = sizeof (struct sockaddr_in);
-+ sockname.sin6_len = sizeof (struct sockaddr_in6);
- #endif
-- sockname.sin_family = AF_INET;
-+ sockname.sin6_family = AF_INET6;
-+ sockname.sin6_flowinfo = 0;
-
- /*
-- * fill in sin_addr
-+ * fill in sin6_addr
- */
-
-- /* check for ww.xx.yy.zz host string */
--
-- if (isascii (host[0]) && isdigit (host[0])) {
-- tmpaddr = inet_addr (host); /* returns network byte order */
-- } else {
-- tmpaddr = -1;
-- }
--
-- PRMSG (4,"SocketINETConnect: inet_addr(%s) = %x\n",
-- host, tmpaddr, 0);
-+ /* ww.xx.yy.zz host string done by _XGethostbyname() */
-
-- if (tmpaddr == -1)
-- {
-- if ((hostp = _XGethostbyname(host,hparams)) == NULL)
-- {
-- PRMSG (1,"SocketINETConnect: Can't get address for %s\n",
-- host, 0, 0);
-- ESET(EINVAL);
-- return TRANS_CONNECT_FAILED;
-- }
-- if (hostp->h_addrtype != AF_INET) /* is IP host? */
-- {
-- PRMSG (1,"SocketINETConnect: not INET host%s\n",
-- host, 0, 0);
-- ESET(EPROTOTYPE);
-- return TRANS_CONNECT_FAILED;
-- }
--
--#if defined(CRAY) && defined(OLDTCP)
-- /* Only Cray UNICOS3 and UNICOS4 will define this */
-- {
-- long t;
-- memcpy ((char *)&t, (char *) hostp->h_addr, sizeof (t));
-- sockname.sin_addr = t;
-- }
--#else
-- memcpy ((char *) &sockname.sin_addr, (char *) hostp->h_addr,
-- sizeof (sockname.sin_addr));
--#endif /* CRAY and OLDTCP */
--
-+ if ((_res.options & RES_INIT) == 0)
-+ (void)res_init();
-+ options = _res.options;
-+ _res.options |= RES_USE_INET6;
-+
-+ hostp = _XGethostbyname(host,hparams);
-+ _res.options = options;
-+ if (hostp == NULL)
-+ {
-+ PRMSG (1,"SocketINETConnect: Can't get address for %s\n",
-+ host, 0, 0);
-+ ESET(EINVAL);
-+ return TRANS_CONNECT_FAILED;
- }
--else
-+ if (hostp->h_addrtype != AF_INET6) /* is IPv6 host? */
- {
--#if defined(CRAY) && defined(OLDTCP)
-- /* Only Cray UNICOS3 and UNICOS4 will define this */
-- sockname.sin_addr = tmpaddr;
--#else
-- sockname.sin_addr.s_addr = tmpaddr;
--#endif /* CRAY and OLDTCP */
-+ PRMSG (1,"SocketINETConnect: not INET host%s\n",
-+ host, 0, 0);
-+ ESET(EPROTOTYPE);
-+ return TRANS_CONNECT_FAILED;
- }
-+
-+ memcpy ((char *) &sockname.sin6_addr, (char *) hostp->h_addr,
-+ sizeof (sockname.sin6_addr));
-
- /*
-- * fill in sin_port
-+ * fill in sin6_port
- */
-
- /* Check for number in the port string */
-@@ -1384,16 +1368,16 @@
- portbuf, 0, 0);
- return TRANS_CONNECT_FAILED;
- }
-- sockname.sin_port = servp->s_port;
-+ sockname.sin6_port = servp->s_port;
- }
- else
- {
- tmpport = (short) atoi (portbuf);
-- sockname.sin_port = htons (tmpport);
-+ sockname.sin6_port = htons (tmpport);
- }
-
-- PRMSG (4,"SocketINETConnect: sockname.sin_port = %d\n",
-- ntohs(sockname.sin_port), 0, 0);
-+ PRMSG (4,"SocketINETConnect: sockname.sin6_port = %d\n",
-+ ntohs(sockname.sin6_port), 0, 0);
-
- /*
- * Do the connect()
-@@ -1481,13 +1465,21 @@
- * by TRANS(GetHostname)), then the two hostnames are equivalent,
- * and we know that 'host' is really a local host.
- */
-- char specified_local_addr_list[10][4];
-+ char specified_local_addr_list[10][16];
- int scount, equiv, i, j;
- _Xgethostbynameparams hparams;
- struct hostent *hostp;
-+ u_long options;
-
-- if ((hostp = _XGethostbyname (host,hparams)) == NULL)
-+ if ((_res.options & RES_INIT) == 0)
-+ (void)res_init();
-+ options = _res.options;
-+ _res.options |= RES_USE_INET6;
-+
-+ if ((hostp = _XGethostbyname (host,hparams)) == NULL) {
-+ _res.options = options;
- return (0);
-+ }
-
- scount = 0;
- while (hostp->h_addr_list[scount] && scount <= 8)
-@@ -1497,17 +1489,14 @@
- * from the 1st call, so we must save the address list.
- */
-
-- specified_local_addr_list[scount][0] =
-- hostp->h_addr_list[scount][0];
-- specified_local_addr_list[scount][1] =
-- hostp->h_addr_list[scount][1];
-- specified_local_addr_list[scount][2] =
-- hostp->h_addr_list[scount][2];
-- specified_local_addr_list[scount][3] =
-- hostp->h_addr_list[scount][3];
-+ memcpy(specified_local_addr_list[scount],
-+ hostp->h_addr_list[scount],
-+ hostp->h_length);
- scount++;
- }
-- if ((hostp = _XGethostbyname (hostnamebuf,hparams)) == NULL)
-+ hostp = _XGethostbyname (hostnamebuf,hparams);
-+ _res.options = options;
-+ if (hostp == NULL)
- return (0);
-
- equiv = 0;
-@@ -1519,14 +1508,9 @@
-
- while (hostp->h_addr_list[j])
- {
-- if ((specified_local_addr_list[i][0] ==
-- hostp->h_addr_list[j][0]) &&
-- (specified_local_addr_list[i][1] ==
-- hostp->h_addr_list[j][1]) &&
-- (specified_local_addr_list[i][2] ==
-- hostp->h_addr_list[j][2]) &&
-- (specified_local_addr_list[i][3] ==
-- hostp->h_addr_list[j][3]))
-+ if (memcmp(specified_local_addr_list[i],
-+ hostp->h_addr_list[j],
-+ hostp->h_length) == 0)
- {
- /* They're equal, so we're done */
-
---- XFree86-3.3.3.1/xc/lib/xtrans/Xtransutil.c.ipv6 Thu Jun 24 12:39:42 1999
-+++ XFree86-3.3.3.1/xc/lib/xtrans/Xtransutil.c Thu Jun 24 12:39:47 1999
-@@ -84,7 +84,7 @@
- /*
- * TRANS(ConvertAddress) converts a sockaddr based address to an
- * X authorization based address. Some of this is defined as part of
-- * the ChangeHost protocol. The rest is just doen in a consistent manner.
-+ * the ChangeHost protocol. The rest is just done in a consistent manner.
- */
-
- int
-@@ -134,6 +134,32 @@
- }
- break;
- }
-+
-+ case AF_INET6:
-+ {
-+ /*
-+ * Check for the hack localhost address ::1.
-+ * In this case, we are really FamilyLocal.
-+ */
-+
-+ struct sockaddr_in6 saddr;
-+ int len = sizeof(saddr.sin6_addr);
-+ char *cp = (char *) &saddr.sin6_addr;
-+
-+ memcpy (&saddr, *addrp, sizeof (struct sockaddr_in6));
-+
-+ if (memcmp(cp, (char *)&in6addr_loopback, len) == 0)
-+ {
-+ *familyp=FamilyLocal;
-+ }
-+ else
-+ {
-+ *familyp=FamilyInternet;
-+ *addrlenp=len;
-+ memcpy(*addrp,&saddr.sin6_addr,len);
-+ }
-+ break;
-+ }
- #endif /* defined(TCPCONN) || defined(STREAMSCONN) || MNX_TCPCONN */
-
- #if defined(DNETCONN)
-@@ -269,6 +295,18 @@
- sprintf (networkId, "%s/%s:%s", transName, hostnamebuf, portnumbuf);
- break;
- }
-+
-+ case AF_INET6:
-+ {
-+ struct sockaddr_in6 *saddr = (struct sockaddr_in6 *) addr;
-+ char portnumbuf[10];
-+
-+ sprintf (portnumbuf, "%d", ntohs (saddr->sin6_port));
-+ networkId = (char *) xalloc (3 + strlen (transName) +
-+ strlen (hostnamebuf) + strlen (portnumbuf));
-+ sprintf (networkId, "%s/%s:%s", transName, hostnamebuf, portnumbuf);
-+ break;
-+ }
- #endif /* defined(TCPCONN) || defined(STREAMSCONN) || MNX_TCPCONN */
-
- #if defined(DNETCONN)
-@@ -377,6 +415,42 @@
- addr = hostp->h_name;
- else
- addr = inet_ntoa (saddr->sin_addr);
-+ break;
-+ }
-+
-+ case AF_INET6:
-+ {
-+ struct sockaddr_in6 *saddr = (struct sockaddr_in6 *) peer_addr;
-+ _Xgethostbynameparams hparams;
-+ struct hostent * hostp;
-+ static char v[64];
-+
-+#ifdef SIGALRM
-+ /*
-+ * gethostbyaddr can take a LONG time if the host does not exist.
-+ * Assume that if it does not respond in NAMESERVER_TIMEOUT seconds
-+ * that something is wrong and do not make the user wait.
-+ * gethostbyaddr will continue after a signal, so we have to
-+ * jump out of it.
-+ */
-+
-+ nameserver_timedout = 0;
-+ signal (SIGALRM, nameserver_lost);
-+ alarm (4);
-+ if (setjmp(env) == 0) {
-+#endif
-+ hostp = _XGethostbyaddr ((char *) &saddr->sin6_addr,
-+ sizeof (saddr->sin6_addr), AF_INET6, hparams);
-+#ifdef SIGALRM
-+ }
-+ alarm (0);
-+#endif
-+ if (hostp != NULL)
-+ addr = hostp->h_name;
-+ else {
-+ inet_ntop (AF_INET6, &saddr->sin6_addr, v, sizeof (v));
-+ addr = addrbuf;
-+ }
- break;
- }
-
---- XFree86-3.3.3.1/xc/programs/Xserver/os/access.c.ipv6 Thu Jun 24 12:39:34 1999
-+++ XFree86-3.3.3.1/xc/programs/Xserver/os/access.c Thu Jun 24 12:39:47 1999
-@@ -163,6 +163,7 @@
- #else
- #if !defined(AMOEBA) && !defined(MINIX)
- #include <netdb.h>
-+#include <resolv.h>
- #else
- #ifdef AMOEBA
- #include <server/ip/gen/netdb.h>
-@@ -215,10 +216,12 @@
-
- #define acmp(a1, a2, len) memcmp((char *)(a1), (char *)(a2), len)
- #define acopy(a1, a2, len) memmove((char *)(a2), (char *)(a1), len)
-+#if !defined(TCPCONN)
- #define addrEqual(fam, address, length, host) \
- ((fam) == (host)->family &&\
- (length) == (host)->len &&\
- !acmp (address, (host)->addr, length))
-+#endif
-
- static int ConvertAddr(
- #if NeedFunctionPrototypes
-@@ -260,6 +263,49 @@
- static int LocalHostEnabled = FALSE;
- static int UsingXdmcp = FALSE;
-
-+#if defined(TCPCONN)
-+#define MAPTOIPV4(a) ((char *)(a) + sizeof(struct in6_addr) - \
-+ sizeof(struct in_addr))
-+#define MAPTOIPV6(d,a) { \
-+ bzero(&d.s6_addr[0], \
-+ sizeof(struct in6_addr)-2-sizeof(struct in_addr)); \
-+ d.s6_addr[10] = d.s6_addr[11] = 0xff; \
-+ acopy(a, MAPTOIPV4(&d.s6_addr[0]), sizeof(struct in_addr)); \
-+ }
-+
-+static int
-+addrEqual(fam, addr, len, host)
-+ unsigned char *addr;
-+ register HOST *host;
-+ int fam, len;
-+{
-+ char *a4, *a6;
-+
-+ if (fam != host->family)
-+ return FALSE;
-+ if (len == host->len)
-+ return !acmp (addr, host->addr, len);
-+ if (fam != FamilyInternet)
-+ return FALSE;
-+
-+ /* compare IPv4 with special IPv6 : mapped, loopback */
-+ if (len == sizeof(struct in6_addr) &&
-+ host->len == sizeof(struct in_addr)) {
-+ a4 = host->addr;
-+ a6 = addr;
-+ } else if (len == sizeof(struct in_addr) &&
-+ host->len == sizeof(struct in6_addr)) {
-+ a4 = addr;
-+ a6 = host->addr;
-+ } else
-+ return FALSE;
-+ if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)a6))
-+ return !acmp(a4, MAPTOIPV4(a6), sizeof(*a4));
-+ else
-+ return (a4[0] == 127 && a4[1] == 0 && a4[2] == 0 && a4[3] == 1 &&
-+ acmp(a6, &in6addr_loopback, sizeof(*a6)) == 0);
-+}
-+#endif
-
- /*
- * called when authorization is not enabled to add the
-@@ -634,6 +680,7 @@
- int family;
- register HOST *host;
- register struct ifreq *ifr;
-+ struct in6_addr mapped;
-
- #ifdef DNETCONN
- struct dn_naddr *dnaddr = getnodeadd();
-@@ -692,10 +739,32 @@
- if (family == -1 || family == FamilyLocal)
- continue;
- #ifdef DEF_SELF_DEBUG
-- if (family == FamilyInternet)
-- ErrorF("Xserver: DefineSelf(): ifname = %s, addr = %d.%d.%d.%d\n",
-- ifr->ifr_name, addr[0], addr[1], addr[2], addr[3]);
-+ if (family == FamilyInternet) {
-+ char v[64];
-+
-+ ErrorF("Xserver: DefineSelf(): ifname = %s, addr = %s\n",
-+ ifr->ifr_name,
-+ inet_ntop(len == 4 ? AF_INET : AF_INET6, addr, v, 64));
-+ }
- #endif
-+ if (family == FamilyInternet) {
-+ if (len == 4) {
-+ /* Mapped IPv4 to IPv6 with special case for loopback */
-+ if (addr[0] == 127 && addr[1] == 0 &&
-+ addr[2] == 0 && addr[3] == 1)
-+ addr = (unsigned char *)&in6addr_loopback;
-+ else {
-+ MAPTOIPV6(mapped, addr);
-+ addr = (unsigned char *) &mapped;
-+ }
-+ len = sizeof(mapped);
-+ }
-+ /*
-+ * Link local addresses are too weird
-+ */
-+ if (IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)addr))
-+ continue;
-+ }
- for (host = selfhosts;
- host && !addrEqual (family, addr, len, host);
- host = host->next)
-@@ -724,13 +793,15 @@
- /*
- * ignore 'localhost' entries as they're not useful
- * on the other end of the wire
-+ * ignore 'link local' entries
- */
-- if (len == 4 &&
-- addr[0] == 127 && addr[1] == 0 &&
-- addr[2] == 0 && addr[3] == 1)
-+ if (acmp(addr, &in6addr_loopback, len)==0)
- continue;
-
- XdmcpRegisterConnection (family, (char *)addr, len);
-+ /* what to do with INET6 ???? */
-+ if (ifr->ifr_addr.sa_family != AF_INET);
-+ continue;
- broad_addr = ifr->ifr_addr;
- ((struct sockaddr_in *) &broad_addr)->sin_addr.s_addr =
- htonl (INADDR_BROADCAST);
-@@ -794,10 +865,22 @@
- int family;
- pointer addr;
- register HOST *host;
-+ struct in6_addr mapped;
-
- family = ConvertAddr(from, &len, (pointer *)&addr);
- if (family == -1 || family == FamilyLocal)
- return;
-+ if ((family == FamilyInternet) && (len == 4)) {
-+ /* Mapped IPv4 to IPv6 with special case for loopback */
-+ if (((char *)addr)[0] == 127 && ((char *)addr)[1] == 0 &&
-+ ((char *)addr)[2] == 0 && ((char *)addr)[3] == 1)
-+ addr = (pointer)&in6addr_loopback;
-+ else {
-+ MAPTOIPV6(mapped, addr);
-+ addr = (unsigned char *) &mapped;
-+ }
-+ len = sizeof(mapped);
-+ }
- for (host = selfhosts; host; host = host->next)
- {
- if (addrEqual(family, addr, len, host))
-@@ -840,7 +923,7 @@
- union {
- struct sockaddr sa;
- #if defined(TCPCONN) || defined(STREAMSCONN) || defined(MNX_TCPCONN)
-- struct sockaddr_in in;
-+ struct sockaddr_in6 in;
- #endif /* TCPCONN || STREAMSCONN */
- #ifdef DNETCONN
- struct sockaddr_dn dn;
-@@ -978,12 +1061,16 @@
- #endif /* SECURE_RPC */
- #if defined(TCPCONN) || defined(STREAMSCONN) || defined(MNX_TCPCONN)
- {
-+ if ((_res.options & RES_INIT) == 0)
-+ (void)res_init();
-+ _res.options |= RES_USE_INET6;
-+
- /* host name */
- if (family == FamilyInternet && (hp = gethostbyname (hostname)) ||
- (hp = gethostbyname (hostname)))
- {
- saddr.sa.sa_family = hp->h_addrtype;
-- len = sizeof(saddr.sa);
-+ len = sizeof(saddr.in);
- if ((family = ConvertAddr (&saddr.sa, &len, (pointer *)&addr)) != -1)
- {
- #ifdef h_addr /* new 4.3bsd version of gethostent */
-@@ -1072,6 +1159,7 @@
- pointer pAddr;
- {
- int len;
-+ struct in6_addr mapped;
-
- if (!AuthorizedClient(client))
- return(BadAccess);
-@@ -1092,6 +1180,11 @@
- break;
- #endif
- case FamilyInternet:
-+ if (length == sizeof (struct in_addr)) {
-+ MAPTOIPV6(mapped, pAddr);
-+ pAddr = (char *)& mapped;
-+ length = sizeof(mapped);
-+ }
- case FamilyDECnet:
- case FamilyChaos:
- if ((len = CheckAddr (family, pAddr, length)) < 0)
-@@ -1174,6 +1267,7 @@
- {
- int len;
- register HOST *host, **prev;
-+ struct in6_addr mapped;
-
- if (!AuthorizedClient(client))
- return(BadAccess);
-@@ -1193,6 +1287,11 @@
- break;
- #endif
- case FamilyInternet:
-+ if (length == sizeof (struct in_addr)) {
-+ MAPTOIPV6(mapped, pAddr);
-+ pAddr = (char *)& mapped;
-+ length = sizeof(mapped);
-+ }
- case FamilyDECnet:
- case FamilyChaos:
- if ((len = CheckAddr (family, pAddr, length)) < 0)
-@@ -1236,7 +1335,12 @@
- for (host = validhosts; host; host = host->next)
- {
- nHosts++;
-- n += (((host->len + 3) >> 2) << 2) + sizeof(xHostEntry);
-+ len = host->len;
-+ if (host->family == FamilyInternet &&
-+ len == sizeof (struct in6_addr) &&
-+ IN6_IS_ADDR_V4MAPPED((struct in6_addr *)host->addr))
-+ len = sizeof (struct in_addr);
-+ n += (((len + 3) >> 2) << 2) + sizeof(xHostEntry);
- }
- if (n)
- {
-@@ -1247,11 +1351,19 @@
- }
- for (host = validhosts; host; host = host->next)
- {
-+ char *ad = host->addr;
-+
- len = host->len;
- ((xHostEntry *)ptr)->family = host->family;
-+ if (host->family == FamilyInternet &&
-+ len == sizeof (struct in6_addr) &&
-+ IN6_IS_ADDR_V4MAPPED((struct in6_addr *)host->addr)) {
-+ len = sizeof (struct in_addr);
-+ ad = MAPTOIPV4(ad);
-+ }
- ((xHostEntry *)ptr)->length = len;
- ptr += sizeof(xHostEntry);
-- acopy (host->addr, ptr, len);
-+ acopy (ad, ptr, len);
- ptr += ((len + 3) >> 2) << 2;
- }
- } else {
-@@ -1277,11 +1389,7 @@
- {
- #if defined(TCPCONN) || defined(STREAMSCONN) || defined(AMTCPCONN) || defined(MNX_TCPCONN)
- case FamilyInternet:
--#if !defined(AMOEBA)
-- if (length == sizeof (struct in_addr))
--#else
-- if (length == sizeof(ipaddr_t))
--#endif
-+ if (length == sizeof (struct in6_addr))
- len = length;
- else
- len = -1;
-@@ -1312,11 +1420,7 @@
- * Returns 1 if host is invalid, 0 if we've found it. */
-
- InvalidHost (saddr, len)
--#ifndef AMOEBA_ORIG
- register struct sockaddr *saddr;
--#else
-- register ipaddr_t *saddr;
--#endif
- int len;
- {
- int family;
-@@ -1359,11 +1463,7 @@
-
- static int
- ConvertAddr (saddr, len, addr)
--#ifndef AMOEBA_ORIG
- register struct sockaddr *saddr;
--#else
-- register ipaddr_t *saddr;
--#endif
- int *len;
- pointer *addr;
- {
-@@ -1381,6 +1481,10 @@
- case AF_INET:
- *len = sizeof (struct in_addr);
- *addr = (pointer) &(((struct sockaddr_in *) saddr)->sin_addr);
-+ return FamilyInternet;
-+ case AF_INET6:
-+ *len = sizeof (struct in6_addr);
-+ *addr = (pointer) &(((struct sockaddr_in6 *) saddr)->sin6_addr);
- return FamilyInternet;
- #endif
- #ifdef DNETCONN
---- XFree86-3.3.3.1/xc/programs/Xserver/os/connection.c.ipv6 Thu Jun 24 12:39:34 1999
-+++ XFree86-3.3.3.1/xc/programs/Xserver/os/connection.c Thu Jun 24 12:39:47 1999
-@@ -477,6 +477,7 @@
- int auth_id;
- {
- char addr[128];
-+ char v[64];
- char *out = addr;
-
- if (!((OsCommPtr)client->osPrivate)->trans_conn) {
-@@ -499,6 +500,13 @@
- sprintf(out, "IP %s port %d",
- inet_ntoa(((struct sockaddr_in *) saddr)->sin_addr),
- ntohs(((struct sockaddr_in *) saddr)->sin_port));
-+ break;
-+ case AF_INET6:
-+ sprintf(out, "IPv6 %s port %d",
-+ inet_ntop(AF_INET6,
-+ &((struct sockaddr_in6 *) saddr)->sin6_addr,
-+ v, sizeof (v)),
-+ ntohs(((struct sockaddr_in6 *) saddr)->sin6_port));
- break;
- #endif
- #ifdef DNETCONN
---- XFree86-3.3.3.1/xc/programs/Xserver/os/k5auth.c.ipv6 Fri May 10 09:02:15 1996
-+++ XFree86-3.3.3.1/xc/programs/Xserver/os/k5auth.c Thu Jun 24 12:39:47 1999
-@@ -277,7 +277,7 @@
- long addrlen;
- krb5_error_code retval, retval2;
- register char n;
-- struct sockaddr cli_net_addr;
-+ struct sockaddr_in6 cli_net_addr;
- xReq prefix;
- krb5_principal cprinc;
- krb5_data buf;
-@@ -299,15 +299,15 @@
- }
- addrlen = sizeof (cli_net_addr);
- if (getpeername(((OsCommPtr)client->osPrivate)->fd,
-- &cli_net_addr, &addrlen) == -1)
-+ (struct sockaddr *)&cli_net_addr, &addrlen) == -1)
- {
- if (creds)
- krb5_free_creds(creds);
- return(SendConnSetup(client, "Krb5 stage1: getpeername failed"));
- }
-- if (cli_net_addr.sa_family == AF_UNSPEC
-+ if (cli_net_addr.sin6_family == AF_UNSPEC
- #if defined(UNIXCONN) || defined(LOCALCONN) || defined(OS2PIPECONN)
-- || cli_net_addr.sa_family == AF_UNIX
-+ || cli_net_addr.sin6_family == AF_UNIX
- #endif
- ) /* assume local host */
- {
-@@ -324,9 +324,9 @@
- }
- else
- {
-- cli_addr.addrtype = cli_net_addr.sa_family; /* the values
-+ cli_addr.addrtype = cli_net_addr.sin6_family; /* the values
- are compatible */
-- switch (cli_net_addr.sa_family)
-+ switch (cli_net_addr.sin6_family)
- {
- #ifdef TCPCONN
- case AF_INET:
-@@ -334,6 +334,11 @@
- cli_addr.contents =
- (krb5_octet *)&((struct sockaddr_in *)&cli_net_addr)->sin_addr;
- break;
-+ case AF_INET6:
-+ cli_addr.length = sizeof (struct in6_addr);
-+ cli_addr.contents =
-+ (krb5_octet *)&(&cli_net_addr)->sin6_addr;
-+ break;
- #endif
- #ifdef DNETCONN
- case AF_DECnet:
-@@ -348,7 +353,7 @@
- if (creds)
- krb5_free_creds(creds);
- sprintf(kerror, "Krb5 stage1: unknown address family %d from getpeername",
-- cli_net_addr.sa_family);
-+ cli_net_addr.sin6_family);
- return(SendConnSetup(client, kerror));
- }
- }
---- XFree86-3.3.3.1/xc/programs/Xserver/os/utils.c.ipv6 Thu Jun 24 12:39:34 1999
-+++ XFree86-3.3.3.1/xc/programs/Xserver/os/utils.c Thu Jun 24 12:39:47 1999
-@@ -1112,7 +1112,9 @@
-
- #if defined(TCPCONN) || defined(STREAMSCONN)
- #ifndef WIN32
-+#include <netinet/in.h>
- #include <netdb.h>
-+#include <resolv.h>
- #endif
- #endif
-
-@@ -1134,6 +1136,10 @@
- char hname[1024], *hnameptr;
- struct hostent *host;
- int len;
-+
-+ if ((_res.options & RES_INIT) == 0)
-+ (void)res_init();
-+ _res.options |= RES_USE_INET6;
-
- gethostname(hname, 1024);
- host = gethostbyname(hname);
---- XFree86-3.3.3.1/xc/programs/Xserver/os/xdmcp.c.ipv6 Thu Jun 24 12:39:34 1999
-+++ XFree86-3.3.3.1/xc/programs/Xserver/os/xdmcp.c Thu Jun 24 12:39:47 1999
-@@ -38,6 +38,8 @@
- #endif
- #include <netinet/in.h>
- #include <netdb.h>
-+#include <resolv.h>
-+#undef QUERY
- #else
- #if defined(MINIX)
- #include <net/hton.h>
-@@ -81,7 +83,7 @@
-
- static int xdmcpSocket, sessionSocket;
- static xdmcp_states state;
--static struct sockaddr_in req_sockaddr;
-+static struct sockaddr_in6 req_sockaddr;
- static int req_socklen;
- static CARD32 SessionID;
- static CARD32 timeOutTime;
-@@ -96,7 +98,7 @@
-
- static XdmcpBuffer buffer;
-
--static struct sockaddr_in ManagerAddress;
-+static struct sockaddr_in6 ManagerAddress;
-
- static void get_xdmcp_sock(
- #if NeedFunctionPrototypes
-@@ -112,7 +114,7 @@
-
- static void recv_willing_msg(
- #if NeedFunctionPrototypes
-- struct sockaddr_in */*from*/,
-+ struct sockaddr_in6 */*from*/,
- int /*fromlen*/,
- unsigned /*length*/
- #endif
-@@ -332,24 +334,27 @@
-
- #define MAX_BROADCAST 10
-
--static struct sockaddr_in BroadcastAddresses[MAX_BROADCAST];
-+static struct sockaddr_in6 BroadcastAddresses[MAX_BROADCAST];
- static int NumBroadcastAddresses;
-
- void
- XdmcpRegisterBroadcastAddress (addr)
- struct sockaddr_in *addr;
- {
-- struct sockaddr_in *bcast;
-+ struct sockaddr_in6 *bcast;
- if (NumBroadcastAddresses >= MAX_BROADCAST)
- return;
- bcast = &BroadcastAddresses[NumBroadcastAddresses++];
-- bzero (bcast, sizeof (struct sockaddr_in));
-+ bzero (bcast, sizeof (struct sockaddr_in6));
-+ /* mapped the IPv4 broadcast address to IPv6 */
- #ifdef BSD44SOCKETS
-- bcast->sin_len = addr->sin_len;
-+ bcast->sin6_len = sizeof(struct sockaddr_in6);
- #endif
-- bcast->sin_family = addr->sin_family;
-- bcast->sin_port = htons (xdm_udp_port);
-- bcast->sin_addr = addr->sin_addr;
-+ bcast->sin6_family = AF_INET6;
-+ bcast->sin6_port = htons (xdm_udp_port);
-+ bcast->sin6_flowinfo = 0;
-+ bcast->sin6_addr.s6_addr[10] = bcast->sin6_addr.s6_addr[11] = 0xff;
-+ memmove(&bcast->sin6_addr.s6_addr[12], &addr->sin_addr, 4);
- }
-
- /*
-@@ -464,6 +469,13 @@
- XdmcpDisposeARRAYofARRAY8 (&ConnectionAddresses);
- xdmcpGeneration = serverGeneration;
- }
-+ /* for INET6, try go back to INET, to help not INET6 managers !! */
-+ if (type == FamilyInternet &&
-+ addrlen == sizeof (struct in6_addr) &&
-+ IN6_IS_ADDR_V4MAPPED((struct in6_addr *)address)) {
-+ addrlen = sizeof (struct in_addr);
-+ address += sizeof (struct in6_addr) - sizeof (struct in_addr);
-+ }
- newAddress = (CARD8 *) xalloc (addrlen * sizeof (CARD8));
- if (!newAddress)
- return;
-@@ -750,7 +762,7 @@
-
- /*ARGSUSED*/
- XdmcpAddHost(from, fromlen, AuthenticationName, hostname, status)
-- struct sockaddr_in *from;
-+ struct sockaddr_in6 *from;
- ARRAY8Ptr AuthenticationName, hostname, status;
- {
- XdmcpSelectHost(from, fromlen, AuthenticationName);
-@@ -766,8 +778,8 @@
- static void
- receive_packet()
- {
-- struct sockaddr_in from;
-- int fromlen = sizeof(struct sockaddr_in);
-+ struct sockaddr_in6 from;
-+ int fromlen = sizeof(struct sockaddr_in6);
- XdmcpHeader header;
-
- /* read message off socket */
-@@ -980,7 +992,7 @@
- #ifndef _MINIX
- int soopts = 1;
-
-- if ((xdmcpSocket = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
-+ if ((xdmcpSocket = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
- #else /* MINIX */
- char *udp_device;
- int r, s_errno;
-@@ -1066,7 +1078,7 @@
-
- for (i = 0; i < NumBroadcastAddresses; i++)
- XdmcpFlush (xdmcpSocket, &buffer, &BroadcastAddresses[i],
-- sizeof (struct sockaddr_in));
-+ sizeof (struct sockaddr_in6));
- }
- else
- {
-@@ -1077,7 +1089,7 @@
-
- static void
- recv_willing_msg(from, fromlen, length)
-- struct sockaddr_in *from;
-+ struct sockaddr_in6 *from;
- int fromlen;
- unsigned length;
- {
-@@ -1380,23 +1392,29 @@
- ErrorF("Xserver: missing host name in command line\n");
- exit(1);
- }
-+
-+ if ((_res.options & RES_INIT) == 0)
-+ (void)res_init();
-+ _res.options |= RES_USE_INET6;
-+
- if (!(hep = gethostbyname(argv[i])))
- {
- ErrorF("Xserver: unknown host: %s\n", argv[i]);
- exit(1);
- }
- #ifndef _MINIX
-- if (hep->h_length == sizeof (struct in_addr))
-+ if (hep->h_length == sizeof (struct in6_addr))
- #else
- if (hep->h_length == sizeof (ipaddr_t))
- #endif
- {
-- memmove(&ManagerAddress.sin_addr, hep->h_addr, hep->h_length);
-+ memmove(&ManagerAddress.sin6_addr, hep->h_addr, hep->h_length);
- #ifdef BSD44SOCKETS
-- ManagerAddress.sin_len = sizeof(ManagerAddress);
-+ ManagerAddress.sin6_len = sizeof(ManagerAddress);
- #endif
-- ManagerAddress.sin_family = AF_INET;
-- ManagerAddress.sin_port = htons (xdm_udp_port);
-+ ManagerAddress.sin6_family = AF_INET6;
-+ ManagerAddress.sin6_port = htons (xdm_udp_port);
-+ ManagerAddress.sin6_flowinfo = 0;
- }
- else
- {
---- XFree86-3.3.3.1/xc/programs/lbxproxy/os/connection.c.ipv6 Thu Jun 24 12:39:42 1999
-+++ XFree86-3.3.3.1/xc/programs/lbxproxy/os/connection.c Thu Jun 24 12:39:47 1999
-@@ -231,7 +231,7 @@
- int retry; /* boolean - retry if addr busy */
-
- {
-- struct sockaddr_in insock;
-+ struct sockaddr_in6 insock;
- int request;
- int retryCount;
- #ifndef SO_DONTLINGER
-@@ -240,7 +240,7 @@
- #endif /* SO_LINGER */
- #endif /* SO_DONTLINGER */
-
-- if ((request = socket (AF_INET, SOCK_STREAM, 0)) < 0)
-+ if ((request = socket (AF_INET6, SOCK_STREAM, 0)) < 0)
- {
- Error ("Creating TCP socket");
- return -1;
-@@ -255,11 +255,12 @@
- {
- bzero ((char *)&insock, sizeof (insock));
- #ifdef BSD44SOCKETS
-- insock.sin_len = sizeof(insock);
-+ insock.sin6_len = sizeof(insock);
- #endif
-- insock.sin_family = AF_INET;
-- insock.sin_port = htons ((unsigned short)(X_TCP_PORT + atoi (display)));
-- insock.sin_addr.s_addr = htonl(INADDR_ANY);
-+ insock.sin6_family = AF_INET6;
-+ insock.sin6_flowinfo = 0;
-+ insock.sin6_port = htons ((unsigned short)(X_TCP_PORT + atoi (display)));
-+ insock.sin6_addr = in6addr_any;
-
- retryCount = retry ? 19 : 0;
-
-@@ -1776,7 +1777,7 @@
- struct sockaddr_un un;
- #endif /* UNIXCONN */
- #ifdef TCPCONN
-- struct sockaddr_in in;
-+ struct sockaddr_in6 in;
- #endif /* TCPCONN */
- #ifdef DNETCONN
- struct sockaddr_dn dn;
-@@ -1801,7 +1802,9 @@
- fromlen = sizeof (from);
- if (!getpeername (newconn, &from.sa, &fromlen))
- {
-- if (fromlen && (from.sa.sa_family == AF_INET))
-+ if (fromlen &&
-+ ((from.sa.sa_family == AF_INET) ||
-+ (from.sa.sa_family == AF_INET6)))
- {
- int mi = 1;
- setsockopt (newconn, IPPROTO_TCP, TCP_NODELAY,
---- XFree86-3.3.3.1/xc/programs/xauth/gethost.c.ipv6 Sun Sep 13 15:15:53 1998
-+++ XFree86-3.3.3.1/xc/programs/xauth/gethost.c Thu Jun 24 12:39:47 1999
-@@ -144,15 +144,21 @@
- alarm (4);
- if (setjmp(env) == 0) {
- #endif
-- hp = gethostbyaddr (auth->address, auth->address_length, AF_INET);
-+ hp = gethostbyaddr (auth->address, auth->address_length,
-+ auth->address_length == 4 ? AF_INET : AF_INET6);
- #ifdef SIGALRM
- }
- alarm (0);
- #endif
- if (hp)
- return (hp->h_name);
-- else
-- return (inet_ntoa(*((struct in_addr *)(auth->address))));
-+ else {
-+ static char v[64];
-+
-+ inet_ntop (auth->address_length == 4 ? AF_INET : AF_INET6,
-+ auth->address, v, sizeof(v));
-+ return (v);
-+ }
- }
- #endif
- #ifdef DNETCONN
-@@ -172,38 +178,26 @@
- }
-
- #ifdef TCPCONN
--/*
-- * cribbed from lib/X/XConnDis.c
-- */
- static Bool get_inet_address (name, resultp)
- char *name;
-- unsigned int *resultp; /* return */
-+ struct in6_addr *resultp; /* return */
- {
-- unsigned int hostinetaddr = inet_addr (name);
- struct hostent *host_ptr;
-- struct sockaddr_in inaddr; /* dummy variable for size calcs */
-
--#ifndef INADDR_NONE
--#define INADDR_NONE -1
--#endif
--
-- if (hostinetaddr == INADDR_NONE) {
-- if ((host_ptr = gethostbyname (name)) == NULL) {
-- /* No such host! */
-- errno = EINVAL;
-- return False;
-- }
-- /* Check the address type for an internet host. */
-- if (host_ptr->h_addrtype != AF_INET) {
-- /* Not an Internet host! */
-- errno = EPROTOTYPE;
-- return False;
-- }
--
-- memmove( (char *)&hostinetaddr, (char *)host_ptr->h_addr,
-- sizeof(inaddr.sin_addr));
-+ if ((host_ptr = gethostbyname (name)) == NULL) {
-+ /* No such host! */
-+ errno = EINVAL;
-+ return False;
- }
-- *resultp = hostinetaddr;
-+ /* Check the address type for an internet host. */
-+ if (host_ptr->h_addrtype != AF_INET6) {
-+ /* Not an Internet host! */
-+ errno = EPROTOTYPE;
-+ return False;
-+ }
-+
-+ memmove( (char *)resultp, (char *)host_ptr->h_addr,
-+ host_ptr->h_length);
- return True;
- }
- #endif
-@@ -239,8 +233,7 @@
- int len = 0;
- char *src = NULL;
- #ifdef TCPCONN
-- unsigned int hostinetaddr;
-- struct sockaddr_in inaddr; /* dummy variable for size calcs */
-+ struct in6_addr hostinetaddr;
- #endif
- #ifdef DNETCONN
- struct dn_naddr dnaddr;
-@@ -273,7 +266,7 @@
- #ifdef TCPCONN
- if (!get_inet_address (host, &hostinetaddr)) return NULL;
- src = (char *) &hostinetaddr;
-- len = 4; /* sizeof inaddr.sin_addr, would fail on Cray */
-+ len = (sizeof hostinetaddr);
- break;
- #else
- return NULL;
---- XFree86-3.3.3.1/xc/programs/xauth/parsedpy.c.ipv6 Mon Feb 16 01:43:19 1998
-+++ XFree86-3.3.3.1/xc/programs/xauth/parsedpy.c Thu Jun 24 12:39:47 1999
-@@ -115,12 +115,18 @@
- if (!displayname || !displayname[0]) return False;
-
- /* must have at least :number */
-- ptr = strchr(displayname, ':');
-+ /*
-+ * If a "host::" is found then assume DNET.
-+ * For IPv6, pb with possible : in host --> use rightmost : and test
-+ * x:y->inet, x::y->dnet, x:::y->inet(v6)
-+ */
-+ ptr = strrchr(displayname, ':');
- if (!ptr || !ptr[1]) return False;
-- if (ptr[1] == ':') {
-- if (ptr[2] == '\0') return False;
-- dnet = True;
-- }
-+ if (ptr > displayname && ptr[-1] == ':')
-+ if (ptr-1 == displayname || ptr[-2] != ':') {
-+ ptr--;
-+ dnet = True;
-+ }
-
-
- /*
---- XFree86-3.3.3.1/xc/programs/xauth/xauth.c.ipv6 Wed Apr 27 09:19:54 1994
-+++ XFree86-3.3.3.1/xc/programs/xauth/xauth.c Thu Jun 24 12:39:47 1999
-@@ -32,6 +32,8 @@
-
- #include "xauth.h"
-
-+#include <netinet/in.h>
-+#include <resolv.h>
-
- /*
- * global data
-@@ -102,6 +104,10 @@
- int status;
-
- ProgramName = argv[0];
-+
-+ if ((_res.options & RES_INIT) == 0)
-+ (void)res_init();
-+ _res.options |= RES_USE_INET6;
-
- for (i = 1; i < argc; i++) {
- char *arg = argv[i];
---- XFree86-3.3.3.1/xc/programs/xdm/access.c.ipv6 Sat Jan 18 08:02:17 1997
-+++ XFree86-3.3.3.1/xc/programs/xdm/access.c Thu Jun 24 12:39:47 1999
-@@ -379,6 +379,11 @@
- display->connectionType = FamilyInternet;
- break;
- #endif
-+#ifdef AF_INET6
-+ case AF_INET6:
-+ display->connectionType = FamilyInternet;
-+ break;
-+#endif
- #ifdef AF_DECnet
- case AF_DECnet:
- display->connectionType = FamilyDECnet;
---- XFree86-3.3.3.1/xc/programs/xdm/auth.c.ipv6 Thu Jun 24 12:39:34 1999
-+++ XFree86-3.3.3.1/xc/programs/xdm/auth.c Thu Jun 24 12:39:47 1999
-@@ -86,8 +86,8 @@
- # endif /* ESIX */
- #endif /* i386 */
-
--#ifdef SVR4
- # include <netdb.h>
-+#ifdef SVR4
- # ifndef SCO325
- # include <sys/sockio.h>
- # endif
-@@ -988,6 +988,21 @@
- Debug ("Skipping localhost address\n");
- continue;
- }
-+ if (len == sizeof (struct in6_addr)) {
-+ if (bcmp(addr, &in6addr_loopback, len) == 0)
-+ {
-+ Debug ("Skipping localhost address\n");
-+ continue;
-+ }
-+ /*
-+ * ignore Link local address, the semantic would be weird
-+ */
-+ if (IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)addr))
-+ {
-+ Debug ("Skipping link-local address\n");
-+ continue;
-+ }
-+ }
- family = FamilyInternet;
- }
- Debug ("DefineSelf: write network address, length %d\n", len);
-@@ -1014,10 +1029,10 @@
-
- union {
- struct sockaddr sa;
-- struct sockaddr_in in;
-+ struct sockaddr_in6 in;
- } saddr;
-
-- struct sockaddr_in *inetaddr;
-+ struct sockaddr_in6 *inetaddr;
-
- /* hpux:
- * Why not use gethostname()? Well, at least on my system, I've had to
-@@ -1029,12 +1044,12 @@
- hp = gethostbyname (name.nodename);
- if (hp != NULL) {
- saddr.sa.sa_family = hp->h_addrtype;
-- inetaddr = (struct sockaddr_in *) (&(saddr.sa));
-- memmove( (char *) &(inetaddr->sin_addr), (char *) hp->h_addr, (int) hp->h_length);
-+ inetaddr = (struct sockaddr_in6 *) (&(saddr.sa));
-+ memmove( (char *) &(inetaddr->sin6_addr), (char *) hp->h_addr, (int) hp->h_length);
- family = ConvertAddr ( &(saddr.sa), &len, &addr);
- if ( family >= 0) {
-- writeAddr (FamilyInternet, sizeof (inetaddr->sin_addr),
-- (char *) (&inetaddr->sin_addr), file, auth);
-+ writeAddr (FamilyInternet, sizeof (inetaddr->sin6_addr),
-+ (char *) (&inetaddr->sin6_addr), file, auth);
- }
- }
- }
-@@ -1101,7 +1116,7 @@
- tcp_device= TCP_DEVICE;
- fd = open(tcp_device, O_RDWR);
- #else
-- fd = socket (AF_INET, SOCK_STREAM, 0);
-+ fd = socket (AF_INET6, SOCK_STREAM, 0);
- #endif
- DefineSelf (fd, file, auth);
- close (fd);
-@@ -1133,6 +1148,35 @@
- setAuthNumber (auth, name);
- family = ConvertAddr (peer, &peerlen, &addr);
- Debug ("writeRemoteAuth: family %d\n", family);
-+ /* if remote and name, set all the remote addresses */
-+ if (family == FamilyInternet)
-+ {
-+ struct in6_addr tmp;
-+ struct hostent *hp;
-+ char **ad, *colon;
-+ int af;
-+
-+ if (peerlen == sizeof (struct in6_addr) &&
-+ !IN6_IS_ADDR_V4MAPPED((struct in6_addr *)addr))
-+ af = AF_INET6;
-+ else
-+ af = AF_INET;
-+ colon = strrchr(name, ':');
-+ if (colon) {
-+ *colon = 0;
-+ if (inet_pton(af, name, &tmp) == 0 &&
-+ (hp = gethostbyname2(name, af))) {
-+ for(ad = hp->h_addr_list; *ad; ad++) {
-+ Debug ("writeRemoteAuth: %d, %d, %x\n",
-+ family, hp->h_length, *(int *)*ad);
-+ writeAddr (family, hp->h_length, *ad, file, auth);
-+ }
-+ *colon = ':';
-+ return;
-+ }
-+ *colon = ':';
-+ }
-+ }
- if (family != FamilyLocal)
- {
- Debug ("writeRemoteAuth: %d, %d, %x\n",
---- XFree86-3.3.3.1/xc/programs/xdm/choose.c.ipv6 Sat Jan 18 08:02:19 1997
-+++ XFree86-3.3.3.1/xc/programs/xdm/choose.c Thu Jun 24 12:39:47 1999
-@@ -232,6 +232,22 @@
- result_len = 8;
- }
- break;
-+ case AF_INET6:
-+ {
-+ char *port;
-+ int portlen;
-+ ARRAY8Ptr localAddress, getLocalAddress ();
-+
-+ port = NetaddrPort((XdmcpNetaddr)addr_buf, &portlen);
-+ result_buf[0] = netfamily >> 8;
-+ result_buf[1] = netfamily & 0xFF;
-+ result_buf[2] = port[0];
-+ result_buf[3] = port[1];
-+ localAddress = getLocalAddress ();
-+ memmove( (char *)result_buf+4, (char *)localAddress->data, 16);
-+ result_len = 20;
-+ }
-+ break;
- #ifdef AF_DECnet
- case AF_DECnet:
- break;
---- XFree86-3.3.3.1/xc/programs/xdm/chooser.c.ipv6 Thu Jun 24 12:39:34 1999
-+++ XFree86-3.3.3.1/xc/programs/xdm/chooser.c Thu Jun 24 12:39:47 1999
-@@ -88,6 +88,7 @@
- #endif
- #include <netinet/in.h>
- #include <arpa/inet.h>
-+#include <resolv.h>
- #else /* MINIX */
- #include <net/hton.h>
- #include <net/netlib.h>
-@@ -347,6 +348,11 @@
- hostAddr.length = 4;
- connectionType = FamilyInternet;
- break;
-+ case AF_INET6:
-+ hostAddr.data = (CARD8 *) &((struct sockaddr_in6 *) addr)->sin6_addr;
-+ hostAddr.length = 16;
-+ connectionType = FamilyInternet;
-+ break;
- default:
- hostAddr.data = (CARD8 *) "";
- hostAddr.length = 0;
-@@ -376,11 +382,12 @@
- switch (addr->sa_family)
- {
- case AF_INET:
-+ case AF_INET6:
- {
- struct hostent *hostent;
- char *host;
-
-- hostent = gethostbyaddr ((char *)hostAddr.data, hostAddr.length, AF_INET);
-+ hostent = gethostbyaddr ((char *)hostAddr.data, hostAddr.length, addr->sa_family);
- if (hostent)
- {
- XdmcpDisposeARRAY8 (hostname);
-@@ -493,7 +500,7 @@
- ARRAY8 hostname;
- ARRAY8 status;
- int saveHostname = 0;
-- struct sockaddr addr;
-+ struct sockaddr_in6 addr;
- int addrlen;
- #ifdef MINIX
- int r;
-@@ -750,6 +757,7 @@
- in_addr.sin_family = AF_INET;
- else
- {
-+ /* TODO */
- hostent = gethostbyname (name);
- if (!hostent)
- return;
-@@ -920,7 +928,7 @@
- ref.ref_int= socketFD;
- nbio_setcallback(socketFD, ASIO_READ, read_cb, ref);
- #else /* !MINIX */
-- if ((socketFD = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
-+ if ((socketFD = socket (AF_INET6, SOCK_DGRAM, 0)) < 0)
- return 0;
- #endif /* MINIX */
- #endif
-@@ -950,7 +958,7 @@
- {
- if (app_resources.xdmAddress)
- {
-- struct sockaddr_in in_addr;
-+ struct sockaddr_in6 in_addr;
- struct sockaddr *addr;
- int family;
- int len;
-@@ -970,13 +978,14 @@
- xdm = (char *) app_resources.xdmAddress->data;
- family = (xdm[0] << 8) + xdm[1];
- switch (family) {
-- case AF_INET:
-+ case AF_INET6:
- #ifdef BSD44SOCKETS
-- in_addr.sin_len = sizeof(in_addr);
-+ in_addr.sin6_len = sizeof(in_addr);
- #endif
-- in_addr.sin_family = family;
-- memmove( &in_addr.sin_port, xdm + 2, 2);
-- memmove( &in_addr.sin_addr, xdm + 4, 4);
-+ in_addr.sin6_family = family;
-+ in_addr.sin6_flowinfo = 0;
-+ memmove( &in_addr.sin6_port, xdm + 2, 2);
-+ memmove( &in_addr.sin6_addr, xdm + 4, 16);
- addr = (struct sockaddr *) &in_addr;
- len = sizeof (in_addr);
- break;
-@@ -1172,6 +1181,10 @@
- Arg position[3];
- Dimension width, height;
- Position x, y;
-+
-+ if ((_res.options & RES_INIT) == 0)
-+ (void)res_init();
-+ _res.options |= RES_USE_INET6;
-
- toplevel = XtInitialize (argv[0], "Chooser", options, XtNumber(options), &argc, argv);
-
---- XFree86-3.3.3.1/xc/programs/xdm/dm.c.ipv6 Sat Oct 31 21:17:43 1998
-+++ XFree86-3.3.3.1/xc/programs/xdm/dm.c Thu Jun 24 12:39:47 1999
-@@ -79,6 +79,8 @@
- extern int errno;
- #endif
-
-+#include <netinet/in.h>
-+#include <resolv.h>
-
- #if defined(SVR4) && !defined(SCO)
- extern FILE *fdopen();
-@@ -118,6 +120,10 @@
- Title = argv[0];
- TitleLen = (argv[argc - 1] + strlen(argv[argc - 1])) - Title;
- #endif
-+
-+ if ((_res.options & RES_INIT) == 0)
-+ (void)res_init();
-+ _res.options |= RES_USE_INET6;
-
- /*
- * Step 1 - load configuration parameters
---- XFree86-3.3.3.1/xc/programs/xdm/netaddr.c.ipv6 Sat Jan 18 08:02:21 1997
-+++ XFree86-3.3.3.1/xc/programs/xdm/netaddr.c Thu Jun 24 12:39:47 1999
-@@ -65,7 +65,7 @@
- #endif
-
- /* given an XdmcpNetaddr, returns the socket protocol family used,
-- e.g., AF_INET */
-+ e.g., AF_INET[6] */
-
- int NetaddrFamily(netaddrp)
- XdmcpNetaddr netaddrp;
-@@ -96,6 +96,9 @@
- case AF_INET:
- *lenp = 2;
- return (char *)&(((struct sockaddr_in *)netaddrp)->sin_port);
-+ case AF_INET6:
-+ *lenp = 2;
-+ return (char *)&(((struct sockaddr_in6 *)netaddrp)->sin6_port);
- default:
- *lenp = 0;
- return NULL;
-@@ -125,6 +128,9 @@
- case AF_INET:
- *lenp = sizeof (struct in_addr);
- return (char *) &(((struct sockaddr_in *)netaddrp)->sin_addr);
-+ case AF_INET6:
-+ *lenp = sizeof (struct in6_addr);
-+ return (char *) &(((struct sockaddr_in6 *)netaddrp)->sin6_addr);
- #endif
- #ifdef DNETCONN
- case AF_DECnet:
-@@ -177,6 +183,7 @@
- #endif
- #ifdef TCPCONN
- case AF_INET:
-+ case AF_INET6:
- retval = FamilyInternet;
- break;
- #endif
-@@ -248,6 +255,20 @@
-
- Debug ("port %d, host %d.%d.%d.%d\n",
- (p[0] << 8) + p[1], t[0], t[1], t[2], t[3]);
-+ break;
-+ }
-+#endif
-+#ifdef AF_INET6
-+ case AF_INET6:
-+
-+ p = (unsigned char *) &((struct sockaddr_in6 *) a)->sin6_port;
-+ t = (unsigned char *) &((struct sockaddr_in6 *) a)->sin6_addr;
-+
-+ Debug ("port %d, host %2x%02x:%2x%02x:%2x%02x:%2x%02x:%2x%02x:%2x%02x:%2x%02x:%2x%02x\n",
-+ (p[0] << 8) + p[1],
-+ t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7],
-+ t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15]);
-+
- break;
- }
- #endif
---- XFree86-3.3.3.1/xc/programs/xdm/socket.c.ipv6 Sat Jan 18 08:02:24 1997
-+++ XFree86-3.3.3.1/xc/programs/xdm/socket.c Thu Jun 24 12:39:47 1999
-@@ -84,7 +84,7 @@
- CreateWellKnownSockets ()
- {
- #ifndef MINIX
-- struct sockaddr_in sock_addr;
-+ struct sockaddr_in6 sock_addr;
- #else /* MINIX */
- char *tcp_device, *udp_device;
- nwio_udpopt_t udpopt;
-@@ -103,7 +103,7 @@
- udp_device= UDP_DEVICE;
- xdmcpFd = open(udp_device, O_RDWR);
- #else
-- xdmcpFd = socket (AF_INET, SOCK_DGRAM, 0);
-+ xdmcpFd = socket (AF_INET6, SOCK_DGRAM, 0);
- #endif
- if (xdmcpFd == -1) {
- LogError ("XDMCP socket creation failed, errno %d\n", errno);
-@@ -145,11 +145,12 @@
- /* zero out the entire structure; this avoids 4.4 incompatibilities */
- bzero ((char *) &sock_addr, sizeof (sock_addr));
- #ifdef BSD44SOCKETS
-- sock_addr.sin_len = sizeof(sock_addr);
-+ sock_addr.sin6_len = sizeof(sock_addr);
- #endif
-- sock_addr.sin_family = AF_INET;
-- sock_addr.sin_port = htons ((short) request_port);
-- sock_addr.sin_addr.s_addr = htonl (INADDR_ANY);
-+ sock_addr.sin6_family = AF_INET6;
-+ sock_addr.sin6_port = htons ((short) request_port);
-+ sock_addr.sin6_flowinfo = 0;
-+ sock_addr.sin6_addr = in6addr_any;
- if (bind (xdmcpFd, (struct sockaddr *)&sock_addr, sizeof (sock_addr)) == -1)
- {
- LogError ("error %d binding socket address %d\n", errno, request_port);
-@@ -167,7 +168,7 @@
- tcp_device= TCP_DEVICE;
- chooserFd = open(tcp_device, O_RDWR);
- #else
-- chooserFd = socket (AF_INET, SOCK_STREAM, 0);
-+ chooserFd = socket (AF_INET6, SOCK_STREAM, 0);
- #endif
- Debug ("Created chooser socket %d\n", chooserFd);
- if (chooserFd == -1)
-@@ -216,7 +217,7 @@
- char *addr;
- int *lenp;
- {
-- struct sockaddr_in in_addr;
-+ struct sockaddr_in6 in_addr;
- int len;
-
- len = sizeof in_addr;
---- XFree86-3.3.3.1/xc/programs/xdm/xdmcp.c.ipv6 Sun Feb 1 22:44:04 1998
-+++ XFree86-3.3.3.1/xc/programs/xdm/xdmcp.c Thu Jun 24 12:39:47 1999
-@@ -66,6 +66,8 @@
- #include <net/gen/netdb.h>
- #endif /* !MINIX */
-
-+# include <arpa/inet.h>
-+
- #ifdef X_NOT_STDC_ENV
- #define Time_t long
- extern Time_t time ();
-@@ -133,8 +135,8 @@
- ARRAY8Ptr address;
- char *closure;
- {
--#ifdef AF_INET
-- struct sockaddr_in in_addr;
-+#ifdef AF_INET6
-+ struct sockaddr_in6 in_addr;
- #endif
- #ifdef AF_DECnet
- #endif
-@@ -143,19 +145,20 @@
-
- switch (connectionType)
- {
--#ifdef AF_INET
-+#ifdef AF_INET6
- case FamilyInternet:
- addr = (struct sockaddr *) &in_addr;
- bzero ((char *) &in_addr, sizeof (in_addr));
- #ifdef BSD44SOCKETS
-- in_addr.sin_len = sizeof(in_addr);
-+ in_addr.sin6_len = sizeof(in_addr);
- #endif
-- in_addr.sin_family = AF_INET;
-- in_addr.sin_port = htons ((short) XDM_UDP_PORT);
-- if (address->length != 4)
-+ in_addr.sin6_family = AF_INET6;
-+ in_addr.sin6_flowinfo = 0;
-+ in_addr.sin6_port = htons ((short) XDM_UDP_PORT);
-+ if (address->length != 16)
- return;
-- memmove( (char *) &in_addr.sin_addr, address->data, address->length);
-- addrlen = sizeof (struct sockaddr_in);
-+ memmove( (char *) &in_addr.sin6_addr, address->data, address->length);
-+ addrlen = sizeof (struct sockaddr_in6);
- break;
- #endif
- #ifdef AF_DECnet
-@@ -287,7 +290,7 @@
- ProcessRequestSocket ()
- {
- XdmcpHeader header;
-- struct sockaddr_in addr;
-+ struct sockaddr_in6 addr;
- int addrlen = sizeof addr;
- #ifdef MINIX
- int r;
-@@ -486,7 +489,8 @@
-
- data = connectionAddress->data;
- hostent = gethostbyaddr ((char *)data,
-- connectionAddress->length, AF_INET);
-+ connectionAddress->length,
-+ connectionAddress->length == 4 ? AF_INET : AF_INET6);
- if (sourceAddress && hostent) {
- #if defined(__SVR4) && defined(__sun)
- /*
-@@ -546,11 +550,34 @@
- }
- else
- {
-+ if (multiHomed) {
-+ if (((struct sockaddr_in *)
-+ originalAddress)->sin_family == AF_INET) {
-+ data = (CARD8 *) &((struct sockaddr_in *)
-+ originalAddress)->sin_addr.s_addr;
-+ goto v4;
-+ }
-+ data = (CARD8 *) &((struct sockaddr_in6 *)
-+ originalAddress)->sin6_addr;
-+ goto v6;
-+ }
-+ if (connectionAddress->length == sizeof (struct in6_addr)) {
-+ v6:
-+ if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)data)) {
-+ data += sizeof(struct in6_addr)-sizeof(struct in_addr);
-+ goto v4;
-+ }
-+ if (!getString (name, INET6_ADDRSTRLEN+6))
-+ return 0;
-+ (void) inet_ntop(AF_INET6, data, name, INET6_ADDRSTRLEN);
-+ sprintf(name+strlen(name), ":%d", displayNumber);
-+ return name;
-+ }
-+ if (connectionAddress->length != 4)
-+ return 0;
-+ v4:
- if (!getString (name, 25))
- return 0;
-- if (multiHomed)
-- data = (CARD8 *) &((struct sockaddr_in *)originalAddress)->
-- sin_addr.s_addr;
- sprintf(name, "%d.%d.%d.%d:%d",
- data[0], data[1], data[2], data[3], displayNumber);
- }
-@@ -631,6 +658,29 @@
- }
- break;
- #endif
-+#ifdef AF_INET6
-+ case AF_INET6:
-+ {
-+ struct sockaddr_in6 in_addr;
-+
-+ if (clientAddress.length != 16 ||
-+ clientPort.length != 2)
-+ {
-+ goto badAddress;
-+ }
-+ bzero ((char *) &in_addr, sizeof (in_addr));
-+#ifdef BSD44SOCKETS
-+ in_addr.sin6_len = sizeof(in_addr);
-+#endif
-+ in_addr.sin6_family = AF_INET6;
-+ in_addr.sin6_flowinfo = 0;
-+ memmove( &in_addr.sin6_addr, clientAddress.data, 16);
-+ memmove( (char *) &in_addr.sin6_port, clientPort.data, 2);
-+ client = (struct sockaddr *) &in_addr;
-+ clientlen = sizeof (in_addr);
-+ }
-+ break;
-+#endif
- #ifdef AF_UNIX
- case AF_UNIX:
- {
-@@ -1199,11 +1249,14 @@
- char *local_name;
-
- hostent = gethostbyaddr ((char *)connectionAddress->data,
-- connectionAddress->length, AF_INET);
-+ connectionAddress->length,
-+ connectionAddress->length == 4 ? AF_INET : AF_INET6);
-
- if (hostent)
- local_name = hostent->h_name;
- else {
-+ if (connectionAddress->length != 4)
-+ break;
- /* can't get name, so use emergency fallback */
- sprintf(dotted, "%d.%d.%d.%d",
- connectionAddress->data[0],
---- XFree86-3.3.3.1/xc/programs/xfs/difs/main.c.ipv6 Thu Jun 24 12:39:41 1999
-+++ XFree86-3.3.3.1/xc/programs/xfs/difs/main.c Thu Jun 24 12:39:47 1999
-@@ -60,6 +60,10 @@
- #include "site.h"
- #include <unistd.h>
-
-+#include <sys/types.h>
-+#include <netinet/in.h>
-+#include <resolv.h>
-+
- char *ConnectionInfo;
- int ConnInfoLen;
-
-@@ -94,6 +98,10 @@
-
- argcGlobal = argc;
- argvGlobal = argv;
-+
-+ if ((_res.options & RES_INIT) == 0)
-+ (void)res_init();
-+ _res.options |= RES_USE_INET6;
-
- configfilename = DEFAULT_CONFIG_FILE;
-
---- XFree86-3.3.3.1/xc/programs/xfs/os/access.c.ipv6 Sat Jan 18 08:02:45 1997
-+++ XFree86-3.3.3.1/xc/programs/xfs/os/access.c Thu Jun 24 12:39:47 1999
-@@ -93,7 +93,7 @@
- char hname[64];
- struct hostent *hp;
-
-- addr->addr_len = sizeof(struct in_addr);
-+ addr->addr_len = sizeof(struct in6_addr);
- addr->address = (pointer) fsalloc(addr->addr_len);
- if (!addr->address)
- return FSBadAlloc;
---- XFree86-3.3.3.1/xc/programs/xfwp/xfwp.c.ipv6 Fri Jan 23 00:53:25 1998
-+++ XFree86-3.3.3.1/xc/programs/xfwp/xfwp.c Thu Jun 24 14:22:13 1999
-@@ -57,6 +57,7 @@
- #endif
- #include <sys/wait.h>
- #include <netdb.h>
-+#include <resolv.h>
- #if defined(_ANSI_SOURCE) && defined(__bsdi__)
- #undef _ANSI_SOURCE
- #include <signal.h>
-@@ -163,13 +164,13 @@
- main (int argc, char * argv[])
- {
- struct clientDataStruct client_data;
-- struct sockaddr_in dest_server;
-+ struct sockaddr_in6 dest_server;
- struct pm_policy policy;
- int pm_listen_array[MAX_TRANSPORTS];
- int pm_conn_counter;
-- struct sockaddr_in pm_sockaddr_in;
-+ struct sockaddr_in6 pm_sockaddr_in6;
- int rem_listen_counter;
-- struct sockaddr_in rem_sockaddr_in;
-+ struct sockaddr_in6 rem_sockaddr_in6;
- fd_set readable, writable, rinit, winit;
- int nfds = 0;
- int nready = 0;
-@@ -196,6 +197,10 @@
- /*
- // now do the rest of the setup
- */
-+ if ((_res.options & RES_INIT) == 0)
-+ (void) res_init();
-+ _res.options |= RES_USE_INET6;
-+
- doProcessInputArgs(config_info, argc, argv);
- if ((config_status = doHandleConfigFile(config_info)) == FAILURE)
- exit(1);
-@@ -515,7 +520,7 @@
- {
- int this_server;
- int one = 1;
-- struct sockaddr_in rem_sockaddr_in;
-+ struct sockaddr_in6 rem_sockaddr_in6;
- int port_counter;
- int listen_port;
- char port_buff[10];
-@@ -578,7 +583,7 @@
- return FAILURE;
- }
- if ((server_array[this_server]->client_listen_fd =
-- socket(AF_INET, SOCK_STREAM, 0)) < 0)
-+ socket(AF_INET6, SOCK_STREAM, 0)) < 0)
- {
- #ifdef DEBUG
- fprintf(stderr,"doRemClientSetup: socket() call failed!");
-@@ -599,8 +604,10 @@
- /*
- // set up the rest of the remote client listener
- */
-- bzero((char * ) &rem_sockaddr_in, sizeof(rem_sockaddr_in));
-- rem_sockaddr_in.sin_family = AF_INET;
-+ bzero((char * ) &rem_sockaddr_in6, sizeof(rem_sockaddr_in6));
-+ rem_sockaddr_in6.sin6_family = AF_INET6;
-+ rem_sockaddr_in6.sin6_flowinfo = 0;
-+ rem_sockaddr_in6.sin6_addr = in6addr_any;
- if (setsockopt(server_array[this_server]->client_listen_fd,
- SOL_SOCKET, SO_REUSEADDR,
- &one, sizeof(one)) < 0)
-@@ -617,10 +624,10 @@
- }
-
- while (True) {
-- rem_sockaddr_in.sin_port = htons(listen_port);
-+ rem_sockaddr_in6.sin6_port = htons(listen_port);
- if (bind(server_array[this_server]->client_listen_fd,
-- (struct sockaddr *)&rem_sockaddr_in,
-- sizeof(rem_sockaddr_in)) == 0)
-+ (struct sockaddr *)&rem_sockaddr_in6,
-+ sizeof(rem_sockaddr_in6)) == 0)
- break;
- if (errno != EADDRINUSE)
- {
-@@ -1003,7 +1010,7 @@
- int server_reason_len;
- int conn_auth_namelen, conn_auth_datalen;
- char throw_away[RWBUFFER_SIZE];
-- struct sockaddr_in server_sockaddr_in;
-+ struct sockaddr_in6 server_sockaddr_in6;
- enum CONFIG_CHECK server_status;
- xConnClientPrefix client;
- xConnSetupPrefix prefix;
-@@ -1039,10 +1046,10 @@
- int check_sock_fd;
- struct timeval time_val;
- struct timezone time_zone;
-- struct sockaddr_in temp_sockaddr_in;
-+ struct sockaddr_in6 temp_sockaddr_in6;
- int retval;
- int config_check;
-- int addrlen = sizeof(temp_sockaddr_in);
-+ int addrlen = sizeof(temp_sockaddr_in6);
- /*
- // start by accepting the connection if you can, use pm_listen_array
- // index to index into ICE listen_object list (this is because the
-@@ -1061,17 +1068,17 @@
- // connection; start by using getpeername() to get endpoint info
- */
- retval = getpeername(temp_sock_fd,
-- (struct sockaddr*)&temp_sockaddr_in,
-+ (struct sockaddr*)&temp_sockaddr_in6,
- &addrlen);
-
-- assert(temp_sockaddr_in.sin_family == AF_INET);
-+ assert(temp_sockaddr_in6.sin6_family == AF_INET6);
-
- /*
- // then do the configuration check; NOTE: we're not doing anything
-- // with the server_sockaddr_in argument
-+ // with the server_sockaddr_in6 argument
- */
-- if ((config_check = doConfigCheck(&temp_sockaddr_in,
-- &server_sockaddr_in,
-+ if ((config_check = doConfigCheck(&temp_sockaddr_in6,
-+ &server_sockaddr_in6,
- config_info,
- PMGR,
- &log_data)) == FAILURE)
-@@ -1302,17 +1309,18 @@
- // configuration, if connection allowed, allocate
- // the read/write buffer for this connection;
- */
-- struct sockaddr_in temp_sockaddr_in;
-- int temp_sock_fd;
-- int temp_sock_len;
-- int host_count;
-- int config_check;
-- struct timeval time_val;
-- struct timezone time_zone;
-+ struct sockaddr_in6 temp_sockaddr_in6;
-+ int temp_sock_fd;
-+ int temp_sock_len;
-+ int host_count;
-+ int config_check;
-+ struct timeval time_val;
-+ struct timezone time_zone;
-+ char v1[64], v2[64];
-
-- temp_sock_len = sizeof(temp_sockaddr_in);
-+ temp_sock_len = sizeof(temp_sockaddr_in6);
- if ((temp_sock_fd = accept(fd_counter,
-- (struct sockaddr *) &temp_sockaddr_in,
-+ (struct sockaddr *) &temp_sockaddr_in6,
- &temp_sock_len)) < 0)
- {
- /*
-@@ -1336,7 +1344,7 @@
- if ((server_status =
- doServerConnectSetup(server_array[listen_counter]->x_server_hostport,
- &server_array[listen_counter]->server_fd,
-- &server_sockaddr_in)) == FAILURE)
-+ &server_sockaddr_in6)) == FAILURE)
- {
- #ifdef DEBUG
- fprintf(stderr,
-@@ -1346,7 +1354,7 @@
- }
- if ((server_status =
- doServerConnect(&server_array[listen_counter]->server_fd,
-- &server_sockaddr_in)) == FAILURE)
-+ &server_sockaddr_in6)) == FAILURE)
- {
- #ifdef DEBUG
- fprintf(stderr,
-@@ -1355,15 +1363,18 @@
- return;
- }
- /*
-- // derive and save the client IP source and destination address strings
-- // for logging purposes (have to do it here while we have them; even if
-- // this client connection passes the config check, it might fail the
-- // server security checks later); also, init the config_rule_num field
-- */
-- log_data.source = Malloc(strlen(inet_ntoa(temp_sockaddr_in.sin_addr)));
-- log_data.destination = Malloc(strlen(inet_ntoa(server_sockaddr_in.sin_addr)));
-- strcpy(log_data.source, inet_ntoa(temp_sockaddr_in.sin_addr));
-- strcpy(log_data.destination, inet_ntoa(server_sockaddr_in.sin_addr));
-+ // derive and save the client IPv6 source and destination
-+ // address strings for logging purposes (have to do it here
-+ // while we have them; even if this client connection passes
-+ // the config check, it might fail the server security checks later);
-+ // also, init the config_rule_num field
-+ */
-+ log_data.source = Malloc(strlen(inet_ntop(AF_INET6,
-+ &temp_sockaddr_in6.sin6_addr, v1, sizeof(v1))));
-+ log_data.destination = Malloc(strlen(inet_ntop(AF_INET6,
-+ &server_sockaddr_in6.sin6_addr, v2, sizeof(v2))));
-+ strcpy(log_data.source, v1);
-+ strcpy(log_data.destination, v2);
- log_data.config_rule_num = -1;
- /*
- // do config check on client source and destination (must do
-@@ -1371,8 +1382,8 @@
- // to query and we may not be able to resolve server name
- // alone from xfindproxy()
- */
-- if ((config_check = doConfigCheck(&temp_sockaddr_in,
-- &server_sockaddr_in,
-+ if ((config_check = doConfigCheck(&temp_sockaddr_in6,
-+ &server_sockaddr_in6,
- config_info,
- CLIENT,
- &log_data)) == FAILURE)
-@@ -1454,13 +1465,13 @@
- // server security extension or other loggable events)
- */
- client_conn_array[temp_sock_fd]->source =
-- Malloc(strlen(inet_ntoa(temp_sockaddr_in.sin_addr)));
-+ Malloc(strlen(inet_ntop(AF_INET6,
-+ &temp_sockaddr_in6.sin6_addr, v1, sizeof(v1))));
- client_conn_array[temp_sock_fd]->destination =
-- Malloc(strlen(inet_ntoa(server_sockaddr_in.sin_addr)));
-- strcpy(client_conn_array[temp_sock_fd]->source,
-- inet_ntoa(temp_sockaddr_in.sin_addr));
-- strcpy(client_conn_array[temp_sock_fd]->destination,
-- inet_ntoa(server_sockaddr_in.sin_addr));
-+ Malloc(strlen(inet_ntop(AF_INET6,
-+ &server_sockaddr_in6.sin6_addr, v2, sizeof(v2))));
-+ strcpy(client_conn_array[temp_sock_fd]->source, v1);
-+ strcpy(client_conn_array[temp_sock_fd]->destination, v2);
- /*
- // allocate a buffer for the X server connection
- // and create the association between client and server
-@@ -1959,7 +1970,7 @@
- fprintf(stderr, "Server replied AUTHENTICATE!\n");
- #endif
- /*
-- // retrieve the client IP source and destination address strings
-+ // retrieve the client IPv6 source and destination address strings
- */
- log_data.source =
- Malloc(strlen
-@@ -2030,13 +2041,22 @@
- }/* end if client_conn_array != NULL */
- }
-
--int doConfigCheck(struct sockaddr_in * source_sockaddr_in,
-- struct sockaddr_in * dest_sockaddr_in,
-+#define IN6ADDR_MATCH(x,m,y) \
-+ match = 1; \
-+ for (i = 0; i < sizeof(struct in6_addr) && (m).s6_addr[i] != 0; i++) \
-+ if (((x).s6_addr[i] & (m).s6_addr[i]) != (y).s6_addr[i]) { \
-+ match = 0; \
-+ break; \
-+ }
-+
-+int doConfigCheck(struct sockaddr_in6 * source_sockaddr_in6,
-+ struct sockaddr_in6 * dest_sockaddr_in6,
- struct config * config_info,
- int context,
- struct log_struct * log_data)
- {
- int line_counter;
-+ int i, match;
- /*
- // look through the config file parse tree for a source IP address
- // that matches this request
-@@ -2045,12 +2065,13 @@
- {
- if (config_info->config_file_data[line_counter] != NULL)
- {
-- if ((source_sockaddr_in->sin_addr.s_addr &
-- (~(config_info->config_file_data[line_counter]->source_net))) ==
-- config_info->config_file_data[line_counter]->source_host)
-+ IN6ADDR_MATCH(source_sockaddr_in6->sin6_addr,
-+ config_info->config_file_data[line_counter]->source_net,
-+ config_info->config_file_data[line_counter]->source_host);
-+ if (match)
- {
- /*
-- // okay, the source host and netmask fields pass, see if the
-+ // okay, the source host and prefix length fields pass, see if the
- // config file specifies "permit" or "deny" for this host
- */
- if (!strcmp(config_info->config_file_data[line_counter]->permit_deny,
-@@ -2065,9 +2086,10 @@
- /*
- // compute destination info restrictions
- */
-- if ((dest_sockaddr_in->sin_addr.s_addr &
-- (~(config_info->config_file_data[line_counter]->dest_net))) ==
-- config_info->config_file_data[line_counter]->dest_host)
-+ IN6ADDR_MATCH(dest_sockaddr_in6->sin6_addr,
-+ config_info->config_file_data[line_counter]->dest_net,
-+ config_info->config_file_data[line_counter]->dest_host);
-+ if (match)
- {
- /*
- // you got a match on the destination, so look at
-@@ -2171,9 +2193,10 @@
- /*
- // compute destination info restrictions
- */
-- if ((dest_sockaddr_in->sin_addr.s_addr &
-- (~(config_info->config_file_data[line_counter]->dest_net))) ==
-- config_info->config_file_data[line_counter]->dest_host)
-+ IN6ADDR_MATCH(dest_sockaddr_in6->sin6_addr,
-+ config_info->config_file_data[line_counter]->dest_net,
-+ config_info->config_file_data[line_counter]->dest_host);
-+ if (match)
- {
- /*
- // you got a match on the destination, so look at
-@@ -2292,7 +2315,7 @@
- if (config_info->config_file_path == NULL)
- {
- if (printConfigVerify)
-- fputs("matched default permit 0.0.0.0 255.255.255.255\n", stderr);
-+ fputs("matched default permit :: 0\n", stderr);
- /*
- // there's no rule match to save
- */
-@@ -2301,7 +2324,7 @@
- }
-
- if (printConfigVerify)
-- fputs("matched default deny 0.0.0.0 255.255.255.255\n", stderr);
-+ fputs("matched default deny :: 0\n", stderr);
- /*
- // not in this case either
- */
-@@ -2395,8 +2418,8 @@
- pmGetProxyAddrReplyMsg * pReply;
- char * pReplyData;
- struct hostent * hostptr;
-- struct sockaddr_in server_sockaddr_in;
-- struct sockaddr_in dummy_sockaddr_in;
-+ struct sockaddr_in6 server_sockaddr_in6;
-+ struct sockaddr_in6 dummy_sockaddr_in6;
- char * server_name_base;
- int config_check;
- char * config_failure = "unrecognized server or permission denied";
-@@ -2497,9 +2520,9 @@
- #endif
- goto sendFailure;
- }
-- memset(&server_sockaddr_in, 0, sizeof(server_sockaddr_in));
-- memset(&dummy_sockaddr_in, 0, sizeof(dummy_sockaddr_in));
-- memcpy((char *) &server_sockaddr_in.sin_addr,
-+ memset(&server_sockaddr_in6, 0, sizeof(server_sockaddr_in6));
-+ memset(&dummy_sockaddr_in6, 0, sizeof(dummy_sockaddr_in6));
-+ memcpy((char *) &server_sockaddr_in6.sin6_addr,
- hostptr->h_addr,
- hostptr->h_length);
-
-@@ -2509,11 +2532,11 @@
- // NOTE: source configuration will always match (see XFWP man
- // page) unless sysadmin explicitly chooses to deny
- */
-- memcpy((char *) &dummy_sockaddr_in.sin_addr,
-+ memcpy((char *) &dummy_sockaddr_in6.sin6_addr,
- hostptr->h_addr,
- hostptr->h_length);
-- if ((config_check = doConfigCheck(&dummy_sockaddr_in,
-- &server_sockaddr_in,
-+ if ((config_check = doConfigCheck(&dummy_sockaddr_in6,
-+ &server_sockaddr_in6,
- global_data.config_info,
- FINDPROXY,
- &log_data)) == FAILURE)
-@@ -2759,7 +2782,7 @@
-
- int doServerConnectSetup(char * x_server_hostport,
- int * server_connect_fd,
-- struct sockaddr_in * server_sockaddr_in)
-+ struct sockaddr_in6 * server_sockaddr_in6)
- {
- struct hostent * hostptr;
- char * server_name_base;
-@@ -2796,7 +2819,7 @@
- #endif
- return;
- }
-- if ((*server_connect_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
-+ if ((*server_connect_fd = socket(AF_INET6, SOCK_STREAM, 0)) < 0)
- {
- #ifdef DEBUG
- fprintf(stderr,
-@@ -2805,20 +2828,20 @@
- #endif
- return FAILURE;
- }
-- memset(server_sockaddr_in, 0, sizeof(*server_sockaddr_in));
-- server_sockaddr_in->sin_family = hostptr->h_addrtype;
-- memcpy((char *) &server_sockaddr_in->sin_addr,
-+ memset(server_sockaddr_in6, 0, sizeof(*server_sockaddr_in6));
-+ server_sockaddr_in6->sin6_family = hostptr->h_addrtype;
-+ memcpy((char *) &server_sockaddr_in6->sin6_addr,
- hostptr->h_addr,
- hostptr->h_length);
-- server_sockaddr_in->sin_port = htons(server_port);
-+ server_sockaddr_in6->sin6_port = htons(server_port);
- return SUCCESS;
- }
-
- int doServerConnect(int * server_connect_fd,
-- struct sockaddr_in * server_sockaddr_in)
-+ struct sockaddr_in6 * server_sockaddr_in6)
- {
-- if(connect(*server_connect_fd, (struct sockaddr * )server_sockaddr_in,
-- sizeof(*server_sockaddr_in)) < 0)
-+ if(connect(*server_connect_fd, (struct sockaddr * )server_sockaddr_in6,
-+ sizeof(*server_sockaddr_in6)) < 0)
- {
- #ifdef DEBUG
- fprintf(stderr,
-@@ -3122,13 +3145,13 @@
-
- config_lineP->permit_deny = NULL;
- config_lineP->source_hostname = NULL;
-- config_lineP->source_host = 0;
-- config_lineP->source_netmask = NULL;
-- config_lineP->source_net = 0;
-+ bzero((char *)&config_lineP->source_host, sizeof(struct in6_addr));
-+ config_lineP->source_preflen = NULL;
-+ bzero((char *)&config_lineP->source_net, sizeof(struct in6_addr));
- config_lineP->dest_hostname = NULL;
-- config_lineP->dest_host = 0;
-- config_lineP->dest_netmask = NULL;
-- config_lineP->dest_net = 0;
-+ bzero((char *)&config_lineP->dest_host, sizeof(struct in6_addr));
-+ config_lineP->dest_preflen = NULL;
-+ bzero((char *)&config_lineP->dest_net, sizeof(struct in6_addr));
- config_lineP->operator = NULL;
- config_lineP->service = NULL;
-
-@@ -3200,7 +3223,7 @@
- {
- char token[64];
- strcpy(token, result);
-- if (doVerifyHostMaskToken(token))
-+ if (doVerifyHostToken(token))
- {
- if ((config_file_data[line_number]->source_hostname =
- (char *) malloc (strlen(result) + 1)) == NULL)
-@@ -3219,22 +3242,24 @@
- /*
- // generate network address format
- */
-- config_file_data[line_number]->source_host =
-- inet_addr(config_file_data[line_number]->source_hostname);
-+ inet_pton(AF_INET6,
-+ config_file_data[line_number]->source_hostname,
-+ &config_file_data[line_number]->source_host);
- } else
- bad_token = 1;
- }
-
- /*
-- // now the source netmask field
-+ // now the source prefix length field
- */
- if ((result = strtok(NULL, SEPARATOR1)) != NULL)
- {
- char token[64];
-+ int plen, j;
- strcpy(token, result);
-- if (doVerifyHostMaskToken(token))
-+ if (doVerifyMaskToken(token))
- {
-- if ((config_file_data[line_number]->source_netmask =
-+ if ((config_file_data[line_number]->source_preflen =
- (char *) malloc (strlen(result) + 1)) == NULL)
- {
- #ifdef DEBUG
-@@ -3242,14 +3267,18 @@
- #endif
- return 0;
- }
-- strcpy(config_file_data[line_number]->source_netmask, result);
-+ strcpy(config_file_data[line_number]->source_preflen, result);
- #ifdef DEBUG
- fprintf(stderr,
- "third token = %s\n",
-- config_file_data[line_number]->source_netmask);
-+ config_file_data[line_number]->source_preflen);
- #endif
-- config_file_data[line_number]->source_net =
-- inet_addr(config_file_data[line_number]->source_netmask);
-+ plen = atoi(config_file_data[line_number]->source_preflen);
-+ for (j = 0; plen >= 8; plen -= 8, j++)
-+ config_file_data[line_number]->source_net.s6_addr[j] = 0xff;
-+ if (plen != 0)
-+ config_file_data[line_number]->source_net.s6_addr[j] =
-+ 0xff << (8 - plen);
- } else
- bad_token = 1;
- }
-@@ -3260,7 +3289,7 @@
- {
- char token[64];
- strcpy(token, result);
-- if (doVerifyHostMaskToken(token))
-+ if (doVerifyHostToken(token))
- {
- if ((config_file_data[line_number]->dest_hostname =
- (char *) malloc (strlen(result) + 1)) == NULL)
-@@ -3276,21 +3305,23 @@
- "fourth token = %s\n",
- config_file_data[line_number]->dest_hostname);
- #endif
-- config_file_data[line_number]->dest_host =
-- inet_addr(config_file_data[line_number]->dest_hostname);
-+ inet_pton(AF_INET6,
-+ config_file_data[line_number]->dest_hostname,
-+ &config_file_data[line_number]->dest_host);
- } else
- bad_token = 1;
- }
- /*
-- // now the destination netmask field
-+ // now the destination prefix length field
- */
- if ((result = strtok(NULL, SEPARATOR1)) != NULL)
- {
- char token[64];
-+ int plen, j;
- strcpy(token, result);
-- if (doVerifyHostMaskToken(token))
-+ if (doVerifyMaskToken(token))
- {
-- if ((config_file_data[line_number]->dest_netmask =
-+ if ((config_file_data[line_number]->dest_preflen =
- (char *) malloc (strlen(result) + 1)) == NULL)
- {
- #ifdef DEBUG
-@@ -3298,14 +3329,18 @@
- #endif
- return 0;
- }
-- strcpy(config_file_data[line_number]->dest_netmask, result);
-+ strcpy(config_file_data[line_number]->dest_preflen, result);
- #ifdef DEBUG
- fprintf(stderr,
- "fifth token = %s\n",
-- config_file_data[line_number]->dest_netmask);
-+ config_file_data[line_number]->dest_preflen);
- #endif
-- config_file_data[line_number]->dest_net =
-- inet_addr(config_file_data[line_number]->dest_netmask);
-+ plen = atoi(config_file_data[line_number]->dest_preflen);
-+ for (j = 0; plen >= 8; plen -= 8, j++)
-+ config_file_data[line_number]->dest_net.s6_addr[j] = 0xff;
-+ if (plen != 0)
-+ config_file_data[line_number]->dest_net.s6_addr[j] =
-+ 0xff << (8 - plen);
- } else
- bad_token = 1;
- }
-@@ -3377,9 +3412,9 @@
- ((config_file_data[line_number]->permit_deny != NULL) &&
- (config_file_data[line_number]->source_hostname == NULL)) ||
- ((config_file_data[line_number]->source_hostname != NULL) &&
-- (config_file_data[line_number]->source_netmask == NULL)) ||
-+ (config_file_data[line_number]->source_preflen == NULL)) ||
- ((config_file_data[line_number]->dest_hostname != NULL) &&
-- (config_file_data[line_number]->dest_netmask == NULL)) ||
-+ (config_file_data[line_number]->dest_preflen == NULL)) ||
- ((config_file_data[line_number]->operator != NULL) &&
- (config_file_data[line_number]->service == NULL)))
- return 1;
-@@ -3388,27 +3423,23 @@
- return 0;
- }
-
--int doVerifyHostMaskToken(char token[])
-+int doVerifyHostToken(char token[])
- {
-- char * result;
-- int delimiter_count = 0;
-+ struct in6_addr addr;
- /*
-- // verify there are 3 "." delimiters in the token
-+ // verify it is a real IPv6 address
- */
-- while (token)
-- {
-- if ((result = strchr(token, SEPARATOR2)) != NULL)
-- {
-- token = result;
-- delimiter_count++;
-- token ++;
-- } else
-- token = result;
-- }
-- if ((delimiter_count < 3) || (delimiter_count > 3))
-- return 0;
-- else
-- return 1;
-+ return (inet_pton(AF_INET6, token, &addr) > 0);
-+}
-+
-+int doVerifyMaskToken(char token[])
-+{
-+ int plen;
-+ /*
-+ // verify it is a legal prefix length
-+ */
-+ plen = atoi(token);
-+ return ((plen >= 0) && (plen <= 128));
- }
-
- void BadSyntax(char *msg, int line)
-@@ -3483,8 +3514,8 @@
- struct config_line *ruleP = config_info->config_file_data[line_counter];
- fprintf(stderr,"matched: %s %s %s %s %s %s %s\n",
- ruleP->permit_deny,
-- ruleP->source_hostname, ruleP->source_netmask,
-- ruleP->dest_hostname, ruleP->dest_netmask,
-+ ruleP->source_hostname, ruleP->source_preflen,
-+ ruleP->dest_hostname, ruleP->dest_preflen,
- ruleP->operator,
- ruleP->service);
- }
---- XFree86-3.3.3.1/xc/programs/xfwp/xfwp.h.ipv6 Wed Jun 11 14:09:00 1997
-+++ XFree86-3.3.3.1/xc/programs/xfwp/xfwp.h Thu Jun 24 12:39:47 1999
-@@ -61,7 +61,7 @@
- /* allocate ADD_LINES entries at a time when loading the configuration */
- #define ADD_LINES 20
- #define SEPARATOR1 " \t\n"
--#define SEPARATOR2 '.'
-+#define SEPARATOR2 ':'
-
- #define min(a,b) ((a) < (b) ? (a) : (b))
- #define max(a,b) ((a) > (b) ? (a) : (b))
-@@ -194,13 +194,13 @@
- {
- char * permit_deny;
- char * source_hostname;
-- unsigned int source_host;
-- char * source_netmask;
-- unsigned int source_net;
-+ struct in6_addr source_host;
-+ char * source_preflen;
-+ struct in6_addr source_net;
- char * dest_hostname;
-- unsigned int dest_host;
-- char * dest_netmask;
-- unsigned int dest_net;
-+ struct in6_addr dest_host;
-+ char * dest_preflen;
-+ struct in6_addr dest_net;
- char * operator;
- char * service;
- int service_id;
-@@ -303,8 +303,8 @@
- struct client_conn_buf * client_conn_array[],
- struct ice_data * ice_data);
-
--int doConfigCheck(struct sockaddr_in * temp_sockaddr_in,
-- struct sockaddr_in * server_sockaddr_in,
-+int doConfigCheck(struct sockaddr_in6 * temp_sockaddr_in6,
-+ struct sockaddr_in6 * server_sockaddr_in6,
- struct config * config_info,
- int context,
- struct log_struct * log_data);
-@@ -337,10 +337,10 @@
-
- int doServerConnectSetup(char * x_server_hostport,
- int * server_connect_fd,
-- struct sockaddr_in * server_addr_in);
-+ struct sockaddr_in6 * server_addr_in6);
-
- int doServerConnect(int * server_connect_fd,
-- struct sockaddr_in * server_addr_in);
-+ struct sockaddr_in6 * server_addr_in6);
-
- int doProcessLine(char *line,
- struct config * config_info,
-@@ -352,7 +352,9 @@
-
- Bool doConfigRequireDisallow(int, char*);
-
--int doVerifyHostMaskToken(char token[]);
-+int doVerifyHostToken(char token[]);
-+
-+int doVerifyMaskToken(char token[]);
-
- void doInstallIOErrorHandler();
-
---- XFree86-3.3.3.1/xc/programs/xfwp/xfwp.man.ipv6 Tue Dec 24 11:04:47 1996
-+++ XFree86-3.3.3.1/xc/programs/xfwp/xfwp.man Thu Jun 24 12:39:47 1999
-@@ -206,7 +206,7 @@
- packet-filtering routers. It contains zero or more source-destination
- rules of the following form:
- .PP
--[#]{permit | deny} <src> <src mask> [<dest> <dest mask> [<operator> <service>]]
-+[#]{permit | deny} <src> <src len> [<dest> <dest len> [<operator> <service>]]
- .sp
- .IP # 12
- comment delimiter; evaluator will skip these lines
-@@ -214,21 +214,21 @@
- the keywords ``permit'' or ``deny'' indicate whether the
- rule will enable or disable access, respectively
- .IP src 12
--the IP address against the host who originated the
--connection request will be matched, expressed in IP
--format (x.x.x.x)
--.IP "src mask" 12
--a subnet mask, also in IP format, for further qualifying
--the source mask. Bits set in the mask indicate bits of the
-+the IPv6 address against the host who originated the
-+connection request will be matched, expressed in IPv6
-+format (x:x:x:x:x:x:x:x)
-+.IP "src len" 12
-+a prefix length, a number between 0 and 128, for further qualifying
-+the source prefix. Bits after the prefix indicate bits of the
- incoming address to be \fIignored\fP when comparing to the specified src
- .IP dest 12
--the IP address against which the destination of the
--incoming connection request (i.e. the host IP of the
-+the IPv6 address against which the destination of the
-+incoming connection request (i.e. the host IPv6 of the
- X server to which the incoming client is attempting to
- connect) will be matched
--.IP "dest mask" 12
--a subnet mask, also in IP format, for further qualifying
--the destination mask. Bits set in the mask indicate bits of the
-+.IP "dest len" 12
-+a prefix length, a number between 0 and 128, for further qualifying
-+the destination prefix. Bits after the prefix indicate bits of the
- destination address to be \fIignored\fP when comparing to the specified dest
- .IP operator 12
- always ``eq'' (if the service field is not NULL)
-@@ -267,8 +267,8 @@
- .RS 3
- while (more entries to check)
- {
-- if ((<originator IP> AND (NOT <src mask>)) == src)
-- [if ((<dest X server IP> AND (NOT <dest mask>)) == dest)]
-+ if ((<originator IPv6> AND (<src prefix>)) == src)
-+ [if ((<dest X server IPv6> AND (<dest prefix>)) == dest)]
- [if (service fields present and matching)]
- do either permit or deny connection depending on keyword
- else
-@@ -312,22 +312,22 @@
- require policy1
- require policy2
- #
--# deny pm connections originating on 8.7.6.5 [NOTE: If pm service
-+# deny pm connections originating on 8:7:6:5:4:3:2:1 [NOTE: If pm service
- # is explicitly qualified, line must include destination fields as
- # shown.]
- #
--deny 8.7.6.5 0.0.0.0 0.0.0.0 255.255.255.255 eq pm
-+deny 8:7:6:5:4:3:2:1 128 :: 0 eq pm
- #
- # permit xfindproxy X server connects to anywhere [NOTE: If
- # fp service is explicitly qualified, line must include source fields
- # as shown.]
- #
--permit 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255 eq fp
-+permit :: 0 :: 0 eq fp
- #
--# permit all connection types originating from the 192.0.0.0
--# IP domain only
-+# permit all connection types originating from the fec0::/10
-+# IPv6 domain only
- #
--permit 192.0.0.0 0.255.255.255
-+permit fec0:: 10
- .fi
- \fP
- .PP
---- XFree86-3.3.3.1/xc/programs/xhost/xhost.c.ipv6 Sun Sep 13 15:15:59 1998
-+++ XFree86-3.3.3.1/xc/programs/xhost/xhost.c Thu Jun 24 12:39:47 1999
-@@ -75,6 +75,7 @@
- #endif
- #include <netdb.h>
- #include <netinet/in.h>
-+#include <resolv.h>
- #else
- #include <server/ip/gen/socket.h>
- #include <server/ip/types.h>
-@@ -153,6 +154,9 @@
- #ifdef AF_INET
- { AF_INET, FamilyInternet },
- #endif
-+#ifdef AF_INET6
-+ { AF_INET6, FamilyInternet },
-+#endif
- };
-
- #define FAMILIES ((sizeof familyMap)/(sizeof familyMap[0]))
-@@ -184,6 +188,12 @@
-
- ProgramName = argv[0];
-
-+#ifdef NEEDSOCKETS
-+ if ((_res.options & RES_INIT) == 0)
-+ (void)res_init();
-+ _res.options |= RES_USE_INET6;
-+#endif
-+
- if ((dpy = XOpenDisplay(NULL)) == NULL) {
- fprintf(stderr, "%s: unable to open display \"%s\"\n",
- ProgramName, XDisplayName (NULL));
-@@ -308,7 +318,7 @@
- #endif
- #ifdef NEEDSOCKETS
- #ifndef AMTCPCONN
-- static struct in_addr addr; /* so we can point at it */
-+ static struct in6_addr addr; /* so we can point at it */
- #else
- static ipaddr_t addr;
- #endif
-@@ -484,41 +494,30 @@
- }
- #ifdef NEEDSOCKETS
- /*
-- * First see if inet_addr() can grok the name; if so, then use it.
-- */
--#ifndef AMTCPCONN
-- if ((addr.s_addr = inet_addr(name)) != -1) {
--#else
-- if ((addr = inet_addr(name)) != -1) {
--#endif
-- ha.family = FamilyInternet;
-- ha.length = 4; /* but for Cray would be sizeof(addr.s_addr) */
-- ha.address = (char *)&addr; /* but for Cray would be &addr.s_addr */
-- if (add) {
-- XAddHost (dpy, &ha);
-- printf ("%s %s\n", name, add_msg);
-- } else {
-- XRemoveHost (dpy, &ha);
-- printf ("%s %s\n", name, remove_msg);
-- }
-- return 1;
-- }
-- /*
-+ * (gethostbyname knows how to handle litterals...)
- * Is it in the namespace?
- */
-- else if (((hp = gethostbyname(name)) == (struct hostent *)NULL)
-- || hp->h_addrtype != AF_INET) {
-+ if (((hp = gethostbyname(name)) == (struct hostent *)NULL)
-+ || hp->h_addrtype != AF_INET6) {
- return 0;
- } else {
- ha.family = XFamily(hp->h_addrtype);
-- ha.length = hp->h_length;
- #ifdef h_addr /* new 4.3bsd version of gethostent */
- {
- char **list;
-
- /* iterate over the hosts */
- for (list = hp->h_addr_list; *list; list++) {
-+ ha.length = hp->h_length;
- ha.address = *list;
-+#ifdef UNMAPPED_IPV4
-+ if ((ha.family == FamilyInternet) &&
-+ (ha.length == sizeof(struct in6_addr)) &&
-+ IN6_IS_ADDR_V4MAPPED((struct in6_addr *)ha.address)) {
-+ ha.length = sizeof(struct in_addr);
-+ ha.address += sizeof(struct in6_addr) - sizeof(struct in_addr);
-+ }
-+#endif
- if (add) {
- XAddHost (dpy, &ha);
- } else {
-@@ -527,7 +526,16 @@
- }
- }
- #else
-+ ha.length = hp->h_length;
- ha.address = hp->h_addr;
-+#ifdef UNMAPPED_IPV4
-+ if ((ha.family == FamilyInternet) &&
-+ (ha.length == sizeof(struct in6_addr)) &&
-+ IN6_IS_ADDR_V4MAPPED((struct in6_addr *)ha.address)) {
-+ ha.length = sizeof(struct in_addr);
-+ ha.address += sizeof(struct in6_addr) - sizeof(struct in_addr);
-+ }
-+#endif
- if (add) {
- XAddHost (dpy, &ha);
- } else {
-@@ -545,7 +553,7 @@
-
- /*
- * get_hostname - Given an internet address, return a name (CHARON.MIT.EDU)
-- * or a string representing the address (18.58.0.13) if the name cannot
-+ * or a string representing the address (::ffff:18.58.0.13) if the name cannot
- * be found.
- */
-
-@@ -556,7 +564,7 @@
- {
- #if defined(TCPCONN) || defined(STREAMSCONN) || defined(AMTCPCONN)
- struct hostent *hp = NULL;
-- char *inet_ntoa();
-+ static char v[64];
- #endif
- #ifdef DNETCONN
- struct nodeent *np;
-@@ -571,12 +579,6 @@
-
- #if defined(TCPCONN) || defined(STREAMSCONN) || defined(AMTCPCONN)
- if (ha->family == FamilyInternet) {
--#ifdef CRAY
-- struct in_addr t_addr;
-- bzero((char *)&t_addr, sizeof(t_addr));
-- bcopy(ha->address, (char *)&t_addr, 4);
-- ha->address = (char *)&t_addr;
--#endif
- /* gethostbyaddr can take a LONG time if the host does not exist.
- Assume that if it does not respond in NAMESERVER_TIMEOUT seconds
- that something is wrong and do not make the user wait.
-@@ -586,16 +588,17 @@
- signal(SIGALRM, nameserver_lost);
- alarm(4);
- if (setjmp(env) == 0) {
-- hp = gethostbyaddr (ha->address, ha->length, AF_INET);
-+ hp = gethostbyaddr (ha->address, ha->length,
-+ ha->length == 4 ? AF_INET : AF_INET6);
- }
- alarm(0);
- if (hp)
- return (hp->h_name);
--#ifndef AMTCPCONN
-- else return (inet_ntoa(*((struct in_addr *)(ha->address))));
--#else
-- else return (inet_ntoa(*((ipaddr_t *)(ha->address))));
--#endif
-+ else {
-+ inet_ntop(ha->length == 4 ? AF_INET : AF_INET6,
-+ ha->address, v, sizeof(v));
-+ return (v);
-+ }
- }
- #endif
- if (ha->family == FamilyNetname) {
+++ /dev/null
-diff -urN xc.orig/config/cf/xfree86.cf xc/config/cf/xfree86.cf
---- xc.orig/config/cf/xfree86.cf Mon Dec 30 15:52:31 2002
-+++ xc/config/cf/xfree86.cf Mon Dec 30 20:44:34 2002
-@@ -1122,7 +1122,7 @@
- && !defined(ia64Architecture) \
- && !defined(s390xArchitecture) \
- && !defined (x86_64Architecture)
--# define BuildPexExt NO /* But we turn off PEX anyway now */
-+# define BuildPexExt YES /* But we turn off PEX anyway now */
- # else
- # define BuildPexExt NO
- # endif
-@@ -1363,7 +1363,7 @@
- */
- #ifndef BuildXIE
- # if XF86Server
--# define BuildXIE NO
-+# define BuildXIE YES
- # else
- # define BuildXIE NO
- # endif
-diff -urN xc.orig/programs/xdpyinfo/Imakefile xc/programs/xdpyinfo/Imakefile
---- xc.orig/programs/xdpyinfo/Imakefile Mon Dec 30 15:54:07 2002
-+++ xc/programs/xdpyinfo/Imakefile Mon Dec 30 20:40:08 2002
-@@ -10,11 +10,6 @@
- SHMDEFINES = -DMITSHM
- #endif
-
--#if BuildXIElib
-- XIEDEFINES = -DXIE
-- XIEDEPLIBS = $(DEPXIELIB)
-- XIELIBS = $(XIELIB)
--#endif
-
- #if BuildXF86VidModeLibrary
- VIDMODEDEFINES = -DXF86VIDMODE
+++ /dev/null
-X server used to crash after XF86VidModeSwitchToMode() failure,
-because of unconditional currentMode info destruction.
-
-E.g. (the case I investigated) when screen resolution set by RandR was
-lower than requested by XF86VidModeSwitchToMode(), xf86SwitchMode is
-unsuccessful; due to currentMode == NULL (in some way) DRIAdjustFrame()
-called itself recursively again and again, leading to stack overflow.
-
-This patch seems to avoid the crash.
-
---- XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c.orig Tue Jan 28 21:52:28 2003
-+++ XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c Sat Mar 8 01:05:00 2003
-@@ -330,6 +330,8 @@
- VidModeSwitchMode(int scrnIndex, pointer mode)
- {
- ScrnInfoPtr pScrn;
-+ DisplayModePtr pTmpMode;
-+ Bool retval;
-
- DEBUG_P("VidModeSwitchMode");
-
-@@ -338,8 +340,12 @@
-
- pScrn = xf86Screens[scrnIndex];
- /* Force a mode switch */
-+ pTmpMode = pScrn->currentMode;
- pScrn->currentMode = NULL;
-- return xf86SwitchMode(pScrn->pScreen, mode);
-+ retval = xf86SwitchMode(pScrn->pScreen, mode);
-+ if (retval == FALSE)
-+ pScrn->currentMode = pTmpMode;
-+ return retval;
- }
-
- Bool
+++ /dev/null
-Binary files XFree86-3.3.5.orig/xc/doc/specs/XIE/XIEProto/ch8_xie.doc and XFree86-3.3.5/xc/doc/specs/XIE/XIEProto/ch8_xie.doc differ
-diff -urN XFree86-3.3.5.orig/xc/programs/Xserver/hw/xfree86/common/xf86Config.c XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/common/xf86Config.c
---- XFree86-3.3.5.orig/xc/programs/Xserver/hw/xfree86/common/xf86Config.c Thu Jul 29 11:22:44 1999
-+++ XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/common/xf86Config.c Thu Sep 2 19:42:40 1999
-@@ -774,11 +774,11 @@
- }
-
- /*
-- * /etc/XF86Config
-+ * /etc/X11/XF86Config
- */
- configPaths[++pcount] = (char *)xalloc(PATH_MAX);
- #if !defined(__QNX__) || defined(__QNXNTO__)
-- strcpy(configPaths[pcount], "/etc/XF86Config");
-+ strcpy(configPaths[pcount], "/etc/X11/XF86Config");
- #else
- /* On QNX, we default to /etc/config/XF86Config.nid to
- * keep config files separate for network setups
+++ /dev/null
---- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/XF86Setup/filelist.tcl~ Mon Nov 16 14:13:41 1998
-+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/XF86Setup/filelist.tcl Sat Jun 19 16:19:34 1999
-@@ -48,8 +48,8 @@
- lib/X11/fonts/misc/fonts.dir 444
- lib/X11/fonts/misc/fonts.alias 444
- lib/X11/fonts/misc/6x13.pc* 444
-- lib/X11/fonts/75dpi/fonts.dir 444
-- lib/X11/fonts/75dpi/symb10.pc* 444
-+ lib/X11/fonts/*dpi/fonts.dir 444
-+ lib/X11/fonts/*dpi/symb10.pc* 444
- }
-
- array set FilePermsDB {
+++ /dev/null
-diff -Nru xc.orig/programs/Xserver/hw/xfree86/xf86Version.h xc/programs/Xserver/hw/xfree86/xf86Version.h
---- xc.orig/programs/Xserver/hw/xfree86/xf86Version.h 2003-06-25 13:07:21.000000000 +0200
-+++ xc/programs/Xserver/hw/xfree86/xf86Version.h 2003-06-27 14:04:29.000000000 +0200
-@@ -19,7 +19,7 @@
- /* Define these for compatibility. They'll be removed at some point. */
- #define XF86_VERSION_SUBMINOR XF86_VERSION_PATCH
- #define XF86_VERSION_BETA 0
--#define XF87_VERSION_ALPHA XF86_VERSION_SNAP
-+#define XF86_VERSION_ALPHA XF86_VERSION_SNAP
-
- #define XF86_VERSION_CURRENT \
- XF86_VERSION_NUMERIC(XF86_VERSION_MAJOR, \
+++ /dev/null
---- XFree86-4.0/xc/lib/Xaw/Scrollbar.c.foo Mon May 15 17:04:02 2000
-+++ XFree86-4.0/xc/lib/Xaw/Scrollbar.c Mon May 15 17:07:30 2000
-@@ -831,6 +831,10 @@
- NotifyThumb(Widget gw, XEvent *event, String *params, Cardinal *num_params)
- {
- ScrollbarWidget w = (ScrollbarWidget)gw;
-+ union {
-+ XtPointer xt_pt;
-+ float xt_top;
-+ } foo;
-
- if (w->scrollbar.direction == 0) /* if no StartScroll */
- return;
-@@ -841,7 +845,10 @@
- /* thumbProc is not pretty, but is necessary for backwards
- compatibility on those architectures for which it work{s,ed};
- the intent is to pass a (truncated) float by value. */
-- XtCallCallbacks(gw, XtNthumbProc, *(XtPointer*)&w->scrollbar.top);
-+
-+ foo.xt_top = w->scrollbar.top;
-+
-+ XtCallCallbacks(gw, XtNthumbProc, foo.xt_pt);
- XtCallCallbacks(gw, XtNjumpProc, (XtPointer)&w->scrollbar.top);
-
- PaintThumb(w);
+++ /dev/null
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/Imakefile xc/lib/Xft/Imakefile
---- XFree86-4.0.2.orig/xc/lib/Xft/Imakefile Sat Dec 16 12:33:01 2000
-+++ XFree86-4.0.2/xc/lib/Xft/Imakefile Fri Jan 19 20:25:58 2001
-@@ -1,4 +1,4 @@
--XCOMM $XFree86: xc/lib/Xft/Imakefile,v 1.8 2000/12/15 17:12:52 keithp Exp $
-+XCOMM $XFree86: xc/lib/Xft/Imakefile,v 1.9 2001/01/02 02:46:50 keithp Exp $
-
- #define DoNormalLib NormalLibXft
- #define DoSharedLib SharedLibXft
-@@ -33,8 +33,8 @@
-
- #ifdef Freetype2Dir
- FT_HEADERS = XftFreetype.h
-- FT_SRCS = xftdir.c xftfreetype.c xftglyphs.c xftrender.c
-- FT_OBJS = xftdir.o xftfreetype.o xftglyphs.o xftrender.o
-+ FT_SRCS = xftcache.c xftdir.c xftfreetype.c xftglyphs.c xftrender.c
-+ FT_OBJS = xftcache.o xftdir.o xftfreetype.o xftglyphs.o xftrender.o
- #endif
-
- HEADERS = Xft.h $(FT_HEADERS)
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/Xft.h xc/lib/Xft/Xft.h
---- XFree86-4.0.2.orig/xc/lib/Xft/Xft.h Fri Dec 8 02:51:26 2000
-+++ XFree86-4.0.2/xc/lib/Xft/Xft.h Fri Jan 19 20:25:58 2001
-@@ -1,5 +1,5 @@
- /*
-- * $XFree86: xc/lib/Xft/Xft.h,v 1.13 2000/12/08 07:51:26 keithp Exp $
-+ * $XFree86: xc/lib/Xft/Xft.h,v 1.16 2001/01/02 02:46:50 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
-@@ -57,6 +57,7 @@
- /* defaults from resources */
- #define XFT_SCALE "scale" /* double */
- #define XFT_RENDER "render" /* Bool */
-+#define XFT_MINSPACE "minspace" /* Bool use minimum line spacing */
-
- /* specific to FreeType rasterizer */
- #define XFT_CHAR_WIDTH "charwidth" /* Int */
-@@ -254,6 +255,16 @@
- int y,
- XftChar32 *string,
- int len);
-+
-+void
-+XftDrawStringUtf8 (XftDraw *d,
-+ XftColor *color,
-+ XftFont *font,
-+ int x,
-+ int y,
-+ XftChar8 *string,
-+ int len);
-+
- void
- XftDrawRect (XftDraw *d,
- XftColor *color,
-@@ -290,6 +301,13 @@
- int len,
- XGlyphInfo *extents);
-
-+void
-+XftTextExtentsUtf8 (Display *dpy,
-+ XftFont *font,
-+ XftChar8 *string,
-+ int len,
-+ XGlyphInfo *extents);
-+
- /* xftfont.c */
- XftPattern *
- XftFontMatch (Display *dpy, int screen, XftPattern *pattern, XftResult *result);
-@@ -379,6 +397,9 @@
- XftPattern *
- XftNameParse (const char *name);
-
-+Bool
-+XftNameUnparse (XftPattern *pat, char *dest, int len);
-+
- /* xftpat.c */
- XftPattern *
- XftPatternCreate (void);
-@@ -442,12 +463,26 @@
-
- /* xftstr.c */
-
-+int
-+XftUtf8ToUcs4 (XftChar8 *src_orig,
-+ XftChar32 *dst,
-+ int len);
-+
-+Bool
-+XftUtf8Len (XftChar8 *string,
-+ int len,
-+ int *nchar,
-+ int *wchar);
-+
- /* xftxlfd.c */
- XftPattern *
- XftXlfdParse (const char *xlfd_orig, Bool ignore_scalable, Bool complete);
-
- XFontStruct *
- XftCoreOpen (Display *dpy, XftPattern *pattern);
-+
-+void
-+XftCoreClose (Display *dpy, XFontStruct *font);
-
- _XFUNCPROTOEND
-
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/XftFreetype.h xc/lib/Xft/XftFreetype.h
---- XFree86-4.0.2.orig/xc/lib/Xft/XftFreetype.h Sat Dec 16 12:33:01 2000
-+++ XFree86-4.0.2/xc/lib/Xft/XftFreetype.h Fri Jan 19 20:25:58 2001
-@@ -1,5 +1,5 @@
- /*
-- * $XFree86: xc/lib/Xft/XftFreetype.h,v 1.7 2000/12/15 17:12:52 keithp Exp $
-+ * $XFree86: xc/lib/Xft/XftFreetype.h,v 1.12 2001/01/02 02:46:50 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
-@@ -38,15 +38,15 @@
- GlyphSet glyphset;
- int min_char;
- int max_char;
-- int size;
-+ FT_F26Dot6 size;
- int ascent;
- int descent;
- int height;
- int max_advance_width;
-- Bool monospace;
-+ int spacing;
- int rgba;
- Bool antialias;
-- Bool encoded; /* use charmap */
-+ int charmap; /* -1 for unencoded */
- XRenderPictFormat *format;
- XGlyphInfo **realized;
- int nrealized;
-@@ -54,13 +54,32 @@
-
- _XFUNCPROTOBEGIN
-
-+/* xftdir.c */
-+Bool
-+XftDirScan (XftFontSet *set, const char *dir, Bool force);
-+
-+Bool
-+XftDirSave (XftFontSet *set, const char *dir);
-+
- /* xftfreetype.c */
-+XftPattern *
-+XftFreeTypeQuery (const char *file, int id, int *count);
-+
-+Bool
-+XftFreeTypeSetFace (FT_Face face, FT_F26Dot6 size, int charmap);
-+
- XftFontStruct *
- XftFreeTypeOpen (Display *dpy, XftPattern *pattern);
-
- void
- XftFreeTypeClose (Display *dpy, XftFontStruct *font);
-
-+XftFontStruct *
-+XftFreeTypeGet (XftFont *font);
-+
-+Bool
-+XftInitFtLibrary(void);
-+
- /* xftglyphs.c */
- void
- XftGlyphLoad (Display *dpy,
-@@ -104,6 +123,13 @@
- XftChar32 *string, int len);
-
- void
-+XftRenderStringUtf8 (Display *dpy, Picture src,
-+ XftFontStruct *font, Picture dst,
-+ int srcx, int srcy,
-+ int x, int y,
-+ XftChar8 *string, int len);
-+
-+void
- XftRenderExtents8 (Display *dpy,
- XftFontStruct *font,
- XftChar8 *string,
-@@ -123,6 +149,13 @@
- XftChar32 *string,
- int len,
- XGlyphInfo *extents);
-+
-+void
-+XftRenderExtentsUtf8 (Display *dpy,
-+ XftFontStruct *font,
-+ XftChar8 *string,
-+ int len,
-+ XGlyphInfo *extents);
-
- XftFontStruct *
- XftFreeTypeGet (XftFont *font);
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/xftcache.c xc/lib/Xft/xftcache.c
---- XFree86-4.0.2.orig/xc/lib/Xft/xftcache.c Wed Dec 31 19:00:00 1969
-+++ XFree86-4.0.2/xc/lib/Xft/xftcache.c Fri Jan 19 20:25:58 2001
-@@ -0,0 +1,608 @@
-+/*
-+ * $XFree86: xc/lib/Xft/xftcache.c,v 1.1 2001/01/02 02:46:51 keithp Exp $
-+ *
-+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
-+ *
-+ * 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 Keith Packard not be used in
-+ * advertising or publicity pertaining to distribution of the software without
-+ * specific, written prior permission. Keith Packard makes no
-+ * representations about the suitability of this software for any purpose. It
-+ * is provided "as is" without express or implied warranty.
-+ *
-+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
-+ * EVENT SHALL KEITH PACKARD 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.
-+ */
-+
-+#include <stdlib.h>
-+#include <stdio.h>
-+#include <unistd.h>
-+#include <string.h>
-+#include <ctype.h>
-+#include <errno.h>
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include "xftint.h"
-+
-+typedef struct _XftFileCacheEnt {
-+ struct _XftFileCacheEnt *next;
-+ unsigned int hash;
-+ char *file;
-+ int id;
-+ time_t time;
-+ char *name;
-+ Bool referenced;
-+} XftFileCacheEnt;
-+
-+#define HASH_SIZE 509
-+
-+typedef struct _XftFileCache {
-+ XftFileCacheEnt *ents[HASH_SIZE];
-+ Bool updated;
-+ int entries;
-+ int referenced;
-+} XftFileCache;
-+
-+static XftFileCache _XftFileCache;
-+
-+static unsigned int
-+_XftFileCacheHash (char *string)
-+{
-+ unsigned int h = 0;
-+ char c;
-+
-+ while ((c = *string++))
-+ h = (h << 1) ^ c;
-+ return h;
-+}
-+
-+char *
-+XftFileCacheFind (char *file, int id, int *count)
-+{
-+ XftFileCache *cache;
-+ unsigned int hash;
-+ char *match;
-+ XftFileCacheEnt *c, *name;
-+ int maxid;
-+ struct stat statb;
-+
-+ cache = &_XftFileCache;
-+ match = file;
-+
-+ hash = _XftFileCacheHash (match);
-+ name = 0;
-+ maxid = -1;
-+ for (c = cache->ents[hash % HASH_SIZE]; c; c = c->next)
-+ {
-+ if (c->hash == hash && !strcmp (match, c->file))
-+ {
-+ if (c->id > maxid)
-+ maxid = c->id;
-+ if (c->id == id)
-+ {
-+ if (stat (file, &statb) < 0)
-+ {
-+ if (_XftFontDebug () & XFT_DBG_CACHE)
-+ printf (" file missing\n");
-+ return 0;
-+ }
-+ if (statb.st_mtime != c->time)
-+ {
-+ if (_XftFontDebug () & XFT_DBG_CACHE)
-+ printf (" timestamp mismatch (was %d is %d)\n",
-+ (int) c->time, (int) statb.st_mtime);
-+ return 0;
-+ }
-+ if (!c->referenced)
-+ {
-+ cache->referenced++;
-+ c->referenced = True;
-+ }
-+ name = c;
-+ }
-+ }
-+ }
-+ if (!name)
-+ return 0;
-+ *count = maxid;
-+ return name->name;
-+}
-+
-+/*
-+ * Cache file syntax is quite simple:
-+ *
-+ * "file_name" id time "font_name" \n
-+ */
-+
-+static Bool
-+_XftFileCacheReadString (FILE *f, char *dest, int len)
-+{
-+ int c;
-+ Bool escape;
-+
-+ while ((c = getc (f)) != EOF)
-+ if (c == '"')
-+ break;
-+ if (c == EOF)
-+ return False;
-+ if (len == 0)
-+ return False;
-+
-+ escape = False;
-+ while ((c = getc (f)) != EOF)
-+ {
-+ if (!escape)
-+ {
-+ switch (c) {
-+ case '"':
-+ *dest++ = '\0';
-+ return True;
-+ case '\\':
-+ escape = True;
-+ continue;
-+ }
-+ }
-+ if (--len <= 1)
-+ return False;
-+ *dest++ = c;
-+ escape = False;
-+ }
-+ return False;
-+}
-+
-+static Bool
-+_XftFileCacheReadUlong (FILE *f, unsigned long *dest)
-+{
-+ unsigned long t;
-+ int c;
-+
-+ while ((c = getc (f)) != EOF)
-+ {
-+ if (!isspace (c))
-+ break;
-+ }
-+ if (c == EOF)
-+ return False;
-+ t = 0;
-+ for (;;)
-+ {
-+ if (c == EOF || isspace (c))
-+ break;
-+ if (!isdigit (c))
-+ return False;
-+ t = t * 10 + (c - '0');
-+ c = getc (f);
-+ }
-+ *dest = t;
-+ return True;
-+}
-+
-+static Bool
-+_XftFileCacheReadInt (FILE *f, int *dest)
-+{
-+ unsigned long t;
-+ Bool ret;
-+
-+ ret = _XftFileCacheReadUlong (f, &t);
-+ if (ret)
-+ *dest = (int) t;
-+ return ret;
-+}
-+
-+static Bool
-+_XftFileCacheReadTime (FILE *f, time_t *dest)
-+{
-+ unsigned long t;
-+ Bool ret;
-+
-+ ret = _XftFileCacheReadUlong (f, &t);
-+ if (ret)
-+ *dest = (time_t) t;
-+ return ret;
-+}
-+
-+static Bool
-+_XftFileCacheAdd (XftFileCache *cache,
-+ char *file,
-+ int id,
-+ time_t time,
-+ char *name,
-+ Bool replace)
-+{
-+ XftFileCacheEnt *c;
-+ XftFileCacheEnt **prev, *old;
-+ unsigned int hash;
-+
-+ if (_XftFontDebug () & XFT_DBG_CACHE)
-+ {
-+ printf ("%s face %s/%d as %s\n", replace ? "Replace" : "Add",
-+ file, id, name);
-+ }
-+ hash = _XftFileCacheHash (file);
-+ for (prev = &cache->ents[hash % HASH_SIZE];
-+ (old = *prev);
-+ prev = &(*prev)->next)
-+ {
-+ if (old->hash == hash && old->id == id && !strcmp (old->file, file))
-+ break;
-+ }
-+ if (*prev)
-+ {
-+ if (!replace)
-+ return False;
-+
-+ old = *prev;
-+ if (old->referenced)
-+ cache->referenced--;
-+ *prev = old->next;
-+ free (old);
-+ cache->entries--;
-+ }
-+
-+ c = malloc (sizeof (XftFileCacheEnt) +
-+ strlen (file) + 1 +
-+ strlen (name) + 1);
-+ if (!c)
-+ return False;
-+ c->next = *prev;
-+ *prev = c;
-+ c->hash = hash;
-+ c->file = (char *) (c + 1);
-+ c->id = id;
-+ c->name = c->file + strlen (file) + 1;
-+ strcpy (c->file, file);
-+ c->time = time;
-+ c->referenced = replace;
-+ strcpy (c->name, name);
-+ cache->entries++;
-+ return True;
-+}
-+
-+void
-+XftFileCacheDispose (void)
-+{
-+ XftFileCache *cache;
-+ XftFileCacheEnt *c, *next;
-+ int h;
-+
-+ cache = &_XftFileCache;
-+
-+ for (h = 0; h < HASH_SIZE; h++)
-+ {
-+ for (c = cache->ents[h]; c; c = next)
-+ {
-+ next = c->next;
-+ free (c);
-+ }
-+ cache->ents[h] = 0;
-+ }
-+ cache->entries = 0;
-+ cache->referenced = 0;
-+ cache->updated = False;
-+}
-+
-+void
-+XftFileCacheLoad (char *cache_file)
-+{
-+ XftFileCache *cache;
-+ FILE *f;
-+ char file[8192];
-+ int id;
-+ time_t time;
-+ char name[8192];
-+
-+ f = fopen (cache_file, "r");
-+ if (!f)
-+ return;
-+
-+ cache = &_XftFileCache;
-+
-+ cache->updated = False;
-+ while (_XftFileCacheReadString (f, file, sizeof (file)) &&
-+ _XftFileCacheReadInt (f, &id) &&
-+ _XftFileCacheReadTime (f, &time) &&
-+ _XftFileCacheReadString (f, name, sizeof (name)))
-+ {
-+ (void) _XftFileCacheAdd (cache, file, id, time, name, False);
-+ }
-+ fclose (f);
-+}
-+
-+Bool
-+XftFileCacheUpdate (char *file, int id, char *name)
-+{
-+ XftFileCache *cache;
-+ char *match;
-+ struct stat statb;
-+ Bool ret;
-+
-+ cache = &_XftFileCache;
-+ match = file;
-+
-+ if (stat (file, &statb) < 0)
-+ return False;
-+ ret = _XftFileCacheAdd (cache, match, id,
-+ statb.st_mtime, name, True);
-+ if (ret)
-+ cache->updated = True;
-+ return ret;
-+}
-+
-+static Bool
-+_XftFileCacheWriteString (FILE *f, char *string)
-+{
-+ char c;
-+
-+ if (putc ('"', f) == EOF)
-+ return False;
-+ while ((c = *string++))
-+ {
-+ switch (c) {
-+ case '"':
-+ case '\\':
-+ if (putc ('\\', f) == EOF)
-+ return False;
-+ /* fall through */
-+ default:
-+ if (putc (c, f) == EOF)
-+ return False;
-+ }
-+ }
-+ if (putc ('"', f) == EOF)
-+ return False;
-+ return True;
-+}
-+
-+static Bool
-+_XftFileCacheWriteUlong (FILE *f, unsigned long t)
-+{
-+ int pow;
-+ unsigned long temp, digit;
-+
-+ temp = t;
-+ pow = 1;
-+ while (temp >= 10)
-+ {
-+ temp /= 10;
-+ pow *= 10;
-+ }
-+ temp = t;
-+ while (pow)
-+ {
-+ digit = temp / pow;
-+ if (putc ((char) digit + '0', f) == EOF)
-+ return False;
-+ temp = temp - pow * digit;
-+ pow = pow / 10;
-+ }
-+ return True;
-+}
-+
-+static Bool
-+_XftFileCacheWriteInt (FILE *f, int i)
-+{
-+ return _XftFileCacheWriteUlong (f, (unsigned long) i);
-+}
-+
-+static Bool
-+_XftFileCacheWriteTime (FILE *f, time_t t)
-+{
-+ return _XftFileCacheWriteUlong (f, (unsigned long) t);
-+}
-+
-+Bool
-+XftFileCacheSave (char *cache_file)
-+{
-+ XftFileCache *cache;
-+ char *lck;
-+ char *tmp;
-+ FILE *f;
-+ int h;
-+ XftFileCacheEnt *c;
-+
-+ cache = &_XftFileCache;
-+
-+ if (!cache->updated && cache->referenced == cache->entries)
-+ return True;
-+
-+ lck = malloc (strlen (cache_file)*2 + 4);
-+ if (!lck)
-+ goto bail0;
-+ tmp = lck + strlen (cache_file) + 2;
-+ strcpy (lck, cache_file);
-+ strcat (lck, "L");
-+ strcpy (tmp, cache_file);
-+ strcat (tmp, "T");
-+ if (link (lck, cache_file) < 0 && errno != ENOENT)
-+ goto bail1;
-+ if (access (tmp, F_OK) == 0)
-+ goto bail2;
-+ f = fopen (tmp, "w");
-+ if (!f)
-+ goto bail2;
-+
-+ for (h = 0; h < HASH_SIZE; h++)
-+ {
-+ for (c = cache->ents[h]; c; c = c->next)
-+ {
-+ if (!c->referenced)
-+ continue;
-+ if (!_XftFileCacheWriteString (f, c->file))
-+ goto bail4;
-+ if (putc (' ', f) == EOF)
-+ goto bail4;
-+ if (!_XftFileCacheWriteInt (f, c->id))
-+ goto bail4;
-+ if (putc (' ', f) == EOF)
-+ goto bail4;
-+ if (!_XftFileCacheWriteTime (f, c->time))
-+ goto bail4;
-+ if (putc (' ', f) == EOF)
-+ goto bail4;
-+ if (!_XftFileCacheWriteString (f, c->name))
-+ goto bail4;
-+ if (putc ('\n', f) == EOF)
-+ goto bail4;
-+ }
-+ }
-+
-+ if (fclose (f) == EOF)
-+ goto bail3;
-+
-+ if (rename (tmp, cache_file) < 0)
-+ goto bail3;
-+
-+ unlink (lck);
-+ cache->updated = False;
-+ return True;
-+
-+bail4:
-+ fclose (f);
-+bail3:
-+ unlink (tmp);
-+bail2:
-+ unlink (lck);
-+bail1:
-+ free (lck);
-+bail0:
-+ return False;
-+}
-+
-+Bool
-+XftFileCacheReadDir (XftFontSet *set, const char *cache_file)
-+{
-+ XftPattern *font;
-+ FILE *f;
-+ char *path;
-+ char *base;
-+ char file[8192];
-+ int id;
-+ char name[8192];
-+ Bool ret = False;
-+
-+ if (_XftFontDebug () & XFT_DBG_CACHE)
-+ {
-+ printf ("XftFileCacheReadDir cache_file \"%s\"\n", cache_file);
-+ }
-+
-+ f = fopen (cache_file, "r");
-+ if (!f)
-+ {
-+ if (_XftFontDebug () & XFT_DBG_CACHE)
-+ {
-+ printf (" no cache file\n");
-+ }
-+ goto bail0;
-+ }
-+
-+ base = strrchr (cache_file, '/');
-+ if (!base)
-+ goto bail1;
-+ base++;
-+ path = malloc (base - cache_file + 8192 + 1);
-+ if (!path)
-+ goto bail1;
-+ memcpy (path, cache_file, base - cache_file);
-+ base = path + (base - cache_file);
-+
-+ while (_XftFileCacheReadString (f, file, sizeof (file)) &&
-+ _XftFileCacheReadInt (f, &id) &&
-+ _XftFileCacheReadString (f, name, sizeof (name)))
-+ {
-+ font = XftNameParse (name);
-+ if (font)
-+ {
-+ strcpy (base, file);
-+ if (_XftFontDebug () & XFT_DBG_CACHEV)
-+ {
-+ printf (" dir cache file \"%s\"\n", file);
-+ }
-+ XftPatternAddString (font, XFT_FILE, path);
-+ if (!XftFontSetAdd (set, font))
-+ goto bail2;
-+ }
-+ }
-+ if (_XftFontDebug () & XFT_DBG_CACHE)
-+ {
-+ printf (" cache loaded\n");
-+ }
-+
-+ ret = True;
-+bail2:
-+ free (path);
-+bail1:
-+ fclose (f);
-+bail0:
-+ return ret;
-+}
-+
-+Bool
-+XftFileCacheWriteDir (XftFontSet *set, const char *cache_file)
-+{
-+ XftPattern *font;
-+ FILE *f;
-+ char name[8192];
-+ char *file, *base;
-+ int n;
-+ int id;
-+
-+ if (_XftFontDebug () & XFT_DBG_CACHE)
-+ printf ("XftFileCacheWriteDir cache_file \"%s\"\n", cache_file);
-+
-+ f = fopen (cache_file, "w");
-+ if (!f)
-+ {
-+ if (_XftFontDebug () & XFT_DBG_CACHE)
-+ printf (" can't create \"%s\"\n", cache_file);
-+ goto bail0;
-+ }
-+ for (n = 0; n < set->nfont; n++)
-+ {
-+ font = set->fonts[n];
-+ if (XftPatternGetString (font, XFT_FILE, 0, &file) != XftResultMatch)
-+ goto bail1;
-+ base = strrchr (file, '/');
-+ if (base)
-+ base = base + 1;
-+ else
-+ base = file;
-+ if (XftPatternGetInteger (font, XFT_INDEX, 0, &id) != XftResultMatch)
-+ goto bail1;
-+ if (!XftNameUnparse (font, name, sizeof (name)))
-+ goto bail1;
-+ if (_XftFontDebug () & XFT_DBG_CACHEV)
-+ printf (" write file \"%s\"\n", base);
-+ if (!_XftFileCacheWriteString (f, base))
-+ goto bail1;
-+ if (putc (' ', f) == EOF)
-+ goto bail1;
-+ if (!_XftFileCacheWriteInt (f, id))
-+ goto bail1;
-+ if (putc (' ', f) == EOF)
-+ goto bail1;
-+ if (!_XftFileCacheWriteString (f, name))
-+ goto bail1;
-+ if (putc ('\n', f) == EOF)
-+ goto bail1;
-+ }
-+ if (fclose (f) == EOF)
-+ goto bail0;
-+
-+ if (_XftFontDebug () & XFT_DBG_CACHE)
-+ printf (" cache written\n");
-+ return True;
-+
-+bail1:
-+ fclose (f);
-+bail0:
-+ unlink (cache_file);
-+ return False;
-+}
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/xftcfg.c xc/lib/Xft/xftcfg.c
---- XFree86-4.0.2.orig/xc/lib/Xft/xftcfg.c Tue Dec 19 08:12:29 2000
-+++ XFree86-4.0.2/xc/lib/Xft/xftcfg.c Fri Jan 19 20:25:58 2001
-@@ -1,5 +1,5 @@
- /*
-- * $XFree86: xc/lib/Xft/xftcfg.c,v 1.7 2000/12/17 09:11:37 keithp Exp $
-+ * $XFree86: xc/lib/Xft/xftcfg.c,v 1.8 2001/01/02 02:46:51 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
-@@ -35,6 +35,9 @@
- char **XftConfigDirs = XftConfigDefaultDirs;
- static int XftConfigNdirs;
-
-+char XftConfigDefaultCache[] = "~/.xftcache";
-+char *XftConfigCache = 0;
-+
- static XftSubst *XftSubsts;
- /* #define XFT_DEBUG_EDIT */
-
-@@ -51,6 +54,8 @@
- if (!h)
- return False;
- dir = (char *) malloc (strlen (h) + strlen (d));
-+ if (!dir)
-+ return False;
- strcpy (dir, h);
- strcat (dir, d+1);
- }
-@@ -78,6 +83,41 @@
- free (XftConfigDirs);
- XftConfigDirs = dirs;
- return True;
-+}
-+
-+Bool
-+XftConfigSetCache (char *c)
-+{
-+ char *new;
-+ char *h;
-+
-+ if (*c == '~')
-+ {
-+ h = getenv ("HOME");
-+ if (!h)
-+ return False;
-+ new = (char *) malloc (strlen (h) + strlen (c));
-+ if (!new)
-+ return False;
-+ strcpy (new, h);
-+ strcat (new, c+1);
-+ }
-+ else
-+ {
-+ new = _XftSaveString (c);
-+ }
-+ if (XftConfigCache)
-+ free (XftConfigCache);
-+ XftConfigCache = new;
-+ return True;
-+}
-+
-+char *
-+XftConfigGetCache (void)
-+{
-+ if (!XftConfigCache)
-+ XftConfigSetCache (XftConfigDefaultCache);
-+ return XftConfigCache;
- }
-
- static int XftSubstsMaxObjects;
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/xftcore.c xc/lib/Xft/xftcore.c
---- XFree86-4.0.2.orig/xc/lib/Xft/xftcore.c Fri Dec 8 02:51:27 2000
-+++ XFree86-4.0.2/xc/lib/Xft/xftcore.c Fri Jan 19 20:25:58 2001
-@@ -1,5 +1,5 @@
- /*
-- * $XFree86: xc/lib/Xft/xftcore.c,v 1.4 2000/12/08 07:51:27 keithp Exp $
-+ * $XFree86: xc/lib/Xft/xftcore.c,v 1.5 2000/12/20 00:28:44 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
-@@ -65,6 +65,37 @@
- return xc;
- }
-
-+XChar2b *
-+XftCoreConvertUtf8 (XftChar8 *string,
-+ int len,
-+ XChar2b xcloc[XFT_CORE_N16LOCAL],
-+ int *nchar)
-+{
-+ XChar2b *xc;
-+ XftChar32 c;
-+ int i;
-+ int n, width;
-+ int clen;
-+
-+ if (!XftUtf8Len (string, len, &n, &width))
-+ return 0;
-+
-+ if (n < XFT_CORE_N16LOCAL)
-+ xc = xcloc;
-+ else
-+ xc = (XChar2b *) malloc (n * sizeof (XChar2b));
-+ for (i = 0; i < n; i++)
-+ {
-+ clen = XftUtf8ToUcs4 (string, &c, len);
-+ xc[i].byte1 = c & 0xff;
-+ xc[i].byte2 = (c >> 8) & 0xff;
-+ string += clen;
-+ len -= clen;
-+ }
-+ *nchar = n;
-+ return xc;
-+}
-+
- void
- XftCoreExtents8 (Display *dpy,
- XFontStruct *fs,
-@@ -109,6 +140,8 @@
- xc = XftCoreConvert16 (string, len, xcloc);
- XTextExtents16 (fs, xc, len, &direction,
- &ascent, &descent, &overall);
-+ if (xc != xcloc)
-+ free (xc);
- if (overall.lbearing < overall.rbearing)
- {
- extents->x = overall.lbearing;
-@@ -140,6 +173,42 @@
- xc = XftCoreConvert32 (string, len, xcloc);
- XTextExtents16 (fs, xc, len, &direction,
- &ascent, &descent, &overall);
-+ if (xc != xcloc)
-+ free (xc);
-+ if (overall.lbearing < overall.rbearing)
-+ {
-+ extents->x = overall.lbearing;
-+ extents->width = overall.rbearing - overall.lbearing;
-+ }
-+ else
-+ {
-+ extents->x = overall.rbearing;
-+ extents->width = overall.lbearing - overall.rbearing;
-+ }
-+ extents->y = -overall.ascent;
-+ extents->height = overall.ascent + overall.descent;
-+ extents->xOff = overall.width;
-+ extents->yOff = 0;
-+}
-+
-+void
-+XftCoreExtentsUtf8 (Display *dpy,
-+ XFontStruct *fs,
-+ XftChar8 *string,
-+ int len,
-+ XGlyphInfo *extents)
-+{
-+ int direction;
-+ int ascent, descent;
-+ XCharStruct overall;
-+ XChar2b *xc, xcloc[XFT_CORE_N16LOCAL];
-+ int n;
-+
-+ xc = XftCoreConvertUtf8 (string, len, xcloc, &n);
-+ XTextExtents16 (fs, xc, n, &direction,
-+ &ascent, &descent, &overall);
-+ if (xc != xcloc)
-+ free (xc);
- if (overall.lbearing < overall.rbearing)
- {
- extents->x = overall.lbearing;
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/xftdir.c xc/lib/Xft/xftdir.c
---- XFree86-4.0.2.orig/xc/lib/Xft/xftdir.c Wed Nov 29 03:39:21 2000
-+++ XFree86-4.0.2/xc/lib/Xft/xftdir.c Fri Jan 19 20:25:58 2001
-@@ -1,5 +1,5 @@
- /*
-- * $XFree86: xc/lib/Xft/xftdir.c,v 1.1 2000/11/29 08:39:21 keithp Exp $
-+ * $XFree86: xc/lib/Xft/xftdir.c,v 1.2 2001/01/02 02:46:51 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
-@@ -29,38 +29,73 @@
- #include "xftint.h"
-
- Bool
--XftDirScan (XftFontSet *set, const char *dir)
-+XftDirScan (XftFontSet *set, const char *dir, Bool force)
- {
- DIR *d;
- struct dirent *e;
- char *file;
- char *base;
- XftPattern *font;
-+ char *name;
- int count;
- Bool ret = True;
- int id;
-
-- d = opendir (dir);
-- if (!d)
-- return False;
- file = (char *) malloc (strlen (dir) + 1 + 256 + 1);
- if (!file)
-- {
-- closedir (d);
- return False;
-- }
-+
- strcpy (file, dir);
- strcat (file, "/");
- base = file + strlen (file);
-+ if (!force)
-+ {
-+ strcpy (base, "XftCache");
-+
-+ if (XftFileCacheReadDir (set, file))
-+ {
-+ free (file);
-+ return True;
-+ }
-+ }
-+
-+ d = opendir (dir);
-+ if (!d)
-+ {
-+ free (file);
-+ return False;
-+ }
- while (ret && (e = readdir (d)))
- {
- if (e->d_name[0] != '.')
- {
-- strcpy (base, e->d_name);
- id = 0;
-+ strcpy (base, e->d_name);
- do
- {
-- font = XftFreeTypeQuery (file, id, &count);
-+ if (!force)
-+ name = XftFileCacheFind (file, id, &count);
-+ else
-+ name = 0;
-+ if (name)
-+ {
-+ font = XftNameParse (name);
-+ if (font)
-+ XftPatternAddString (font, XFT_FILE, file);
-+ }
-+ else
-+ {
-+ font = XftFreeTypeQuery (file, id, &count);
-+ if (font && !force)
-+ {
-+ char unparse[8192];
-+
-+ if (XftNameUnparse (font, unparse, sizeof (unparse)))
-+ {
-+ (void) XftFileCacheUpdate (file, id, unparse);
-+ }
-+ }
-+ }
- if (font)
- {
- if (!XftFontSetAdd (set, font))
-@@ -75,4 +110,23 @@
- return ret;
- }
-
--
-+Bool
-+XftDirSave (XftFontSet *set, const char *dir)
-+{
-+ char *file;
-+ char *base;
-+ Bool ret;
-+
-+ file = (char *) malloc (strlen (dir) + 1 + 256 + 1);
-+ if (!file)
-+ return False;
-+
-+ strcpy (file, dir);
-+ strcat (file, "/");
-+ base = file + strlen (file);
-+ strcpy (base, "XftCache");
-+ ret = XftFileCacheWriteDir (set, file);
-+ free (file);
-+ return ret;
-+}
-+
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/xftdpy.c xc/lib/Xft/xftdpy.c
---- XFree86-4.0.2.orig/xc/lib/Xft/xftdpy.c Tue Dec 19 08:12:29 2000
-+++ XFree86-4.0.2/xc/lib/Xft/xftdpy.c Fri Jan 19 20:25:58 2001
-@@ -1,5 +1,5 @@
- /*
-- * $XFree86: xc/lib/Xft/xftdpy.c,v 1.4 2000/12/17 08:30:45 keithp Exp $
-+ * $XFree86: xc/lib/Xft/xftdpy.c,v 1.5 2000/12/20 00:20:48 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
-@@ -22,6 +22,7 @@
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#include <stdio.h>
- #include <stdlib.h>
- #include <ctype.h>
- #include <X11/Xlibint.h>
-@@ -81,6 +82,34 @@
- info->defaults = 0;
- info->coreFonts = 0;
- info->hasRender = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, DefaultScreen (dpy))) != 0;
-+ if (_XftFontDebug () & XFT_DBG_RENDER)
-+ {
-+ Visual *visual = DefaultVisual (dpy, DefaultScreen (dpy));
-+ XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual);
-+
-+ printf ("XftDisplayInfoGet Default visual 0x%x ",
-+ (int) visual->visualid);
-+ if (format)
-+ {
-+ if (format->type == PictTypeDirect)
-+ {
-+ printf ("format %d,%d,%d,%d\n",
-+ format->direct.alpha,
-+ format->direct.red,
-+ format->direct.green,
-+ format->direct.blue);
-+ }
-+ else
-+ {
-+ printf ("format indexed\n");
-+ }
-+ }
-+ else
-+ printf ("No Render format for default visual\n");
-+
-+ printf ("XftDisplayInfoGet initialized, hasRender set to \"%s\"\n",
-+ info->hasRender ? "True" : "False");
-+ }
-
- info->next = _XftDisplayInfo;
- _XftDisplayInfo = info;
-@@ -89,6 +118,10 @@
- bail1:
- free (info);
- bail0:
-+ if (_XftFontDebug () & XFT_DBG_RENDER)
-+ {
-+ printf ("XftDisplayInfoGet failed to initialize, Xft unhappy\n");
-+ }
- return 0;
- }
-
-@@ -209,6 +242,8 @@
- goto bail1;
- if (!_XftDefaultInitBool (dpy, pat, XFT_ANTIALIAS))
- goto bail1;
-+ if (!_XftDefaultInitBool (dpy, pat, XFT_MINSPACE))
-+ goto bail1;
-
- return pat;
-
-@@ -343,6 +378,12 @@
- XftPatternAddInteger (pattern, XFT_RGBA,
- XftDefaultGetInteger (dpy, XFT_RGBA, screen,
- XFT_RGBA_NONE));
-+ }
-+ if (XftPatternGet (pattern, XFT_MINSPACE, 0, &v) == XftResultNoMatch)
-+ {
-+ XftPatternAddBool (pattern, XFT_MINSPACE,
-+ XftDefaultGetBool (dpy, XFT_MINSPACE, screen,
-+ False));
- }
- if (XftPatternGet (pattern, XFT_PIXEL_SIZE, 0, &v) == XftResultNoMatch)
- {
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/xftdraw.c xc/lib/Xft/xftdraw.c
---- XFree86-4.0.2.orig/xc/lib/Xft/xftdraw.c Sat Dec 16 12:33:01 2000
-+++ XFree86-4.0.2/xc/lib/Xft/xftdraw.c Fri Jan 19 20:25:58 2001
-@@ -1,5 +1,5 @@
- /*
-- * $XFree86: xc/lib/Xft/xftdraw.c,v 1.10 2000/12/15 17:12:52 keithp Exp $
-+ * $XFree86: xc/lib/Xft/xftdraw.c,v 1.12 2000/12/20 00:28:44 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
-@@ -22,6 +22,7 @@
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#include <stdio.h>
- #include <stdlib.h>
- #include "xftint.h"
- #include <X11/Xutil.h>
-@@ -200,6 +201,14 @@
- return False;
- if (memcmp (&color->color, &draw->render.fg_color, sizeof (XRenderColor)))
- {
-+ if (_XftFontDebug () & XFT_DBG_DRAW)
-+ {
-+ printf ("Switching to color %04x,%04x,%04x,%04x\n",
-+ color->color.alpha,
-+ color->color.red,
-+ color->color.green,
-+ color->color.blue);
-+ }
- XRenderFillRectangle (draw->dpy, PictOpSrc, draw->render.fg_pict,
- &color->color, 0, 0, 1, 1);
- draw->render.fg_color = color->color;
-@@ -255,6 +264,10 @@
- XftChar8 *string,
- int len)
- {
-+ if (_XftFontDebug () & XFT_DBG_DRAW)
-+ {
-+ printf ("DrawString \"%*.*s\"\n", len, len, string);
-+ }
- if (font->core)
- {
- XftDrawCorePrepare (draw, color, font);
-@@ -331,6 +344,41 @@
- }
- #endif
- }
-+
-+void
-+XftDrawStringUtf8 (XftDraw *draw,
-+ XftColor *color,
-+ XftFont *font,
-+ int x,
-+ int y,
-+ XftChar8 *string,
-+ int len)
-+{
-+ if (font->core)
-+ {
-+ XChar2b *xc;
-+ XChar2b xcloc[XFT_CORE_N16LOCAL];
-+ int n;
-+
-+ XftDrawCorePrepare (draw, color, font);
-+ xc = XftCoreConvertUtf8 (string, len, xcloc, &n);
-+ if (xc)
-+ {
-+ XDrawString16 (draw->dpy, draw->drawable, draw->core.draw_gc, x, y,
-+ xc, n);
-+ }
-+ if (xc != xcloc)
-+ free (xc);
-+ }
-+#ifdef FREETYPE2
-+ else if (XftDrawRenderPrepare (draw, color, font))
-+ {
-+ XftRenderStringUtf8 (draw->dpy, draw->render.fg_pict, font->u.ft.font,
-+ draw->render.pict, 0, 0, x, y, string, len);
-+ }
-+#endif
-+}
-+
-
- void
- XftDrawRect (XftDraw *draw,
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/xftextent.c xc/lib/Xft/xftextent.c
---- XFree86-4.0.2.orig/xc/lib/Xft/xftextent.c Sat Dec 16 12:33:01 2000
-+++ XFree86-4.0.2/xc/lib/Xft/xftextent.c Fri Jan 19 20:25:58 2001
-@@ -1,5 +1,5 @@
- /*
-- * $XFree86: xc/lib/Xft/xftextent.c,v 1.4 2000/12/15 17:12:52 keithp Exp $
-+ * $XFree86: xc/lib/Xft/xftextent.c,v 1.5 2000/12/20 00:28:44 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
-@@ -22,6 +22,7 @@
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#include <stdlib.h>
- #include "xftint.h"
-
- void
-@@ -79,4 +80,110 @@
- XftRenderExtents32 (dpy, font->u.ft.font, string, len, extents);
- }
- #endif
-+}
-+
-+void
-+XftTextExtentsUtf8 (Display *dpy,
-+ XftFont *font,
-+ XftChar8 *string,
-+ int len,
-+ XGlyphInfo *extents)
-+{
-+ XftChar8 *src;
-+ XftChar32 c;
-+ XftChar32 lbuf[4096];
-+ XftChar32 *dst;
-+ XftChar8 *dst8;
-+ XftChar16 *dst16;
-+ XftChar32 *dst32;
-+ int rlen, clen;
-+ int width = 1;
-+ int n;
-+
-+ /* compute needed width */
-+ src = string;
-+ rlen = len;
-+ n = 0;
-+ while (rlen)
-+ {
-+ clen = XftUtf8ToUcs4 (src, &c, rlen);
-+ if (clen <= 0) /* malformed UTF8 string */
-+ {
-+ memset (extents, 0, sizeof (XGlyphInfo));
-+ return;
-+ }
-+ if (c >= 0x10000)
-+ width = 4;
-+ else if (c >= 0x100)
-+ {
-+ if (width == 1)
-+ width = 2;
-+ }
-+ src += clen;
-+ rlen -= clen;
-+ n++;
-+ }
-+ dst = lbuf;
-+ if (n * width > sizeof (lbuf))
-+ {
-+ dst = (XftChar32 *) malloc (n * width);
-+ if (!dst)
-+ {
-+ memset (extents, 0, sizeof (XGlyphInfo));
-+ return;
-+ }
-+ }
-+
-+ switch (width) {
-+ case 4:
-+ src = string;
-+ rlen = len;
-+ dst32 = dst;
-+ while (rlen)
-+ {
-+ clen = XftUtf8ToUcs4 (src, &c, rlen);
-+ if (clen <= 0) /* malformed UTF8 string */
-+ return;
-+ *dst32++ = c;
-+ src += clen;
-+ rlen -= clen;
-+ }
-+ dst32 = dst;
-+ XftTextExtents32 (dpy, font, dst32, n, extents);
-+ break;
-+ case 2:
-+ src = string;
-+ rlen = len;
-+ dst16 = (XftChar16 *) dst;
-+ while (rlen)
-+ {
-+ clen = XftUtf8ToUcs4 (src, &c, rlen);
-+ if (clen <= 0) /* malformed UTF8 string */
-+ return;
-+ *dst16++ = c;
-+ src += clen;
-+ rlen -= clen;
-+ }
-+ dst16 = (XftChar16 *) dst;
-+ XftTextExtents16 (dpy, font, dst16, n, extents);
-+ break;
-+ case 1:
-+ src = string;
-+ rlen = len;
-+ dst8 = (XftChar8 *) dst;
-+ while (rlen)
-+ {
-+ clen = XftUtf8ToUcs4 (src, &c, rlen);
-+ if (clen <= 0) /* malformed UTF8 string */
-+ return;
-+ *dst8++ = c;
-+ src += clen;
-+ rlen -= clen;
-+ }
-+ dst8 = (XftChar8 *) dst;
-+ XftTextExtents8 (dpy, font, dst8, n, extents);
-+ break;
-+ }
-+ if (dst != lbuf)
-+ free (dst);
- }
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/xftfont.c xc/lib/Xft/xftfont.c
---- XFree86-4.0.2.orig/xc/lib/Xft/xftfont.c Sat Dec 16 12:33:01 2000
-+++ XFree86-4.0.2/xc/lib/Xft/xftfont.c Fri Jan 19 20:25:58 2001
-@@ -1,5 +1,5 @@
- /*
-- * $XFree86: xc/lib/Xft/xftfont.c,v 1.7 2000/12/15 17:12:53 keithp Exp $
-+ * $XFree86: xc/lib/Xft/xftfont.c,v 1.8 2000/12/20 00:20:48 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
-@@ -22,9 +22,9 @@
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#include <stdio.h>
- #include <stdlib.h>
- #include "xftint.h"
--#include <stdio.h>
-
- XftPattern *
- XftFontMatch (Display *dpy, int screen, XftPattern *pattern, XftResult *result)
-@@ -43,8 +43,24 @@
- new = XftPatternDuplicate (pattern);
- if (!new)
- return 0;
-+
-+ if (_XftFontDebug () & XFT_DBG_OPENV)
-+ {
-+ printf ("XftFontMatch pattern ");
-+ XftPatternPrint (new);
-+ }
- XftConfigSubstitute (new);
-+ if (_XftFontDebug () & XFT_DBG_OPENV)
-+ {
-+ printf ("XftFontMatch after XftConfig substitutions ");
-+ XftPatternPrint (new);
-+ }
- XftDefaultSubstitute (dpy, screen, new);
-+ if (_XftFontDebug () & XFT_DBG_OPENV)
-+ {
-+ printf ("XftFontMatch after X resource substitutions ");
-+ XftPatternPrint (new);
-+ }
- nsets = 0;
-
- #ifdef FREETYPE2
-@@ -52,6 +68,11 @@
- core = True;
- (void) XftPatternGetBool (new, XFT_RENDER, 0, &render);
- (void) XftPatternGetBool (new, XFT_CORE, 0, &core);
-+ if (_XftFontDebug () & XFT_DBG_OPENV)
-+ {
-+ printf ("XftFontMatch: use core fonts \"%s\", use render fonts \"%s\"\n",
-+ core ? "True" : "False", render ? "True" : "False");
-+ }
-
- if (render)
- {
-@@ -133,10 +154,17 @@
-
- if (!initialized)
- {
-+ char *e;
-+
- initialized = 1;
-- debug = getenv ("XFT_DEBUG") != 0;
-- if (debug)
-- printf ("XFT_DEBUG found\n");
-+ e = getenv ("XFT_DEBUG");
-+ if (e)
-+ {
-+ printf ("XFT_DEBUG=%s\n", e);
-+ debug = atoi (e);
-+ if (debug <= 0)
-+ debug = 1;
-+ }
- }
- return debug;
- }
-@@ -155,12 +183,12 @@
- va_end (va);
- if (!pat)
- {
-- if (_XftFontDebug ())
-+ if (_XftFontDebug () & XFT_DBG_OPEN)
- printf ("XftFontOpen: Invalid pattern argument\n");
- return 0;
- }
- match = XftFontMatch (dpy, screen, pat, &result);
-- if (_XftFontDebug ())
-+ if (_XftFontDebug () & XFT_DBG_OPEN)
- {
- printf ("Pattern ");
- XftPatternPrint (pat);
-@@ -179,7 +207,7 @@
- font = XftFontOpenPattern (dpy, match);
- if (!font)
- {
-- if (_XftFontDebug ())
-+ if (_XftFontDebug () & XFT_DBG_OPEN)
- printf ("No Font\n");
- XftPatternDestroy (match);
- }
-@@ -196,7 +224,7 @@
- XftFont *font;
-
- pat = XftNameParse (name);
-- if (_XftFontDebug ())
-+ if (_XftFontDebug () & XFT_DBG_OPEN)
- {
- printf ("XftFontOpenName \"%s\": ", name);
- if (pat)
-@@ -208,7 +236,7 @@
- if (!pat)
- return 0;
- match = XftFontMatch (dpy, screen, pat, &result);
-- if (_XftFontDebug ())
-+ if (_XftFontDebug () & XFT_DBG_OPEN)
- {
- if (match)
- {
-@@ -238,7 +266,7 @@
- XftFont *font;
-
- pat = XftXlfdParse (xlfd, False, False);
-- if (_XftFontDebug ())
-+ if (_XftFontDebug () & XFT_DBG_OPEN)
- {
- printf ("XftFontOpenXlfd \"%s\": ", xlfd);
- if (pat)
-@@ -250,7 +278,7 @@
- if (!pat)
- return 0;
- match = XftFontMatch (dpy, screen, pat, &result);
-- if (_XftFontDebug ())
-+ if (_XftFontDebug () & XFT_DBG_OPEN)
- {
- if (match)
- {
-@@ -275,7 +303,7 @@
- XftFontClose (Display *dpy, XftFont *font)
- {
- if (font->core)
-- XFreeFont (dpy, font->u.core.font);
-+ XftCoreClose (dpy, font->u.core.font);
- #ifdef FREETYPE2
- else
- XftFreeTypeClose (dpy, font->u.ft.font);
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/xftfreetype.c xc/lib/Xft/xftfreetype.c
---- XFree86-4.0.2.orig/xc/lib/Xft/xftfreetype.c Sat Dec 16 12:33:01 2000
-+++ XFree86-4.0.2/xc/lib/Xft/xftfreetype.c Fri Jan 19 20:25:58 2001
-@@ -1,5 +1,5 @@
- /*
-- * $XFree86: xc/lib/Xft/xftfreetype.c,v 1.5 2000/12/15 17:12:53 keithp Exp $
-+ * $XFree86: xc/lib/Xft/xftfreetype.c,v 1.9 2001/01/02 02:46:51 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
-@@ -23,6 +23,7 @@
- */
-
- #include <stdlib.h>
-+#include <stdio.h>
- #include "xftint.h"
-
- FT_Library _XftFTlibrary;
-@@ -32,9 +33,10 @@
- FT_Encoding encoding;
- } XftFtEncoding;
-
--XftFtEncoding xftFtEncoding[] = {
-+static XftFtEncoding xftFtEncoding[] = {
- { "iso10646-1", ft_encoding_unicode, },
- { "iso8859-1", ft_encoding_unicode, },
-+ { "apple-roman", ft_encoding_apple_roman },
- { "adobe-fontspecific", ft_encoding_symbol, },
- { "glyphs-fontspecific",ft_encoding_none, },
- };
-@@ -74,7 +76,7 @@
-
- slant = XFT_SLANT_ROMAN;
- if (face->style_flags & FT_STYLE_FLAG_ITALIC)
-- slant = (XFT_SLANT_ITALIC + XFT_SLANT_OBLIQUE) / 2;
-+ slant = XFT_SLANT_ITALIC;
-
- if (!XftPatternAddInteger (pat, XFT_SLANT, slant))
- goto bail1;
-@@ -98,6 +100,10 @@
- if (!XftPatternAddInteger (pat, XFT_INDEX, id))
- goto bail1;
-
-+ if ((face->face_flags & FT_FACE_FLAG_FIXED_WIDTH) != 0)
-+ if (!XftPatternAddInteger (pat, XFT_SPACING, XFT_MONO))
-+ goto bail1;
-+
- if (!(face->face_flags & FT_FACE_FLAG_SCALABLE))
- {
- for (i = 0; i < face->num_fixed_sizes; i++)
-@@ -142,41 +148,185 @@
- return 0;
- }
-
-+/*
-+ * List of all open files (each face in a file is managed separately)
-+ */
-+typedef struct _XftFtFile {
-+ struct _XftFtFile *next;
-+ int ref;
-+
-+ char *file;
-+ int id;
-+
-+ FT_Face face;
-+ FT_F26Dot6 size;
-+ int charmap;
-+} XftFtFile;
-+
-+static XftFtFile *_XftFtFiles;
-+
-+static XftFtFile *
-+_XftFreeTypeOpenFile (char *file, int id)
-+{
-+ XftFtFile *f;
-+ FT_Face face;
-+
-+ for (f = _XftFtFiles; f; f = f->next)
-+ {
-+ if (!strcmp (f->file, file) && f->id == id)
-+ {
-+ ++f->ref;
-+ if (_XftFontDebug () & XFT_DBG_REF)
-+ printf ("FontFile %s/%d matches existing (%d)\n",
-+ file, id, f->ref);
-+ return f;
-+ }
-+ }
-+ if (FT_New_Face (_XftFTlibrary, file, id, &face))
-+ return 0;
-+
-+ f = malloc (sizeof (XftFtFile) + strlen (file) + 1);
-+ if (!f)
-+ return 0;
-+
-+ if (_XftFontDebug () & XFT_DBG_REF)
-+ printf ("FontFile %s/%d matches new\n",
-+ file, id);
-+ f->next = _XftFtFiles;
-+ _XftFtFiles = f;
-+ f->ref = 1;
-+
-+ f->file = (char *) (f+1);
-+ strcpy (f->file, file);
-+ f->id = id;
-+
-+ f->face = face;
-+ f->size = 0;
-+ f->charmap = -1;
-+ return f;
-+}
-+
-+Bool
-+XftFreeTypeSetFace (FT_Face face, FT_F26Dot6 size, int charmap)
-+{
-+ XftFtFile *f, **prev;
-+
-+ for (prev = &_XftFtFiles; (f = *prev); prev = &f->next)
-+ {
-+ if (f->face == face)
-+ {
-+ /* LRU */
-+ if (prev != &_XftFtFiles)
-+ {
-+ *prev = f->next;
-+ f->next = _XftFtFiles;
-+ _XftFtFiles = f;
-+ }
-+ if (f->size != size)
-+ {
-+ if (_XftFontDebug() & XFT_DBG_GLYPH)
-+ printf ("Set face size to %d (%d)\n",
-+ (int) (size >> 6), (int) size);
-+ if (FT_Set_Char_Size (face, size, size, 0, 0))
-+ return False;
-+ f->size = size;
-+ }
-+ if (f->charmap != charmap && charmap != -1)
-+ {
-+ if (_XftFontDebug() & XFT_DBG_GLYPH)
-+ printf ("Set face charmap to %d\n", charmap);
-+ if (FT_Set_Charmap (face, face->charmaps[charmap]))
-+ return False;
-+ f->charmap = charmap;
-+ }
-+ break;
-+ }
-+ }
-+ return True;
-+}
-+
-+static void
-+_XftFreeTypeCloseFile (XftFtFile *f)
-+{
-+ XftFtFile **prev;
-+
-+ if (--f->ref != 0)
-+ return;
-+ for (prev = &_XftFtFiles; *prev; prev = &(*prev)->next)
-+ {
-+ if (*prev == f)
-+ {
-+ *prev = f->next;
-+ break;
-+ }
-+ }
-+ FT_Done_Face (f->face);
-+ free (f);
-+}
-+
-+/*
-+ * Cache of all glyphsets
-+ */
-+typedef struct _XftFtGlyphSet {
-+ struct _XftFtGlyphSet *next;
-+ int ref;
-+
-+ XftFtFile *file;
-+ Bool minspace;
-+ int char_width;
-+
-+ XftFontStruct font;
-+} XftFtGlyphSet;
-+
-+static XftFtGlyphSet *_XftFtGlyphSets;
-+
- XftFontStruct *
- XftFreeTypeOpen (Display *dpy, XftPattern *pattern)
- {
-- char *file;
-+ XftFtFile *file;
-+ FT_Face face;
-+ XftFtGlyphSet *gs;
-+ char *filename;
- int id;
-- double size;
-+ double dsize;
-+ FT_F26Dot6 size;
- int rgba;
- int spacing;
- int char_width;
- Bool antialias;
-- Bool encoded;
-+ Bool minspace;
- char *encoding_name;
-- FT_Face face;
- XftFontStruct *font;
- int j;
- FT_Encoding encoding;
- int charmap;
-- int error;
-
-- int height, ascent, descent;
- int extra;
-- int div;
--
-+ int height, ascent, descent;
- XRenderPictFormat pf, *format;
-
-- if (XftPatternGetString (pattern, XFT_FILE, 0, &file) != XftResultMatch)
-+ /*
-+ * Open the file
-+ */
-+ if (XftPatternGetString (pattern, XFT_FILE, 0, &filename) != XftResultMatch)
- goto bail0;
-
- if (XftPatternGetInteger (pattern, XFT_INDEX, 0, &id) != XftResultMatch)
- goto bail0;
-
-+ file = _XftFreeTypeOpenFile (filename, id);
-+ if (!file)
-+ goto bail0;
-+
-+ face = file->face;
-+
-+ /*
-+ * Extract the glyphset information from the pattern
-+ */
- if (XftPatternGetString (pattern, XFT_ENCODING, 0, &encoding_name) != XftResultMatch)
- goto bail0;
-
-- if (XftPatternGetDouble (pattern, XFT_PIXEL_SIZE, 0, &size) != XftResultMatch)
-+ if (XftPatternGetDouble (pattern, XFT_PIXEL_SIZE, 0, &dsize) != XftResultMatch)
- goto bail0;
-
- switch (XftPatternGetInteger (pattern, XFT_RGBA, 0, &rgba)) {
-@@ -199,11 +349,101 @@
- goto bail0;
- }
-
-+ switch (XftPatternGetBool (pattern, XFT_MINSPACE, 0, &minspace)) {
-+ case XftResultNoMatch:
-+ minspace = False;
-+ break;
-+ case XftResultMatch:
-+ break;
-+ default:
-+ goto bail0;
-+ }
-+
-+ switch (XftPatternGetInteger (pattern, XFT_SPACING, 0, &spacing)) {
-+ case XftResultNoMatch:
-+ spacing = XFT_PROPORTIONAL;
-+ break;
-+ case XftResultMatch:
-+ break;
-+ default:
-+ goto bail1;
-+ }
-+
- if (XftPatternGetInteger (pattern, XFT_CHAR_WIDTH,
- 0, &char_width) != XftResultMatch)
- {
- char_width = 0;
- }
-+ else if (char_width)
-+ spacing = XFT_MONO;
-+
-+ encoding = face->charmaps[0]->encoding;
-+
-+ for (j = 0; j < NUM_FT_ENCODINGS; j++)
-+ if (!strcmp (encoding_name, xftFtEncoding[j].name))
-+ {
-+ encoding = xftFtEncoding[j].encoding;
-+ break;
-+ }
-+
-+ size = (FT_F26Dot6) (dsize * 64.0);
-+
-+ if (encoding == ft_encoding_none)
-+ charmap = -1;
-+ else
-+ {
-+ for (charmap = 0; charmap < face->num_charmaps; charmap++)
-+ if (face->charmaps[charmap]->encoding == encoding)
-+ break;
-+
-+ if (charmap == face->num_charmaps)
-+ goto bail1;
-+ }
-+
-+
-+ /*
-+ * Match an existing glyphset
-+ */
-+ for (gs = _XftFtGlyphSets; gs; gs = gs->next)
-+ {
-+ if (gs->file == file &&
-+ gs->minspace == minspace &&
-+ gs->char_width == char_width &&
-+ gs->font.size == size &&
-+ gs->font.spacing == spacing &&
-+ gs->font.charmap == charmap &&
-+ gs->font.rgba == rgba &&
-+ gs->font.antialias == antialias)
-+ {
-+ ++gs->ref;
-+ if (_XftFontDebug () & XFT_DBG_REF)
-+ {
-+ printf ("Face size %g matches existing (%d)\n",
-+ dsize, gs->ref);
-+ }
-+ return &gs->font;
-+ }
-+ }
-+
-+ if (_XftFontDebug () & XFT_DBG_REF)
-+ {
-+ printf ("Face size %g matches new\n",
-+ dsize);
-+ }
-+ /*
-+ * No existing glyphset, create another
-+ */
-+ gs = malloc (sizeof (XftFtGlyphSet));
-+ if (!gs)
-+ goto bail1;
-+
-+ gs->ref = 1;
-+
-+ gs->file = file;
-+ gs->minspace = minspace;
-+ gs->char_width = char_width;
-+
-+ font = &gs->font;
-
- if (antialias)
- {
-@@ -261,106 +501,60 @@
- }
-
- if (!format)
-- goto bail0;
-+ goto bail2;
-
-- if (FT_New_Face (_XftFTlibrary, file, id, &face))
-- goto bail0;
-+ font->size = size;
-
-- font = (XftFontStruct *) malloc (sizeof (XftFontStruct));
-- if (!font)
-- goto bail1;
--
-- font->size = (FT_F26Dot6) (size * 64.0);
--
-- if ( FT_Set_Char_Size (face, font->size, font->size, 0, 0) )
-+ if (!XftFreeTypeSetFace (face, size, charmap))
- goto bail2;
-
-- encoding = face->charmaps[0]->encoding;
--
-- for (j = 0; j < NUM_FT_ENCODINGS; j++)
-- if (!strcmp (encoding_name, xftFtEncoding[j].name))
-- {
-- encoding = xftFtEncoding[j].encoding;
-- break;
-- }
--
-- if (encoding == ft_encoding_none)
-- encoded = False;
-- else
-+ descent = -(face->size->metrics.descender >> 6);
-+ ascent = face->size->metrics.ascender >> 6;
-+ if (minspace)
- {
-- encoded = True;
-- for (charmap = 0; charmap < face->num_charmaps; charmap++)
-- if (face->charmaps[charmap]->encoding == encoding)
-- break;
--
-- if (charmap == face->num_charmaps)
-- goto bail2;
--
-- error = FT_Set_Charmap(face,
-- face->charmaps[charmap]);
--
-- if (error)
-- goto bail2;
-+ height = ascent + descent;
- }
--
-- height = face->height;
-- ascent = face->ascender;
-- descent = face->descender;
-- if (descent < 0) descent = - descent;
-- extra = (height - (ascent + descent));
-- if (extra > 0)
-+ else
- {
-- ascent = ascent + extra / 2;
-- descent = height - ascent;
-+ height = face->size->metrics.height >> 6;
-+ extra = (height - (ascent + descent));
-+ if (extra > 0)
-+ {
-+ ascent = ascent + extra / 2;
-+ descent = height - ascent;
-+ }
-+ else if (extra < 0)
-+ height = ascent + descent;
- }
-- else if (extra < 0)
-- height = ascent + descent;
-- div = face->units_per_EM;
-- if (height > div * 5)
-- div *= 10;
--
-- div = face->units_per_EM;
-- if (height > div * 5)
-- div *= 10;
--
-- font->descent = descent * font->size / (64 * div);
-- font->ascent = ascent * font->size / (64 * div);
-- font->height = height * font->size / (64 * div);
-- font->max_advance_width = face->max_advance_width * font->size / (64 * div);
-+ font->ascent = ascent;
-+ font->descent = descent;
-+ font->height = height;
-
-- font->monospace = (face->face_flags & FT_FACE_FLAG_FIXED_WIDTH) != 0;
- if (char_width)
-- {
- font->max_advance_width = char_width;
-- font->monospace = True;
-- }
-- switch (XftPatternGetInteger (pattern, XFT_SPACING, 0, &spacing)) {
-- case XftResultNoMatch:
-- break;
-- case XftResultMatch:
-- if (spacing != XFT_PROPORTIONAL)
-- font->monospace = True;
-- break;
-- default:
-- goto bail2;
-- }
-+ else
-+ font->max_advance_width = face->size->metrics.max_advance >> 6;
-+
-+ gs->next = _XftFtGlyphSets;
-+ _XftFtGlyphSets = gs;
-
- font->glyphset = XRenderCreateGlyphSet (dpy, format);
-
-+ font->spacing = spacing;
- font->format = format;
- font->realized =0;
- font->nrealized = 0;
- font->rgba = rgba;
- font->antialias = antialias;
-- font->encoded = encoded;
-+ font->charmap = charmap;
- font->face = face;
-
- return font;
-
- bail2:
-- free (font);
-+ free (gs);
- bail1:
-- FT_Done_Face (font->face);
-+ _XftFreeTypeCloseFile (file);
- bail0:
- return 0;
- }
-@@ -368,10 +562,26 @@
- void
- XftFreeTypeClose (Display *dpy, XftFontStruct *font)
- {
-- XRenderFreeGlyphSet (dpy, font->glyphset);
-- if (font->realized)
-- free (font->realized);
-- FT_Done_Face (font->face);
-+ XftFtGlyphSet *gs, **prev;
-+
-+ for (prev = &_XftFtGlyphSets; (gs = *prev); prev = &gs->next)
-+ {
-+ if (&gs->font == font)
-+ {
-+ if (--gs->ref == 0)
-+ {
-+ XRenderFreeGlyphSet (dpy, font->glyphset);
-+ if (font->realized)
-+ free (font->realized);
-+
-+ _XftFreeTypeCloseFile (gs->file);
-+
-+ *prev = gs->next;
-+ free (gs);
-+ }
-+ break;
-+ }
-+ }
- }
-
- XftFontStruct *
-@@ -388,6 +598,7 @@
- XftInitFtLibrary (void)
- {
- char **d;
-+ char *cache;
-
- if (_XftFTlibrary)
- return True;
-@@ -396,16 +607,21 @@
- _XftFontSet = XftFontSetCreate ();
- if (!_XftFontSet)
- return False;
-+ cache = XftConfigGetCache ();
-+ if (cache)
-+ XftFileCacheLoad (cache);
- for (d = XftConfigDirs; d && *d; d++)
- {
- #ifdef XFT_DEBUG_FONTSET
- printf ("scan dir %s\n", *d);
- #endif
-- XftDirScan (_XftFontSet, *d);
-+ XftDirScan (_XftFontSet, *d, False);
- }
- #ifdef XFT_DEBUG_FONTSET
- XftPrintFontSet (_XftFontSet);
- #endif
-+ if (cache)
-+ XftFileCacheSave (cache);
-+ XftFileCacheDispose ();
- return True;
- }
--
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/xftglyphs.c xc/lib/Xft/xftglyphs.c
---- XFree86-4.0.2.orig/xc/lib/Xft/xftglyphs.c Sat Dec 16 12:33:01 2000
-+++ XFree86-4.0.2/xc/lib/Xft/xftglyphs.c Fri Jan 19 20:25:58 2001
-@@ -1,5 +1,5 @@
- /*
-- * $XFree86: xc/lib/Xft/xftglyphs.c,v 1.6 2000/12/15 17:12:53 keithp Exp $
-+ * $XFree86: xc/lib/Xft/xftglyphs.c,v 1.8 2000/12/22 02:25:41 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
-@@ -22,6 +22,7 @@
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#include <stdio.h>
- #include <stdlib.h>
- #include "xftint.h"
- #include <freetype/ftoutln.h>
-@@ -73,6 +74,9 @@
- FT_Bitmap ftbit;
- FT_Matrix matrix;
-
-+ if (!XftFreeTypeSetFace (font->face, font->size, font->charmap))
-+ return ;
-+
- if (font->antialias && font->rgba)
- {
- matrix.xx = 0x30000L;
-@@ -87,11 +91,16 @@
- if (!gi)
- continue;
-
-- if (font->encoded)
-+ if (font->charmap != -1)
- {
- glyphindex = FT_Get_Char_Index (font->face, charcode);
- if (!glyphindex)
-+ {
-+ if (_XftFontDebug() & XFT_DBG_GLYPH)
-+ printf ("glyph (%c) %d missing\n",
-+ (int) charcode, (int) charcode);
- continue;
-+ }
- }
- else
- glyphindex = (FT_UInt) charcode;
-@@ -112,7 +121,7 @@
- /*
- * Try to keep monospace fonts ink-inside
- */
-- if (font->monospace)
-+ if (font->spacing != XFT_PROPORTIONAL)
- {
- if (TRUNC(right) > font->max_advance_width)
- {
-@@ -192,39 +201,42 @@
- }
- }
- }
--#if 0
-+ if (_XftFontDebug() & XFT_DBG_GLYPH)
- {
-- int x, y;
-- unsigned char *line;
--
-- line = bufBitmap;
-- printf ("\nchar 0x%x (%c):\n", (int) charcode, (char) charcode);
-- for (y = 0; y < height; y++)
-+ printf ("char 0x%x (%c):\n", (int) charcode, (char) charcode);
-+ if (_XftFontDebug() & XFT_DBG_GLYPHV)
- {
-- if (font->antialias)
-- {
-- static char den[] = { " .:;=+*#" };
-- for (x = 0; x < pitch; x++)
-- printf ("%c", den[line[x] >> 5]);
-- }
-- else
-+ int x, y;
-+ unsigned char *line;
-+
-+ line = bufBitmap;
-+ for (y = 0; y < height; y++)
- {
-- for (x = 0; x < pitch * 8; x++)
-+ if (font->antialias)
- {
-- printf ("%c", line[x>>3] & (1 << (x & 7)) ? '#' : ' ');
-+ static char den[] = { " .:;=+*#" };
-+ for (x = 0; x < pitch; x++)
-+ printf ("%c", den[line[x] >> 5]);
- }
-+ else
-+ {
-+ for (x = 0; x < pitch * 8; x++)
-+ {
-+ printf ("%c", line[x>>3] & (1 << (x & 7)) ? '#' : ' ');
-+ }
-+ }
-+ printf ("\n");
-+ line += pitch;
- }
- printf ("\n");
-- line += pitch;
- }
- }
--#endif
- }
- else
- {
--#if 0
-- printf ("glyph (%c) %d missing\n", (int) charcode, (int) charcode);
--#endif
-+ if (_XftFontDebug() & XFT_DBG_GLYPH)
-+ printf ("glyph (%c) %d no outline\n",
-+ (int) charcode, (int) charcode);
- continue;
- }
-
-@@ -232,7 +244,7 @@
- gi->height = height;
- gi->x = -TRUNC(left);
- gi->y = TRUNC(top);
-- if (font->monospace)
-+ if (font->spacing != XFT_PROPORTIONAL)
- gi->xOff = font->max_advance_width;
- else
- gi->xOff = TRUNC(ROUND(glyph->metrics.horiAdvance));
-@@ -368,7 +380,10 @@
- XftFontStruct *font,
- XftChar32 glyph)
- {
-- if (font->encoded)
-+ if (font->charmap != -1)
-+ {
-+ FT_Set_Charmap (font->face, font->face->charmaps[font->charmap]);
- glyph = (XftChar32) FT_Get_Char_Index (font->face, (FT_ULong) glyph);
-+ }
- return glyph && glyph <= font->face->num_glyphs;
- }
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/xftgram.y xc/lib/Xft/xftgram.y
---- XFree86-4.0.2.orig/xc/lib/Xft/xftgram.y Thu Nov 30 18:30:00 2000
-+++ XFree86-4.0.2/xc/lib/Xft/xftgram.y Fri Jan 19 20:25:58 2001
-@@ -1,5 +1,5 @@
- /*
-- * $XFree86: xc/lib/Xft/xftgram.y,v 1.2 2000/11/30 23:30:00 dawes Exp $
-+ * $XFree86: xc/lib/Xft/xftgram.y,v 1.3 2001/01/02 02:46:51 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
-@@ -47,7 +47,8 @@
- %token <dval> DOUBLE
- %token <sval> STRING NAME
- %token <ival> ANY ALL
--%token <ival> DIR INCLUDE INCLUDEIF MATCH EDIT TOK_TRUE TOK_FALSE TOK_NIL
-+%token <ival> DIR CACHE INCLUDE INCLUDEIF MATCH EDIT
-+%token <ival> TOK_TRUE TOK_FALSE TOK_NIL
- %token <ival> EQUAL SEMI
-
- %type <eval> expr
-@@ -75,6 +76,8 @@
- ;
- config : DIR STRING
- { XftConfigAddDir ($2); }
-+ | CACHE STRING
-+ { XftConfigSetCache ($2); }
- | INCLUDE STRING
- { XftConfigPushInput ($2, True); }
- | INCLUDEIF STRING
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/xftint.h xc/lib/Xft/xftint.h
---- XFree86-4.0.2.orig/xc/lib/Xft/xftint.h Sat Dec 16 12:33:01 2000
-+++ XFree86-4.0.2/xc/lib/Xft/xftint.h Fri Jan 19 20:25:58 2001
-@@ -1,5 +1,5 @@
- /*
-- * $XFree86: xc/lib/Xft/xftint.h,v 1.15 2000/12/15 17:12:53 keithp Exp $
-+ * $XFree86: xc/lib/Xft/xftint.h,v 1.20 2001/01/02 02:46:51 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
-@@ -84,6 +84,16 @@
- #define XFT_DEFAULT_PATH "/usr/X11R6/lib/X11/XftConfig"
- #endif
-
-+#define XFT_DBG_OPEN 1
-+#define XFT_DBG_OPENV 2
-+#define XFT_DBG_RENDER 4
-+#define XFT_DBG_DRAW 8
-+#define XFT_DBG_REF 16
-+#define XFT_DBG_GLYPH 32
-+#define XFT_DBG_GLYPHV 64
-+#define XFT_DBG_CACHE 128
-+#define XFT_DBG_CACHEV 256
-+
- typedef enum _XftOp {
- XftOpInteger, XftOpDouble, XftOpString, XftOpBool, XftOpNil,
- XftOpField,
-@@ -191,11 +201,40 @@
- }
-
-
-+/* xftcache.c */
-+
-+char *
-+XftFileCacheFind (char *file, int id, int *count);
-+
-+void
-+XftFileCacheDispose (void);
-+
-+void
-+XftFileCacheLoad (char *cache);
-+
-+Bool
-+XftFileCacheUpdate (char *file, int id, char *name);
-+
-+Bool
-+XftFileCacheSave (char *cache);
-+
-+Bool
-+XftFileCacheReadDir (XftFontSet *set, const char *cache_file);
-+
-+Bool
-+XftFileCacheWriteDir (XftFontSet *set, const char *cache_file);
-+
- /* xftcfg.c */
- Bool
- XftConfigAddDir (char *d);
-
- Bool
-+XftConfigSetCache (char *c);
-+
-+char *
-+XftConfigGetCache (void);
-+
-+Bool
- XftConfigAddEdit (XftTest *test, XftEdit *edit);
-
- Bool
-@@ -217,6 +256,12 @@
- int len,
- XChar2b xcloc[XFT_CORE_N16LOCAL]);
-
-+XChar2b *
-+XftCoreConvertUtf8 (XftChar8 *string,
-+ int len,
-+ XChar2b xcloc[XFT_CORE_N16LOCAL],
-+ int *nchar);
-+
- void
- XftCoreExtents8 (Display *dpy,
- XFontStruct *fs,
-@@ -238,6 +283,13 @@
- int len,
- XGlyphInfo *extents);
-
-+void
-+XftCoreExtentsUtf8 (Display *dpy,
-+ XFontStruct *fs,
-+ XftChar8 *string,
-+ int len,
-+ XGlyphInfo *extents);
-+
- Bool
- XftCoreGlyphExists (Display *dpy,
- XFontStruct *fs,
-@@ -259,10 +311,6 @@
- void
- XftSubstPrint (XftSubst *subst);
-
--/* xftdir.c */
--Bool
--XftDirScan (XftFontSet *set, const char *dir);
--
- /* xftdpy.c */
- int
- XftDefaultParseBool (char *v);
-@@ -295,12 +343,7 @@
- int
- _XftFontDebug (void);
-
--/* xftfreetype.c */
--XftPattern *
--XftFreeTypeQuery (const char *file, int id, int *count);
--
- /* xftfs.c */
--/* xftglyphs.c */
- /* xftgram.y */
- int
- XftConfigparse (void);
-@@ -349,7 +392,7 @@
-
- /* xftinit.c */
- Bool
--XftInitFtLibrary (void);
-+XftInit (char *config);
-
- /* xftlex.l */
- extern int XftConfigLineno;
-@@ -365,9 +408,6 @@
- XftConfigPushInput (char *s, Bool complain);
-
- /* xftlist.c */
--XftObjectSet *
--_XftObjectSetVapBuild (const char *first, va_list *vap);
--
- Bool
- XftListValueCompare (XftValue v1,
- XftValue v2);
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/xftlex.l xc/lib/Xft/xftlex.l
---- XFree86-4.0.2.orig/xc/lib/Xft/xftlex.l Sat Dec 16 12:33:01 2000
-+++ XFree86-4.0.2/xc/lib/Xft/xftlex.l Fri Jan 19 20:25:58 2001
-@@ -1,6 +1,6 @@
- %{
- /*
-- * $XFree86: xc/lib/Xft/xftlex.l,v 1.3 2000/12/15 22:48:39 dawes Exp $
-+ * $XFree86: xc/lib/Xft/xftlex.l,v 1.4 2001/01/02 02:46:51 keithp Exp $
- *
- * Copyright (c) 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
-@@ -97,6 +97,7 @@
- "/\052" _XftConfigSkipComment();
- ^# _XftConfigSkipLine();
- dir return DIR;
-+cache return CACHE;
- include return INCLUDE;
- includeif return INCLUDEIF;
- match return MATCH;
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/xftname.c xc/lib/Xft/xftname.c
---- XFree86-4.0.2.orig/xc/lib/Xft/xftname.c Sat Dec 16 12:33:00 2000
-+++ XFree86-4.0.2/xc/lib/Xft/xftname.c Fri Jan 19 20:25:58 2001
-@@ -1,5 +1,5 @@
- /*
-- * $XFree86: xc/lib/Xft/xftname.c,v 1.5 2000/12/14 23:03:56 keithp Exp $
-+ * $XFree86: xc/lib/Xft/xftname.c,v 1.8 2001/01/02 02:46:51 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
-@@ -26,13 +26,14 @@
- #include <ctype.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <stdio.h>
-
- typedef struct _XftObjectType {
- const char *object;
- XftType type;
- } XftObjectType;
-
--const XftObjectType _XftObjectTypes[] = {
-+static const XftObjectType _XftObjectTypes[] = {
- { XFT_FAMILY, XftTypeString, },
- { XFT_STYLE, XftTypeString, },
- { XFT_SLANT, XftTypeInteger, },
-@@ -53,6 +54,9 @@
- { XFT_RGBA, XftTypeInteger, },
- { XFT_SCALE, XftTypeDouble, },
- { XFT_RENDER, XftTypeBool, },
-+ { XFT_MINSPACE, XftTypeBool, },
-+ { XFT_CHAR_WIDTH, XftTypeInteger },
-+ { XFT_CHAR_HEIGHT, XftTypeInteger },
- };
-
- #define NUM_OBJECT_TYPES (sizeof _XftObjectTypes / sizeof _XftObjectTypes[0])
-@@ -152,9 +156,17 @@
- {
- char c;
-
-- while (*cur && !strchr (delim, *cur))
-+ while ((c = *cur))
- {
-- c = *cur++;
-+ if (c == '\\')
-+ {
-+ ++cur;
-+ if (!(c = *cur))
-+ break;
-+ }
-+ else if (strchr (delim, c))
-+ break;
-+ ++cur;
- *save++ = c;
- }
- *save = 0;
-@@ -211,10 +223,10 @@
- }
- while (delim == ':')
- {
-- name = _XftNameFindNext (name, "=-:", save, &delim);
-+ name = _XftNameFindNext (name, "=_:", save, &delim);
- if (save[0])
- {
-- if (delim == '=' || delim == '-')
-+ if (delim == '=' || delim == '_')
- {
- t = XftNameGetType (save);
- for (;;)
-@@ -250,4 +262,118 @@
- free (save);
- bail0:
- return 0;
-+}
-+
-+static Bool
-+_XftNameUnparseString (const char *string, char *escape, char **destp, int *lenp)
-+{
-+ int len = *lenp;
-+ char *dest = *destp;
-+ char c;
-+
-+ while ((c = *string++))
-+ {
-+ if (escape && strchr (escape, c))
-+ {
-+ if (len-- == 0)
-+ return False;
-+ *dest++ = escape[0];
-+ }
-+ if (len-- == 0)
-+ return False;
-+ *dest++ = c;
-+ }
-+ *destp = dest;
-+ *lenp = len;
-+ return True;
-+}
-+
-+static Bool
-+_XftNameUnparseValue (XftValue v, char *escape, char **destp, int *lenp)
-+{
-+ char temp[1024];
-+
-+ switch (v.type) {
-+ case XftTypeVoid:
-+ return True;
-+ case XftTypeInteger:
-+ sprintf (temp, "%d", v.u.i);
-+ return _XftNameUnparseString (temp, 0, destp, lenp);
-+ case XftTypeDouble:
-+ sprintf (temp, "%g", v.u.d);
-+ return _XftNameUnparseString (temp, 0, destp, lenp);
-+ case XftTypeString:
-+ return _XftNameUnparseString (v.u.s, escape, destp, lenp);
-+ case XftTypeBool:
-+ return _XftNameUnparseString (v.u.b ? "True" : "False", 0, destp, lenp);
-+ }
-+ return False;
-+}
-+
-+static Bool
-+_XftNameUnparseValueList (XftValueList *v, char *escape, char **destp, int *lenp)
-+{
-+ while (v)
-+ {
-+ if (!_XftNameUnparseValue (v->value, escape, destp, lenp))
-+ return False;
-+ if ((v = v->next))
-+ if (!_XftNameUnparseString (",", 0, destp, lenp))
-+ return False;
-+ }
-+ return True;
-+}
-+
-+#define XFT_ESCAPE_FIXED "\\-:,"
-+#define XFT_ESCAPE_VARIABLE "\\=_:,"
-+
-+Bool
-+XftNameUnparse (XftPattern *pat, char *dest, int len)
-+{
-+ int i;
-+ XftPatternElt *e;
-+ const XftObjectType *o;
-+
-+ e = XftPatternFind (pat, XFT_FAMILY, False);
-+ if (e)
-+ {
-+ if (!_XftNameUnparseValueList (e->values, XFT_ESCAPE_FIXED,
-+ &dest, &len))
-+ return False;
-+ }
-+ e = XftPatternFind (pat, XFT_SIZE, False);
-+ if (e)
-+ {
-+ if (!_XftNameUnparseString ("-", 0, &dest, &len))
-+ return False;
-+ if (!_XftNameUnparseValueList (e->values, XFT_ESCAPE_FIXED, &dest, &len))
-+ return False;
-+ }
-+ for (i = 0; i < NUM_OBJECT_TYPES; i++)
-+ {
-+ o = &_XftObjectTypes[i];
-+ if (!strcmp (o->object, XFT_FAMILY) ||
-+ !strcmp (o->object, XFT_SIZE) ||
-+ !strcmp (o->object, XFT_FILE))
-+ continue;
-+
-+ e = XftPatternFind (pat, o->object, False);
-+ if (e)
-+ {
-+ if (!_XftNameUnparseString (":", 0, &dest, &len))
-+ return False;
-+ if (!_XftNameUnparseString (o->object, XFT_ESCAPE_VARIABLE,
-+ &dest, &len))
-+ return False;
-+ if (!_XftNameUnparseString ("=", 0, &dest, &len))
-+ return False;
-+ if (!_XftNameUnparseValueList (e->values, XFT_ESCAPE_VARIABLE,
-+ &dest, &len))
-+ return False;
-+ }
-+ }
-+ if (len == 0)
-+ return False;
-+ *dest = '\0';
-+ return True;
- }
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/xftrender.c xc/lib/Xft/xftrender.c
---- XFree86-4.0.2.orig/xc/lib/Xft/xftrender.c Fri Dec 8 02:51:28 2000
-+++ XFree86-4.0.2/xc/lib/Xft/xftrender.c Fri Jan 19 20:25:58 2001
-@@ -1,5 +1,5 @@
- /*
-- * $XFree86: xc/lib/Xft/xftrender.c,v 1.5 2000/12/08 07:51:28 keithp Exp $
-+ * $XFree86: xc/lib/Xft/xftrender.c,v 1.6 2000/12/20 00:28:45 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
-@@ -22,6 +22,7 @@
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#include <stdlib.h>
- #include "xftint.h"
-
- void
-@@ -97,6 +98,93 @@
- }
-
- void
-+XftRenderStringUtf8 (Display *dpy, Picture src,
-+ XftFontStruct *font, Picture dst,
-+ int srcx, int srcy,
-+ int x, int y,
-+ XftChar8 *string, int len)
-+{
-+ XftChar8 *s;
-+ XftChar32 c;
-+ XftChar32 lbuf[4096];
-+ XftChar32 *d;
-+ XftChar8 *dst8;
-+ XftChar16 *dst16;
-+ XftChar32 *dst32;
-+ int rlen, clen;
-+ int width = 1;
-+ int n;
-+
-+ /* compute needed width */
-+ if (!XftUtf8Len (string, len, &n, &width))
-+ return;
-+
-+ d = lbuf;
-+ if (n * width > sizeof (lbuf))
-+ {
-+ d = (XftChar32 *) malloc (n * width);
-+ if (!d)
-+ return;
-+ }
-+
-+ switch (width) {
-+ case 4:
-+ s = string;
-+ rlen = len;
-+ dst32 = d;
-+ while (rlen)
-+ {
-+ clen = XftUtf8ToUcs4 (s, &c, rlen);
-+ if (clen <= 0) /* malformed UTF8 string */
-+ return;
-+ *dst32++ = c;
-+ s += clen;
-+ rlen -= clen;
-+ }
-+ dst32 = d;
-+ XftRenderString32 (dpy, src, font, dst, srcx, srcy, x, y,
-+ dst32, n);
-+ break;
-+ case 2:
-+ s = string;
-+ rlen = len;
-+ dst16 = (XftChar16 *) d;
-+ while (rlen)
-+ {
-+ clen = XftUtf8ToUcs4 (s, &c, rlen);
-+ if (clen <= 0) /* malformed UTF8 string */
-+ return;
-+ *dst16++ = c;
-+ s += clen;
-+ rlen -= clen;
-+ }
-+ dst16 = (XftChar16 *) d;
-+ XftRenderString16 (dpy, src, font, dst, srcx, srcy, x, y,
-+ dst16, n);
-+ break;
-+ case 1:
-+ s = string;
-+ rlen = len;
-+ dst8 = (XftChar8 *) d;
-+ while (rlen)
-+ {
-+ clen = XftUtf8ToUcs4 (s, &c, rlen);
-+ if (clen <= 0) /* malformed UTF8 string */
-+ return;
-+ *dst8++ = c;
-+ s += clen;
-+ rlen -= clen;
-+ }
-+ dst8 = (XftChar8 *) d;
-+ XftRenderString8 (dpy, src, font, dst, srcx, srcy, x, y,
-+ dst8, n);
-+ break;
-+ }
-+ if (d != lbuf)
-+ free (d);
-+}
-+
-+void
- XftRenderExtents8 (Display *dpy,
- XftFontStruct *font,
- XftChar8 *string,
-@@ -273,6 +361,89 @@
- while (len--)
- {
- c = *string++;
-+ gi = c < font->nrealized ? font->realized[c] : 0;
-+ if (!gi)
-+ continue;
-+ if (gi->x + x < extents->x)
-+ extents->x = gi->x + x;
-+ if (gi->y + y < extents->y)
-+ extents->y = gi->y + y;
-+ if (gi->width + x > extents->width)
-+ extents->width = gi->width + x;
-+ if (gi->height + y > extents->height)
-+ extents->height = gi->height + y;
-+ x += gi->xOff;
-+ y += gi->yOff;
-+ }
-+ extents->xOff = x;
-+ extents->yOff = y;
-+}
-+
-+void
-+XftRenderExtentsUtf8 (Display *dpy,
-+ XftFontStruct *font,
-+ XftChar8 *string,
-+ int len,
-+ XGlyphInfo *extents)
-+{
-+ unsigned int missing[XFT_NMISSING];
-+ int nmissing;
-+ XftChar8 *s;
-+ XftChar32 c;
-+ int l, clen;
-+ XGlyphInfo *gi;
-+ int x, y;
-+
-+ s = string;
-+ l = len;
-+ nmissing = 0;
-+ while (l)
-+ {
-+ clen = XftUtf8ToUcs4 (s, &c, l);
-+ if (clen < 0)
-+ break;
-+ XftGlyphCheck (dpy, font, c, missing, &nmissing);
-+ s += clen;
-+ l -= clen;
-+ }
-+ if (nmissing)
-+ XftGlyphLoad (dpy, font, missing, nmissing);
-+
-+ gi = 0;
-+ while (len)
-+ {
-+ clen = XftUtf8ToUcs4 (string, &c, len);
-+ if (clen < 0)
-+ {
-+ len = 0;
-+ break;
-+ }
-+ len -= clen;
-+ string += clen;
-+ gi = c < font->nrealized ? font->realized[c] : 0;
-+ if (gi)
-+ break;
-+ }
-+ if (len == 0 && !gi)
-+ {
-+ extents->width = 0;
-+ extents->height = 0;
-+ extents->x = 0;
-+ extents->y = 0;
-+ extents->yOff = 0;
-+ extents->xOff = 0;
-+ return;
-+ }
-+ *extents = *gi;
-+ x = gi->xOff;
-+ y = gi->yOff;
-+ while (len)
-+ {
-+ clen = XftUtf8ToUcs4 (string, &c, len);
-+ if (clen < 0)
-+ break;
-+ len -= clen;
-+ string += clen;
- gi = c < font->nrealized ? font->realized[c] : 0;
- if (!gi)
- continue;
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/xftstr.c xc/lib/Xft/xftstr.c
---- XFree86-4.0.2.orig/xc/lib/Xft/xftstr.c Sat Dec 16 12:33:00 2000
-+++ XFree86-4.0.2/xc/lib/Xft/xftstr.c Fri Jan 19 20:25:58 2001
-@@ -1,5 +1,5 @@
- /*
-- * $XFree86: xc/lib/Xft/xftstr.c,v 1.2 2000/12/14 23:03:57 keithp Exp $
-+ * $XFree86: xc/lib/Xft/xftstr.c,v 1.4 2000/12/20 10:24:27 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
-@@ -149,4 +149,108 @@
- break;
- }
- return (int) c2 - (int) c1;
-+}
-+
-+int
-+XftUtf8ToUcs4 (XftChar8 *src_orig,
-+ XftChar32 *dst,
-+ int len)
-+{
-+ XftChar8 *src = src_orig;
-+ XftChar8 s;
-+ int extra;
-+ XftChar32 result;
-+
-+ if (len == 0)
-+ return 0;
-+
-+ s = *src++;
-+ len--;
-+
-+ if (!(s & 0x80))
-+ {
-+ result = s;
-+ extra = 0;
-+ }
-+ else if (!(s & 0x40))
-+ {
-+ return -1;
-+ }
-+ else if (!(s & 0x20))
-+ {
-+ result = s & 0x1f;
-+ extra = 1;
-+ }
-+ else if (!(s & 0x10))
-+ {
-+ result = s & 0xf;
-+ extra = 2;
-+ }
-+ else if (!(s & 0x08))
-+ {
-+ result = s & 0x07;
-+ extra = 3;
-+ }
-+ else if (!(s & 0x04))
-+ {
-+ result = s & 0x03;
-+ extra = 4;
-+ }
-+ else if ( ! (s & 0x02))
-+ {
-+ result = s & 0x01;
-+ extra = 5;
-+ }
-+ else
-+ {
-+ return -1;
-+ }
-+ if (extra > len)
-+ return -1;
-+
-+ while (extra--)
-+ {
-+ result <<= 6;
-+ s = *src++;
-+
-+ if ((s & 0xc0) != 0x80)
-+ return -1;
-+
-+ result |= s & 0x3f;
-+ }
-+ *dst = result;
-+ return src - src_orig;
-+}
-+
-+Bool
-+XftUtf8Len (XftChar8 *string,
-+ int len,
-+ int *nchar,
-+ int *wchar)
-+{
-+ int n;
-+ int clen;
-+ int width = 1;
-+ XftChar32 c;
-+
-+ n = 0;
-+ while (len)
-+ {
-+ clen = XftUtf8ToUcs4 (string, &c, len);
-+ if (clen <= 0) /* malformed UTF8 string */
-+ return False;
-+ if (c >= 0x10000)
-+ width = 4;
-+ else if (c >= 0x100)
-+ {
-+ if (width == 1)
-+ width = 2;
-+ }
-+ string += clen;
-+ len -= clen;
-+ n++;
-+ }
-+ *nchar = n;
-+ *wchar = width;
-+ return True;
- }
-diff -urN -x CVS xc-4.0.2.orig/lib/Xft/xftxlfd.c xc/lib/Xft/xftxlfd.c
---- XFree86-4.0.2.orig/xc/lib/Xft/xftxlfd.c Sat Dec 16 12:33:00 2000
-+++ XFree86-4.0.2/xc/lib/Xft/xftxlfd.c Fri Jan 19 20:25:58 2001
-@@ -1,5 +1,5 @@
- /*
-- * $XFree86: xc/lib/Xft/xftxlfd.c,v 1.5 2000/12/14 23:03:57 keithp Exp $
-+ * $XFree86: xc/lib/Xft/xftxlfd.c,v 1.7 2000/12/22 05:05:16 tsi Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
-@@ -208,9 +208,21 @@
- return ret;
- }
-
--XFontStruct *
-+typedef struct _XftCoreFont {
-+ struct _XftCoreFont *next;
-+ int ref;
-+
-+ XFontStruct *font;
-+ Display *display;
-+ char *xlfd;
-+} XftCoreFont;
-+
-+static XftCoreFont *_XftCoreFonts;
-+
-+XFontStruct*
- XftCoreOpen (Display *dpy, XftPattern *pattern)
- {
-+ XftCoreFont *cf;
- char *xlfd;
- char *xlfd_pixel = 0;
- char *i, *o;
-@@ -258,9 +270,66 @@
- xlfd = xlfd_pixel;
- }
- }
-- ret = XLoadQueryFont (dpy, xlfd);
-+ for (cf = _XftCoreFonts; cf; cf = cf->next)
-+ {
-+ if (cf->display == dpy &&
-+ !_XftStrCmpIgnoreCase (cf->xlfd, xlfd))
-+ {
-+ cf->ref++;
-+ if (_XftFontDebug () & XFT_DBG_REF)
-+ {
-+ printf ("Xlfd \"%s\" matches existing font (%d)\n",
-+ xlfd, cf->ref);
-+ }
-+ break;
-+ }
-+ }
-+ if (!cf)
-+ {
-+ ret = XLoadQueryFont (dpy, xlfd);
-+ if (!ret)
-+ return 0;
-+
-+ cf = (XftCoreFont *) malloc (sizeof (XftCoreFont) +
-+ strlen (xlfd) + 1);
-+ if (!cf)
-+ {
-+ XFreeFont (dpy, ret);
-+ return 0;
-+ }
-+
-+ if (_XftFontDebug () & XFT_DBG_REF)
-+ printf ("Xlfd \"%s\" matches new font\n", xlfd);
-+
-+ cf->next = _XftCoreFonts;
-+ _XftCoreFonts = cf;
-+ cf->ref = 1;
-+
-+ cf->font = ret;
-+ cf->xlfd = (char *) (cf + 1);
-+ strcpy (cf->xlfd, xlfd);
-+ }
- if (xlfd_pixel)
- free (xlfd_pixel);
-- return ret;
-+ return cf->font;
- }
-
-+void
-+XftCoreClose (Display *dpy, XFontStruct *font)
-+{
-+ XftCoreFont *cf, **prev;
-+
-+ for (prev = &_XftCoreFonts; (cf = *prev); prev = &cf->next)
-+ {
-+ if (cf->display == dpy && cf->font == font)
-+ {
-+ if (--cf->ref == 0)
-+ {
-+ XFreeFont (dpy, cf->font);
-+ *prev = cf->next;
-+ free (cf);
-+ }
-+ break;
-+ }
-+ }
-+}
+++ /dev/null
---- xc/programs/Xserver/dix/main.c~ Sat Jun 17 13:42:40 2000
-+++ xc/programs/Xserver/dix/main.c Mon Oct 30 18:02:23 2000
-@@ -256,6 +256,7 @@
- char *envp[];
- {
- int i, j, k, error;
-+ char *xauthfile;
- HWEventQueueType alwaysCheckForInput[2];
-
- /* Notice if we're restarted. Probably this is because we jumped through
-@@ -279,6 +280,10 @@
- argcGlobal = argc;
- argvGlobal = argv;
- display = "0";
-+ /* prep X authority file from environment; this can be overriden by a
-+ * command line option */
-+ xauthfile = getenv("XAUTHORITY");
-+ if (xauthfile) InitAuthorization (xauthfile);
- ProcessCommandLine(argc, argv);
-
- alwaysCheckForInput[0] = 0;
-@@ -286,7 +291,7 @@
- while(1)
- {
- serverGeneration++;
-- ScreenSaverTime = defaultScreenSaverTime;
-+ ScreenSaverTime = defaultScreenSaverTime;
- ScreenSaverInterval = defaultScreenSaverInterval;
- ScreenSaverBlanking = defaultScreenSaverBlanking;
- ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
+++ /dev/null
---- XFree86-3.3.3.1/xc/include/Xpoll.h.alpha-sockets Mon Jan 11 12:28:21 1999
-+++ XFree86-3.3.3.1/xc/include/Xpoll.h Mon Jan 11 12:30:05 1999
-@@ -40,7 +40,7 @@
-
- #include <X11/Xos.h>
- #if !defined(DGUX)
--#if (defined(SVR4) || defined(CRAY) || defined(AIXV3)) && !defined(FD_SETSIZE)
-+#if (defined(SVR4) || defined(CRAY) || defined(AIXV3) || defined(linux)) && !defined(FD_SETSIZE)
- #include <sys/select.h>
- #ifdef luna
- #include <sysent.h>
---- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/compiler.h.alpha-sockets Mon Oct 19 16:39:32 1998
-+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/compiler.h Mon Jan 11 12:28:22 1999
-@@ -161,53 +161,93 @@
- * from linux/include/asm-alpha/unaligned.h
- */
-
--static __inline__ unsigned long ldq_u(unsigned long * r11)
--{
-+/*
-+ * This is a silly but good way to make sure that
-+ * the get/put functions are indeed always optimized,
-+ * and that we use the correct sizes.
-+ */
-+extern void bad_unaligned_access_length(void);
-+
-+/*
-+ * EGCS 1.1 knows about arbitrary unaligned loads. Define some
-+ * packed structures to talk about such things with.
-+ */
-+
-+struct __una_u64 { unsigned long x __attribute__((packed)); };
-+struct __una_u32 { unsigned int x __attribute__((packed)); };
-+struct __una_u16 { unsigned short x __attribute__((packed)); };
-+
-+/*
-+ * Elemental unaligned loads
-+ */
-+
-+extern __inline__ unsigned long ldq_u(const unsigned long * r11)
-+{
-+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
-+ const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
-+ return ptr->x;
-+#else
- unsigned long r1,r2;
- __asm__("ldq_u %0,%3\n\t"
- "ldq_u %1,%4\n\t"
- "extql %0,%2,%0\n\t"
-- "extqh %1,%2,%1\n\t"
-- "bis %1,%0,%0"
-+ "extqh %1,%2,%1"
- :"=&r" (r1), "=&r" (r2)
- :"r" (r11),
- "m" (*r11),
-- "m" (*(unsigned long *)(7+(char *) r11)));
-- return r1;
-+ "m" (*(const unsigned long *)(7+(char *) r11)));
-+ return r1 | r2;
-+#endif
- }
-
--static __inline__ unsigned long ldl_u(unsigned int * r11)
-+extern __inline__ unsigned long ldl_u(const unsigned int * r11)
- {
-+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
-+ const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
-+ return ptr->x;
-+#else
- unsigned long r1,r2;
- __asm__("ldq_u %0,%3\n\t"
- "ldq_u %1,%4\n\t"
- "extll %0,%2,%0\n\t"
-- "extlh %1,%2,%1\n\t"
-- "bis %1,%0,%0"
-+ "extlh %1,%2,%1"
- :"=&r" (r1), "=&r" (r2)
- :"r" (r11),
- "m" (*r11),
-- "m" (*(unsigned long *)(3+(char *) r11)));
-- return r1;
-+ "m" (*(const unsigned long *)(3+(char *) r11)));
-+ return r1 | r2;
-+#endif
- }
-
--static __inline__ unsigned long ldw_u(unsigned short * r11)
-+extern __inline__ unsigned long ldw_u(const unsigned short * r11)
- {
-+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
-+ const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
-+ return ptr->x;
-+#else
- unsigned long r1,r2;
- __asm__("ldq_u %0,%3\n\t"
- "ldq_u %1,%4\n\t"
- "extwl %0,%2,%0\n\t"
-- "extwh %1,%2,%1\n\t"
-- "bis %1,%0,%0"
-+ "extwh %1,%2,%1"
- :"=&r" (r1), "=&r" (r2)
- :"r" (r11),
- "m" (*r11),
-- "m" (*(unsigned long *)(1+(char *) r11)));
-- return r1;
-+ "m" (*(const unsigned long *)(1+(char *) r11)));
-+ return r1 | r2;
-+#endif
- }
-
--static __inline__ void stq_u(unsigned long r5, unsigned long * r11)
--{
-+/*
-+ * Elemental unaligned stores
-+ */
-+
-+extern __inline__ void stq_u(unsigned long r5, unsigned long * r11)
-+{
-+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
-+ struct __una_u64 *ptr = (struct __una_u64 *) r11;
-+ ptr->x = r5;
-+#else
- unsigned long r1,r2,r3,r4;
-
- __asm__("ldq_u %3,%1\n\t"
-@@ -224,10 +264,15 @@
- "=m" (*(unsigned long *)(7+(char *) r11)),
- "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
- :"r" (r5), "r" (r11));
-+#endif
- }
-
--static __inline__ void stl_u(unsigned long r5, unsigned int * r11)
-+extern __inline__ void stl_u(unsigned long r5, unsigned int * r11)
- {
-+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
-+ struct __una_u32 *ptr = (struct __una_u32 *) r11;
-+ ptr->x = r5;
-+#else
- unsigned long r1,r2,r3,r4;
-
- __asm__("ldq_u %3,%1\n\t"
-@@ -244,10 +289,15 @@
- "=m" (*(unsigned long *)(3+(char *) r11)),
- "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
- :"r" (r5), "r" (r11));
-+#endif
- }
-
--static __inline__ void stw_u(unsigned long r5, unsigned short * r11)
-+extern __inline__ void stw_u(unsigned long r5, unsigned short * r11)
- {
-+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
-+ struct __una_u16 *ptr = (struct __una_u16 *) r11;
-+ ptr->x = r5;
-+#else
- unsigned long r1,r2,r3,r4;
-
- __asm__("ldq_u %3,%1\n\t"
-@@ -264,6 +314,7 @@
- "=m" (*(unsigned long *)(1+(char *) r11)),
- "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
- :"r" (r5), "r" (r11));
-+#endif
- }
-
- #define mem_barrier() __asm__ __volatile__("mb" : : : "memory")
---- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86Summa.c.alpha-sockets Mon Jan 11 12:28:16 1999
-+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86Summa.c Mon Jan 11 12:28:22 1999
-@@ -600,7 +600,7 @@
- timeout.tv_sec = 0;
- timeout.tv_usec = 200000;
-
-- SYSCALL(err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout));
-+ SYSCALL(err = select(fd+1, &readfds, NULL, NULL, &timeout));
- if (err == -1) {
- Error("SummaSketch select");
- return NULL;
---- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86Wacom.c.alpha-sockets Mon Jan 11 12:28:16 1999
-+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86Wacom.c Mon Jan 11 12:28:23 1999
-@@ -692,7 +692,7 @@
-
- timeout.tv_sec = 1;
- timeout.tv_usec = 0;
-- SYSCALL(err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout));
-+ SYSCALL(err = select(fd+1, &readfds, NULL, NULL, &timeout));
-
- return err;
- }
---- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86_Mouse.c.alpha-sockets Mon Jan 11 12:28:16 1999
-+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86_Mouse.c Mon Jan 11 12:28:23 1999
-@@ -437,7 +437,7 @@
- write(mouse->mseFd, s, 1);
- FD_ZERO(&fds);
- FD_SET(mouse->mseFd, &fds);
-- if (select(FD_SETSIZE, &fds, NULL, NULL, NULL) <= 0)
-+ if (select(mouse->mseFd+1, &fds, NULL, NULL, NULL) <= 0)
- break;
- read(mouse->mseFd, &c, 1);
- if (c != *s)
---- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86_PnPMouse.c.alpha-sockets Mon Mar 2 05:23:21 1998
-+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86_PnPMouse.c Mon Jan 11 12:28:23 1999
-@@ -235,7 +235,7 @@
- FD_SET(mouse->mseFd, &fds);
- timeout.tv_sec = 0;
- timeout.tv_usec = 200000;
-- if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0) {
-+ if (select(mouse->mseFd+1, &fds, NULL, NULL, &timeout) <= 0) {
-
- /* port setup, 2nd phase (2.1.5) */
- i = TIOCM_DTR | TIOCM_RTS; /* DTR = 0, RTS = 0 */
-@@ -252,7 +252,7 @@
- FD_SET(mouse->mseFd, &fds);
- timeout.tv_sec = 0;
- timeout.tv_usec = 200000;
-- if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0)
-+ if (select(mouse->mseFd+1, &fds, NULL, NULL, &timeout) <= 0)
- goto connect_idle;
- }
- #else
-@@ -277,7 +277,7 @@
- FD_SET(mouse->mseFd, &fds);
- timeout.tv_sec = 0;
- timeout.tv_usec = 200000;
-- if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0)
-+ if (select(mouse->mseFd+1, &fds, NULL, NULL, &timeout) <= 0)
- goto connect_idle;
- #endif
-
-@@ -302,7 +302,7 @@
- FD_SET(mouse->mseFd, &fds);
- timeout.tv_sec = 0;
- timeout.tv_usec = 200000;
-- if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0)
-+ if (select(mouse->mseFd+1, &fds, NULL, NULL, &timeout) <= 0)
- break;
-
- read(mouse->mseFd, &buf[i], 1);
---- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/mga/mga_driver.c.alpha-sockets Mon Jan 11 12:28:17 1999
-+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/mga/mga_driver.c Mon Jan 11 12:28:23 1999
-@@ -1256,6 +1256,16 @@
- MGASave(save)
- vgaHWPtr save;
- {
-+#if NeedFunctionPrototypes
-+ extern void *MGA3026Save(void*);
-+ extern void *MGA1064Save(void*);
-+ extern void *MGA200Save(void*);
-+#else
-+ extern void *MGA3026Save();
-+ extern void *MGA1064Save();
-+ extern void *MGA200Save();
-+#endif
-+
- switch (MGAchipset)
- {
- case PCI_CHIP_MGA2064:
---- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/xaa/xf86bench.c.alpha-sockets Mon Jan 11 12:28:19 1999
-+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/xaa/xf86bench.c Mon Jan 11 12:28:23 1999
-@@ -96,7 +96,7 @@
- unsigned char *end;
- #ifdef __alpha__
- unsigned long data64;
-- data64 = data | (data << 32);
-+ data64 = (unsigned long)data | ((unsigned long)data << 32);
- #endif
- end = dest + nbytes;
- while (dest <= end - 128) {
---- XFree86-3.3.3.1/xc/programs/Xserver/include/os.h.alpha-sockets Thu Jan 22 05:47:13 1998
-+++ XFree86-3.3.3.1/xc/programs/Xserver/include/os.h Mon Jan 11 12:28:23 1999
-@@ -773,4 +773,20 @@
- /* stuff for FlushCallback */
- extern CallbackListPtr FlushCallback;
-
-+#ifdef LONG64
-+
-+/* Systems with 64-bit 'long' have their own quirks, like
-+ select()'s fd_mask components are 64-bit long, but the
-+ ffs() function works only on 'int', which at least at
-+ an Alpha are 32-bit wide... */
-+
-+# define ffs mffs
-+
-+extern int mffs (
-+#if NeedFunctionPrototypes
-+ unsigned long
-+#endif
-+);
-+#endif /* LONG64 */
-+
- #endif /* OS_H */
---- XFree86-3.3.3.1/xc/programs/Xserver/os/WaitFor.c.alpha-sockets Sat Oct 24 03:56:28 1998
-+++ XFree86-3.3.3.1/xc/programs/Xserver/os/WaitFor.c Mon Jan 11 12:28:23 1999
-@@ -83,9 +83,10 @@
- #include "dixstruct.h"
- #include "opaque.h"
-
--/* modifications by raphael */
--#define ffs mffs
--int mffs(fd_mask mask) {
-+/* modifications by raphael, and [mea];
-+ system uses this if LONG64 is defined.
-+ See at the end of the "os.h" */
-+int mffs(unsigned long mask) {
- register i;
- if ( ! mask ) return 0;
- i = 1;
-@@ -423,17 +424,18 @@
- if (XFD_ANYSET (&clientsReadable))
- {
- #ifndef WIN32
-- for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++)
-+ for (i=0;
-+ i < (sizeof(clientsReadable)/sizeof(clientsReadable.fds_bits[0]));
-+ i++)
- {
- int highest_priority;
-
- while (clientsReadable.fds_bits[i])
- {
- int client_priority, client_index;
--
- curclient = ffs (clientsReadable.fds_bits[i]) - 1;
-- client_index = /* raphael: modified */
-- ConnectionTranslation[curclient + (i * (sizeof(fd_mask) * 8))];
-+ curclient += i * (8 * sizeof(fd_mask));
-+ client_index = ConnectionTranslation[curclient];
- #else
- int highest_priority;
- fd_set savedClientsReadable;
-@@ -476,11 +478,10 @@
- {
- pClientsReady[nready++] = client_index;
- }
-+
-+ FD_CLR(curclient, &clientsReadable);
- #ifndef WIN32
-- clientsReadable.fds_bits[i] &= ~(((fd_mask)1) << curclient);
- }
--#else
-- FD_CLR(curclient, &clientsReadable);
- #endif
- }
- }
-@@ -541,12 +542,13 @@
- COPYBITS(ClientsWithInput, clientsReadable);
- dbprintf(("WaitFor: "));
- nready = 0;
-- for (i=0; i < mskcnt; i++) {
-+ for (i=0; i < mskcnt;i++) {
- while (clientsReadable[i]) {
- int client_priority, curclient, client_index;
-
- curclient = ffs (clientsReadable[i]) - 1;
-- client_index = ConnectionTranslation[curclient + (i << 5)];
-+ curclient += i * (8 * sizeof(clientsReadable[i]));
-+ client_index = ConnectionTranslation[curclient];
- dbprintf(("%d has input\n", curclient));
- #ifdef XSYNC
- client_priority = clients[client_index]->priority;
-@@ -794,7 +796,7 @@
- {
- OsTimerPtr timer;
-
-- while (timer = timers)
-+ while ((timer = timers))
- {
- timers = timer->next;
- xfree(timer);
---- XFree86-3.3.3.1/xc/programs/Xserver/os/connection.c.alpha-sockets Mon Jan 11 12:28:20 1999
-+++ XFree86-3.3.3.1/xc/programs/Xserver/os/connection.c Mon Jan 11 12:28:23 1999
-@@ -178,10 +178,6 @@
- #include <netdnet/dn.h>
- #endif /* DNETCONN */
-
--/* added by raphael */
--#define ffs mffs
--extern int mffs(long);
--
- extern char *display; /* The display number */
- int lastfdesc; /* maximum file descriptor */
-
-@@ -785,6 +781,8 @@
- {
- #ifndef WIN32
- fd_mask readyconnections; /* mask of listeners that are ready */
-+ /* In UNIX environments we assume that all listeners fit into
-+ the first 32 file descriptor ids. */
- #else
- fd_set readyconnections; /* set of listeners that are ready */
- #endif
-@@ -981,9 +979,6 @@
- void
- CheckConnections()
- {
--#ifndef WIN32
-- fd_mask mask;
--#endif
- fd_set tmask;
- register int curclient, curoff;
- int i;
-@@ -994,23 +989,24 @@
- #endif
-
- #ifndef AMOEBA
-- notime.tv_sec = 0;
-- notime.tv_usec = 0;
--
- #ifndef WIN32
-- for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++)
-+ for (i=0; i < (sizeof(AllClients)/sizeof(fd_mask)); i++)
- {
-- mask = AllClients.fds_bits[i];
-+ fd_mask mask = AllClients.fds_bits[i];
- while (mask)
- {
- curoff = ffs (mask) - 1;
-- curclient = curoff + (i << 5);
-+ curclient = curoff + (i * 8 * sizeof(mask));
- FD_ZERO(&tmask);
- FD_SET(curclient, &tmask);
-+ /* there are operating systems which *do* alter the timeout
-+ variables -- it is good practice to initialize them always */
-+ notime.tv_sec = 0;
-+ notime.tv_usec = 0;
- r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime);
- if (r < 0)
- CloseDownClient(clients[ConnectionTranslation[curclient]]);
-- mask &= ~(1 << curoff);
-+ mask &= ~(((fd_mask)1) << curoff);
- }
- }
- #else
---- XFree86-3.3.3.1/xc/programs/Xserver/os/io.c.alpha-sockets Sat Oct 24 03:56:29 1998
-+++ XFree86-3.3.3.1/xc/programs/Xserver/os/io.c Mon Jan 11 12:28:23 1999
-@@ -85,10 +85,6 @@
- #include "lbxserve.h"
- #endif
-
--/* added by raphael */
--#define ffs mffs
--extern int mffs(long);
--
- CallbackListPtr ReplyCallback;
- CallbackListPtr FlushCallback;
-
-@@ -995,7 +991,7 @@
- NewOutputPending = FALSE;
-
- #ifndef WIN32
-- for (base = 0; base < howmany(XFD_SETSIZE, NFDBITS); base++)
-+ for (base = 0; base < (sizeof(OutputPending)/sizeof(fd_mask)); base++)
- {
- mask = OutputPending.fds_bits[ base ];
- OutputPending.fds_bits[ base ] = 0;
-@@ -1003,7 +999,8 @@
- {
- index = ffs(mask) - 1;
- mask &= ~lowbit(mask);
-- if ((index = ConnectionTranslation[(base << 5) + index]) == 0)
-+ index = ConnectionTranslation[ base * (8 * sizeof(mask)) + index ];
-+ if (index == 0)
- continue;
- client = clients[index];
- if (client->clientGone)
---- XFree86-3.3.3.1/xc/programs/lbxproxy/include/os.h.alpha-sockets Sat Dec 21 23:16:36 1996
-+++ XFree86-3.3.3.1/xc/programs/lbxproxy/include/os.h Mon Jan 11 12:28:23 1999
-@@ -243,4 +243,20 @@
- #endif
- );
-
-+#ifdef LONG64
-+
-+/* Systems with 64-bit 'long' have their own quirks, like
-+ select()'s fd_mask components are 64-bit long, but the
-+ ffs() function works only on 'int', which at least at
-+ an Alpha are 32-bit wide... */
-+
-+# define ffs mffs
-+
-+extern int mffs (
-+#if NeedFunctionPrototypes
-+ unsigned long
-+#endif
-+);
-+#endif /* LONG64 */
-+
- #endif
---- XFree86-3.3.3.1/xc/programs/lbxproxy/os/WaitFor.c.alpha-sockets Sat Dec 21 23:16:30 1996
-+++ XFree86-3.3.3.1/xc/programs/lbxproxy/os/WaitFor.c Mon Jan 11 12:28:23 1999
-@@ -71,6 +71,20 @@
- #include "osdep.h"
- #include "os.h"
-
-+/* modifications by raphael, and [mea];
-+ system uses this if LONG64 is defined.
-+ See at the end of the "os.h" */
-+int mffs(unsigned long mask) {
-+ register i;
-+ if ( ! mask ) return 0;
-+ i = 1;
-+ while (! (mask & 1)) {
-+ i++;
-+ mask = mask >> 1;
-+ }
-+ return i;
-+}
-+
- extern fd_set AllSockets;
- extern fd_set AllClients;
- extern fd_set LastSelectMask;
-@@ -192,17 +206,18 @@
- nready = 0;
- if (XFD_ANYSET(&clientsReadable))
- {
-- for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++)
-+ for (i=0; i < (sizeof(clientsReadable)/sizeof(fd_mask)); i++)
- {
- while (clientsReadable.fds_bits[i])
- {
- int client_index;
-
- curclient = ffs (clientsReadable.fds_bits[i]) - 1;
-- client_index = ConnectionTranslation[curclient + (i << 5)];
-- {
-- pClientsReady[nready++] = client_index;
-- }
-+ curclient += i * (8 * sizeof(fd_mask));
-+ client_index = ConnectionTranslation[curclient];
-+
-+ pClientsReady[nready++] = client_index;
-+
- clientsReadable.fds_bits[i] &= ~(((fd_mask)1) << curclient);
- }
- }
---- XFree86-3.3.3.1/xc/programs/lbxproxy/os/connection.c.alpha-sockets Thu Nov 5 14:27:57 1998
-+++ XFree86-3.3.3.1/xc/programs/lbxproxy/os/connection.c Mon Jan 11 12:28:23 1999
-@@ -1746,7 +1746,7 @@
- while (readyconnections)
- {
- curconn = ffs (readyconnections) - 1;
-- readyconnections &= ~(1 << curconn);
-+ readyconnections &= ~(((fd_mask)1) << curconn);
- if ((newconn = accept (curconn,
- (struct sockaddr *) NULL,
- (int *)NULL)) < 0)
-@@ -1905,19 +1905,19 @@
- notime.tv_sec = 0;
- notime.tv_usec = 0;
-
-- for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++)
-+ for (i=0; i < (sizeof(AllClients)/sizeof(fd_mask)); i++)
- {
- mask = AllClients.fds_bits[i];
- while (mask)
- {
- curoff = ffs (mask) - 1;
-- curclient = curoff + (i << 5);
-+ curclient = curoff + i * (8 * sizeof(mask));
- FD_ZERO(&tmask);
- FD_SET(curclient, &tmask);
- r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime);
- if (r < 0)
- CloseDownClient(clients[ConnectionTranslation[curclient]]);
-- mask &= ~(1 << curoff);
-+ mask &= ~(((fd_mask)1) << curoff);
- }
- }
- }
---- XFree86-3.3.3.1/xc/programs/lbxproxy/os/io.c.alpha-sockets Wed Jan 1 22:02:48 1997
-+++ XFree86-3.3.3.1/xc/programs/lbxproxy/os/io.c Mon Jan 11 12:28:23 1999
-@@ -913,7 +913,8 @@
- void
- FlushAllOutput()
- {
-- register int index, base, mask;
-+ register int index, base;
-+ register fd_mask mask;
- OsCommPtr oc;
- register ClientPtr client;
-
-@@ -927,7 +928,7 @@
- */
- NewOutputPending = FALSE;
-
-- for (base = 0; base < howmany(XFD_SETSIZE, NFDBITS); base++)
-+ for (base = 0; base < (sizeof(OutputPending)/sizeof(mask)); base++)
- {
- mask = OutputPending.fds_bits[ base ];
- OutputPending.fds_bits[ base ] = 0;
-@@ -935,7 +936,9 @@
- {
- index = ffs(mask) - 1;
- mask &= ~lowbit(mask);
-- if ((index = ConnectionOutputTranslation[(base << 5) + index]) == 0)
-+ index += base * (8 * sizeof(mask));
-+ index = ConnectionOutputTranslation[index];
-+ if (index == 0)
- continue;
- client = clients[index];
- if (client->clientGone)
---- XFree86-3.3.3.1/xc/programs/xfs/include/os.h.alpha-sockets Fri Jan 5 08:21:30 1996
-+++ XFree86-3.3.3.1/xc/programs/xfs/include/os.h Mon Jan 11 12:28:23 1999
-@@ -94,4 +94,19 @@
- extern int ListCatalogues();
- extern int ListAlternateServers();
-
-+#ifdef LONG64
-+
-+/* Systems with 64-bit 'long' have their own quirks, like
-+ select()'s fd_mask components are 64-bit long, but the
-+ ffs() function works only on 'int', which at least at
-+ an Alpha are 32-bit wide... */
-+
-+# define ffs mffs
-+
-+extern int mffs (
-+#if NeedFunctionPrototypes
-+ unsigned long
-+#endif
-+);
-+#endif /* LONG64 */
- #endif /* _OS_H_ */
---- XFree86-3.3.3.1/xc/programs/xfs/os/connection.c.alpha-sockets Thu Nov 5 14:28:31 1998
-+++ XFree86-3.3.3.1/xc/programs/xfs/os/connection.c Mon Jan 11 12:28:23 1999
-@@ -325,6 +325,9 @@
-
- /*
- * accepts new connections
-+ *
-+ * This assumes that all sockets in *listen* mode are numbered
-+ * something below 32! (likely true..)
- */
- void
- MakeNewConnections()
-@@ -495,15 +498,15 @@
- struct timeval notime;
- int r;
-
-- notime.tv_sec = 0;
-- notime.tv_usec = 0;
--
- XFD_COPYSET(&AllClients, &mask);
- for (i = 0; i < howmany(XFD_SETSIZE, NFDBITS); i++) {
- while (mask.fds_bits[i]) {
-- curclient = ffs(mask.fds_bits[i]) - 1 + (i << 5);
-+ curclient = ffs(mask.fds_bits[i]) - 1;
-+ curclient += i * (8 * sizeof(mask.fds_bits[i]));
- FD_ZERO(&tmask);
- FD_SET(curclient, &tmask);
-+ notime.tv_sec = 0;
-+ notime.tv_usec = 0;
- r = Select(curclient + 1, &tmask, NULL, NULL, ¬ime);
- if (r < 0)
- CloseDownClient(clients[ConnectionTranslation[curclient]]);
---- XFree86-3.3.3.1/xc/programs/xfs/os/io.c.alpha-sockets Thu May 29 10:01:08 1997
-+++ XFree86-3.3.3.1/xc/programs/xfs/os/io.c Mon Jan 11 12:28:23 1999
-@@ -69,6 +69,7 @@
- #include "X11/Xpoll.h"
- #include "osdep.h"
- #include "globals.h"
-+#include "os.h"
-
- #ifdef X_NOT_STDC_ENV
- extern int errno;
-@@ -530,13 +531,14 @@
-
- NewOutputPending = FALSE;
-
-- for (base = 0; base < howmany(XFD_SETSIZE, NFDBITS); base++) {
-+ for (base = 0; base < (sizeof(OutputPending)/sizeof(mask)); base++) {
- mask = OutputPending.fds_bits[base];
- OutputPending.fds_bits[base] = 0;
- while (mask) {
- index = ffs(mask) - 1;
- mask &= ~lowbit(mask);
-- if ((index = ConnectionTranslation[(base << 5) + index]) == 0)
-+ index += base * (8 * sizeof(mask));
-+ if ((index = ConnectionTranslation[index]) == 0)
- continue;
- client = clients[index];
- if (client->clientGone == CLIENT_GONE)
---- XFree86-3.3.3.1/xc/programs/xfs/os/waitfor.c.alpha-sockets Sat Jan 18 02:02:48 1997
-+++ XFree86-3.3.3.1/xc/programs/xfs/os/waitfor.c Mon Jan 11 12:28:23 1999
-@@ -65,6 +65,21 @@
- #include "globals.h"
- #include "X11/Xpoll.h"
- #include "osdep.h"
-+#include "os.h"
-+
-+/* modifications by raphael, and [mea];
-+ system uses this if LONG64 is defined.
-+ See at the end of the "os.h" */
-+int mffs(unsigned long mask) {
-+ register i;
-+ if ( ! mask ) return 0;
-+ i = 1;
-+ while (! (mask & 1)) {
-+ i++;
-+ mask = mask >> 1;
-+ }
-+ return i;
-+}
-
- #ifdef MINIX
- #include <sys/nbio.h>
-@@ -208,10 +223,11 @@
-
- if (current_time) /* may not have been set */
- current_time = GetTimeInMillis();
-- for (i = 0; i < howmany(XFD_SETSIZE, NFDBITS); i++) {
-+ for (i = 0; i < (sizeof(clientsReadable)/sizeof(fd_mask)); i++) {
- while (clientsReadable.fds_bits[i]) {
- curclient = ffs(clientsReadable.fds_bits[i]) - 1;
-- conn = ConnectionTranslation[curclient + (i << 5)];
-+ curclient += i * (8 * sizeof(fd_mask));
-+ conn = ConnectionTranslation[curclient];
- FD_CLR (curclient, &clientsReadable);
- client = clients[conn];
- if (!client)
+++ /dev/null
-diff -urN ati.old.org/ati.c ati.old/ati.c
---- ati.old.org/ati.c Wed Mar 13 11:18:18 2002
-+++ ati.old/ati.c Wed Mar 13 21:05:26 2002
-@@ -90,7 +90,7 @@
- DriverRec ATI =
- {
- ATI_VERSION_CURRENT,
-- "ati",
-+ "ati_old",
- ATIIdentify,
- ATIProbe,
- ATIAvailableOptions,
-diff -urN ati.old.org/atimisc.c ati.old/atimisc.c
---- ati.old.org/atimisc.c Wed Mar 13 11:18:18 2002
-+++ ati.old/atimisc.c Wed Mar 13 11:19:27 2002
-@@ -71,7 +71,7 @@
- }
-
- /* The following record must be called atimiscModuleData */
--XF86ModuleData atimiscModuleData =
-+XF86ModuleData atimisc_oldModuleData =
- {
- &ATIVersionRec,
- ATISetup,
-diff -urN ati.old.org/atimodule.c ati.old/atimodule.c
---- ati.old.org/atimodule.c Wed Mar 13 11:18:18 2002
-+++ ati.old/atimodule.c Wed Mar 13 11:19:40 2002
-@@ -116,7 +116,7 @@
- }
-
- /* The following record must be called atiModuleData */
--XF86ModuleData atiModuleData =
-+XF86ModuleData ati_oldModuleData =
- {
- &ATIVersionRec,
- ATISetup,
-diff -urN ati.old.org/atiprobe.c ati.old/atiprobe.c
---- ati.old.org/atiprobe.c Wed Mar 13 11:18:44 2002
-+++ ati.old/atiprobe.c Mon Mar 11 13:14:51 2002
-@@ -2275,10 +2275,10 @@
-
- #ifdef XFree86LOADER
-
-- if (!xf86LoadSubModule(pScreenInfo, "atimisc"))
-+ if (!xf86LoadSubModule(pScreenInfo, "atimisc_old"))
- {
- xf86Msg(X_ERROR,
-- ATI_NAME ": Failed to load \"atimisc\" module.\n");
-+ ATI_NAME ": Failed to load \"atimisc_old\" module.\n");
- xf86DeleteScreen(pScreenInfo->scrnIndex, 0);
- continue;
- }
-diff -urN ati.old.org/ativersion.h ati.old/ativersion.h
---- ati.old.org/ativersion.h Wed Mar 13 11:18:44 2002
-+++ ati.old/ativersion.h Mon Mar 11 13:14:51 2002
-@@ -25,7 +25,7 @@
- #define ___ATIVERSION_H___ 1
-
- #define ATI_NAME "ATI"
--#define ATI_DRIVER_NAME "ati"
-+#define ATI_DRIVER_NAME "ati_old"
-
- #define ATI_VERSION_NAME "6.4.8"
-
-diff -urN ati.old.org/r128_misc.c ati.old/r128_misc.c
---- ati.old.org/r128_misc.c Wed Mar 13 11:18:18 2002
-+++ ati.old/r128_misc.c Wed Mar 13 11:20:02 2002
-@@ -74,7 +74,7 @@
- }
-
- /* The following record must be called r128ModuleData */
--XF86ModuleData r128ModuleData =
-+XF86ModuleData r128_oldModuleData =
- {
- &R128VersionRec,
- R128Setup,
-diff -urN ati.old.org/r128_probe.c ati.old/r128_probe.c
---- ati.old.org/r128_probe.c Wed Mar 13 11:18:44 2002
-+++ ati.old/r128_probe.c Mon Mar 11 13:14:51 2002
-@@ -205,9 +205,9 @@
-
- #ifdef XFree86LOADER
-
-- if (!xf86LoadSubModule(pScrn, "r128")) {
-+ if (!xf86LoadSubModule(pScrn, "r128_old")) {
- xf86Msg(X_ERROR,
-- R128_NAME ": Failed to load \"r128\" module.\n");
-+ R128_NAME ": Failed to load \"r128_old\" module.\n");
- xf86DeleteScreen(pScrn->scrnIndex, 0);
- continue;
- }
-diff -urN ati.old.org/r128_version.h ati.old/r128_version.h
---- ati.old.org/r128_version.h Wed Mar 13 11:18:18 2002
-+++ ati.old/r128_version.h Wed Mar 13 21:07:17 2002
-@@ -25,7 +25,7 @@
- #define _R128_VERSION_H_ 1
-
- #define R128_NAME "R128"
--#define R128_DRIVER_NAME "r128"
-+#define R128_DRIVER_NAME "r128_old"
-
- #define R128_VERSION_NAME "4.0.1"
-
-diff -urN ati.old.org/radeon_misc.c ati.old/radeon_misc.c
---- ati.old.org/radeon_misc.c Wed Mar 13 11:18:18 2002
-+++ ati.old/radeon_misc.c Wed Mar 13 11:20:20 2002
-@@ -74,7 +74,7 @@
- }
-
- /* The following record must be called radeonModuleData */
--XF86ModuleData radeonModuleData =
-+XF86ModuleData radeon_oldModuleData =
- {
- &RADEONVersionRec,
- RADEONSetup,
-diff -urN ati.old.org/radeon_probe.c ati.old/radeon_probe.c
---- ati.old.org/radeon_probe.c Wed Mar 13 11:18:44 2002
-+++ ati.old/radeon_probe.c Mon Mar 11 13:14:51 2002
-@@ -203,9 +203,9 @@
- {
- #ifdef XFree86LOADER
-
-- if (!xf86LoadSubModule(pScrn, "radeon")) {
-+ if (!xf86LoadSubModule(pScrn, "radeon_old")) {
- xf86Msg(X_ERROR,
-- RADEON_NAME ": Failed to load \"radeon\" module.\n");
-+ RADEON_NAME ": Failed to load \"radeon_old\" module.\n");
- xf86DeleteScreen(pScrn->scrnIndex, 0);
- continue;
- }
-diff -urN ati.old.org/radeon_version.h ati.old/radeon_version.h
---- ati.old.org/radeon_version.h Wed Mar 13 11:18:18 2002
-+++ ati.old/radeon_version.h Wed Mar 13 21:07:52 2002
-@@ -25,7 +25,7 @@
- #define _RADEON_VERSION_H_ 1
-
- #define RADEON_NAME "RADEON"
--#define RADEON_DRIVER_NAME "radeon"
-+#define RADEON_DRIVER_NAME "radeon_old"
-
- #define RADEON_VERSION_NAME "4.0.1"
-
+++ /dev/null
-diff -urN aaa/xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c
---- aaa/xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c 2003-07-25 13:04:20.000000000 +0200
-+++ xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c 2003-07-29 22:09:08.000000000 +0200
-@@ -333,7 +333,7 @@
-
- xf86LoaderReqSymLists(i2cSymbols, NULL);
-
-- if (!dev = xf86I2CFindDev(pBus, 0x00A0)) {
-+ if (!(dev = xf86I2CFindDev(pBus, 0x00A0))) {
- dev = xf86CreateI2CDevRec();
- dev->DevName = "ddc2";
- dev->SlaveAddr = 0xA0;
+++ /dev/null
---- XFree86-4.0.1/xc/config/cf/linux.cf.cpp Sun Aug 6 18:33:24 2000
-+++ XFree86-4.0.1/xc/config/cf/linux.cf Sun Aug 6 18:33:31 2000
-@@ -408,7 +408,7 @@
- #define YaccCmd bison -y
- #define LexCmd flex -l
- #define LexLib -lfl
--#define PreProcessCmd CcCmd -E
-+#define PreProcessCmd cpp
- #define PostIncDir DefaultGccIncludeDir
- #define LdCombineFlags -r
- #ifndef LdPostLib
+++ /dev/null
-diff -ruN XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/Imakefile XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/Imakefile
---- XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/Imakefile Wed Jun 23 08:37:21 1999
-+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/Imakefile Sat Oct 24 03:54:44 1998
-@@ -1,4 +1,4 @@
--XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/Imakefile,v 1.1.2.9 1999/06/23 12:37:21 hohndel Exp $
-+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/Imakefile,v 1.1.2.8 1998/10/22 04:31:05 hohndel Exp $
- XCOMM
- XCOMM This is an Imakefile for the cyrix driver.
- XCOMM
-@@ -6,10 +6,10 @@
- #include <Server.tmpl>
-
- SRCS = cyrix_driver.c cyrix_accel.c cyrix_cursor.c cyrix_cmap.c cyrix_bank.s \
-- cyrix_asm.s gxrender.c
-+ cyrix_asm.s
-
- OBJS = cyrix_driver.o cyrix_accel.o cyrix_cursor.o cyrix_cmap.o cyrix_bank.o \
-- cyrix_asm.o gxrender.o
-+ cyrix_asm.o
-
- DEFINES = -DPSZ=8
-
-@@ -61,7 +61,6 @@
- InstallLinkKitNonExecFile(cyrix_driver.c,$(LINKKITDIR)/drivers/vga256/cyrix)
- InstallLinkKitNonExecFile(cyrix_bank.s,$(LINKKITDIR)/drivers/vga256/cyrix)
- InstallLinkKitNonExecFile(cyrix_asm.s,$(LINKKITDIR)/drivers/vga256/cyrix)
--InstallLinkKitNonExecFile(gxrender.c,$(LINKKITDIR)/drivers/vga256/cyrix)
- InstallLinkKitNonExecFile(Imakefile,$(LINKKITDIR)/drivers/vga256/cyrix)
-
- XCOMM
-@@ -82,4 +81,3 @@
- XCOMM Install Link Kit Non Exec File(Imakefile,$(LINKKITDIR)/drivers/vga16/cyrix)
-
- DependTarget()
--
-diff -ruN XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix.h XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix.h
---- XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix.h Tue Dec 22 02:49:58 1998
-+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix.h Fri Nov 6 11:41:51 1998
-@@ -1,5 +1,5 @@
-
--/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix.h,v 1.1.2.6 1998/12/22 07:49:58 hohndel Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix.h,v 1.1.2.5 1998/11/06 09:47:02 hohndel Exp $ */
-
- /* this code is partly based on the MediaGX sources from the GGI project
- based on CYRIX example code (gxvideo.c) and included with CYRIX and
-@@ -88,10 +88,9 @@
- #define CYRIXsetVectorMode() \
- GX_REG(GP_VECTOR_MODE) = (vectorMode)
-
--#define IfDest(rop, planemask, val) \
-- (( (((rop) & 0x5) ^ (((rop) & 0xA) >> 1)) \
-- || (~((planemask) & 0xFF)) \
-- ) ? (val) : 0)
-+#define IfDest(xrop, val) ((((xrop) & 0x5) ^ (((xrop) & 0xA) >> 1)) ? (val) : 0)
-+
-+
-
- /* Generic MediaGX hardware register and value definitions */
-
-diff -ruN XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_accel.c XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_accel.c
---- XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_accel.c Wed Jun 23 08:37:21 1999
-+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_accel.c Fri Nov 6 11:41:51 1998
-@@ -1,7 +1,6 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_accel.c,v 1.1.2.6 1999/06/23 12:37:21 hohndel Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_accel.c,v 1.1.2.3 1998/11/06 09:47:04 hohndel Exp $ */
-
- /*
-- * Copyright 1999 by Brian Falardeau.
- * Copyright 1998 by Annius Groenink, Amsterdam.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
-@@ -33,6 +32,7 @@
- #include "cyrix.h"
- #include "miline.h"
-
-+
- /* size of color expand source area (embedded in frame buffer) */
- #define CYRIXexpandSize 32768
-
-@@ -41,64 +41,17 @@
- upper nybble inverted X raster operation (bits 0 - 3 correspond to
- bits 3 - 0 and 7 - 4 in Windows style ROP). In some routines,
- the role of source and pattern is inverted. */
--
--/* The following ROPs only use pattern and destination data. */
--/* They are used when the planemask specifies all planes (no mask). */
--
--static const int windowsROPpat[16] = {
-- 0x00, /* GXclear = 0 */
-- 0xA0, /* GXand = pat AND dst */
-- 0x50, /* GXandReverse = pat AND NOT dst */
-- 0xF0, /* GXcopy = pat */
-- 0x0A, /* GXandInverted = NOT pat AND dst */
-- 0xAA, /* GXnoop = dst */
-- 0x5A, /* GXxor = pat XOR dst */
-- 0xFA, /* GXor = pat OR dst */
-- 0x05, /* GXnor = NOT pat AND NOT dst */
-- 0xA5, /* GXequiv = NOT pat XOR dst */
-- 0x55, /* GXinvert = NOT dst */
-- 0xF5, /* GXorReverse = pat OR NOT dst */
-- 0x0F, /* GXcopyInverted = NOT pat */
-- 0xAF, /* GXorInverted = NOT pat OR dst */
-- 0x5F, /* GXnand = NOT pat OR NOT dst */
-- 0xFF, /* GXset = 1 */
--};
--
--/* The following ROPs use source data to specify a planemask. */
--/* If the planemask (src) is one, then the result is the appropriate */
--/* combination of pattern and destination data. If the planemask (src) */
--/* is zero, then the result is always just destination data. */
--
--static const int windowsROPsrcMask[16] = {
-- 0x22, /* GXclear => 0 if src = 1, dst if src = 0 */
-- 0xA2, /* GXand = pat AND dst if src = 1, dst if src = 0 */
-- 0x62, /* GXandReverse = pat AND NOT dst if src = 1, dst if src = 0 */
-- 0xE2, /* GXcopy = pat if src = 1, dst if src = 0 */
-- 0x2A, /* GXandInverted = NOT pat AND dst if src = 1, dst if src = 0 */
-- 0xAA, /* GXnoop = dst if src = 1, dst if src = 0 */
-- 0x6A, /* GXxor = pat XOR dst if src = 1, dst if src = 0 */
-- 0xEA, /* GXor = pat OR dst if src = 1, dst if src = 0 */
-- 0x26, /* GXnor = NOT pat AND NOT dst if src = 1, dst if src = 0 */
-- 0xA6, /* GXequiv = NOT pat XOR dst if src = 1, dst if src = 0 */
-- 0x66, /* GXinvert = NOT dst if src = 1, dst if src = 0 */
-- 0xE6, /* GXorReverse = pat OR NOT dst if src = 1, dst if src = 0 */
-- 0x2E, /* GXcopyInverted = NOT pat if src = 1, dst if src = 0 */
-- 0xAE, /* GXorInverted = NOT pat OR dst if src = 1, dst if src = 0 */
-- 0x6E, /* GXnand = NOT pat OR NOT dst if src = 1, dst if src = 0 */
-- 0xEE, /* GXset = 1 if src = 1, dst if src = 0 */
--};
--
--/* The following ROPs use pattern data to specify a planemask. */
--/* If the planemask (pat) is one, then the result is the appropriate */
--/* combination of source and destination data. If the planemask (pat) */
--/* is zero, then the result is always just destination data. */
--
- static const int windowsROPpatMask[16] = { 0x0A, 0x8A, 0x4A, 0xCA,
- 0x2A, 0xAA, 0x6A, 0xEA,
- 0x1A, 0x9A, 0x5A, 0xDA,
- 0x3A, 0xBA, 0x7A, 0xFA };
-
-+static const int windowsROPsrcMask[16] = { 0x22, 0xA2, 0x62, 0xE2,
-+ 0x2A, 0xAA, 0x6A, 0xEA,
-+ 0x26, 0xA6, 0x66, 0xE6,
-+ 0x2E, 0xAE, 0x6E, 0xEE };
-
-+static int bltBufWidth;
-
- static int blitMode;
- static int vectorMode;
-@@ -106,85 +59,25 @@
- static int copyXdir;
- static int setBlitModeOnSync = 0;
-
--/* STATIC VARIABLES FOR THIS FILE */
--/* Used to maintain state between setup and rendering calls. */
--
--static int CYRIXsavedROP;
--static int CYRIXtransparent;
--static int CYRIXtransColor;
--static int CYRIXstartMonoExpand = 0;
--
--static unsigned short CYRIXsaveX, CYRIXsaveY, CYRIXsaveW, CYRIXsaveH;
-
- /* Forward declaration of functions used in the driver */
--
- void CYRIXAccelSync();
- void CYRIXAccelInit();
- void CYRIXSetupForFillRectSolid();
- void CYRIXSubsequentFillRectSolid();
--void CYRIXSetupFor8x8PatternColorExpand();
--void CYRIXSubsequent8x8PatternColorExpand();
- void CYRIXSetupForScreenToScreenCopy();
- void CYRIXSubsequentScreenToScreenCopy();
--
- void CYRIXSubsequentBresenhamLine();
-+void CYRIXSetupFor8x8PatternColorExpand();
-+void CYRIXSubsequent8x8PatternColorExpand();
- void CYRIXSetupForCPUToScreenColorExpand();
- void CYRIXSubsequentCPUToScreenColorExpand();
-
--/* Routines in GXRENDER.C */
--
--void gxr_initialize(unsigned char *regptr, unsigned short bpp,
-- unsigned short BB0base, unsigned short BB1base,
-- unsigned short BBwidthPixels);
--
--void gxr_wait_until_idle(void);
--
--void gxr_load_solid_source(unsigned short color);
--
--void gxr_load_mono_source(unsigned short bgcolor, unsigned short fgcolor,
-- unsigned short transparent);
--
--void gxr_load_solid_pattern(unsigned short color);
--
--void gxr_load_mono_pattern(unsigned short bgcolor, unsigned short fgcolor,
-- unsigned long data0, unsigned long data1, unsigned char transparency);
--
--void gxr_load_raster_operation(unsigned char rop);
--
--void gxr_pattern_fill(unsigned short x, unsigned short y,
-- unsigned short width, unsigned short height);
--
--void gxr_screen_to_screen_blt(unsigned short srcx, unsigned short srcy,
-- unsigned short dstx, unsigned short dsty, unsigned short width,
-- unsigned short height);
--
--void gxr_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy,
-- unsigned short dstx, unsigned short dsty, unsigned short width,
-- unsigned short height, unsigned short color);
--
--void gxr_text_glyph(unsigned short srcx, unsigned short srcy,
-- unsigned short dstx, unsigned short dsty, unsigned short width,
-- unsigned short height, unsigned char *data, unsigned short pitch);
--
--void gxr_bresenham_line(unsigned short x, unsigned short y,
-- unsigned short length, unsigned short initerr,
-- unsigned short axialerr, unsigned short diagerr,
-- unsigned short flags);
--
--/*
--//---------------------------------------------------------------------------
--// CYRIXAccelInit
--//
--// This routine hooks the acceleration routines and sets appropriate flags.
--//---------------------------------------------------------------------------
--*/
-
-+/* Acceleration init function, sets up pointers to our accelerated functions */
- void
- CYRIXAccelInit()
--{
-- int bltBufWidth;
--
-- /* General acceleration flags */
-+{ /* General acceleration flags */
- xf86AccelInfoRec.Flags = PIXMAP_CACHE
- | BACKGROUND_OPERATIONS
- | HARDWARE_PATTERN_SCREEN_ORIGIN
-@@ -245,344 +138,232 @@
-
- /* calculate the pixel width of a blit buffer for convenience */
- bltBufWidth = CYRIXbltBufSize / (vgaBitsPerPixel / 8);
-+}
-
-- /* pass parameters to GXRENDER.C file */
-
-- gxr_initialize((unsigned char *) GXregisters,
-- (unsigned short) vgaBitsPerPixel,
-- (unsigned short) CYRIXbltBuf0Address,
-- (unsigned short) CYRIXbltBuf1Address,
-- (unsigned short) bltBufWidth);
--}
-+/* set colors - called through access macros in cyrix.h */
-+static __inline__ void CYRIXsetColors01(reg, col0, col1)
-+int reg;
-+int col0;
-+int col1;
-+{ if (vgaBitsPerPixel == 16)
-+ GX_REG(reg) = ((col1 & 0xFFFF) << 16) | (col0 & 0xFFFF);
-+ else
-+ { col0 &= 0xFF;
-+ col1 &= 0xFF;
-+ GX_REG(reg) = (col1 << 24) | (col1 << 16) | (col0 << 8) | col0;
-+} }
-
--/*
--//---------------------------------------------------------------------------
--// CYRIXAccelSync
--//
--// This routine is called before accessing the frame buffer directly to
--// make sure that the graphics pipeline is idle. It is also called after
--// loading the monochrome data into BB0 for bitmap to screen BLTs.
--//---------------------------------------------------------------------------
--*/
-
-+/* The generic Sync() function that waits for everything to
-+ be completed (e.g. before writing to the frame buffer
-+ directly). */
- void
- CYRIXAccelSync()
--{
-- /* CHECK IF END TO CPU TO SCREEN EXPAND BLT */
--
-- if (CYRIXstartMonoExpand)
-- {
-- /* START CPU TO SCREEN EXPAND BLT */
-- /* Data has already been loaded into BB0, so use NULL pointer. */
--
-- /* this is formally incorrect: XAA may use both BB0 and BB1
-- for the text source bitmap, so READ_DST_FB1 should not be
-- used. So far, this problem has not manifested itself in
-- practice. */
--
-- CYRIXstartMonoExpand = 0;
-- gxr_text_glyph(0, 0, CYRIXsaveX, CYRIXsaveY, CYRIXsaveW,
-- CYRIXsaveH, 0, 0);
-+{ if (setBlitModeOnSync)
-+ { setBlitModeOnSync = 0;
-+ CYRIXsetupSync();
-+ CYRIXsetBlitMode();
- }
--
-- /* WAIT UNTIL IDLE */
--
-- gxr_wait_until_idle();
-+ while (GX_REG(GP_BLIT_STATUS) &
-+ (BS_BLIT_BUSY|BS_PIPELINE_BUSY|BS_BLIT_PENDING));
- }
-
-
--/*
--//---------------------------------------------------------------------------
--// CYRIXSetupForFillRectSolid
--//
--// This routine is called to setup the solid pattern color for future
--// rectangular fills or vectors.
--//---------------------------------------------------------------------------
--*/
--
-+/* Solid rectangles */
- void
- CYRIXSetupForFillRectSolid(color, rop, planemask)
- int color, rop;
- unsigned int planemask;
--{
-- /* LOAD THE SOLID PATTERN COLOR */
--
-- gxr_load_solid_pattern((unsigned short) color);
--
-- /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */
--
-- if (planemask == (unsigned int) -1)
-- {
-- /* use normal pattern ROPs if all planes are enabled */
--
-- gxr_load_raster_operation(windowsROPpat[rop & 0x0F]);
-- }
-- else
-- {
-- /* select ROP that uses planemask in src data */
--
-- gxr_load_solid_source((unsigned short) planemask);
-- gxr_load_raster_operation(windowsROPsrcMask[rop & 0x0F]);
-- }
-+{ CYRIXsetupSync();
-+ CYRIXsetSourceColors01(color, color);
-+ CYRIXsetPatColors01(planemask, 0);
-+ CYRIXsetPatMode(rop, RM_PAT_DISABLE);
-+ blitMode = BM_READ_SRC_NONE | BM_WRITE_FB | BM_SOURCE_EXPAND
-+ | IfDest(rop, BM_READ_DST_FB0);
-+ vectorMode = IfDest(rop, VM_READ_DST_FB);
- }
-
--/*
--//---------------------------------------------------------------------------
--// CYRIXSubsequentFillRectSolid
--//
--// This routine is called to fill a rectangular region using the previously
--// specified solid pattern and raster operation.
--//
--// Sample application uses:
--// - Window backgrounds.
--// - x11perf: rectangle tests (-rect500).
--// - x11perf: fill trapezoid tests (-trap100).
--// - x11perf: horizontal line segments (-hseg500).
--//---------------------------------------------------------------------------
--*/
-
- void
- CYRIXSubsequentFillRectSolid(x, y, w, h)
- int x, y, w, h;
--{
-- /* call routine to fill rectangular region */
--
-- gxr_pattern_fill((unsigned short) x, (unsigned short) y,
-- (unsigned short) w, (unsigned short) h);
--}
--
--/*
--//---------------------------------------------------------------------------
--// CYRIXSetupFor8x8PatternColorExpand
--//
--// This routine is called to setup the monochrome pattern (8x8) and raster
--// operation for future rectangular fills.
--//---------------------------------------------------------------------------
--*/
--
--void CYRIXSetupFor8x8PatternColorExpand(patternx, patterny, bg, fg, rop, planemask)
--int patternx, patterny;
--int bg, fg, rop;
--unsigned int planemask;
--{ int trans = (bg == -1);
--
-- /* LOAD PATTERN COLORS AND DATA */
--
-- gxr_load_mono_pattern((unsigned short) bg, (unsigned short) fg,
-- (unsigned long) patternx, (unsigned long) patterny,
-- (unsigned char) trans);
--
-- /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */
--
-- if (planemask == (unsigned int) -1)
-- {
-- /* use normal pattern ROPs if all planes are enabled */
--
-- gxr_load_raster_operation(windowsROPpat[rop & 0x0F]);
-- }
-- else
-- {
-- /* select ROP that uses planemask in src data */
--
-- gxr_load_solid_source((unsigned short) planemask);
-- gxr_load_raster_operation(windowsROPsrcMask[rop & 0x0F]);
-+{ /* divide the operation into columns if required; use twice the
-+ blit buffer width because buffer 0 will overflow into buffer 1 */
-+ while (w > 2 * bltBufWidth)
-+ { CYRIXSubsequentFillRectSolid(x, y, 2 * bltBufWidth, h);
-+ x += 2 * bltBufWidth;
-+ w -= 2 * bltBufWidth;
- }
-+ CYRIXsetupSync();
-+ CYRIXsetDstXY(x, y);
-+ CYRIXsetWH(w, h);
-+ CYRIXsetBlitMode();
- }
-
--/*
--//---------------------------------------------------------------------------
--// CYRIXSubsequent8x8PatternColorExpand
--//
--// This routine is called to fill a rectangular region using the previously
--// specified monochrome pattern (8x8) and raster operation.
--//
--// Sample application uses:
--// - Patterned desktops
--// - x11perf: stippled rectangle tests (-srect500).
--// - x11perf: opaque stippled rectangle tests (-osrect500).
--//---------------------------------------------------------------------------
--*/
--
--void CYRIXSubsequent8x8PatternColorExpand(patternx, patterny, x, y, w, h)
--int patternx, patterny;
--int x, y, w, h;
--{
-- /* call routine to fill rectangular region */
--
-- gxr_pattern_fill((unsigned short) x, (unsigned short) y,
-- (unsigned short) w, (unsigned short) h);
--}
--
--/*
--//---------------------------------------------------------------------------
--// CYRIXSetupForScreenToScreenCopy
--//
--// This routine is called to setup the planemask and raster operation
--// for future screen to screen BLTs.
--//---------------------------------------------------------------------------
--*/
-
-+/* Screen to screen copies */
- void
- CYRIXSetupForScreenToScreenCopy(xdir, ydir, rop, planemask, transparency_color)
- int xdir, ydir;
- int rop;
- unsigned int planemask;
- int transparency_color;
--{
-- /* LOAD PLANEMASK INTO PATTERN DATA */
-+{ CYRIXsetupSync();
-+ CYRIXsetPatColors01(planemask, 0);
-
-- gxr_load_solid_pattern((unsigned short) planemask);
--
-- /* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */
-+ if (transparency_color == -1)
-+ { CYRIXsetPatMode(rop, RM_PAT_DISABLE);
-+ transMode = 0;
-+ }
-+ else
-+ { CYRIXsetPatModeTrans(RM_PAT_DISABLE);
-+ transMode = 1;
-
-- gxr_load_raster_operation(windowsROPpatMask[rop & 0x0F]);
-+ /* fill blit buffer 1 with the transparency color */
-+ if (vgaBitsPerPixel == 16)
-+ { int k = CYRIXbltBufSize / 4;
-+ CARD32 val = (transparency_color << 16) |
-+ transparency_color;
-+ volatile CARD32* buf = &(GX_REG(CYRIXbltBuf1Address));
-+
-+ while (--k >= 0) buf[k] = val;
-+ }
-+ else
-+ memset(GXregisters + CYRIXbltBuf1Address,
-+ transparency_color, CYRIXbltBufSize);
-+ }
-
-- /* SAVE TRANSPARENCY FLAG */
-+ blitMode = BM_READ_SRC_FB | BM_WRITE_FB | BM_SOURCE_COLOR
-+ | (transMode ? IfDest(rop, BM_READ_DST_FB1) : BM_READ_DST_NONE)
-+ | (ydir < 0 ? BM_REVERSE_Y : 0);
-
-- CYRIXtransparent = (transparency_color == -1) ? 0 : 1;
-- CYRIXtransColor = transparency_color;
-+ copyXdir = xdir;
- }
-
--/*
--//---------------------------------------------------------------------------
--// CYRIXSubsequentScreenToScreenCopy
--//
--// This routine is called to perform a screen to screen BLT using the
--// previously specified planemask, raster operation, and transparency flag.
--//
--// Sample application uses (non-transparent):
--// - Moving windows.
--// - x11perf: scroll tests (-scroll500).
--// - x11perf: copy from window to window (-copywinwin500).
--//
--// No application found using transparency.
--//---------------------------------------------------------------------------
--*/
--
- void
- CYRIXSubsequentScreenToScreenCopy(x1, y1, x2, y2, w, h)
- int x1, y1, x2, y2, w, h;
--{
-- if (CYRIXtransparent)
-- {
-- /* CALL ROUTINE FOR TRANSPARENT SCREEN TO SCREEN BLT */
-- /* Should only be called for the "copy" raster operation. */
--
-- gxr_screen_to_screen_xblt(
-- (unsigned short) x1, (unsigned short) y1,
-- (unsigned short) x2, (unsigned short) y2,
-- (unsigned short) w, (unsigned short) h,
-- (unsigned short) CYRIXtransColor);
-+{ int up = (blitMode & BM_REVERSE_Y);
-+
-+ /* divide the operation into columns when necessary */
-+ if (copyXdir < 0)
-+ { int x_offset = w - bltBufWidth;
-+
-+ while (x_offset > 0)
-+ { CYRIXSubsequentScreenToScreenCopy(x1 + x_offset, y1,
-+ x2 + x_offset, y2,
-+ bltBufWidth, h);
-+ x_offset -= bltBufWidth;
-+ w -= bltBufWidth;
-+ } }
-+ else while (w > bltBufWidth)
-+ { CYRIXSubsequentScreenToScreenCopy(x1, y1, x2, y2,
-+ bltBufWidth, h);
-+ x1 += bltBufWidth;
-+ x2 += bltBufWidth;
-+ w -= bltBufWidth;
- }
-- else
-- {
-- /* CALL ROUTINE FOR NORMAL SCREEN TO SCREEN BLT */
-
-- gxr_screen_to_screen_blt(
-- (unsigned short) x1, (unsigned short) y1,
-- (unsigned short) x2, (unsigned short) y2,
-- (unsigned short) w, (unsigned short) h);
-+ CYRIXsetupSync();
-+ CYRIXsetSrcXY(x1, (up ? (y1 + h - 1) : y1));
-+ CYRIXsetDstXY(x2, (up ? (y2 + h - 1) : y2));
-+
-+ /* in transparent mode, one line reads the transparency color
-+ into a processor-internal register, and the remaining lines
-+ can be done in a single second pass */
-+ if (transMode)
-+ { blitMode |= BM_READ_DST_BB1;
-+ CYRIXsetWH(w, 1);
-+ CYRIXsetBlitMode();
-+ h--;
-+ if (!h) return;
-+ if (up) { y1--; y2--; }
-+ else { y1++; y2++; }
-+ CYRIXsetupSync();
-+ blitMode &= ~(BM_READ_DST_BB1);
- }
-+ CYRIXsetWH(w, h);
-+ CYRIXsetBlitMode();
- }
-
--/*
--//---------------------------------------------------------------------------
--// CYRIXSubsequentBresenhamLine
--//
--// This routine is called to render a vector using the specified Bresenham
--// parameters.
--//
--// Sample application uses:
--// - Window outlines on window move.
--// - x11perf: line segments (-seg500).
--//---------------------------------------------------------------------------
--*/
-
-+/* Bresenham lines */
- void
- CYRIXSubsequentBresenhamLine(x1, y1, octant, err, e1, e2, length)
- int x1, y1, octant, err, e1, e2, length;
--{
-- unsigned short flags;
--
-- /* DETERMINE YMAJOR AND DIRECTION FLAGS */
--
-- if (octant & YMAJOR)
-- { flags = VM_Y_MAJOR;
-- if (!(octant & XDECREASING)) flags |= VM_MINOR_INC;
-- if (!(octant & YDECREASING)) flags |= VM_MAJOR_INC;
-+{ if (octant & YMAJOR)
-+ { vectorMode = (vectorMode & VM_READ_DST_FB) | VM_Y_MAJOR;
-+ if (!(octant & XDECREASING)) vectorMode |= VM_MINOR_INC;
-+ if (!(octant & YDECREASING)) vectorMode |= VM_MAJOR_INC;
- }
- else
-- { flags = VM_X_MAJOR;
-- if (!(octant & XDECREASING)) flags |= VM_MAJOR_INC;
-- if (!(octant & YDECREASING)) flags |= VM_MINOR_INC;
-+ { vectorMode = (vectorMode & VM_READ_DST_FB) | VM_X_MAJOR;
-+ if (!(octant & XDECREASING)) vectorMode |= VM_MAJOR_INC;
-+ if (!(octant & YDECREASING)) vectorMode |= VM_MINOR_INC;
- }
-
-- /* CALL ROUTINE TO DRAW VECTOR */
--
-- gxr_bresenham_line((unsigned short) x1, (unsigned short) y1,
-- (unsigned short) length, (unsigned short) err,
-- (unsigned short) e1, (unsigned short) e2, (unsigned short) flags);
-+ CYRIXsetupSync();
-+ CYRIXsetDstXY(x1, y1);
-+ CYRIXsetWH(length, (err & 0xFFFF));
-+ CYRIXsetSrcXY((e1 & 0xFFFF), (e2 & 0xFFFF));
-+ CYRIXsetVectorMode();
- }
-
--/*
--//---------------------------------------------------------------------------
--// CYRIXSetupForCPUToScreenColorExpand
--//
--// This routine is called to setup the planemask, colors, and raster
--// operation for future monocrome bitmap to screen BLTs.
--//---------------------------------------------------------------------------
--*/
-
--void CYRIXSetupForCPUToScreenColorExpand(bg, fg, rop, planemask)
-+/* 8x8 pattern color expand */
-+void CYRIXSetupFor8x8PatternColorExpand(patternx, patterny, bg, fg, rop, planemask)
-+int patternx, patterny;
- int bg, fg, rop;
- unsigned int planemask;
- { int trans = (bg == -1);
-
-- /* LOAD SOURCE COLORS */
-+ CYRIXsetupSync();
-+ CYRIXsetSourceColors01(planemask, planemask);
-+ CYRIXsetPatColors01(trans ? 0 : bg, fg);
-+ CYRIXsetPatData(patternx, patterny);
-+ CYRIXsetPatModeX(rop, RM_PAT_MONO | (trans ? RM_PAT_TRANSPARENT : 0));
-
-- gxr_load_mono_source((unsigned short) bg, (unsigned short) fg,
-- (unsigned short) trans);
-+ blitMode = BM_READ_SRC_NONE | BM_WRITE_FB | BM_SOURCE_EXPAND
-+ | (trans ? IfDest(rop, BM_READ_DST_FB0) : BM_READ_DST_NONE);
-+}
-
-- /* LOAD PLANEMASK INTO PATTERN DATA */
-+void CYRIXSubsequent8x8PatternColorExpand(patternx, patterny, x, y, w, h)
-+int patternx, patterny;
-+int x, y, w, h;
-+{ CYRIXSubsequentFillRectSolid(x, y, w, h);
-+}
-
-- gxr_load_solid_pattern((unsigned short) planemask);
--
-- /* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */
-
-- gxr_load_raster_operation(windowsROPpatMask[rop & 0x0F]);
--}
-+/* CPU-to-screen color expansion */
-+void CYRIXSetupForCPUToScreenColorExpand(bg, fg, rop, planemask)
-+int bg, fg, rop;
-+unsigned int planemask;
-+{ int trans = (bg == -1);
-
--/*
--//---------------------------------------------------------------------------
--// CYRIXSubsequentCPUToScreenColorExpand
--//
--// This routine is called to render expanded monocrome bitmap data to the
--// screen using the previously specified colors and raster operation. Since
--// the server loads the monochrome data into BB0, not the driver, this
--// routine just sets a flag and saves the parameters to use when the server
--// is done loading the data and calls the CYRIXAccelSync function.
--//
--// Sample application uses:
--// - Text in windows.
--// - x11perf: text (-ftext, -f8text, -f9text, ...).
--//---------------------------------------------------------------------------
--*/
-+ CYRIXsetupSync();
-+ CYRIXsetSourceColors01(trans ? 0 : bg, fg);
-+ CYRIXsetPatColors01(planemask, 0);
-+
-+ CYRIXsetPatMode(rop, RM_PAT_DISABLE | (trans ? RM_SRC_TRANSPARENT : 0));
-+
-+ /* this is formally incorrect: XAA may use both BB0 and BB1
-+ for the text source bitmap, so READ_DST_FB1 should not be
-+ used. So far, this problem has not manifested itself in
-+ practice. */
-+ blitMode = BM_READ_SRC_BB0 | BM_WRITE_FB | BM_SOURCE_EXPAND
-+ | (trans ? IfDest(rop, BM_READ_DST_FB1) : BM_READ_DST_NONE);
-+}
-
- void CYRIXSubsequentCPUToScreenColorExpand(x, y, w, h, skipleft)
- int x, y, w, h;
- int skipleft;
--{
-- CYRIXstartMonoExpand = 1;
-- CYRIXsaveX = x;
-- CYRIXsaveY = y;
-- CYRIXsaveW = w;
-- CYRIXsaveH = h;
--
-- /* WAIT UNTIL IDLE BEFORE ALLOWING WRITES TO BLT BUFFERS */
-- /* Server will load the monochrome data into BB0 after this. */
-+{ CYRIXsetupSync();
-+ CYRIXsetSrcXY(0, 0);
-+ CYRIXsetDstXY(x, y);
-+ CYRIXsetWH(w, h);
-
-- gxr_wait_until_idle();
-+ CYRIXAccelSync();
-+ setBlitModeOnSync = 1;
- }
--
--/* END OF FILE */
-
-diff -ruN XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_driver.c XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_driver.c
---- XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_driver.c Wed Jun 23 08:37:22 1999
-+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_driver.c Fri Nov 6 11:41:51 1998
-@@ -1,12 +1,9 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_driver.c,v 1.1.2.7 1999/06/23 12:37:22 hohndel Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_driver.c,v 1.1.2.6 1998/11/06 09:47:08 hohndel Exp $ */
- /*
-- * Copyright 1999 by Brian Falardeau
- * Copyright 1998 by Annius V. Groenink (A.V.Groenink@zfc.nl, avg@cwi.nl),
- * Dirk H. Hohndel (hohndel@suse.de),
- * Portions: the GGI project & confidential CYRIX databooks.
- *
-- * Substitute Brian Falardeau into a copy of the following legal jargon...
-- *
- * 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
-@@ -25,17 +22,13 @@
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-+/* $XConsortium: $ */
-
- /*************************************************************************/
-
- /*
- Log for the cyrix driver source as a whole
-
-- May 1999, Brian Falardeau:
-- - Fixed interaction with SoftVGA for setting 2K pitch at 1280x1024.
-- - Added CRTC tables for 60 Hz and 75 Hz modes.
-- - Removed enabling display compression directly for VSA1.
--
- 5th Nov 1998 avg - Fixed blit buffer organization using CPU_WRITE
- instruction. Support for older chipsets (color
- treatment and different CPU_WRITE opcode).
-@@ -115,35 +108,50 @@
- #include "extensions/xf86dgastr.h"
- #endif
-
-+#ifdef XF86VGA16
-+#define MONOVGA
-+#endif
-
-+#if !defined(MONOVGA) && !defined(XF86VGA16)
- #include "vga256.h"
-+#endif
-+
- #include "cyrix.h"
-
- pciTagRec CyrixPciTag;
- extern vgaHWCursorRec vgaHWCursor;
-
--#define NUM_STD_CRTC_REGS 25
--#define NUM_EXT_CRTC_REGS 16
--
- typedef struct {
- vgaHWRec std; /* IBM VGA */
- struct vgaCYRIXext
-- {
-- /* override of miscellaneous output register value */
--
-- unsigned char miscOutput;
--
-- /* override of standard CRTC register values */
--
-- unsigned char stdCRTCregs[NUM_STD_CRTC_REGS];
--
-- /* extended CRTC register values (specific to MediaGX) */
--
-- unsigned char extCRTCregs[NUM_EXT_CRTC_REGS];
-+ { /* extended SoftVGA registers */
-+ unsigned char VerticalTimingExtension;
-+ unsigned char ExtendedAddressControl;
-+ unsigned char ExtendedOffset;
-+ unsigned char ExtendedColorControl;
-+ unsigned char DisplayCompression;
-+ unsigned char DriverControl;
-+ unsigned char DACControl;
-+ unsigned char ClockControl;
-+ unsigned char CrtClockFrequency;
-+ unsigned char CrtClockFrequencyFraction;
-+ unsigned char RefreshRate;
-+
-+ /* display controller hardware registers */
-+ CARD32 DcGeneralCfg;
-+ CARD32 DcCursStOffset;
-+ CARD32 DcCbStOffset;
-+ CARD32 DcLineDelta;
-+ CARD32 DcBufSize;
-+ CARD32 DcCursorX;
-+ CARD32 DcCursorY;
-+ CARD32 DcCursorColor;
-
- /* graphics pipeline registers */
--
- CARD32 GpBlitStatus;
-+
-+ /* save area for cursor image */
-+ char cursorPattern[256];
- } ext;
- } vgaCYRIXRec, *vgaCYRIXPtr;
-
-@@ -158,9 +166,11 @@
- static void CYRIXRestore();
- static void CYRIXAdjust();
-
-+#ifndef MONOVGA
- static void CYRIXFbInit();
- static Bool CYRIXScreenInit();
- static Bool CYRIXPitchAdjust();
-+#endif
-
- void CYRIXSetRead();
- void CYRIXSetWrite();
-@@ -177,7 +187,11 @@
- CYRIXAdjust,
- vgaHWSaveScreen,
- (void (*)())NoopDDA, /* CYRIXGetMode */
-+#ifndef MONOVGA
- CYRIXFbInit,
-+#else
-+ (void (*)())NoopDDA, /* CYRIXFbInit */
-+#endif
- CYRIXSetRead,
- CYRIXSetWrite,
- CYRIXSetReadWrite,
-@@ -191,9 +205,9 @@
- VGA_NO_DIVIDE_VERT, /* ChipInterlaceType */
- {0,}, /* ChipOptionFlags */
- 8, /* ChipRounding */
-- TRUE, /* ChipUseLinearAddressing */
-- 0x40800000, /* ChipLinearBase */
-- 0x001FFFFF, /* ChipLinearSize */
-+ FALSE, /* ChipUseLinearAddressing */
-+ 0, /* ChipLinearBase */
-+ 0, /* ChipLinearSize */
- TRUE, /* ChipHas16bpp */
- FALSE, /* ChipHas24bpp */
- FALSE, /* ChipHas32bpp */
-@@ -207,10 +221,6 @@
-
- char* GXregisters;
-
--int CYRIXvsaversion; /* VSA version */
--#define CYRIX_VSA1 1
--#define CYRIX_VSA2 2
--
- int CYRIXcbufferAddress; /* relative to video base */
- int CYRIXoffscreenAddress;
- int CYRIXcursorAddress;
-@@ -225,94 +235,6 @@
-
- #define newstate ((vgaCYRIXPtr)vgaNewVideoState)
-
--typedef struct {
-- int xsize;
-- int ysize;
-- int clock;
-- unsigned char miscOutput;
-- unsigned char stdCRTCregs[NUM_STD_CRTC_REGS];
-- unsigned char extCRTCregs[NUM_EXT_CRTC_REGS];
--} vgaCYRIXmode;
--
--vgaCYRIXmode CYRIXmodes[] =
--{
--/*------------------------------------------------------------------------------*/
-- { 640, 480, /* 640x480 */
-- 25, /* 25 MHz clock = 60 Hz refresh rate */
-- 0xE3, /* miscOutput register */
-- { 0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0x0B, 0x3E, /* standard CRTC */
-- 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-- 0xEA, 0x0C, 0xDF, 0x50, 0x00, 0xE7, 0x04, 0xE3, 0xFF },
-- { 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */
-- 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 } },
--/*------------------------------------------------------------------------------*/
-- { 800, 600, /* 800x600 */
-- 40, /* 40 MHz clock = 60 Hz refresh rate */
-- 0x23, /* miscOutput register */
-- { 0x7F, 0x63, 0x64, 0x82, 0x6B, 0x1B, 0x72, 0xF0, /* standard CRTC */
-- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-- 0x59, 0x0D, 0x57, 0x64, 0x00, 0x57, 0x73, 0xE3, 0xFF },
-- { 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */
-- 0x00, 0x00, 0x01, 0x03, 0xA0, 0x50, 0x00, 0x00 } },
--/*------------------------------------------------------------------------------*/
-- { 1024, 768, /* 1024x768 */
-- 65, /* 65 MHz clock = 60 Hz refresh rate */
-- 0xE3, /* miscOutput register */
-- { 0xA3, 0x7F, 0x80, 0x86, 0x85, 0x96, 0x24, 0xF5, /* standard CRTC */
-- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-- 0x04, 0x0A, 0xFF, 0x80, 0x00, 0xFF, 0x25, 0xE3, 0xFF },
-- { 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */
-- 0x00, 0x00, 0x01, 0x03, 0x80, 0x41, 0x00, 0x00 } },
--/*------------------------------------------------------------------------------*/
-- { 1280, 1024, /* 1280x1024 */
-- 108, /* 108 MHz clock = 60 Hz refresh rate */
-- 0x23, /* miscOutput register */
-- { 0xCF, 0x9F, 0xA0, 0x92, 0xAA, 0x19, 0x28, 0x52, /* standard CRTC */
-- 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-- 0x01, 0x04, 0xFF, 0xA0, 0x00, 0x00, 0x29, 0xE3, 0xFF },
-- { 0x00, 0x51, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */
-- 0x00, 0x00, 0x01, 0x03, 0x80, 0x6C, 0x00, 0x00 } },
--/*------------------------------------------------------------------------------*/
-- { 640, 480, /* 640x480 */
-- 31, /* 31.5 MHz clock = 75 Hz refresh rate */
-- 0xE3, /* miscOutput register */
-- { 0x64, 0x4F, 0x4F, 0x88, 0x54, 0x9B, 0xF2, 0x1F, /* standard CRTC */
-- 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-- 0xE1, 0x04, 0xDF, 0x50, 0x00, 0xDF, 0xF3, 0xE3, 0xFF },
-- { 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */
-- 0x00, 0x00, 0x01, 0x03, 0xA0, 0x3F, 0x00, 0x00 } },
--/*------------------------------------------------------------------------------*/
-- { 800, 600, /* 800x600 */
-- 99, /* 99 MHz clock = 75 Hz refresh rate */
-- 0x23, /* miscOutput register */
-- { 0x7F, 0x63, 0x63, 0x83, 0x68, 0x11, 0x6F, 0xF0, /* standard CRTC */
-- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-- 0x59, 0x1C, 0x57, 0x64, 0x00, 0x57, 0x70, 0xE3, 0xFF },
-- { 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */
-- 0x00, 0x00, 0x01, 0x03, 0xA0, 0x63, 0x00, 0x00 } },
--/*------------------------------------------------------------------------------*/
-- { 1024, 768, /* 1024x768 */
-- 79, /* 79 MHz clock = 75 Hz refresh rate */
-- 0xE3, /* miscOutput register */
-- { 0x9F, 0x7F, 0x7F, 0x83, 0x84, 0x8F, 0x1E, 0xF5, /* standard CRTC */
-- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-- 0x01, 0x04, 0xFF, 0x80, 0x00, 0xFF, 0x1F, 0xE3, 0xFF },
-- { 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */
-- 0x00, 0x00, 0x01, 0x03, 0x80, 0x4F, 0x00, 0x00 } },
--/*------------------------------------------------------------------------------*/
-- { 1280, 1024, /* 1280x1024 */
-- 135, /* 135 MHz clock = 75 Hz refresh rate */
-- 0x23, /* miscOutput register */
-- { 0xCE, 0x9F, 0x9F, 0x92, 0xA4, 0x15, 0x28, 0x52, /* standard CRTC */
-- 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-- 0x01, 0x04, 0xFF, 0xA0, 0x00, 0x00, 0x29, 0xE3, 0xFF },
-- { 0x00, 0x51, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */
-- 0x00, 0x00, 0x01, 0x03, 0x80, 0x87, 0x00, 0x00 } },
--/*------------------------------------------------------------------------------*/
--};
--
--#define NUM_CYRIX_MODES sizeof(CYRIXmodes)/sizeof(vgaCYRIXmode)
--
- static char *
- CYRIXIdent(n)
- int n;
-@@ -478,6 +400,7 @@
- vga256InfoRec.bankedMono = TRUE;
- OFLG_SET(CLOCK_OPTION_PROGRAMABLE, &vga256InfoRec.clockOptions);
-
-+#ifndef MONOVGA
- /* define option set valid for the driver */
- OFLG_SET(OPTION_SW_CURSOR, &CYRIX.ChipOptionFlags);
- OFLG_SET(OPTION_HW_CURSOR, &CYRIX.ChipOptionFlags);
-@@ -496,12 +419,13 @@
- CYRIX.ChipLinearSize = (1024 * vga256InfoRec.videoRam);
-
- CYRIX.ChipUseLinearAddressing = TRUE;
-+#endif
-
- /* map the entire area from GX_BASE (scratchpad area)
- up to the end of the control registers */
- GXregisters = (char*)xf86MapVidMem(vga256InfoRec.scrnIndex,
- EXTENDED_REGION,
-- (void*)physbase, 0x20000);
-+ (void*)physbase, 0x9000);
-
- if (!GXregisters)
- { ErrorF("%s %s: Cannot map hardware registers\n",
-@@ -509,80 +433,27 @@
- goto probeFailed;
- }
-
-- /* check VSA version */
-- /* VSA2 contains a "CX" signature at registers 0x35 and 0x36. */
-- /* The SoftVGA interface changed slightly for VSA2. Originally, */
-- /* VSA2 was intended for MXi only, but it may someday be */
-- /* provided for MediaGX systems as well. */
--
-- CYRIXvsaversion = CYRIX_VSA2;
-- outb(vgaIOBase + 4, 0x35);
-- if (inb(vgaIOBase + 5) != 'C') CYRIXvsaversion = CYRIX_VSA1;
-- outb(vgaIOBase + 4, 0x36);
-- if (inb(vgaIOBase + 5) != 'X') CYRIXvsaversion = CYRIX_VSA1;
-- if (CYRIXvsaversion == CYRIX_VSA1)
-- {
-- ErrorF("%s %s: VSA1 detected\n",
-- XCONFIG_PROBED, vga256InfoRec.name);
-- }
-- else
-- {
-- ErrorF("%s %s: VSA2 detected\n",
-- XCONFIG_PROBED, vga256InfoRec.name);
-- }
- return(TRUE);
- }
-
--/*------------------------------------------------------------------------*\
--** FbInit()
--**
--** From README file: "The FbInit() function is required for drivers with
--** accelerated graphics support. It is used to replace default cfb.banked
--** functions with accelerated chip-specific versions.
--**
--** For the Cyrix driver, this routine is also used to allocate video
--** memory. This is more complicated than it needs to be...
--**
--** For VSA1, SoftVGA manages all of graphics memory, including the
--** compression buffer, cursor buffer, and offscreen memory. The driver
--** should not allocate memory itself. For offscreen memory it reads
--** registers 0x3C and 0x3D. For the cursor buffer it reads the hardware
--** register after validating a mode. For compression, it just sets bit 0
--** of register 0x49 if it wants to use compression, and SoftVGA will
--** enable it if memory has been allocated.
--**
--** This model, however, breaks down for this driver. There is a bug in
--** SoftVGA that keeps the 0x3C register from working properly. This bug
--** also prevents compression from being enabled when using a virtual
--** desktop. This driver also cannot use the memory past 2 Meg, which
--** effects the memory calculation.
--**
--** Therefore, this driver does what it is not supposed to and allocates
--** video memory itself. But, this is required due to bugs in SoftVGA and,
--** as it turns out, works out fine (with limiting compression use).
--**
--** For VSA2, the driver is supposed to do this allocation itself.
--\*------------------------------------------------------------------------*/
-
-+#ifndef MONOVGA
- static void
- CYRIXFbInit()
- { int lineDelta = vga256InfoRec.displayWidth * (vgaBitsPerPixel / 8);
- int virtualDelta = vga256InfoRec.virtualX * (vgaBitsPerPixel / 8);
-- int base;
-
- vgaSetScreenInitHook(CYRIXScreenInit);
-
-- /* always put the cursor at the end of video memory. */
--
-- CYRIXcursorAddress = CYRIX.ChipLinearSize - 256;
--
- /* offscreen memory is, normally, right after the frame buffer;
-+ always put the cursor at the end of video memory.
-+
- (It would be nice to use the ignored 64KB block at the end of
- the video memory (2112 - 2048) for the hardware cursor, but
- it is not mapped. This will not be a problem in Xfree 3.9 */
--
- CYRIXoffscreenAddress = (lineDelta * vga256InfoRec.virtualY);
-- CYRIXoffscreenSize = CYRIXcursorAddress - CYRIXoffscreenAddress;
-+ CYRIXcursorAddress = CYRIX.ChipLinearSize - 256;
-+ CYRIXoffscreenSize = CYRIXcursorAddress - CYRIXoffscreenAddress;
-
- /* if there is enough room between lines, put the compression
- buffer there */
-@@ -591,7 +462,7 @@
- CYRIXcbLineDelta = (lineDelta >> 2);
- if (xf86Verbose > 1)
- ErrorF("%s %s: Interleaving frame buffer and compression buffer\n",
-- XCONFIG_PROBED, vga256InfoRec.name);
-+ XCONFIG_PROBED, vga256InfoRec.name);
- }
- /* otherwise, put it directly after the virtual frame */
- else
-@@ -600,7 +471,7 @@
- if (cbuffer_size > CYRIXoffscreenSize)
- { CYRIXcbLineDelta = 0;
- ErrorF("%s %s: No room for the compression buffer\n",
-- XCONFIG_PROBED, vga256InfoRec.name);
-+ XCONFIG_PROBED, vga256InfoRec.name);
- }
- else
- { CYRIXcbufferAddress = CYRIXoffscreenAddress;
-@@ -609,43 +480,25 @@
- CYRIXoffscreenSize -= cbuffer_size;
- } }
-
-- /* print results of offscreen memory configuration */
--
-- if (CYRIXoffscreenSize <= 0)
-- {
-- ErrorF("%s %s: No offscreen memory available.\n",
-- XCONFIG_PROBED, vga256InfoRec.name);
-- }
-- else
-- {
-- ErrorF("%s %s: Offscreen memory from 0x%8.8X-0x%8.8X\n",
-- XCONFIG_PROBED, vga256InfoRec.name,
-- CYRIXoffscreenAddress,
-- CYRIXoffscreenAddress+CYRIXoffscreenSize-1);
-- }
--
-- /* call CYRIXAccelInit to setup the XAA accelerated functions */
--
-+ /* call CYRIXAccelInit to setup the XAA accelerated functions */
- if (!OFLG_ISSET(OPTION_NOACCEL, &vga256InfoRec.options))
- CYRIXAccelInit();
-
- /* install hardware cursor routines */
--
- if (OFLG_ISSET(OPTION_HW_CURSOR, &vga256InfoRec.options))
-- { if (CYRIXoffscreenSize > 0)
-+ { if (CYRIXoffscreenSize >= 0)
- { vgaHWCursor.Initialized = TRUE;
- vgaHWCursor.Init = CYRIXCursorInit;
- vgaHWCursor.Restore = CYRIXRestoreCursor;
- vgaHWCursor.Warp = CYRIXWarpCursor;
- vgaHWCursor.QueryBestSize = CYRIXQueryBestSize;
-- ErrorF("%s %s: Using hardware cursor at %8.8X\n",
-- XCONFIG_PROBED, vga256InfoRec.name, CYRIXcursorAddress);
-+ if (xf86Verbose)
-+ ErrorF("%s %s: Using hardware cursor\n",
-+ XCONFIG_PROBED, vga256InfoRec.name);
- }
- else
-- {
- ErrorF("%s %s: No room for hardware cursor\n",
-- XCONFIG_PROBED, vga256InfoRec.name);
-- }
-+ XCONFIG_PROBED, vga256InfoRec.name);
- }
- }
-
-@@ -696,6 +549,7 @@
-
- return pitch;
- }
-+#endif /* not MONOVGA */
-
-
- static void
-@@ -747,121 +601,210 @@
-
- static void
- CYRIXresetVGA()
--{
-- int i;
-+{ unsigned char temp;
-+ /* switch off compression and cursor the hard way */
-+ GX_REG(DC_UNLOCK) = DC_UNLOCK_VALUE;
-+ GX_REG(DC_GENERAL_CFG) &= ~(DC_GCFG_CMPE | DC_GCFG_DECE | DC_GCFG_FDTY | DC_GCFG_CURE);
-+ GX_REG(DC_UNLOCK) = 0;
-+ CYRIXmarkLinesDirty();
-
- /* reset SoftVGA extensions to standard VGA behaviour */
--
-- for (i = 0; i < NUM_EXT_CRTC_REGS; i++)
-- {
-- outb(vgaIOBase + 4, 0x40 + i);
-- outb(vgaIOBase + 5, 0x00);
-- }
-+ outb(vgaIOBase + 4, CrtcExtendedAddressControl);
-+ temp = inb(vgaIOBase + 5);
-+ outb(vgaIOBase + 5, temp & 0xf8);
-+ outb(vgaIOBase + 4, CrtcExtendedStartAddress);
-+ outb(vgaIOBase + 5, 0x00);
-+ outb(vgaIOBase + 4, CrtcWriteMemoryAperture);
-+ temp = inb(vgaIOBase + 5);
-+ outb(vgaIOBase + 5, temp & 0xe0);
-+ outb(vgaIOBase + 4, CrtcReadMemoryAperture);
-+ temp = inb(vgaIOBase + 5);
-+ outb(vgaIOBase + 5, temp & 0xe0);
-+ outb(vgaIOBase + 4, CrtcDriverControl);
-+ temp = inb(vgaIOBase + 5);
-+ outb(vgaIOBase + 5, temp & 0xfe);
-+ outb(vgaIOBase + 4, CrtcDisplayCompression);
-+ temp = inb(vgaIOBase + 5);
-+ outb(vgaIOBase + 5, temp & 0xf0);
- }
-
- static void
- CYRIXRestore(restore)
- vgaCYRIXPtr restore;
--{ unsigned char i, temp, temp2;
-- unsigned long value;
--
-- /* unlock extended CRTC registers */
--
-- outb(vgaIOBase + 4, 0x30);
-- outb(vgaIOBase + 5, 0x57);
-- outb(vgaIOBase + 5, 0x4C);
-+{ unsigned char temp;
-+ vgaProtect(TRUE); /* Blank the screen */
-
-- /* SIGNAL THE BEGINNING OF THE MODE SWITCH
-- SoftVGA will hold off validating the back end hardware. */
--
-- outb(vgaIOBase + 4, CrtcModeSwitchControl);
-- outb(vgaIOBase + 5, 0x01);
-+ /* it would be ideal to be able to use the ModeSwitchControl
-+ register to protect SoftVGA from reading the configuration
-+ before all registers have been written. But that bit must be
-+ set somewhere in the middle of vgaHWRestore (after restoring
-+ the font). Luckily things seem to work without it. */
-
- /* restore standard VGA portion */
--
- CYRIXresetVGA();
- vgaHWRestore((vgaHWPtr)restore);
-+ CYRIXmarkLinesDirty();
-
-- /* override restored miscellaneous output regiter value */
--
-- outb(0x3C2, restore->ext.miscOutput);
--
-- /* override restored standard CRTC register values */
--
-- outb(vgaIOBase + 4, 0x11);
-- outb(vgaIOBase + 5, 0x00);
-- for (i = 0; i < NUM_STD_CRTC_REGS; i++)
-- {
-- outb(vgaIOBase + 4, i);
-- outb(vgaIOBase + 5, restore->ext.stdCRTCregs[i]);
-- }
--
- /* restore SoftVGA extended registers */
-+ outb(vgaIOBase + 4, CrtcDriverControl);
-+ temp = inb(vgaIOBase + 5);
-+ outb(vgaIOBase + 5, (restore->ext.DriverControl & 0x01)
-+ | (temp & 0xfe));
-+
-+ outb(vgaIOBase + 4, CrtcVerticalTimingExtension);
-+ temp = inb(vgaIOBase + 5);
-+ outb(vgaIOBase + 5, (restore->ext.VerticalTimingExtension & 0x55)
-+ | (temp & 0xaa));
-+
-+ outb(vgaIOBase + 4, CrtcExtendedAddressControl);
-+ temp = inb(vgaIOBase + 5);
-+ outb(vgaIOBase + 5, (restore->ext.ExtendedAddressControl & 0x07)
-+ | (temp & 0xf8));
-+
-+ outb(vgaIOBase + 4, CrtcExtendedOffset);
-+ temp = inb(vgaIOBase + 5);
-+ outb(vgaIOBase + 5, (restore->ext.ExtendedOffset & 0x03)
-+ | (temp & 0xfc));
-+
-+ outb(vgaIOBase + 4, CrtcExtendedColorControl);
-+ temp = inb(vgaIOBase + 5);
-+ outb(vgaIOBase + 5, (restore->ext.ExtendedColorControl & 0x07)
-+ | (temp & 0xf8));
-+
-+ outb(vgaIOBase + 4, CrtcDisplayCompression);
-+ temp = inb(vgaIOBase + 5);
-+ outb(vgaIOBase + 5, (restore->ext.DisplayCompression & 0x0f)
-+ | (temp & 0xf0));
-+
-+ outb(vgaIOBase + 4, CrtcDACControl);
-+ temp = inb(vgaIOBase + 5);
-+ outb(vgaIOBase + 5, (restore->ext.DACControl & 0x0e)
-+ | (temp & 0xf1));
-+
-+ if (restore->std.NoClock >= 0)
-+ { outb(vgaIOBase + 4, CrtcClockControl);
-+ temp = inb(vgaIOBase + 5);
-+ outb(vgaIOBase + 5, (restore->ext.ClockControl & 0xb0)
-+ | (temp & 0x4f));
-+
-+ outb(vgaIOBase + 4, CrtcClockFrequency);
-+ outb(vgaIOBase + 5, restore->ext.CrtClockFrequency);
-+
-+ outb(vgaIOBase + 4, CrtcClockFrequencyFraction);
-+ outb(vgaIOBase + 5, restore->ext.CrtClockFrequencyFraction);
-+
-+ outb(vgaIOBase + 4, CrtcRefreshRate);
-+ outb(vgaIOBase + 5, restore->ext.RefreshRate);
-+ }
-+
-+ /* let SoftVGA programming settle before we access DC registers,
-+ but don't wait too long */
-+ usleep(1000);
-+ CYRIXmarkLinesDirty();
-+
-+ /* restore display controller hardware registers */
-+#ifndef MONOVGA
-+#define DCFG_MASK (DC_GCFG_FDTY | DC_GCFG_DECE | DC_GCFG_CMPE)
-+#define GPBS_MASK (BC_16BPP | BC_FB_WIDTH_2048)
-
-- for (i = 0; i < NUM_EXT_CRTC_REGS; i++)
-- {
-- outb(vgaIOBase + 4, 0x40+i);
-- outb(vgaIOBase + 5, restore->ext.extCRTCregs[i]);
-- }
-+ GX_REG(DC_UNLOCK) = DC_UNLOCK_VALUE;
-
-- /* signal the end of the mode switch */
-+ GX_REG(DC_CURS_ST_OFFSET) = restore->ext.DcCursStOffset;
-+ GX_REG(DC_CB_ST_OFFSET) = restore->ext.DcCbStOffset;
-+ GX_REG(DC_LINE_DELTA) = (GX_REG(DC_LINE_DELTA) & 0xFFC00FFF)
-+ | (restore->ext.DcLineDelta & 0x003FF000);
-+ GX_REG(DC_BUF_SIZE) = (GX_REG(DC_BUF_SIZE) & 0xFFFF01FF)
-+ | (restore->ext.DcBufSize & 0x0000FE00);
-+ GX_REG(DC_CURSOR_X) = restore->ext.DcCursorX;
-+ GX_REG(DC_CURSOR_Y) = restore->ext.DcCursorY;
-+ GX_REG(DC_CURSOR_COLOR) = restore->ext.DcCursorColor;
-
-- outb(vgaIOBase + 4, CrtcModeSwitchControl);
-- outb(vgaIOBase + 5, 0x00);
-+ GX_REG(DC_GENERAL_CFG) = (GX_REG(DC_GENERAL_CFG) & (~DCFG_MASK))
-+ | (restore->ext.DcGeneralCfg & DCFG_MASK);
-
-- /* wait until SoftVGA has validated the mode.
-- This is for VSA1 only, where SoftVGA waits until the next
-- vertical blank to recalculate the hardware state. For VSA2
-- the hardware us updated immediately, so this is not needed.
-- THIS MUST BE DONE FOR VSA1 before loading the GP_BLT_STATUS
-- register, otherwise SoftVGA will override the value. */
-+ GX_REG(DC_UNLOCK) = 0;
-
-- if (CYRIXvsaversion == CYRIX_VSA1)
-- {
-- outb(vgaIOBase + 4, 0x33);
-- while(inb(vgaIOBase + 5) & 0x80);
-- }
-+ GX_REG(GP_BLIT_STATUS) = (GX_REG(GP_BLIT_STATUS) & (~GPBS_MASK))
-+ | (restore->ext.GpBlitStatus & GPBS_MASK);
-
-- /* overrite what SoftVGA may have stored into GP_BLIT_STATUS */
-+ /* restore cursor pattern */
-+ if (restore->ext.DcCursStOffset < 1024 * vga256InfoRec.videoRam)
-+ memcpy((char*)vgaLinearBase + restore->ext.DcCursStOffset,
-+ restore->ext.cursorPattern, 256);
-+#endif
-
-- GX_REG(GP_BLIT_STATUS) = restore->ext.GpBlitStatus;
-+ vgaProtect(FALSE); /* Turn on screen */
- }
-
- static void *
- CYRIXSave(save)
- vgaCYRIXPtr save;
--{ unsigned char i;
-- struct vgaCYRIXext ext;
-+{ struct vgaCYRIXext ext;
-
-- /* save miscellaneous output register */
-+#ifndef MONOVGA
-+ /* save graphics pipeline registers */
-+ ext.GpBlitStatus = GX_REG(GP_BLIT_STATUS);
-
-- ext.miscOutput = inb(0x3CC);
-+ /* save display controller hardware registers */
-+ GX_REG(DC_UNLOCK) = DC_UNLOCK_VALUE;
-+ ext.DcGeneralCfg = GX_REG(DC_GENERAL_CFG);
-+ ext.DcCursStOffset = GX_REG(DC_CURS_ST_OFFSET);
-+ ext.DcCbStOffset = GX_REG(DC_CB_ST_OFFSET);
-+ ext.DcLineDelta = GX_REG(DC_LINE_DELTA);
-+ ext.DcBufSize = GX_REG(DC_BUF_SIZE);
-+ ext.DcCursorX = GX_REG(DC_CURSOR_X);
-+ ext.DcCursorY = GX_REG(DC_CURSOR_Y);
-+ ext.DcCursorColor = GX_REG(DC_CURSOR_COLOR);
-+ GX_REG(DC_UNLOCK) = 0;
-+
-+ /* save cursor pattern.
-+ In the 3.3.1 solution, we don't need to do this
-+ if it is in the extra 64KB block of frame buffer memory
-+ that we ignore (and is not mapped anyway) */
-+ if (ext.DcCursStOffset < 1024 * vga256InfoRec.videoRam)
-+ memcpy(ext.cursorPattern,
-+ (char*)vgaLinearBase + ext.DcCursStOffset, 256);
-+#endif
-
-- /* save standard CRTC registers */
-+ /* save SoftVGA extended registers */
-+ outb(vgaIOBase + 4, CrtcVerticalTimingExtension);
-+ ext.VerticalTimingExtension = inb(vgaIOBase + 5);
-
-- for (i = 0; i < NUM_STD_CRTC_REGS; i++)
-- {
-- outb(vgaIOBase + 4, i);
-- ext.stdCRTCregs[i] = inb(vgaIOBase + 5);
-- }
-+ outb(vgaIOBase + 4, CrtcExtendedAddressControl);
-+ ext.ExtendedAddressControl = inb(vgaIOBase + 5);
-
-- /* save extended CRTC registers */
-+ outb(vgaIOBase + 4, CrtcExtendedOffset);
-+ ext.ExtendedOffset = inb(vgaIOBase + 5);
-
-- for (i = 0; i < NUM_EXT_CRTC_REGS; i++)
-- {
-- outb(vgaIOBase + 4, 0x40+i);
-- ext.extCRTCregs[i] = inb(vgaIOBase + 5);
-- }
-+ outb(vgaIOBase + 4, CrtcExtendedColorControl);
-+ ext.ExtendedColorControl = inb(vgaIOBase + 5);
-
-- /* save graphics pipeline registers */
-+ outb(vgaIOBase + 4, CrtcDisplayCompression);
-+ ext.DisplayCompression = inb(vgaIOBase + 5);
-
-- ext.GpBlitStatus = GX_REG(GP_BLIT_STATUS);
-+ outb(vgaIOBase + 4, CrtcDriverControl);
-+ ext.DriverControl = inb(vgaIOBase + 5);
-
-- /* save standard VGA portion */
-+ outb(vgaIOBase + 4, CrtcDACControl);
-+ ext.DACControl = inb(vgaIOBase + 5);
-+
-+ outb(vgaIOBase + 4, CrtcClockControl);
-+ ext.ClockControl = inb(vgaIOBase + 5);
-+
-+ outb(vgaIOBase + 4, CrtcClockFrequency);
-+ ext.CrtClockFrequency = inb(vgaIOBase + 5);
-
-+ outb(vgaIOBase + 4, CrtcClockFrequencyFraction);
-+ ext.CrtClockFrequencyFraction = inb(vgaIOBase + 5);
-+
-+ outb(vgaIOBase + 4, CrtcRefreshRate);
-+ ext.RefreshRate = inb(vgaIOBase + 5);
-+
-+ /* save standard VGA portion */
- CYRIXresetVGA();
- save = (vgaCYRIXPtr)vgaHWSave((vgaHWPtr)save, sizeof(vgaCYRIXRec));
- save->ext = ext;
-+
- return ((void *) save);
- }
-
-@@ -869,108 +812,101 @@
- static Bool
- CYRIXInit(mode)
- DisplayModePtr mode;
--{ int i, mode_index;
-- int clock = vga256InfoRec.clock[mode->Clock] / 1000;
-- int min, diff;
-- int offset_shift = (vgaBitsPerPixel == 16) ? 2 :
-+{ int offset_shift = (vgaBitsPerPixel == 16) ? 2 :
- (vgaBitsPerPixel == 8) ? 3 : 4;
- int line_offset = vga256InfoRec.displayWidth >> offset_shift;
-
- /* initialize standard VGA portion */
--
- if (!vgaHWInit(mode,sizeof(vgaCYRIXRec)))
- return(FALSE);
-
-- /* search for specified mode in the table */
-- /* Need to find the entry with the closest dot clock value */
-- /* Assume within at least 200 MHz and then maintain closest natch. */
--
-- mode_index = 0;
-- min = 200;
-- for (i = 0; i < NUM_CYRIX_MODES; i++)
-- {
-- diff = clock - CYRIXmodes[i].clock;
-- if (diff < 0) diff = -diff;
-- if ((mode->CrtcHDisplay == CYRIXmodes[i].xsize) &&
-- (mode->CrtcVDisplay == CYRIXmodes[i].ysize) &&
-- (diff < min))
-- {
-- mode_index = i;
-- min = diff;
-- }
-- }
--
-- /* override standard miscOutput register value */
--
-- newstate->ext.miscOutput = CYRIXmodes[mode_index].miscOutput;
-+ newstate->std.CRTC[19] = line_offset;
-
-- /* override standard CRTC register values */
-+ /* initialize SoftVGA extended registers */
-+ newstate->ext.VerticalTimingExtension =
-+ ((mode->CrtcVSyncStart & 0x400) >> 4) |
-+ (((mode->CrtcVDisplay - 1) & 0x400) >> 8) |
-+ (((mode->CrtcVTotal - 2) & 0x400) >> 10) |
-+ ((mode->CrtcVSyncStart & 0x400) >> 6);
-
-- for (i = 0; i < NUM_STD_CRTC_REGS; i++)
-- {
-- newstate->ext.stdCRTCregs[i] =
-- CYRIXmodes[mode_index].stdCRTCregs[i];
-- }
--
-- /* set extended CRTC registers */
--
-- for (i = 0; i < NUM_EXT_CRTC_REGS; i++)
-- {
-- newstate->ext.extCRTCregs[i] =
-- CYRIXmodes[mode_index].extCRTCregs[i];
-- }
--
-- /* override pitch from the mode tables */
-- /* (same tables are used for 8BPP and 16BPP) */
-+ if (vgaBitsPerPixel < 8)
-+ newstate->ext.ExtendedAddressControl = EAC_DIRECT_FRAME_BUFFER;
-+ else
-+ newstate->ext.ExtendedAddressControl = EAC_DIRECT_FRAME_BUFFER |
-+ EAC_PACKED_CHAIN4;
-
-- newstate->ext.stdCRTCregs[19] = line_offset;
-- newstate->ext.extCRTCregs[5] = ((line_offset >> 8) & 0x03);
-+ newstate->ext.ExtendedOffset = ((line_offset >> 8) & 0x03);
-
-- /* override color control from the mode tables */
-- /* (same tables are used for 8BPP and 16BPP) */
-+ newstate->ext.ExtendedColorControl = (vgaBitsPerPixel == 16)
-+ ? ECC_16BPP | ECC_565_FORMAT
-+ : ECC_8BPP;
-+
-+ /* display compression is set using the DC registers */
-+ newstate->ext.DisplayCompression = 0x00;
-+
-+ /* we drive the palette through the display controller (in new
-+ chipsets only) in 8bpp and 16bpp (that is, whenever the
-+ hardware cursor is used). */
-+ if (vgaBitsPerPixel < 8)
-+ newstate->ext.DriverControl = 0x00;
-+ else
-+ newstate->ext.DriverControl = DRVCT_DISPLAY_DRIVER_ACTIVE;
-
-- newstate->ext.extCRTCregs[6] = (vgaBitsPerPixel == 16)
-- ? ECC_16BPP | ECC_565_FORMAT : ECC_8BPP;
-+ /* set `16 bit bus' or else compression will hang the
-+ system in 16bpp mode */
-+ if (vgaBitsPerPixel == 16)
-+ newstate->ext.DACControl = DACCT_ENABLE_16BIT_BUS;
-+ else
-+ newstate->ext.DACControl = 0;
-
-- /* enable display compression when appropriate */
-
-- if (CYRIXvsaversion == CYRIX_VSA1)
-- {
-- /* For VSA1, SoftVGA manages the compression buffer. */
-- /* Enabling compression directly causes unpredictable results. */
-- /* Only enable if not panning (there is a bug in SoftVGA that */
-- /* will put the compression buffer in the wrong place when */
-- /* using a virtual desktop. */
-- /* By setting bit 0 of register 0x49, SoftVGA will enable */
-- /* compression whenever possible, based on memory available */
-- /* and starting address of memory. */
--
-- if ((mode->CrtcVDisplay == vga256InfoRec.virtualY) &&
-- (mode->CrtcHDisplay == vga256InfoRec.virtualX))
-- {
-- newstate->ext.extCRTCregs[9] = 0x01;
-- ErrorF("%s %s: Display compression enabled.\n",
-- XCONFIG_PROBED, vga256InfoRec.name);
-- }
-- else
-- {
-- ErrorF("%s %s: Display compression disabled.\n",
-- XCONFIG_PROBED, vga256InfoRec.name);
-- }
-+ if (newstate->std.NoClock >= 0)
-+ { int entier_clock = (vga256InfoRec.clock[mode->Clock] / 1000);
-+ int clock_fraction = (vga256InfoRec.clock[mode->Clock] / 100)
-+ - (entier_clock * 10);
-+
-+ newstate->ext.ClockControl = CLKCT_EXT_CLOCK_MODE;
-+ newstate->ext.CrtClockFrequency = entier_clock;
-+ newstate->ext.CrtClockFrequencyFraction = clock_fraction;
-+ newstate->ext.RefreshRate = 0 /* relevant to VGA BIOS only */;
-+ }
-+
-+#ifndef MONOVGA
-+ /* initialize masked contents of display controller
-+ hardware registers. */
-+ newstate->ext.DcCursStOffset = CYRIXcursorAddress;
-+ newstate->ext.DcCbStOffset = CYRIXcbufferAddress;
-+ newstate->ext.DcLineDelta = CYRIXcbLineDelta << 12;
-+ newstate->ext.DcBufSize = 0x41 << 9;
-+ newstate->ext.DcCursorX = 0;
-+ newstate->ext.DcCursorY = 0;
-+ newstate->ext.DcCursorColor = 0;
-+
-+ /* Compression is enabled only when a buffer was allocated by
-+ FbInit and provided that the displayed screen is the virtual
-+ screen. If the line delta is not 1024 or 2048, entire frames
-+ will be flagged dirty as opposed to lines. Problems with 16bpp
-+ and line-dirty flagging seem to have been solved now. */
-+ if (CYRIXcbLineDelta != 0 &&
-+ mode->CrtcVDisplay == vga256InfoRec.virtualY &&
-+ mode->CrtcHDisplay == vga256InfoRec.virtualX)
-+ { newstate->ext.DcGeneralCfg = DC_GCFG_DECE
-+ | DC_GCFG_CMPE;
-+ if (/* vgaBitsPerPixel != 8 || -- this is OK now */
-+ (vga256InfoRec.displayWidth * (vgaBitsPerPixel / 8)) & 0x03FF)
-+ newstate->ext.DcGeneralCfg |= DC_GCFG_FDTY;
- }
- else
-- {
-- /* ### TO DO ### */
-- /* Enable display compression directly for VSA2. */
-- /* For VSA2, the display driver manages all graphics memory. */
-- }
-+ newstate->ext.DcGeneralCfg = 0;
-
-- /* initialize the graphics pipeline registers */
-
-+ /* initialize the graphics pipeline registers */
- newstate->ext.GpBlitStatus = ((vga256InfoRec.displayWidth == 2048) ?
- BC_FB_WIDTH_2048 : BC_FB_WIDTH_1024) |
- ((vgaBitsPerPixel == 16) ?
- BC_16BPP : BC_8BPP);
-+#endif
-+
- return(TRUE);
- }
-
-@@ -978,68 +914,31 @@
- CYRIXAdjust(x, y)
- int x, y;
- { int Base = (y * vga256InfoRec.displayWidth + x);
-- unsigned long active, sync, count1, count2;
-
- if (vgaBitsPerPixel > 8) Base *= (vgaBitsPerPixel / 8);
- if (vgaBitsPerPixel < 8) Base /= 2;
-
-- /* wait until out of active display area */
--
-- active = GX_REG(DC_V_TIMING_1) & 0x07FF;
-- sync = GX_REG(DC_V_TIMING_3) & 0x07FF;
--
-- do
-- {
-- /* read twice to avoid transition values */
--
-- count1 = GX_REG(DC_V_LINE_CNT) & 0x07FF;
-- count2 = GX_REG(DC_V_LINE_CNT) & 0x07FF;
-- } while ((count1 != count2) || (count1 < active) || (count1 >= sync));
--
-- /* load the start address directly */
--
-+ /* doing this using the SoftVGA registers does not work reliably */
- GX_REG(DC_UNLOCK) = DC_UNLOCK_VALUE;
- GX_REG(DC_FB_ST_OFFSET) = Base;
- GX_REG(DC_UNLOCK) = 0;
- }
-
--/*------------------------------------------------------------------------*\
--** ValidMode()
--**
--** From README file: "The ValidMode() function is required. It is used to
--** check for any chipset dependent reasons why a graphics mode might not be
--** valid. It gets called by higher levels of the code after the Probe()
--** stage. In many cases no special checking will be required and this
--** function will simply return TRUE always."
--**
--** For the Cyrix driver, this routine loops through modes provided in a
--** table at the beginning of this file and returns OK if it finds a match.
--** These tables were required to make the standard VESA 60 Hz and 75 Hz
--** modes work correctly. Doing this, however, takes away the flexibility
--** of adding different resolutions or different refresh rates to the
--** XF86Config file.
--\*------------------------------------------------------------------------*/
--
- static int
- CYRIXValidMode(mode, verbose, flag)
- DisplayModePtr mode;
- Bool verbose;
- int flag;
--{
-- int i;
--
-- /* loop through table of modes */
--
-- for (i = 0; i < NUM_CYRIX_MODES; i++)
-- {
-- if ((mode->CrtcHDisplay == CYRIXmodes[i].xsize) &&
-- (mode->CrtcVDisplay == CYRIXmodes[i].ysize))
-- {
-- return MODE_OK;
-- }
-+{ /* note (avg): there seems to be a lot more to this if you look
-+ at the GGI code (adjustment). */
-+ if (mode->CrtcHSyncStart - mode->CrtcHDisplay >= 24 ||
-+ mode->CrtcHSyncStart - mode->CrtcHDisplay <= 8)
-+ { if (verbose)
-+ ErrorF("%s %s: mode %s: horizontal sync out of range (sync - display should be between 8 and 24)\n",
-+ XCONFIG_PROBED, vga256InfoRec.name, mode->name
-+ );
-+ return MODE_HSYNC;
- }
-- return MODE_BAD;
-+ return(MODE_OK);
- }
--
--/* END OF FILE */
-
-diff -ruN XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/gxrender.c XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/gxrender.c
---- XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/gxrender.c Thu Jun 24 01:59:41 1999
-+++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/gxrender.c Wed Dec 31 19:00:00 1969
-@@ -1,1237 +0,0 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/gxrender.c,v 1.1.2.1 1999/06/24 05:59:41 hohndel Exp $ */
--/*
--//---------------------------------------------------------------------------
--// gxrender.c
--//
--// This file gives examples of using the MediaGX graphics unit to provide
--// acceleration for 2D display drivers. It is intended to provide an
--// absraction layer for new display driver development. This code handles
--// the quirks of the MediaGX graphics unit to allow faster developemt times
--// for new drivers.
--//---------------------------------------------------------------------------
--*/
--
--/* GRAPHICS PIPELINE REGISTER DEFINITIONS */
--
--#define GP_DST_XCOOR 0x8100 /* x destination origin */
--#define GP_DST_YCOOR 0x8102 /* y destination origin */
--#define GP_WIDTH 0x8104 /* pixel width */
--#define GP_HEIGHT 0x8106 /* pixel height */
--#define GP_SRC_XCOOR 0x8108 /* x source origin */
--#define GP_SRC_YCOOR 0x810A /* y source origin */
--
--#define GP_VECTOR_LENGTH 0x8104 /* vector length */
--#define GP_INIT_ERROR 0x8106 /* vector initial error */
--#define GP_AXIAL_ERROR 0x8108 /* axial error increment */
--#define GP_DIAG_ERROR 0x810A /* diagonal error increment */
--
--#define GP_SRC_COLOR_0 0x810C /* source color 0 */
--#define GP_SRC_COLOR_1 0x810E /* source color 1 */
--#define GP_PAT_COLOR_0 0x8110 /* pattern color 0 */
--#define GP_PAT_COLOR_1 0x8112 /* pattern color 1 */
--#define GP_PAT_COLOR_2 0x8114 /* pattern color 2 */
--#define GP_PAT_COLOR_3 0x8116 /* pattern color 3 */
--#define GP_PAT_DATA_0 0x8120 /* bits 31:0 of pattern */
--#define GP_PAT_DATA_1 0x8124 /* bits 63:32 of pattern */
--#define GP_PAT_DATA_2 0x8128 /* bits 95:64 of pattern */
--#define GP_PAT_DATA_3 0x812C /* bits 127:96 of pattern */
--
--#define GP_RASTER_MODE 0x8200 /* raster operation */
--#define GP_VECTOR_MODE 0x8204 /* vector mode register */
--#define GP_BLIT_MODE 0x8208 /* blit mode register */
--#define GP_BLIT_STATUS 0x820C /* blit status register */
--
--/* "GP_VECTOR_MODE" BIT DEFINITIONS */
--
--#define VM_X_MAJOR 0x0000 /* X major vector */
--#define VM_Y_MAJOR 0x0001 /* Y major vector */
--#define VM_MAJOR_INC 0x0002 /* positive major axis step */
--#define VM_MINOR_INC 0x0004 /* positive minor axis step */
--#define VM_READ_DST_FB 0x0008 /* read destination data */
--
--/* "GP_RASTER_MODE" BIT DEFINITIONS */
--
--#define RM_PAT_DISABLE 0x0000 /* pattern is disabled */
--#define RM_PAT_MONO 0x0100 /* 1BPP pattern expansion */
--#define RM_PAT_DITHER 0x0200 /* 2BPP pattern expansion */
--#define RM_PAT_COLOR 0x0300 /* 8BPP or 16BPP pattern */
--#define RM_PAT_MASK 0x0300 /* mask for pattern mode */
--#define RM_PAT_TRANSPARENT 0x0400 /* transparent 1BPP pattern */
--#define RM_SRC_TRANSPARENT 0x0800 /* transparent 1BPP source */
--
--/* "GP_BLIT_STATUS" BIT DEFINITIONS */
--
--#define BS_BLIT_BUSY 0x0001 /* blit engine is busy */
--#define BS_PIPELINE_BUSY 0x0002 /* graphics pipeline is bus */
--#define BS_BLIT_PENDING 0x0004 /* blit pending */
--#define BC_8BPP 0x0000 /* 8BPP mode */
--#define BC_16BPP 0x0100 /* 16BPP mode */
--#define BC_FB_WIDTH_1024 0x0000 /* framebuffer width = 1024 */
--#define BC_FB_WIDTH_2048 0x0200 /* framebuffer width = 2048 */
--
--/* "GP_BLIT_MODE" BIT DEFINITIONS */
--
--#define BM_READ_SRC_NONE 0x0000 /* source foreground color */
--#define BM_READ_SRC_FB 0x0001 /* read source from FB */
--#define BM_READ_SRC_BB0 0x0002 /* read source from BB0 */
--#define BM_READ_SRC_BB1 0x0003 /* read source from BB1 */
--#define BM_READ_SRC_MASK 0x0003 /* read source mask */
--
--#define BM_READ_DST_NONE 0x0000 /* no destination data */
--#define BM_READ_DST_BB0 0x0008 /* destination from BB0 */
--#define BM_READ_DST_BB1 0x000C /* destination from BB1 */
--#define BM_READ_DST_FB0 0x0010 /* dest from FB (store BB0) */
--#define BM_READ_DST_FB1 0x0014 /* dest from FB (store BB1)*/
--#define BM_READ_DST_MASK 0x001C /* read destination mask */
--
--#define BM_WRITE_FB 0x0000 /* write to framebuffer */
--#define BM_WRITE_MEM 0x0020 /* write to memory */
--#define BM_WRITE_MASK 0x0020 /* write mask */
--
--#define BM_SOURCE_COLOR 0x0000 /* source is 8BPP or 16BPP */
--#define BM_SOURCE_EXPAND 0x0040 /* source is 1BPP */
--#define BM_SOURCE_TEXT 0x00C0 /* source is 1BPP text */
--#define BM_SOURCE_MASK 0x00C0 /* source mask */
--
--#define BM_REVERSE_Y 0x0100 /* reverse Y direction */
--
--/* THE DRIVER NEEDS TO MAINTAIN THE SIZE AND LOCATION OF THE BLT BUFFERS
--// These constants will work with 2K or 3K config, 8 or 16 BPP. The driver
--// should set them, however, to optimize for the current config. Otherwise
--// screen to screen BLTs, for example, may be visibly split into two vertical
--// sections when they do not need to be.
--*/
--
--/* STATIC VARIABLES FOR GXRENDER.C FILE */
--
--unsigned char *GXRregptr;
--unsigned short GXRbpp;
--unsigned short GXRbb0Base;
--unsigned short GXRbb1Base;
--unsigned short GXRbufferWidthPixels;
--
--unsigned short GXRpatternFlags;
--unsigned short GXRsourceFlags;
--unsigned short GXRsavedColor;
--unsigned short GXRsavedRop;
--unsigned short GXRusesDstData;
--
--/* MACROS FOR REGISTER ACCESS
--// These macros asssume that a pointer was specified during initialization.
--// They also assume 32-bit access is possible (16-bit access such as for
--// Windows 98 display drivers would require different macros).
--*/
--
--#define WRITE_REG8(offset, value) \
-- (*(volatile unsigned char *)(GXRregptr + (offset))) = (value)
--
--#define WRITE_REG16(offset, value) \
-- (*(volatile unsigned short *)(GXRregptr + (offset))) = (value)
--
--#define WRITE_REG32(offset, value) \
-- (*(volatile unsigned long *)(GXRregptr + (offset))) = (value)
--
--#define READ_REG16(offset) \
-- (*(volatile unsigned short *)(GXRregptr + (offset)))
--
--#define READ_REG32(offset) \
-- (*(volatile unsigned long *)(GXRregptr + (offset)))
--
--/*
--//---------------------------------------------------------------------------
--// GXR_INITIALIZE
--//
--// This routine initializes the parameters for the current configuration.
--//
--// REGPTR pointer to GX memory mapped registers
--// BPP bits per pixel (8 pr 16)
--//
--//---------------------------------------------------------------------------
--*/
--
--void gxr_initialize(unsigned char *regptr, unsigned short bpp,
-- unsigned short BB0base, unsigned short BB1base,
-- unsigned short BBwidthPixels)
--{
-- GXRregptr = regptr;
-- GXRbpp = bpp;
-- GXRbb0Base = BB0base;
-- GXRbb1Base = BB1base;
-- GXRbufferWidthPixels = BBwidthPixels;
--}
--
--/*
--//---------------------------------------------------------------------------
--// GXR_WAIT_UNTIL_IDLE
--//
--// This routine waits until the graphics engine is idle.
--//---------------------------------------------------------------------------
--*/
--
--void gxr_wait_until_idle(void)
--{
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_BUSY);
--}
--
--/*
--//---------------------------------------------------------------------------
--// GXR_LOAD_SOLID_SOURCE
--//
--// This routine is used to specify a solid source color. For the Xfree96
--// display driver, the source color is used to specify a planemask and the
--// ROP is adjusted accordingly.
--//---------------------------------------------------------------------------
--*/
--
--void gxr_load_solid_source(unsigned short color)
--{
-- /* CLEAR TRANSPARENCY FLAG */
--
-- GXRsourceFlags = 0;
--
-- /* FORMAT 8 BPP COLOR */
-- /* GX requires 8BPP color data be duplicated into bits [15:8]. */
--
-- if (!(READ_REG16(GP_BLIT_STATUS) & BC_16BPP))
-- {
-- color &= 0x00FF;
-- color |= (color << 8);
-- }
--
-- /* POLL UNTIL ABLE TO WRITE THE SOURCE COLOR */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_SRC_COLOR_0, color);
--}
--
--/*
--//---------------------------------------------------------------------------
--// GXR_LOAD_MONO_SOURCE
--//
--// This routine is used to specify the monochrome source colors.
--//---------------------------------------------------------------------------
--*/
--
--void gxr_load_mono_source(unsigned short bgcolor, unsigned short fgcolor,
-- unsigned short transparent)
--{
-- /* SET TRANSPARENCY FLAG */
--
-- GXRsourceFlags = transparent ? RM_SRC_TRANSPARENT : 0;
--
-- /* FORMAT 8 BPP COLOR */
-- /* GX requires 8BPP color data be duplicated into bits [15:8]. */
--
-- if (!(READ_REG16(GP_BLIT_STATUS) & BC_16BPP))
-- {
-- bgcolor &= 0x00FF;
-- bgcolor |= (bgcolor << 8);
-- fgcolor &= 0x00FF;
-- fgcolor |= (fgcolor << 8);
-- }
--
-- /* POLL UNTIL ABLE TO WRITE THE SOURCE COLOR */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_SRC_COLOR_0, bgcolor);
-- WRITE_REG16(GP_SRC_COLOR_1, fgcolor);
--}
--
--/*
--//---------------------------------------------------------------------------
--// GXR_LOAD_SOLID_PATTERN
--//
--// This routine is used to specify a solid pattern color. It is called
--// before performing solid rectangle fills or more complicated BLTs that
--// use a solid pattern color.
--//
--// The driver should always call "gxr_load_raster_operation" after a call
--// to this routine to make sure that the pattern flags are set appropriately.
--//---------------------------------------------------------------------------
--*/
--
--void gxr_load_solid_pattern(unsigned short color)
--{
-- /* SET PATTERN FLAGS */
--
-- GXRpatternFlags = 0;
--
-- /* FORMAT 8 BPP COLOR */
-- /* GX requires 8BPP color data be duplicated into bits [15:8]. */
--
-- if (!(READ_REG16(GP_BLIT_STATUS) & BC_16BPP))
-- {
-- color &= 0x00FF;
-- color |= (color << 8);
-- }
--
-- /* SAVE THE REFORMATTED COLOR FOR LATER */
-- /* Used to call the "gxr_solid_fill" routine for special cases. */
--
-- GXRsavedColor = color;
--
-- /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_PAT_COLOR_0, color);
--}
--
--/*
--//---------------------------------------------------------------------------
--// GXR_LOAD_MONO_PATTERN
--//
--// This routine is used to specify a monochrome pattern.
--//---------------------------------------------------------------------------
--*/
--
--void gxr_load_mono_pattern(unsigned short bgcolor, unsigned short fgcolor,
-- unsigned long data0, unsigned long data1, unsigned char transparent)
--{
-- /* SET PATTERN FLAGS */
--
-- GXRpatternFlags = transparent ? RM_PAT_MONO | RM_PAT_TRANSPARENT :
-- RM_PAT_MONO;
--
-- /* FORMAT 8 BPP COLOR */
-- /* GX requires 8BPP color data be duplicated into bits [15:8]. */
--
-- if (!(READ_REG16(GP_BLIT_STATUS) & BC_16BPP))
-- {
-- bgcolor &= 0x00FF;
-- bgcolor |= (bgcolor << 8);
-- fgcolor &= 0x00FF;
-- fgcolor |= (fgcolor << 8);
-- }
--
-- /* POLL UNTIL ABLE TO WRITE THE PATTERN COLORS AND DATA */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_PAT_COLOR_0, bgcolor);
-- WRITE_REG16(GP_PAT_COLOR_1, fgcolor);
-- WRITE_REG32(GP_PAT_DATA_0, data0);
-- WRITE_REG32(GP_PAT_DATA_1, data1);
--}
--
--/*
--//---------------------------------------------------------------------------
--// GXR_LOAD_RASTER_OPERATION
--//
--// This routine loads the specified raster operation. It sets the pattern
--// flags appropriately.
--//---------------------------------------------------------------------------
--*/
--
--void gxr_load_raster_operation(unsigned char rop)
--{
-- unsigned short rop16;
--
-- /* GENERATE 16-BIT VERSION OF ROP WITH PATTERN FLAGS */
--
-- rop16 = (unsigned short) rop | GXRpatternFlags;
-- if ((rop & 0x33) ^ ((rop >> 2) & 0x33))
-- rop16 |= GXRsourceFlags;
--
-- /* SAVE ROP FOR LATER COMPARISONS */
-- /* Need to have the pattern flags included */
--
-- GXRsavedRop = rop16;
--
-- /* SET FLAG INDICATING ROP REQUIRES DESTINATION DATA */
-- /* True if even bits (0:2:4:6) do not equal the correspinding */
-- /* even bits (1:3:5:7). */
--
-- GXRusesDstData = ((rop & 0x55) ^ ((rop >> 1) & 0x55));
--
-- /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */
-- /* Only one operation can be pending at a time. */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_RASTER_MODE, rop16);
--}
--
--/*
--//---------------------------------------------------------------------------
--// GXR_SOLID_FILL
--//
--// This routine MUST be used when performing a solid rectangle fill with
--// the ROPs of PATCOPY (0xF0), BLACKNESS (0x00), WHITENESS (0xFF), or
--// PATINVERT (0x0F). There is a bug in GXm for these cases that requires a
--// workaround.
--//
--// For BLACKNESS (ROP = 0x00), set the color to 0x0000.
--// For WHITENESS (ROP = 0xFF), set the color to 0xFFFF.
--// For PATINVERT (ROP = 0x0F), invert the desired color.
--//
--// X screen X position (left)
--// Y screen Y position (top)
--// WIDTH width of rectangle, in pixels
--// HEIGHT height of rectangle, in scanlines
--// COLOR fill color
--//
--// THIS ROUTINE SHOULD NOT BE DIRECTLY CALLED FROM THE DRIVER. The driver
--// should always use gxr_pattern_fill and let that routine call this one
--// when approipriate. This is to hide quirks specific to MediaGX hardware.
--//---------------------------------------------------------------------------
--*/
--
--void gxr_solid_fill(unsigned short x, unsigned short y,
-- unsigned short width, unsigned short height, unsigned short color)
--{
-- unsigned short section;
--
-- /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
-- /* Only one operation can be pending at a time. */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
--
-- /* SET REGISTERS TO DRAW RECTANGLE */
--
-- WRITE_REG16(GP_DST_XCOOR, x);
-- WRITE_REG16(GP_DST_YCOOR, y);
-- WRITE_REG16(GP_HEIGHT, height);
-- WRITE_REG16(GP_RASTER_MODE, 0x00F0); /* PATCOPY */
-- WRITE_REG16(GP_PAT_COLOR_0, color);
--
-- /* CHECK WIDTH FOR GX BUG WORKAROUND */
--
-- if (width <= 16)
-- {
-- /* OK TO DRAW SMALL RECTANGLE IN ONE PASS */
--
-- WRITE_REG16(GP_WIDTH, width);
-- WRITE_REG16(GP_BLIT_MODE, 0);
-- }
-- else
-- {
-- /* DRAW FIRST PART OF RECTANGLE */
-- /* Get to a 16 pixel boundary. */
--
-- section = 0x10 - (x & 0x0F);
-- WRITE_REG16(GP_WIDTH, section);
-- WRITE_REG16(GP_BLIT_MODE, 0);
--
-- /* POLL UNTIL ABLE TO LOAD THE SECOND RECTANGLE */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_DST_XCOOR, x + section);
-- WRITE_REG16(GP_DST_YCOOR, y);
-- WRITE_REG16(GP_WIDTH, width - section);
-- WRITE_REG16(GP_BLIT_MODE, 0);
-- }
--}
--
--/*
--//----------------------------------------------------------------------------
--// GXR_PATTERN_FILL
--//
--// This routine is used to fill a rectangular region. The pattern must
--// be previously loaded using one of gxr_load_*_pattern routines. Also, the
--// raster operation must be previously specified using the
--// "gxr_load_raster_operation" routine.
--//
--// X screen X position (left)
--// Y screen Y position (top)
--// WIDTH width of rectangle, in pixels
--// HEIGHT height of rectangle, in scanlines
--//----------------------------------------------------------------------------
--*/
--
--void gxr_pattern_fill(unsigned short x, unsigned short y,
-- unsigned short width, unsigned short height)
--{
-- unsigned short section, buffer_width, blit_mode;
--
-- /* CHECK IF OPTIMIZED SOLID CASES */
-- /* Check all 16 bits of the ROP to include solid pattern flags. */
--
-- switch(GXRsavedRop)
-- {
-- /* CHECK FOR SPECIAL CASES WITHOUT DESTINATION DATA */
-- /* Need hardware workaround for fast "burst write" cases. */
--
-- case 0x00F0:
-- gxr_solid_fill(x, y, width, height, GXRsavedColor);
-- break;
-- case 0x000F:
-- gxr_solid_fill(x, y, width, height, ~GXRsavedColor);
-- break;
-- case 0x0000:
-- gxr_solid_fill(x, y, width, height, 0x0000);
-- break;
-- case 0x00FF:
-- gxr_solid_fill(x, y, width, height, 0xFFFF);
-- break;
--
-- /* REMAINING CASES REQUIRE DESTINATION DATA OR NOT SOLID COLOR */
--
-- default:
--
-- /* DETERMINE BLT MODE VALUE */
-- /* Still here for non-solid patterns without destination data. */
--
-- blit_mode = GXRusesDstData ? BM_READ_DST_FB0 : 0;
--
-- /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
-- /* Write the registers that do not change for each section. */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_HEIGHT, height);
--
-- /* SINCE ONLY DESTINATION DATA, WE CAN USE BOTH BB0 AND BB1. */
-- /* Therefore, width available = BLT buffer width * 2. */
--
-- buffer_width = GXRbufferWidthPixels << 1;
--
-- /* REPEAT UNTIL FINISHED WITH RECTANGLE */
-- /* Perform BLT in vertical sections, as wide as the BLT buffer */
-- /* allows. Hardware does not split the operations, so */
-- /* software must do it to avoid large scanlines that would */
-- /* overflow the BLT buffers. */
--
-- while(width > 0)
-- {
-- /* DETERMINE WIDTH OF SECTION */
--
-- if (width > buffer_width) section = buffer_width;
-- else section = width;
--
-- /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_DST_XCOOR, x);
-- WRITE_REG16(GP_DST_YCOOR, y);
-- WRITE_REG16(GP_WIDTH, section);
-- WRITE_REG16(GP_BLIT_MODE, blit_mode);
--
-- /* ADJUST PARAMETERS FOR NEXT SECTION */
--
-- width -= section;
-- x += section;
-- }
-- break;
-- }
--}
--
--/*
--//----------------------------------------------------------------------------
--// SCREEN TO SCREEN BLT
--//
--// This routine should be used to perform a screen to screen BLT when the
--// ROP does not require destination data.
--//
--// SRCX screen X position to copy from
--// SRCY screen Y position to copy from
--// DSTX screen X position to copy to
--// DSTY screen Y position to copy to
--// WIDTH width of rectangle, in pixels
--// HEIGHT height of rectangle, in scanlines
--//----------------------------------------------------------------------------
--*/
--
--void gxr_screen_to_screen_blt(unsigned short srcx, unsigned short srcy,
-- unsigned short dstx, unsigned short dsty, unsigned short width,
-- unsigned short height)
--{
-- unsigned short section, buffer_width;
-- unsigned short blit_mode;
--
-- /* CHECK IF RASTER OPERATION REQUIRES DESTINATION DATA */
--
-- blit_mode = GXRusesDstData ? BM_READ_DST_FB1 | BM_READ_SRC_FB :
-- BM_READ_SRC_FB;
--
-- /* CHECK Y DIRECTION */
-- /* Hardware has support for negative Y direction. */
--
-- if (dsty > srcy)
-- {
-- blit_mode |= BM_REVERSE_Y;
-- srcy += height - 1;
-- dsty += height - 1;
-- }
--
-- /* CHECK X DIRECTION */
-- /* Hardware does not support negative X direction since at the time */
-- /* of development all supported resolutions could fit a scanline of */
-- /* data at once into the BLT buffers (using both BB0 and BB1). This */
-- /* code is more generic to allow for any size BLT buffer. */
--
-- if (dstx > srcx)
-- {
-- srcx += width;
-- dstx += width;
-- }
--
-- /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
-- /* Write the registers that do not change for each section. */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_HEIGHT, height);
--
-- /* CHECK AVAILABLE BLT BUFFER SIZE */
-- /* Can use both BLT buffers if no destination data is required. */
--
-- buffer_width = GXRusesDstData ? GXRbufferWidthPixels :
-- GXRbufferWidthPixels << 1;
--
-- /* REPEAT UNTIL FINISHED WITH RECTANGLE */
-- /* Perform BLT in vertical sections, as wide as the BLT buffer allows. */
-- /* Hardware does not split the operations, so software must do it to */
-- /* avoid large scanlines that would overflow the BLT buffers. */
--
-- while(width > 0)
-- {
-- /* CHECK WIDTH OF CURRENT SECTION */
--
-- if (width > buffer_width) section = buffer_width;
-- else section = width;
--
-- /* PROGRAM REGISTERS THAT ARE THE SAME FOR EITHER X DIRECTION */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_SRC_YCOOR, srcy);
-- WRITE_REG16(GP_DST_YCOOR, dsty);
-- WRITE_REG16(GP_WIDTH, section);
--
-- /* CHECK X DIRECTION */
--
-- if (dstx > srcx)
-- {
-- /* NEGATIVE X DIRECTION */
-- /* Still positive X direction within the section. */
--
-- srcx -= section;
-- dstx -= section;
-- WRITE_REG16(GP_SRC_XCOOR, srcx);
-- WRITE_REG16(GP_DST_XCOOR, dstx);
-- WRITE_REG16(GP_BLIT_MODE, blit_mode);
-- }
-- else
-- {
-- /* POSITIVE X DIRECTION */
--
-- WRITE_REG16(GP_SRC_XCOOR, srcx);
-- WRITE_REG16(GP_DST_XCOOR, dstx);
-- WRITE_REG16(GP_BLIT_MODE, blit_mode);
-- dstx += section;
-- srcx += section;
-- }
-- width -= section;
-- }
--}
--
--/*
--//----------------------------------------------------------------------------
--// SCREEN TO SCREEN TRANSPARENT BLT
--//
--// This routine should be used to perform a screen to screen BLT when a
--// specified color should by transparent. The only supported ROP is SRCCOPY.
--//
--// SRCX screen X position to copy from
--// SRCY screen Y position to copy from
--// DSTX screen X position to copy to
--// DSTY screen Y position to copy to
--// WIDTH width of rectangle, in pixels
--// HEIGHT height of rectangle, in scanlines
--// COLOR transparent color
--//----------------------------------------------------------------------------
--*/
--
--void gxr_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy,
-- unsigned short dstx, unsigned short dsty, unsigned short width,
-- unsigned short height, unsigned short color)
--{
-- unsigned short section, buffer_width;
-- unsigned short blit_mode = BM_READ_SRC_FB;
-- unsigned short i;
--
-- /* CHECK Y DIRECTION */
-- /* Hardware has support for negative Y direction. */
--
-- if (dsty > srcy)
-- {
-- blit_mode |= BM_REVERSE_Y;
-- srcy += height - 1;
-- dsty += height - 1;
-- }
--
-- /* CHECK X DIRECTION */
-- /* Hardware does not support negative X direction since at the time */
-- /* of development all supported resolutions could fit a scanline of */
-- /* data at once into the BLT buffers (using both BB0 and BB1). This */
-- /* code is more generic to allow for any size BLT buffer. */
--
-- if (dstx > srcx)
-- {
-- srcx += width;
-- dstx += width;
-- }
--
-- /* CALCULATE BLT BUFFER SIZE */
-- /* Need to use BB1 to store the BLT buffer data. */
--
-- buffer_width = GXRbufferWidthPixels;
--
-- /* WRITE TRANSPARENCY COLOR TO BLT BUFFER 1 */
--
-- if (!(READ_REG16(GP_BLIT_STATUS) & BC_16BPP))
-- {
-- color &= 0x00FF;
-- color |= (color << 8);
-- }
--
-- /* WAIT UNTIL PIPELINE IS NOT BUSY BEFORE LOADING DATA INTO BB1 */
-- /* Need to make sure any previous BLT using BB1 is complete. */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_PIPELINE_BUSY);
-- for (i = 0; i < 16; i+=2)
-- {
-- WRITE_REG16(GXRbb1Base+i, color);
-- }
--
-- /* DO BOGUS BLT TO LATCH DATA FROM BB1 */
-- /* Already know graphics pipeline is idle. */
--
-- WRITE_REG32(GP_DST_XCOOR, 0);
-- WRITE_REG32(GP_SRC_XCOOR, 0);
-- WRITE_REG16(GP_WIDTH, 16);
-- WRITE_REG16(GP_HEIGHT, 1);
-- WRITE_REG16(GP_RASTER_MODE, 0x00CC);
-- WRITE_REG16(GP_BLIT_MODE, BM_READ_SRC_FB | BM_READ_DST_BB1);
--
-- /* WRITE REGISTERS FOR REAL SCREEN TO SCREEN BLT */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_HEIGHT, height);
-- WRITE_REG16(GP_RASTER_MODE, 0x10C6);
-- WRITE_REG32(GP_PAT_COLOR_0, 0xFFFFFFFF);
--
-- /* REPEAT UNTIL FINISHED WITH RECTANGLE */
-- /* Perform BLT in vertical sections, as wide as the BLT buffer allows. */
-- /* Hardware does not split the operations, so software must do it to */
-- /* avoid large scanlines that would overflow the BLT buffers. */
--
-- while(width > 0)
-- {
-- /* CHECK WIDTH OF CURRENT SECTION */
--
-- if (width > buffer_width) section = buffer_width;
-- else section = width;
--
-- /* PROGRAM REGISTERS THAT ARE THE SAME FOR EITHER X DIRECTION */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_SRC_YCOOR, srcy);
-- WRITE_REG16(GP_DST_YCOOR, dsty);
-- WRITE_REG16(GP_WIDTH, section);
--
-- /* CHECK X DIRECTION */
-- /* Again, this must be done in software, and can be removed if the */
-- /* display driver knows that the BLT buffers will always be large */
-- /* enough to contain an entire scanline of a screen to screen BLT. */
--
-- if (dstx > srcx)
-- {
-- /* NEGATIVE X DIRECTION */
-- /* Still positive X direction within the section. */
--
-- srcx -= section;
-- dstx -= section;
-- WRITE_REG16(GP_SRC_XCOOR, srcx);
-- WRITE_REG16(GP_DST_XCOOR, dstx);
-- WRITE_REG16(GP_BLIT_MODE, blit_mode);
-- }
-- else
-- {
-- /* POSITIVE X DIRECTION */
--
-- WRITE_REG16(GP_SRC_XCOOR, srcx);
-- WRITE_REG16(GP_DST_XCOOR, dstx);
-- WRITE_REG16(GP_BLIT_MODE, blit_mode);
-- dstx += section;
-- srcx += section;
-- }
-- width -= section;
-- }
--}
--
--/*
--//----------------------------------------------------------------------------
--// COLOR BITMAP TO SCREEN BLT
--//
--// This routine transfers color bitmap data to the screen. For most cases,
--// when the ROP is SRCCOPY, it may be faster to write a separate routine that
--// copies the data to the frame buffer directly. This routine should be
--// used when the ROP requires destination data.
--//
--// Transparency is handled by another routine.
--//
--// SRCX X offset within source bitmap
--// SRCY Y offset within source bitmap
--// DSTX screen X position to render data
--// DSTY screen Y position to render data
--// WIDTH width of rectangle, in pixels
--// HEIGHT height of rectangle, in scanlines
--// *DATA pointer to bitmap data
--// PITCH pitch of bitmap data (bytes between scanlines)
--// ROP ternary raster operation (0x00-0xFF).
--//----------------------------------------------------------------------------
--*/
--
--void gxr_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy,
-- unsigned short dstx, unsigned short dsty, unsigned short width,
-- unsigned short height, unsigned char *data, unsigned short pitch,
-- unsigned char rop)
--{
-- unsigned short section, buffer_width;
-- unsigned short blit_mode = BM_READ_SRC_BB0;
-- unsigned short line_srcx, line_dstx, line_width;
-- unsigned short offset, i;
--
-- /* CHECK IF ROP REQUIRES DESTINATION DATA */
-- /* Even bits (0:2:4:6) do not equal corresponding odd bits (1:3:5:7). */
--
-- if ((rop & 0x55) ^ ((rop >> 1) & 0x55))
-- blit_mode |= BM_READ_DST_FB1;
--
-- /* CHECK SIZE OF BLT BUFFER */
--
-- buffer_width = GXRbufferWidthPixels;
--
-- /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
-- /* Write the registers that do not change for each section. */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_HEIGHT, 1);
-- WRITE_REG16(GP_RASTER_MODE, (unsigned short) rop & 0x00FF);
--
-- /* REPEAT FOR EACH SCANLINE */
--
-- offset = srcy * pitch;
--
-- while(height > 0)
-- {
-- line_width = width;
-- line_srcx = srcx;
-- line_dstx = dstx;
--
-- while(line_width > 0)
-- {
-- /* CHECK WIDTH OF CURRENT SECTION */
--
-- if (line_width > buffer_width) section = buffer_width;
-- else section = line_width;
--
-- /* TRANSFER SCANLINE OF BITMAP DATA TO BLT BUFFER 0 */
-- /* Need to wait for BS_PIPELINE_BUSY to make sure that the */
-- /* data in BB0 for the previous scanline is no longer used. */
-- /* This can be heavily optimized to not do a byte at a time. */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_PIPELINE_BUSY);
-- if (READ_REG16(GP_BLIT_STATUS) & BC_16BPP)
-- {
-- for (i = 0; i < section; i++)
-- {
-- WRITE_REG16(GXRbb0Base+i, data[offset+((line_srcx+i)<<1)]);
-- }
-- }
-- else
-- {
-- for (i = 0; i < section; i++)
-- {
-- WRITE_REG8(GXRbb0Base+i, data[line_srcx+offset+i]);
-- }
-- }
--
-- /* RENDER FROM BB0 TO FRAME BUFFER */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_DST_XCOOR, line_dstx);
-- WRITE_REG16(GP_DST_YCOOR, dsty);
-- WRITE_REG16(GP_WIDTH, section);
-- WRITE_REG16(GP_BLIT_MODE, blit_mode);
--
-- line_width -= section;
-- line_dstx += section;
-- line_srcx += section;
-- }
-- height--;
-- dsty++;
-- offset += pitch;
-- }
--}
--
--/*
--//----------------------------------------------------------------------------
--// COLOR BITMAP TO SCREEN TRANSPARENT BLT
--//
--// This routine transfers color bitmap data to the screen with transparency.
--// The transparent color is specified. The only supported ROP is SRCCOPY,
--// meaning that transparency cannot be applied if the ROP requires
--// destination data (this is a hardware restriction).
--//
--// SRCX X offset within source bitmap
--// SRCY Y offset within source bitmap
--// DSTX screen X position to render data
--// DSTY screen Y position to render data
--// WIDTH width of rectangle, in pixels
--// HEIGHT height of rectangle, in scanlines
--// *DATA pointer to bitmap data
--// PITCH pitch of bitmap data (bytes between scanlines)
--// COLOR transparent color
--//----------------------------------------------------------------------------
--*/
--
--void gxr_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy,
-- unsigned short dstx, unsigned short dsty, unsigned short width,
-- unsigned short height, unsigned char *data, unsigned short pitch,
-- unsigned short color)
--{
-- unsigned short section, buffer_width;
-- unsigned short blit_mode = BM_READ_SRC_BB0;
-- unsigned short line_srcx, line_dstx, line_width;
-- unsigned short offset, i, first_blt = 1;
--
-- /* CHECK SIZE OF BLT BUFFER */
--
-- buffer_width = GXRbufferWidthPixels;
--
-- /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
-- /* Write the registers that do not change for each section. */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_HEIGHT, 1);
-- WRITE_REG16(GP_RASTER_MODE, 0x10C6);
-- WRITE_REG32(GP_PAT_COLOR_0, 0xFFFFFFFF);
--
-- /* CALCULATE OFFSET INTO BITMAP DATA */
--
-- offset = srcy * pitch;
--
-- /* REPEAT FOR EACH SCANLINE */
--
-- while(height > 0)
-- {
-- line_width = width;
-- line_srcx = srcx;
-- line_dstx = dstx;
--
-- while(line_width > 0)
-- {
-- /* CHECK WIDTH OF CURRENT SECTION */
--
-- if (line_width > buffer_width) section = buffer_width;
-- else section = line_width;
--
-- /* TRANSFER SCANLINE OF BITMAP DATA TO BLT BUFFER 0 */
-- /* Need to wait for BS_PIPELINE_BUSY to make sure that the */
-- /* data in BB0 for the previous scanline is no longer used. */
-- /* This can be heavily optimized to not do a byte at a time. */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_PIPELINE_BUSY);
-- if (READ_REG16(GP_BLIT_STATUS) & BC_16BPP)
-- {
-- for (i = 0; i < section; i++)
-- {
-- WRITE_REG16(GXRbb0Base+i, data[offset+((line_srcx+i)<<1)]);
-- }
-- }
-- else
-- {
-- for (i = 0; i < section; i++)
-- {
-- WRITE_REG8(GXRbb0Base+i, data[line_srcx+offset+i]);
-- }
-- }
--
-- /* RENDER FROM BB0 TO FRAME BUFFER */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_DST_XCOOR, line_dstx);
-- WRITE_REG16(GP_DST_YCOOR, dsty);
-- WRITE_REG16(GP_WIDTH, section);
--
-- /* NEED TO DO EXTRA WORK FOR THE FIRST BLT */
--
-- if (first_blt)
-- {
-- /* WRITE TRANSPARENCY COLOR TO BLT BUFFER 1 */
-- /* This can be heavily optimized to not do 16-bits at a time. */
--
-- if (READ_REG16(GP_BLIT_STATUS) & BC_16BPP)
-- {
-- for (i = 0; i < section; i++)
-- {
-- WRITE_REG16(GXRbb1Base+i*2, color);
-- }
-- }
-- else
-- {
-- for (i = 0; i < section; i++)
-- {
-- WRITE_REG8(GXRbb1Base+i, (unsigned char) color);
-- }
-- }
-- WRITE_REG16(GP_BLIT_MODE, BM_READ_SRC_BB0 | BM_READ_DST_BB1);
-- first_blt = 0;
-- }
-- else
-- {
-- /* AFTER FIRST BLT, THE TRANSPARENCY DATA IS LATCHED */
-- /* Save time by not reading data from BB1. */
--
-- WRITE_REG16(GP_BLIT_MODE, BM_READ_SRC_BB0);
-- }
-- line_width -= section;
-- line_dstx += section;
-- line_srcx += section;
-- }
-- height--;
-- dsty++;
-- offset += pitch;
-- }
--}
--
--/*
--//----------------------------------------------------------------------------
--// MONOCHROME BITMAP TO SCREEN BLT
--//
--// This routine transfers monochrome bitmap data to the screen.
--//
--// SRCX X offset within source bitmap
--// SRCY Y offset within source bitmap
--// DSTX screen X position to render data
--// DSTY screen Y position to render data
--// WIDTH width of rectangle, in pixels
--// HEIGHT height of rectangle, in scanlines
--// *DATA pointer to bitmap data
--// PITCH pitch of bitmap data (bytes between scanlines)
--// FGCOLOR color for bits = 1
--// BGCOLOR color for bits = 0
--// ROP ternary raster operation (0x00-0xFF).
--// TRANSPARENT zero for opaque, otherwise transparent
--//----------------------------------------------------------------------------
--*/
--
--void gxr_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy,
-- unsigned short dstx, unsigned short dsty, unsigned short width,
-- unsigned short height, unsigned char *data, unsigned short pitch,
-- unsigned short fgcolor, unsigned short bgcolor, unsigned char rop,
-- unsigned char transparent)
--{
-- unsigned short section, buffer_width;
-- unsigned short blit_mode = BM_READ_SRC_BB0 | BM_SOURCE_EXPAND;
-- unsigned short line_srcx, line_dstx, line_width;
-- unsigned short offset, i, bytes, raster_mode;
--
-- /* FORMAT 8BPP COLOR */
-- /* GX requires that 8BPP color data be duplicated into bits [15:8]. */
--
-- if (!(READ_REG16(GP_BLIT_STATUS) & BC_16BPP))
-- {
-- fgcolor &= 0x00FF;
-- fgcolor |= (fgcolor << 8);
-- bgcolor &= 0x00FF;
-- bgcolor |= (bgcolor << 8);
-- }
--
-- /* CHECK IF ROP REQUIRES DESTINATION DATA */
-- /* Even bits (0:2:4:6) do not equal corresponding odd bits (1:3:5:7). */
--
-- if ((rop & 0x55) ^ ((rop >> 1) & 0x55))
-- blit_mode |= BM_READ_DST_FB1;
--
-- /* CALCULATE RASTER MODE */
-- /* Set mono flag. Transparency set based on input parameter. */
--
-- raster_mode = ((unsigned short) rop & 0x00FF);
-- if (transparent) raster_mode |= RM_SRC_TRANSPARENT;
--
-- /* CHECK SIZE OF BLT BUFFER */
--
-- buffer_width = GXRbufferWidthPixels;
--
-- /* CALCULATE OFFSET INTO BITMAP DATA */
--
-- offset = srcy * pitch;
--
-- /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
-- /* Write the registers that do not change for each section. */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_HEIGHT, 1);
-- WRITE_REG16(GP_RASTER_MODE, raster_mode);
-- WRITE_REG16(GP_SRC_COLOR_0, bgcolor);
-- WRITE_REG16(GP_SRC_COLOR_1, fgcolor);
--
-- /* REPEAT FOR EACH SCANLINE */
--
-- while(height > 0)
-- {
-- line_width = width;
-- line_srcx = srcx;
-- line_dstx = dstx;
--
-- while(line_width > 0)
-- {
-- /* CHECK WIDTH OF CURRENT SECTION */
-- /* Only divide into sections if reading destination data. */
-- /* Since the source data is monochrome, it will always fit. */
--
-- section = line_width;
-- if ((line_width > buffer_width) && (blit_mode & BM_READ_DST_FB1))
-- section = buffer_width;
--
-- /* BYTES TO TRANSFER */
-- /* Add two bytes to handle truncating and alignment. */
--
-- bytes = (section >> 3) + 2;
--
-- /* TRANSFER SCANLINE OF BITMAP DATA TO BLT BUFFER 0 */
-- /* Need to wait for BS_PIPELINE_BUSY to make sure that the */
-- /* data in BB0 for the previous scanline is no longer used. */
-- /* This can be heavily optimized to not do a byte at a time. */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_PIPELINE_BUSY);
-- for (i = 0; i < bytes; i++)
-- {
-- WRITE_REG8(GXRbb0Base+i, data[(line_srcx >> 3)+offset+i]);
-- }
--
-- /* RENDER FROM BB0 TO FRAME BUFFER */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_DST_XCOOR, line_dstx);
-- WRITE_REG16(GP_DST_YCOOR, dsty);
-- WRITE_REG16(GP_SRC_XCOOR, line_srcx & 7);
-- WRITE_REG16(GP_WIDTH, section);
-- WRITE_REG16(GP_BLIT_MODE, blit_mode);
--
-- line_width -= section;
-- line_dstx += section;
-- line_srcx += section;
-- }
-- height--;
-- dsty++;
-- offset += pitch;
-- }
--}
--
--/*
--//----------------------------------------------------------------------------
--// TEXT GLYPH
--//
--// This routine draws a single character of text. It can only be used for
--// characters that are less than or equal to 64x64 in size, since it
--// transfers the entire data into the BLT buffers at once. Larger characters
--// should use the monochrome bitmap to screen routine. The only supported
--// ROP is SRCCOPY, again since the BLT buffer size is limited.
--//
--// SRCX X offset within source bitmap
--// SRCY Y offset within source bitmap
--// DSTX screen X position to render data
--// DSTY screen Y position to render data
--// WIDTH width of rectangle, in pixels
--// HEIGHT height of rectangle, in scanlines
--// *DATA pointer to bitmap data (NULL if already loaded)
--// PITCH pitch of bitmap data (bytes between scanlines)
--//
--// For the Xfree86 display driver, the OS is given a pointer to BB0.
--// Therefore, the data is already loaded when the driver is called, so the
--// driver simply passes a NULL pointer to this routine.
--//
--// This same type of routine could be developed for "icons", or small
--// color bitmaps that can fit entirely in the BLT buffer.
--//----------------------------------------------------------------------------
--*/
--
--void gxr_text_glyph(unsigned short srcx, unsigned short srcy,
-- unsigned short dstx, unsigned short dsty, unsigned short width,
-- unsigned short height, unsigned char *data, unsigned short pitch)
--{
-- unsigned short offset, i, j, buffer_offset, bytes, blit_mode;
--
-- blit_mode = BM_READ_SRC_BB0 | BM_SOURCE_EXPAND;
-- if (GXRusesDstData) blit_mode |= BM_READ_DST_FB1;
--
-- /* CHECK IF DATA NEEDS TO BE TRANSFERRED */
--
-- if (data != 0)
-- {
-- /* TRANSFER ENTIRE BITMAP DATA TO BLT BUFFER 0 */
-- /* Need to wait for BS_PIPELINE_BUSY to make sure that the */
-- /* data in BB0 for any previous BLT is no longer used. */
-- /* This data transfer has lots of room for performance optimization. */
--
-- buffer_offset = 0;
-- offset = srcy * pitch + (srcx >> 3);
-- bytes = ((width + (srcx & 7) + 7) >> 3);
-- while(READ_REG16(GP_BLIT_STATUS) & BS_PIPELINE_BUSY);
-- for (j = 0; j < height; j++)
-- {
-- for (i = 0; i < bytes; i++)
-- {
-- WRITE_REG8(GXRbb0Base+buffer_offset, data[offset+i]);
-- buffer_offset++;
-- }
-- offset += pitch;
-- }
-- }
--
-- /* RENDER FROM BB0 TO FRAME BUFFER */
-- /* Already know that the pipeline is idle from loading data. */
--
-- WRITE_REG16(GP_DST_XCOOR, dstx);
-- WRITE_REG16(GP_DST_YCOOR, dsty);
-- WRITE_REG16(GP_SRC_XCOOR, srcx & 7);
-- WRITE_REG16(GP_WIDTH, width);
-- WRITE_REG16(GP_HEIGHT, height);
-- WRITE_REG16(GP_BLIT_MODE, blit_mode);
--}
--
--/*
--//----------------------------------------------------------------------------
--// BRESENHAM LINE
--//
--// This routine draws a vector using the specified Bresenham parameters.
--// Currently this file does not support a routine that accepts the two
--// endpoints of a vector and calculates the Bresenham parameters. If it
--// ever does, this routine is still required for vectors that have been
--// clipped.
--//
--// X screen X position to start vector
--// Y screen Y position to start vector
--// LENGTH length of the vector, in pixels
--// INITERR Bresenham initial error term
--// AXIALERR Bresenham axial error term
--// DIAGERR Bresenham diagonal error term
--// FLAGS VM_YMAJOR, VM_MAJOR_INC, VM_MINOR_INC
--//----------------------------------------------------------------------------
--*/
--
--void gxr_bresenham_line(unsigned short x, unsigned short y,
-- unsigned short length, unsigned short initerr,
-- unsigned short axialerr, unsigned short diagerr,
-- unsigned short flags)
--{
-- unsigned short vector_mode = flags;
-- if (GXRusesDstData) vector_mode |= VM_READ_DST_FB;
--
-- /* CHECK NULL LENGTH */
--
-- if (!length) return;
--
-- /* LOAD THE REGISTERS FOR THE VECTOR */
--
-- while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
-- WRITE_REG16(GP_DST_XCOOR, x);
-- WRITE_REG16(GP_DST_YCOOR, y);
-- WRITE_REG16(GP_VECTOR_LENGTH, length);
-- WRITE_REG16(GP_INIT_ERROR, initerr);
-- WRITE_REG16(GP_AXIAL_ERROR, axialerr);
-- WRITE_REG16(GP_DIAG_ERROR, diagerr);
-- WRITE_REG16(GP_VECTOR_MODE, vector_mode);
--}
--
--/* END OF FILE */
--
+++ /dev/null
---- XFree86-3.3.6/xc/lib/X11/XlibInt.c.fixemacs Mon Jan 24 17:09:48 2000
-+++ XFree86-3.3.6/xc/lib/X11/XlibInt.c Mon Jan 24 17:10:49 2000
-@@ -597,7 +597,10 @@
- register char *bufindex;
- _XExtension *ext;
-
-- if (dpy->flags & XlibDisplayIOError) return;
-+ if (dpy->flags & XlibDisplayIOError) {
-+ dpy->bufptr = dpy->buffer; /* reset to avoid buffer overflows */
-+ return;
-+ }
- #ifdef XTHREADS
- while (dpy->flags & XlibDisplayWriting) {
- ConditionWait(dpy, dpy->lock->writers);
+++ /dev/null
---- XFree86-3.3.3.1/xc/nls/XLC_LOCALE/iso8859-2.fixiso8859-2 Thu Jun 10 14:25:13 1999
-+++ XFree86-3.3.3.1/xc/nls/XLC_LOCALE/iso8859-2 Thu Jun 10 14:25:48 1999
-@@ -67,7 +67,7 @@
- #else
- wc_encoding \x00008080
- #endif
-- ct_encoding ISO8859-2:GR
-+ ct_encoding ISO8859-2:GR; ISO8859-1:GR
- }
-
- END XLC_XLOCALE
+++ /dev/null
-diff -urN XFree86-3.3.6.orig/xc/programs/Xserver/hw/xfree86/XF86Setup/Imakefile XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/XF86Setup/Imakefile
---- XFree86-3.3.6.orig/xc/programs/Xserver/hw/xfree86/XF86Setup/Imakefile Sat Apr 17 17:51:10 1999
-+++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/XF86Setup/Imakefile Sat Mar 11 04:36:27 2000
-@@ -81,7 +81,7 @@
-
- XCONFIG_DEFINES = $(EXT_DEFINES) -DXF86SETUP \
- '-DPROJECTROOT="$(PROJECTROOT)"' \
-- '-DSERVER_CONFIG_FILE="$(LIBDIR)/$(XCONFIGFILE)"'
-+ '-DSERVER_CONFIG_FILE="/etc/X11/$(XCONFIGFILE)"'
-
- XF86SETUPLIBDIR = $(LIBDIR)/XF86Setup
- DEFINES = -DCARD_DATABASE_FILE='"$(CARDDBFILE)"' \
-diff -urN XFree86-3.3.6.orig/xc/programs/Xserver/hw/xfree86/XF86Setup/phase5.tcl XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/XF86Setup/phase5.tcl
---- XFree86-3.3.6.orig/xc/programs/Xserver/hw/xfree86/XF86Setup/phase5.tcl Tue Oct 12 20:06:52 1999
-+++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/XF86Setup/phase5.tcl Sat Mar 11 04:38:12 2000
-@@ -38,7 +38,7 @@
- set devid [lindex $DeviceIDs $idx]
- global Device_$devid
- set server [set Device_${devid}(Server)]
-- set linkname $Xwinhome/bin/X
-+ set linkname /etc/X11/X
- set lastlink $linkname
- for {set nlinks 0} \
- {[file exists $linkname] && [file type $linkname]=="link" \
-@@ -75,7 +75,7 @@
- if [string match XFCom* $server] {
- set serverpath $Xwinhome/bin/$server
- } else {
-- set serverpath $Xwinhome/bin/XF86_$server
-+ set serverpath ../../usr/X11R6/bin/XF86_$server
- }
- if [catch "link $serverpath X" ret] {
- mesg "Link creation failed!\n\
-diff -urN XFree86-3.3.6.orig/xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c
---- XFree86-3.3.6.orig/xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c Mon Dec 20 17:40:07 1999
-+++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c Sat Mar 11 04:36:27 2000
-@@ -107,7 +107,7 @@
- #endif
-
- /*
-- * Define this to have /etc/XF86Config prompted for as the default
-+ * Define this to have /etc/X11/XF86Config prompted for as the default
- * location to write the XF86Config file to.
- */
- #define PREFER_XF86CONFIG_IN_ETC
-@@ -215,7 +215,7 @@
- "This program will create a basic " CONFIGNAME " file, based on menu selections you\n"
- "make.\n"
- "\n"
--"The " CONFIGNAME " file usually resides in " TREEROOTLX " or /etc. A sample\n"
-+"The " CONFIGNAME " file usually resides in " TREEROOTLX " or /etc/X11. A sample\n"
- CONFIGNAME " file is supplied with XFree86; it is configured for a standard\n"
- "VGA card and monitor with 640x480 resolution. This program will ask for a\n"
- "pathname when it is ready to write the file.\n"
-@@ -2986,7 +2986,7 @@
- #endif
- #ifdef PREFER_XF86CONFIG_IN_ETC
- #if !(defined(__QNX__) && !defined(__QNXNTO__))
-- printf("Shall I write it to /etc/XF86Config? ");
-+ printf("Shall I write it to /etc/X11/XF86Config? ");
- #else
- printf("Shall I write it to /etc/config/X11/XF86Config.%d? ",
- getnid());
-@@ -2995,7 +2995,7 @@
- printf("\n");
- if (answerisyes(s))
- #if !(defined(__QNX__) && !defined(__QNXNTO__))
-- return "/etc/XF86Config";
-+ return "/etc/X11/XF86Config";
- #else
- /* In QNX, use XF86Config.nid for filename */
- {
-@@ -3030,11 +3030,11 @@
- #endif
-
- #ifndef PREFER_XF86CONFIG_IN_ETC
-- printf("Shall I write it to /etc/XF86Config? ");
-+ printf("Shall I write it to /etc/X11/XF86Config? ");
- getstring(s);
- printf("\n");
- if (answerisyes(s))
-- return "/etc/XF86Config";
-+ return "/etc/X11/XF86Config";
- #endif
- #else /* __EMX__ */
- {
-diff -urN XFree86-3.3.6.orig/xc/programs/Xserver/os/wrapper.c XFree86-3.3.6/xc/programs/Xserver/os/wrapper.c
---- XFree86-3.3.6.orig/xc/programs/Xserver/os/wrapper.c Fri Jul 30 15:07:09 1999
-+++ XFree86-3.3.6/xc/programs/Xserver/os/wrapper.c Sat Mar 11 04:36:27 2000
-@@ -42,6 +42,9 @@
- #define XSERVER_PATH "/usr/X11R6/bin/X"
- #endif
-
-+#undef XSERVER_PATH
-+#define XSERVER_PATH "/etc/X11/X"
-+
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
+++ /dev/null
---- xc/lib/GL/mesa/src/drv/tdfx/Imakefile.fred Thu Aug 24 09:17:57 2000
-+++ xc/lib/GL/mesa/src/drv/tdfx/Imakefile Thu Aug 24 09:51:47 2000
-@@ -278,7 +278,7 @@
- SRCS = $(DRISRCS) $(DRMSRCS) $(TDFXSRCS) $(MESASRCS) $(ASMSRCS)
- OBJS = $(DRIOBJS) $(DRMOBJS) $(TDFXOBJS) $(MESAOBJS) $(ASMOBJS)
-
--REQUIREDLIBS = -lglide3x -lm
-+REQUIREDLIBS = -lglide3 -lm
- #if !GlxBuiltInTdfx
- REQUIREDLIBS += -L../../../.. -lGL
- #endif
+++ /dev/null
---- XFree86-4.2.0/xc.orig/programs/Xserver/hw/xfree86/common/xf86PciInfo.h Mon Jan 21 02:55:00 2002
-+++ XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h Mon Jan 21 03:01:54 2002
-@@ -644,6 +644,7 @@
- /* Intel */
- #define PCI_CHIP_I830_M_BRIDGE 0x3575
- #define PCI_CHIP_I830_M 0x3577
-+#define PCI_CHIP_I815_M 0x1112
- #define PCI_CHIP_I815_BRIDGE 0x1130
- #define PCI_CHIP_I815 0x1132
- #define PCI_CHIP_I810_BRIDGE 0x7120
-@@ -1599,6 +1600,7 @@
- {PCI_CHIP_I810_BRIDGE, "i810 Bridge",0},
- {PCI_CHIP_I810_DC100_BRIDGE, "i810-dc100 Bridge",0},
- {PCI_CHIP_I810_E_BRIDGE,"i810e Bridge",0},
-+ {PCI_CHIP_I815_M, "i815m",0},
- {PCI_CHIP_I815_BRIDGE, "i815 Bridge",0},
- {PCI_CHIP_I830_M_BRIDGE,"i830M Bridge",0},
- #endif
---- XFree86-4.2.0/xc.orig/programs/Xserver/hw/xfree86/drivers/i810/i810.h Tue Jan 15 03:43:51 2002
-+++ XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h Mon Jan 21 02:59:17 2002
-@@ -798,6 +798,7 @@
- #define PCI_CHIP_I810 0x7121
- #define PCI_CHIP_I810_DC100 0x7123
- #define PCI_CHIP_I810_E 0x7125
-+#define PCI_CHIP_I815_M 0x1112
- #define PCI_CHIP_I815 0x1132
- #define PCI_CHIP_I810_BRIDGE 0x7120
- #define PCI_CHIP_I810_DC100_BRIDGE 0x7122
-@@ -809,7 +810,8 @@
- #define IS_I810(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I810 || \
- pI810->PciInfo->chipType == PCI_CHIP_I810_DC100 || \
- pI810->PciInfo->chipType == PCI_CHIP_I810_E)
--#define IS_I815(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I815)
-+#define IS_I815(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I815 || \
-+ pI810->PciInfo->chipType == PCI_CHIP_I815_M)
- #define IS_I830(pI810) (pI810->PciInfo->chipType == PCI_CHIP_I830_M)
-
-
---- XFree86-4.2.0/xc.orig/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c Thu Jan 10 01:02:29 2002
-+++ XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c Mon Jan 21 03:00:42 2002
-@@ -101,7 +101,8 @@
- { PCI_CHIP_I810, "i810"},
- { PCI_CHIP_I810_DC100, "i810-dc100"},
- { PCI_CHIP_I810_E, "i810e"},
-- { PCI_CHIP_I815, "i815"},
-+ { PCI_CHIP_I815, "i815"},
-+ { PCI_CHIP_I815_M, "i815m"},
- { PCI_CHIP_I830_M, "i830M"},
- { -1, NULL }
- };
-@@ -110,7 +111,8 @@
- { PCI_CHIP_I810, PCI_CHIP_I810, RES_SHARED_VGA },
- { PCI_CHIP_I810_DC100, PCI_CHIP_I810_DC100, RES_SHARED_VGA },
- { PCI_CHIP_I810_E, PCI_CHIP_I810_E, RES_SHARED_VGA },
-- { PCI_CHIP_I815, PCI_CHIP_I815, RES_SHARED_VGA },
-+ { PCI_CHIP_I815, PCI_CHIP_I815, RES_SHARED_VGA },
-+ { PCI_CHIP_I815_M, PCI_CHIP_I815_M, RES_SHARED_VGA },
- { PCI_CHIP_I830_M, PCI_CHIP_I830_M, RES_SHARED_VGA },
- { -1, -1, RES_UNDEFINED }
- };
+++ /dev/null
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v
-retrieving revision 1.56
-retrieving revision 1.57
-diff -u -r1.56 -r1.57
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c 2000/12/06 15:35:07 1.56
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c 2001/01/06 20:19:06 1.57
-@@ -225,12 +225,13 @@
-
- switch (pEnt->busType) {
- case BUS_PCI:
-- return (primaryBus.type == BUS_PCI &&
-- pEnt->pciBusId.bus == primaryBus.id.pci.bus &&
-+ return (pEnt->pciBusId.bus == primaryBus.id.pci.bus &&
- pEnt->pciBusId.device == primaryBus.id.pci.device &&
- pEnt->pciBusId.func == primaryBus.id.pci.func);
- case BUS_ISA:
-- return ( primaryBus.type == BUS_ISA );
-+ return TRUE;
-+ case BUS_SBUS:
-+ return (pEnt->sbusBusId.fbNum == primaryBus.id.sbus.fbNum);
- default:
- return FALSE;
- }
-@@ -1395,7 +1396,7 @@
- * only deals with exclusive resources.
- */
- void
--RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment)
-+RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated)
- {
- resPtr pRes;
- memType size, newsize, adjust;
-@@ -1406,6 +1407,8 @@
- (target->res_type & ResPhysMask))
- && pRes->block_begin <= target->block_end
- && pRes->block_end >= target->block_begin) {
-+ /* Possibly ignore estimated resources */
-+ if (!useEstimated && (pRes->res_type & ResEstimated)) continue;
- /*
- * target should be a larger region than pRes. If pRes fully
- * contains target, don't do anything.
-@@ -2973,13 +2976,13 @@
- CheckGenericGA();
- if (primaryBus.type != BUS_NONE) {
- char *bus;
-- char *loc = xnfcalloc(1,8);
-+ char *loc = xnfcalloc(1,9);
- if (loc == NULL) return;
-
- switch (primaryBus.type) {
- case BUS_PCI:
- bus = "PCI";
-- sprintf(loc,"%2.2x:%2.2x:%1.1x",primaryBus.id.pci.bus,
-+ sprintf(loc," %2.2x:%2.2x:%1.1x",primaryBus.id.pci.bus,
- primaryBus.id.pci.device,primaryBus.id.pci.func);
- break;
- case BUS_ISA:
-@@ -2988,14 +2991,14 @@
- break;
- case BUS_SBUS:
- bus = "SBUS";
-- sprintf(loc,"%2.2x",primaryBus.id.sbus.fbNum);
-+ sprintf(loc," %2.2x",primaryBus.id.sbus.fbNum);
- break;
- default:
- bus = "";
- loc[0] = '\0';
- }
-
-- xf86MsgVerb(X_INFO, 2, "Primary Device is: %s %s\n",bus,loc);
-+ xf86MsgVerb(X_INFO, 2, "Primary Device is: %s%s\n",bus,loc);
- xfree(loc);
- }
-
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Bus.h
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v
-retrieving revision 1.16
-retrieving revision 1.17
-diff -u -r1.16 -r1.17
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Bus.h 2000/06/20 05:08:43 1.16
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Bus.h 2001/01/06 20:19:07 1.17
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v 1.16 2000/06/20 05:08:43 dawes Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v 1.17 2001/01/06 20:19:07 tsi Exp $ */
- /*
- * Copyright (c) 1997 by The XFree86 Project, Inc.
- */
-@@ -124,7 +124,8 @@
- resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type);
- resPtr findIntersect(resRange Range, resPtr list);
- resPtr xf86FindIntersect(resRange Range, resPtr list);
--void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment);
-+void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment,
-+ Bool useEstimated);
- void xf86ConvertListToHost(int entityIndex, resPtr list);
-
- #endif /* _XF86_BUS_H */
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Config.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v
-retrieving revision 3.236
-retrieving revision 3.237
-diff -u -r3.236 -r3.237
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Config.c 2000/12/06 15:35:07 3.236
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Config.c 2001/01/06 20:19:07 3.237
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.236 2000/12/06 15:35:07 eich Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.237 2001/01/06 20:19:07 tsi Exp $ */
-
-
- /*
-@@ -2060,6 +2060,7 @@
- X_INFO_STRING " informational,\n"
- " " X_WARNING_STRING " warning, "
- X_ERROR_STRING " error, "
-+ X_NOT_IMPLEMENTED_STRING " not implemented, "
- X_UNKNOWN_STRING " unknown.\n");
-
- /*
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v
-retrieving revision 3.49
-retrieving revision 3.50
-diff -u -r3.49 -r3.50
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c 2000/12/12 18:23:50 3.49
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c 2001/01/06 20:19:07 3.50
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.49 2000/12/12 18:23:50 tsi Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.50 2001/01/06 20:19:07 tsi Exp $ */
- /*
- * Copyright 2000 by Alan Hourihane, Sychdyn, North Wales.
- *
-@@ -213,7 +213,7 @@
- # undef CardName
-
- if (chipset < 0)
-- chipset = (pVideo->vendor << 16) || pVideo->chipType;
-+ chipset = (pVideo->vendor << 16) | pVideo->chipType;
- }
- break;
- case BUS_ISA:
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v
-retrieving revision 1.108
-retrieving revision 1.109
-diff -u -r1.108 -r1.109
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c 2000/12/14 16:33:08 1.108
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c 2001/01/06 20:19:07 1.109
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.108 2000/12/14 16:33:08 eich Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.109 2001/01/06 20:19:07 tsi Exp $ */
-
- /*
- * Copyright (c) 1997-1998 by The XFree86 Project, Inc.
-@@ -1217,6 +1217,9 @@
- break;
- case X_INFO:
- s = X_INFO_STRING;
-+ break;
-+ case X_NOT_IMPLEMENTED:
-+ s = X_NOT_IMPLEMENTED_STRING;
- break;
- case X_NONE:
- s = NULL;
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v
-retrieving revision 1.36
-retrieving revision 1.37
-diff -u -r1.36 -r1.37
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c 2000/12/06 15:35:11 1.36
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c 2001/01/06 20:19:08 1.37
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.36 2000/12/06 15:35:11 eich Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.37 2001/01/06 20:19:08 tsi Exp $ */
-
- /*
- * Copyright (c) 1997,1998 by The XFree86 Project, Inc.
-@@ -1305,16 +1305,16 @@
- q->status = MODE_OK;
- } else {
- if (p->type & M_T_BUILTIN)
-- xf86DrvMsg(scrp->scrnIndex, X_WARNING,
-- "Built-in mode \"%s\" deleted (%s)\n", p->name,
-- xf86ModeStatusToString(status));
-+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
-+ "Not using built-in mode \"%s\" (%s)\n",
-+ p->name, xf86ModeStatusToString(status));
- else if (p->type & M_T_DEFAULT)
-- xf86DrvMsg(scrp->scrnIndex, X_WARNING,
-- "Default mode \"%s\" deleted (%s)\n", p->name,
-+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
-+ "Not using default mode \"%s\" (%s)\n", p->name,
- xf86ModeStatusToString(status));
- else
-- xf86DrvMsg(scrp->scrnIndex, X_WARNING,
-- "Mode \"%s\" deleted (%s)\n", p->name,
-+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
-+ "Not using mode \"%s\" (%s)\n", p->name,
- xf86ModeStatusToString(status));
- }
- }
-@@ -1401,16 +1401,16 @@
- status = xf86LookupMode(scrp, p, clockRanges, strategy);
- if (status != MODE_OK) {
- if (p->type & M_T_BUILTIN)
-- xf86DrvMsg(scrp->scrnIndex, X_WARNING,
-- "Built-in mode \"%s\" deleted (%s)\n", p->name,
-- xf86ModeStatusToString(status));
-+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
-+ "Not using built-in mode \"%s\" (%s)\n",
-+ p->name, xf86ModeStatusToString(status));
- else if (p->type & M_T_DEFAULT)
-- xf86DrvMsg(scrp->scrnIndex, X_WARNING,
-- "Default mode \"%s\" deleted (%s)\n", p->name,
-+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
-+ "Not using default mode \"%s\" (%s)\n", p->name,
- xf86ModeStatusToString(status));
- else
-- xf86DrvMsg(scrp->scrnIndex, X_WARNING,
-- "Mode \"%s\" deleted (%s)\n", p->name,
-+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
-+ "Not using mode \"%s\" (%s)\n", p->name,
- xf86ModeStatusToString(status));
- }
- if (status == MODE_ERROR) {
-@@ -1493,16 +1493,16 @@
-
- if (p->status != MODE_OK) {
- if (p->type & M_T_BUILTIN)
-- xf86DrvMsg(scrp->scrnIndex, X_WARNING,
-- "Built-in mode \"%s\" deleted (%s)\n", p->name,
-- xf86ModeStatusToString(p->status));
-+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
-+ "Not using built-in mode \"%s\" (%s)\n",
-+ p->name, xf86ModeStatusToString(p->status));
- else if (p->type & M_T_DEFAULT)
-- xf86DrvMsg(scrp->scrnIndex, X_WARNING,
-- "Default mode \"%s\" deleted (%s)\n", p->name,
-+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
-+ "Not using default mode \"%s\" (%s)\n", p->name,
- xf86ModeStatusToString(p->status));
- else
-- xf86DrvMsg(scrp->scrnIndex, X_WARNING,
-- "Mode \"%s\" deleted (%s)\n", p->name,
-+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
-+ "Not using mode \"%s\" (%s)\n", p->name,
- xf86ModeStatusToString(p->status));
-
- goto lookupNext;
-@@ -1607,17 +1607,17 @@
- if (p->status != MODE_OK) {
- #if 0
- if (p->type & M_T_BUILTIN)
-- xf86DrvMsg(scrp->scrnIndex, X_WARNING,
-- "Built-in mode \"%s\" deleted (%s)\n", p->name,
-+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
-+ "Not using built-in mode \"%s\" (%s)\n", p->name,
- xf86ModeStatusToString(p->status));
- else if (p->type & M_T_DEFAULT)
-- xf86DrvMsg(scrp->scrnIndex, X_WARNING,
-- "Default mode \"%s\" deleted (%s)\n", p->name,
-- xf86ModeStatusToString(p->status));
-+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
-+ "Not using default mode \"%s\" (%s)\n", p->name,
-+ xf86ModeStatusToString(p->status));
- else
-- xf86DrvMsg(scrp->scrnIndex, X_WARNING,
-- "Mode \"%s\" deleted (%s)\n", p->name,
-- xf86ModeStatusToString(p->status));
-+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
-+ "Not using mode \"%s\" (%s)\n", p->name,
-+ xf86ModeStatusToString(p->status));
- #endif
- xf86DeleteMode(&(scrp->modes), p);
- }
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v
-retrieving revision 1.21
-retrieving revision 1.22
-diff -u -r1.21 -r1.22
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h 2000/11/06 19:24:07 1.21
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h 2001/01/06 20:19:08 1.22
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.21 2000/11/06 19:24:07 dawes Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.22 2001/01/06 20:19:08 tsi Exp $ */
-
- /*
- * Copyright (c) 1997,1998 by The XFree86 Project, Inc.
-@@ -200,6 +200,9 @@
- #endif
- #ifndef X_INFO_STRING
- #define X_INFO_STRING "(II)"
-+#endif
-+#ifndef X_NOT_IMPLEMENTED_STRING
-+#define X_NOT_IMPLEMENTED_STRING "(NI)"
- #endif
-
- #endif /* _XF86PRIVSTR_H */
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v
-retrieving revision 3.28
-retrieving revision 3.29
-diff -u -r3.28 -r3.29
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c 2000/12/08 20:13:35 3.28
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c 2001/01/06 20:19:08 3.29
-@@ -175,11 +175,16 @@
- if ((PCISHAREDIOCLASSES(baseclass, subclass))
- && (pcrp->pci_command & PCI_CMD_IO_ENABLE) &&
- (pcrp->pci_prog_if == 0)) {
-- /* assumption: primary bus is always VGA */
-+ if (primaryBus.type == BUS_NONE) {
-+ /* assumption: primary bus is always VGA */
- primaryBus.type = BUS_PCI;
- primaryBus.id.pci.bus = pcrp->busnum;
- primaryBus.id.pci.device = pcrp->devnum;
- primaryBus.id.pci.func = pcrp->funcnum;
-+ } else if (primaryBus.type < BUS_last) {
-+ xf86Msg(X_NOTICE, "More than one primary device found\n");
-+ primaryBus.type ^= (BusType)(-1);
-+ }
- }
-
- for (j = 0; j < 6; j++) {
-@@ -752,7 +757,7 @@
- }
- }
-
-- RemoveOverlaps(target,bridgeRes,TRUE);
-+ RemoveOverlaps(target, bridgeRes, TRUE, TRUE);
- if (range.rEnd > target->block_end) {
- correctPciSize(range.rBegin,range.rEnd - range.rBegin,
- target->block_end - target->block_begin,
-@@ -902,9 +907,9 @@
- if (ResIsEstimated(&pRes->val)) {
- range = pRes->val;
-
-- RemoveOverlaps(pRes, *activeRes, TRUE);
-- if (xf86Info.estimateSizesAggressively > 0)
-- RemoveOverlaps(pRes, *inactiveRes, TRUE);
-+ RemoveOverlaps(pRes, *activeRes, TRUE, TRUE);
-+ RemoveOverlaps(pRes, *inactiveRes, TRUE,
-+ (xf86Info.estimateSizesAggressively > 0));
-
- if (range.rEnd > pRes->block_end) {
- correctPciSize(range.rBegin,range.rEnd - range.rBegin,
-@@ -923,14 +928,16 @@
- xf86PrintResList(3, *activeRes);
- }
-
-- if (*inactiveRes && (xf86Info.estimateSizesAggressively > 1)) {
-+ if (*inactiveRes) {
- /* Check for overlaps */
- for (pRes = *inactiveRes; pRes; pRes = pRes->next) {
- if (ResIsEstimated(&pRes->val)) {
- range = pRes->val;
-
-- RemoveOverlaps(pRes, *activeRes, TRUE);
-- RemoveOverlaps(pRes, *inactiveRes, TRUE);
-+ RemoveOverlaps(pRes, *activeRes, TRUE,
-+ (xf86Info.estimateSizesAggressively > 1));
-+ RemoveOverlaps(pRes, *inactiveRes, TRUE,
-+ (xf86Info.estimateSizesAggressively > 1));
-
- if (range.rEnd > pRes->block_end) {
- correctPciSize(range.rBegin,range.rEnd - range.rBegin,
-@@ -946,7 +953,7 @@
- }
- }
- xf86MsgVerb(X_INFO, 3,
-- "Ative PCI resource ranges after removing overlaps:\n");
-+ "Active PCI resource ranges after removing overlaps:\n");
- xf86PrintResList(3, *inactiveRes);
- }
- }
-@@ -968,7 +975,7 @@
- */
-
- for (tmp = *osRes; tmp; tmp = tmp->next)
-- RemoveOverlaps(tmp, activeRes, FALSE);
-+ RemoveOverlaps(tmp, activeRes, FALSE, TRUE);
-
- xf86MsgVerb(X_INFO, 3, "OS-reported resource ranges after removing"
- " overlaps with PCI:\n");
-@@ -976,7 +983,7 @@
-
- pciAvoidRes = xf86AddRangesToList(pciAvoidRes,PciAvoid,-1);
- for (tmp = pciAvoidRes; tmp; tmp = tmp->next)
-- RemoveOverlaps(tmp, activeRes, FALSE);
-+ RemoveOverlaps(tmp, activeRes, FALSE, TRUE);
- tmp = xf86DupResList(*osRes);
- pciAvoidRes = xf86JoinResLists(pciAvoidRes,tmp);
-
-@@ -1424,40 +1431,54 @@
- if ((*num < 0) || (*num > 5) ||
- !pvp->memBase[*num] || (pvp->size[*num] < biosSize)) {
- *num = -1;
-+ } else {
-+ P_M_RANGE(range, TAG(pvp), pvp->memBase[*num], biosSize,
-+ ResExcMemBlock);
-+ if (!xf86IsSubsetOf(range, m) || ChkConflict(&range, avoid, SETUP))
-+ *num = -1;
-+ }
-+
-+ if (*num < 0) {
- for (n = 0; n <= 5; n++) {
- if (pvp->memBase[n] && (pvp->size[n] >= biosSize)) {
-- *num = n;
-- break;
-+ /* keep bios size ! */
-+ P_M_RANGE(range, TAG(pvp), pvp->memBase[*num],
-+ biosSize, ResExcMemBlock);
-+ if (xf86IsSubsetOf(range, m) &&
-+ !ChkConflict(&range, avoid, SETUP)) {
-+ *num = n;
-+ break;
-+ }
- }
- }
- }
-
-- if (*num >= 0) {
-- /* then try suggested memBase */
-- /* keep bios size ! */
-- P_M_RANGE(range,TAG(pvp),pvp->memBase[*num],biosSize,ResExcMemBlock);
-- if (xf86IsSubsetOf(range,m) && !ChkConflict(&range,avoid,SETUP)) {
-- xf86FreeResList(avoid);
-- xf86FreeResList(m);
-- return pvp->memBase[*num];
-- }
-- }
-+ /*
-+ * Return a possible window. Note that this doesn't deal with host bridges
-+ * yet. But the fix for that belongs elsewhere.
-+ */
- while (m) {
- range = xf86GetBlock(ResExcMemBlock,
-- PCI_SIZE(ResMem,TAG(pvp),(1 << biosSize)),
-+ PCI_SIZE(ResMem, TAG(pvp), 1 << biosSize),
- m->block_begin, m->block_end,
-- PCI_SIZE(ResMem,TAG(pvp),alignment), avoid);
-- if (range.type != ResEnd)
-- break;
-+ PCI_SIZE(ResMem, TAG(pvp), alignment), avoid);
-+ if (range.type != ResEnd) {
-+ xf86FreeResList(avoid);
-+ xf86FreeResList(m);
-+ return M2B(TAG(pvp), range.rBase);
-+ }
- m = m->next;
- }
--
-+
- xf86FreeResList(avoid);
- xf86FreeResList(m);
-- xf86MsgVerb(X_INFO,5,"GetVaildBIOSBase for %x:%x:%x: BIOSbase 0x%lx\n",
-- pvp->bus,pvp->device,pvp->func,
-- (memType)M2B(TAG(pvp),range.rBase));
-- return M2B(TAG(pvp),range.rBase);
-+
-+ if (*num >= 0) {
-+ /* then try suggested memBase */
-+ return pvp->memBase[*num];
-+ }
-+
-+ return 0;
- }
-
- /*
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86str.h
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/common/xf86str.h,v
-retrieving revision 1.74
-retrieving revision 1.75
-diff -u -r1.74 -r1.75
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86str.h 2000/12/13 02:44:59 1.74
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86str.h 2001/01/06 20:19:08 1.75
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.74 2000/12/13 02:44:59 tsi Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.75 2001/01/06 20:19:08 tsi Exp $ */
-
- /*
- * Copyright (c) 1997-2000 by The XFree86 Project, Inc.
-@@ -233,7 +233,8 @@
- BUS_NONE,
- BUS_ISA,
- BUS_PCI,
-- BUS_SBUS
-+ BUS_SBUS,
-+ BUS_last /* Keep last */
- } BusType;
-
- typedef struct {
-@@ -438,7 +439,8 @@
- X_ERROR, /* Error message */
- X_WARNING, /* Warning message */
- X_INFO, /* Informational message */
-- X_NONE /* No prefix */
-+ X_NONE, /* No prefix */
-+ X_NOT_IMPLEMENTED /* Not implemented */
- } MessageType;
-
- /* flags for depth 24 pixmap options */
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c,v
-retrieving revision 1.13
-retrieving revision 1.15
-diff -u -r1.13 -r1.15
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c 2000/11/02 16:55:28 1.13
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c 2001/01/06 20:58:06 1.15
-@@ -1,6 +1,6 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c,v 1.13 2000/11/02 16:55:28 tsi Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c,v 1.15 2001/01/06 20:58:06 tsi Exp $ */
- /*
-- * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca
-+ * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
-@@ -107,8 +107,8 @@
- OptionInfoPtr
- ATIAvailableOptions
- (
-- int ChipId, /* Ignored */
-- int BusId /* Ignored */
-+ int ChipId,
-+ int BusId
- )
- {
- OptionInfoPtr pOptions;
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v
-retrieving revision 1.36
-retrieving revision 1.38
-diff -u -r1.36 -r1.38
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c 2000/12/13 02:44:59 1.36
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c 2001/01/06 20:58:07 1.38
-@@ -1,6 +1,6 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v 1.36 2000/12/13 02:44:59 tsi Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v 1.38 2001/01/06 20:58:07 tsi Exp $ */
- /*
-- * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca
-+ * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
-@@ -2241,6 +2241,7 @@
-
- xf86LoaderReqSymLists(ATISymbols, NULL);
-
-+#ifndef ELFDEBUG
- /* Workaround for possible loader bug */
- # define ATIPreInit \
- (xf86PreInitProc*) LoaderSymbol("ATIPreInit")
-@@ -2258,6 +2259,7 @@
- (xf86FreeScreenProc*) LoaderSymbol("ATIFreeScreen")
- # define ATIValidMode \
- (xf86ValidModeProc*) LoaderSymbol("ATIValidMode")
-+#endif
-
- #endif
-
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h,v
-retrieving revision 1.12
-retrieving revision 1.14
-diff -u -r1.12 -r1.14
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h 2000/08/22 21:54:31 1.12
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h 2001/01/06 20:58:07 1.14
-@@ -1,6 +1,6 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h,v 1.12 2000/08/22 21:54:31 tsi Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h,v 1.14 2001/01/06 20:58:07 tsi Exp $ */
- /*
-- * Copyright 1994 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca
-+ * Copyright 1994 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
-@@ -62,7 +62,7 @@
- #define SparseIOTag(_IOSelect) IOPortTag(_IOSelect, 0)
- #define BlockIOTag(_IOSelect) IOPortTag(0, _IOSelect)
-
--/* MDA/CGA/EGA/VGA I/O ports */
-+/* MDA/[M]CGA/EGA/VGA I/O ports */
- #define GENVS 0x0102u /* Write (and Read on uC only) */
-
- #define R_GENLPS 0x03b9u /* Read */
-@@ -99,24 +99,24 @@
- #define MonochromeIOBase 0x03b0u
- #define ColourIOBase 0x03d0u
-
--/* Other EGA/CGA/VGA I/O ports */
--/* ?(_IOBase) (_IOBase + 0x00u) */
--/* ?(_IOBase) (_IOBase + 0x01u) */
--/* ?(_IOBase) (_IOBase + 0x02u) */
--/* ?(_IOBase) (_IOBase + 0x03u) */
--#define CRTX(_IOBase) (_IOBase + 0x04u)
--#define CRTD(_IOBase) (_IOBase + 0x05u)
--/* ?(_IOBase) (_IOBase + 0x06u) */
--/* ?(_IOBase) (_IOBase + 0x07u) */
--#define GENMC(_IOBase) (_IOBase + 0x08u)
--/* ?(_IOBase) (_IOBase + 0x09u) */ /* R_GENLPS/GENB */
--#define GENS1(_IOBase) (_IOBase + 0x0au) /* Read */
--#define GENFC(_IOBase) (_IOBase + 0x0au) /* Write */
--#define GENLPC(_IOBase) (_IOBase + 0x0bu)
--/* ?(_IOBase) (_IOBase + 0x0cu) */ /* /GENLPS */
--/* ?(_IOBase) (_IOBase + 0x0du) */ /* /KCX */
--/* ?(_IOBase) (_IOBase + 0x0eu) */ /* /KCD */
--/* ?(_IOBase) (_IOBase + 0x0fu) */ /* GENHP/ */
-+/* Other MDA/[M]CGA/EGA/VGA I/O ports */
-+/* ?(_IOBase) ((_IOBase) + 0x00u) */ /* CRTX synonym */
-+/* ?(_IOBase) ((_IOBase) + 0x01u) */ /* CRTD synonym */
-+/* ?(_IOBase) ((_IOBase) + 0x02u) */ /* CRTX synonym */
-+/* ?(_IOBase) ((_IOBase) + 0x03u) */ /* CRTD synonym */
-+#define CRTX(_IOBase) ((_IOBase) + 0x04u)
-+#define CRTD(_IOBase) ((_IOBase) + 0x05u)
-+/* ?(_IOBase) ((_IOBase) + 0x06u) */
-+/* ?(_IOBase) ((_IOBase) + 0x07u) */
-+#define GENMC(_IOBase) ((_IOBase) + 0x08u)
-+/* ?(_IOBase) ((_IOBase) + 0x09u) */ /* R_GENLPS/GENB */
-+#define GENS1(_IOBase) ((_IOBase) + 0x0au) /* Read */
-+#define GENFC(_IOBase) ((_IOBase) + 0x0au) /* Write */
-+#define GENLPC(_IOBase) ((_IOBase) + 0x0bu)
-+/* ?(_IOBase) ((_IOBase) + 0x0cu) */ /* /GENLPS */
-+/* ?(_IOBase) ((_IOBase) + 0x0du) */ /* /KCX */
-+/* ?(_IOBase) ((_IOBase) + 0x0eu) */ /* /KCD */
-+/* ?(_IOBase) ((_IOBase) + 0x0fu) */ /* GENHP/ */
-
- /* 8514/A VESA approved register definitions */
- #define DISP_STAT 0x02e8u /* Read */
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v
-retrieving revision 1.8
-retrieving revision 1.9
-diff -u -r1.8 -r1.9
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h 2000/12/08 19:15:33 1.8
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h 2001/01/06 20:19:10 1.9
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.8 2000/12/08 19:15:33 martin Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.9 2001/01/06 20:19:10 tsi Exp $ */
- /*
- * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
- * Precision Insight, Inc., Cedar Park, Texas, and
-@@ -193,7 +193,6 @@
- unsigned long LinearAddr; /* Frame buffer physical address */
- unsigned long MMIOAddr; /* MMIO region physical address */
- unsigned long BIOSAddr; /* BIOS physical address */
-- Bool BIOSFromPCI; /* BIOS is read from PCI space */
-
- unsigned char *MMIO; /* Map of MMIO region */
- unsigned char *FB; /* Map of frame buffer */
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v
-retrieving revision 1.15
-retrieving revision 1.16
-diff -u -r1.15 -r1.16
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c 2000/12/22 12:13:15 1.15
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c 2001/01/06 20:19:10 1.16
-@@ -503,17 +503,12 @@
- }
-
- /* Read the Video BIOS block and the FP registers (if applicable). */
--static Bool R128GetBIOSParameters(ScrnInfoPtr pScrn)
-+static Bool R128GetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
- {
- R128InfoPtr info = R128PTR(pScrn);
- int i;
- int FPHeader = 0;
-
--#define R128ReadBIOS(offset, buffer, length) \
-- (info->BIOSFromPCI ? \
-- xf86ReadPciBIOS(offset, info->PciTag, 0, buffer, length) : \
-- xf86ReadBIOS(info->BIOSAddr, offset, buffer, length))
--
- #define R128_BIOS8(v) (info->VBIOS[v])
- #define R128_BIOS16(v) (info->VBIOS[v] | \
- (info->VBIOS[(v) + 1] << 8))
-@@ -528,16 +523,20 @@
- return FALSE;
- }
-
-- info->BIOSFromPCI = TRUE;
-- R128ReadBIOS(0x0000, info->VBIOS, R128_VBIOS_SIZE);
-- if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) {
-- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-- "Video BIOS not detected in PCI space!\n");
-- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-- "Attempting to read Video BIOS from legacy ISA space!\n");
-- info->BIOSFromPCI = FALSE;
-- info->BIOSAddr = 0x000c0000;
-- R128ReadBIOS(0x0000, info->VBIOS, R128_VBIOS_SIZE);
-+ if (pInt10) {
-+ info->BIOSAddr = pInt10->BIOSseg << 4;
-+ (void)memcpy(info->VBIOS, xf86int10Addr(pInt10, info->BIOSAddr),
-+ R128_VBIOS_SIZE);
-+ } else {
-+ xf86ReadPciBIOS(0, info->PciTag, 0, info->VBIOS, R128_VBIOS_SIZE);
-+ if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) {
-+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-+ "Video BIOS not detected in PCI space!\n");
-+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-+ "Attempting to read Video BIOS from legacy ISA space!\n");
-+ info->BIOSAddr = 0x000c0000;
-+ xf86ReadBIOS(info->BIOSAddr, 0, info->VBIOS, R128_VBIOS_SIZE);
-+ }
- }
- if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) {
- info->BIOSAddr = 0x00000000;
-@@ -1010,7 +1009,7 @@
- return TRUE;
- }
-
--static Bool R128PreInitDDC(ScrnInfoPtr pScrn)
-+static Bool R128PreInitDDC(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
- {
- R128InfoPtr info = R128PTR(pScrn);
- vbeInfoPtr pVbe;
-@@ -1026,7 +1025,7 @@
- #ifdef XFree86LOADER
- xf86LoaderReqSymLists(vbeSymbols,NULL);
- #endif
-- pVbe = VBEInit(NULL,info->pEnt->index);
-+ pVbe = VBEInit(pInt10, info->pEnt->index);
- if (!pVbe) return FALSE;
-
- xf86SetDDCproperties(pScrn,xf86PrintEDID(vbeDoEDID(pVbe,NULL)));
-@@ -1155,15 +1154,13 @@
- return TRUE;
- }
-
--static Bool R128PreInitInt10(ScrnInfoPtr pScrn)
-+static Bool R128PreInitInt10(ScrnInfoPtr pScrn, xf86Int10InfoPtr *ppInt10)
- {
- R128InfoPtr info = R128PTR(pScrn);
- #if 1
- if (xf86LoadSubModule(pScrn, "int10")) {
-- xf86Int10InfoPtr pInt;
- xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n");
-- pInt = xf86InitInt10(info->pEnt->index);
-- xf86FreeInt10(pInt);
-+ *ppInt10 = xf86InitInt10(info->pEnt->index);
- }
- #endif
- return TRUE;
-@@ -1296,7 +1293,8 @@
- /* R128PreInit is called once at server startup. */
- Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
- {
-- R128InfoPtr info;
-+ R128InfoPtr info;
-+ xf86Int10InfoPtr pInt10 = NULL;
-
- R128TRACE(("R128PreInit\n"));
-
-@@ -1403,26 +1401,26 @@
- }
-
- if (!info->FBDev)
-- if (!R128PreInitInt10(pScrn)) goto fail;
-+ if (!R128PreInitInt10(pScrn, &pInt10)) goto fail;
-
-- if (!R128PreInitConfig(pScrn)) goto fail;
-+ if (!R128PreInitConfig(pScrn)) goto fail;
-
-- if (!R128GetBIOSParameters(pScrn)) goto fail;
-+ if (!R128GetBIOSParameters(pScrn, pInt10)) goto fail;
-
-- if (!R128GetPLLParameters(pScrn)) goto fail;
-+ if (!R128GetPLLParameters(pScrn)) goto fail;
-
-- if (!R128PreInitDDC(pScrn)) goto fail;
-+ if (!R128PreInitDDC(pScrn, pInt10)) goto fail;
-
-- if (!R128PreInitGamma(pScrn)) goto fail;
-+ if (!R128PreInitGamma(pScrn)) goto fail;
-
-- if (!R128PreInitModes(pScrn)) goto fail;
-+ if (!R128PreInitModes(pScrn)) goto fail;
-
-- if (!R128PreInitCursor(pScrn)) goto fail;
-+ if (!R128PreInitCursor(pScrn)) goto fail;
-
-- if (!R128PreInitAccel(pScrn)) goto fail;
-+ if (!R128PreInitAccel(pScrn)) goto fail;
-
- #ifdef XF86DRI
-- if (!R128PreInitDRI(pScrn)) goto fail;
-+ if (!R128PreInitDRI(pScrn)) goto fail;
- #endif
-
- /* Free the video bios (if applicable) */
-@@ -1431,6 +1429,10 @@
- info->VBIOS = NULL;
- }
-
-+ /* Free int10 info */
-+ if (pInt10)
-+ xf86FreeInt10(pInt10);
-+
- return TRUE;
-
- fail:
-@@ -1441,6 +1443,10 @@
- xfree(info->VBIOS);
- info->VBIOS = NULL;
- }
-+
-+ /* Free int10 info */
-+ if (pInt10)
-+ xf86FreeInt10(pInt10);
-
- vgaHWFreeHWRec(pScrn);
- R128FreeRec(pScrn);
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v
-retrieving revision 1.6
-retrieving revision 1.7
-diff -u -r1.6 -r1.7
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c 2000/12/13 02:45:00 1.6
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c 2001/01/06 20:19:10 1.7
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.6 2000/12/13 02:45:00 tsi Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.7 2001/01/06 20:19:10 tsi Exp $ */
- /*
- * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
- * Precision Insight, Inc., Cedar Park, Texas, and
-@@ -86,6 +86,8 @@
- * Return options defined in the r128 submodule which will have been
- * loaded by this point.
- */
-+ if ((chipid >> 16) == PCI_VENDOR_ATI)
-+ chipid -= PCI_VENDOR_ATI << 16;
- for (i = 0; R128PciChipsets[i].PCIid > 0; i++) {
- if (chipid == R128PciChipsets[i].PCIid)
- return R128Options;
-@@ -159,7 +161,7 @@
- pEnt = xf86GetEntityInfo(usedChips[i]);
-
- if (pEnt->active) {
-- ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0);
-+ ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0);
-
- #ifdef XFree86LOADER
- if (!xf86LoadSubModule(pScrn, "r128")) {
-@@ -171,6 +173,7 @@
-
- xf86LoaderReqSymLists(R128Symbols, NULL);
-
-+#ifndef ELFDEBUG
- /* Workaround for possible loader bug */
- # define R128PreInit \
- (xf86PreInitProc*) LoaderSymbol("R128PreInit")
-@@ -188,6 +191,7 @@
- (xf86FreeScreenProc*) LoaderSymbol("R128FreeScreen")
- # define R128ValidMode \
- (xf86ValidModeProc*) LoaderSymbol("R128ValidMode")
-+#endif
-
- #endif
-
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v
-retrieving revision 1.8
-retrieving revision 1.9
-diff -u -r1.8 -r1.9
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h 2000/12/08 14:41:16 1.8
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h 2001/01/06 20:19:10 1.9
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.8 2000/12/08 14:41:16 alanh Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.9 2001/01/06 20:19:10 tsi Exp $ */
- /*
- * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
- * VA Linux Systems Inc., Fremont, California.
-@@ -197,7 +197,6 @@
- unsigned long LinearAddr; /* Frame buffer physical address */
- unsigned long MMIOAddr; /* MMIO region physical address */
- unsigned long BIOSAddr; /* BIOS physical address */
-- Bool BIOSFromPCI; /* BIOS is read from PCI space */
-
- unsigned char *MMIO; /* Map of MMIO region */
- unsigned char *FB; /* Map of frame buffer */
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v
-retrieving revision 1.9
-retrieving revision 1.10
-diff -u -r1.9 -r1.10
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c 2000/12/22 12:13:15 1.9
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c 2001/01/06 20:19:10 1.10
-@@ -496,7 +496,7 @@
- }
-
- /* Read the Video BIOS block and the FP registers (if applicable). */
--static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn)
-+static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
- {
- RADEONInfoPtr info = RADEONPTR(pScrn);
- #ifdef ENABLE_FLAT_PANEL
-@@ -523,16 +523,20 @@
- return FALSE;
- }
-
-- info->BIOSFromPCI = TRUE;
-- RADEONReadBIOS(0x0000, info->VBIOS, RADEON_VBIOS_SIZE);
-- if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) {
-- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-- "Video BIOS not detected in PCI space!\n");
-- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-- "Attempting to read Video BIOS from legacy ISA space!\n");
-- info->BIOSFromPCI = FALSE;
-- info->BIOSAddr = 0x000c0000;
-- RADEONReadBIOS(0x0000, info->VBIOS, RADEON_VBIOS_SIZE);
-+ if (pInt10) {
-+ info->BIOSAddr = pInt10->BIOSseg << 4;
-+ (void)memcpy(info->VBIOS, xf86int10Addr(pInt10, info->BIOSAddr),
-+ RADEON_VBIOS_SIZE);
-+ } else {
-+ xf86ReadPciBIOS(0, info->PciTag, 0, info->VBIOS, RADEON_VBIOS_SIZE);
-+ if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) {
-+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-+ "Video BIOS not detected in PCI space!\n");
-+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-+ "Attempting to read Video BIOS from legacy ISA space!\n");
-+ info->BIOSAddr = 0x000c0000;
-+ xf86ReadBIOS(info->BIOSAddr, 0, info->VBIOS, RADEON_VBIOS_SIZE);
-+ }
- }
- if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) {
- info->BIOSAddr = 0x00000000;
-@@ -953,7 +957,7 @@
- return TRUE;
- }
-
--static Bool RADEONPreInitDDC(ScrnInfoPtr pScrn)
-+static Bool RADEONPreInitDDC(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
- {
- RADEONInfoPtr info = RADEONPTR(pScrn);
- vbeInfoPtr pVbe;
-@@ -961,7 +965,7 @@
- if (!xf86LoadSubModule(pScrn, "ddc")) return FALSE;
- xf86LoaderReqSymLists(ddcSymbols, NULL);
- if (xf86LoadSubModule(pScrn, "vbe")) {
-- pVbe = VBEInit(NULL,info->pEnt->index);
-+ pVbe = VBEInit(pInt10, info->pEnt->index);
- if (!pVbe) return FALSE;
-
- xf86SetDDCproperties(pScrn,xf86PrintEDID(vbeDoEDID(pVbe,NULL)));
-@@ -1088,15 +1092,13 @@
- return TRUE;
- }
-
--static Bool RADEONPreInitInt10(ScrnInfoPtr pScrn)
-+static Bool RADEONPreInitInt10(ScrnInfoPtr pScrn, xf86Int10InfoPtr *ppInt10)
- {
- RADEONInfoPtr info = RADEONPTR(pScrn);
- #if 1
- if (xf86LoadSubModule(pScrn, "int10")) {
-- xf86Int10InfoPtr pInt;
- xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n");
-- pInt = xf86InitInt10(info->pEnt->index);
-- xf86FreeInt10(pInt);
-+ *ppInt10 = xf86InitInt10(info->pEnt->index);
- }
- #endif
- return TRUE;
-@@ -1237,7 +1239,8 @@
- /* RADEONPreInit is called once at server startup. */
- Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags)
- {
-- RADEONInfoPtr info;
-+ RADEONInfoPtr info;
-+ xf86Int10InfoPtr pInt10 = NULL;
-
- #ifdef XFree86LOADER
- /*
-@@ -1331,26 +1334,26 @@
- }
-
- if (!info->FBDev)
-- if (!RADEONPreInitInt10(pScrn)) goto fail;
-+ if (!RADEONPreInitInt10(pScrn, &pInt10)) goto fail;
-
-- if (!RADEONPreInitConfig(pScrn)) goto fail;
-+ if (!RADEONPreInitConfig(pScrn)) goto fail;
-
-- if (!RADEONGetBIOSParameters(pScrn)) goto fail;
-+ if (!RADEONGetBIOSParameters(pScrn, pInt10)) goto fail;
-
-- if (!RADEONGetPLLParameters(pScrn)) goto fail;
-+ if (!RADEONGetPLLParameters(pScrn)) goto fail;
-
-- if (!RADEONPreInitDDC(pScrn)) goto fail;
-+ if (!RADEONPreInitDDC(pScrn, pInt10)) goto fail;
-
-- if (!RADEONPreInitGamma(pScrn)) goto fail;
-+ if (!RADEONPreInitGamma(pScrn)) goto fail;
-
-- if (!RADEONPreInitModes(pScrn)) goto fail;
-+ if (!RADEONPreInitModes(pScrn)) goto fail;
-
-- if (!RADEONPreInitCursor(pScrn)) goto fail;
-+ if (!RADEONPreInitCursor(pScrn)) goto fail;
-
-- if (!RADEONPreInitAccel(pScrn)) goto fail;
-+ if (!RADEONPreInitAccel(pScrn)) goto fail;
-
- #ifdef XF86DRI
-- if (!RADEONPreInitDRI(pScrn)) goto fail;
-+ if (!RADEONPreInitDRI(pScrn)) goto fail;
- #endif
-
- /* Free the video bios (if applicable) */
-@@ -1359,6 +1362,10 @@
- info->VBIOS = NULL;
- }
-
-+ /* Free int10 info */
-+ if (pInt10)
-+ xf86FreeInt10(pInt10);
-+
- return TRUE;
-
- fail:
-@@ -1369,6 +1376,10 @@
- xfree(info->VBIOS);
- info->VBIOS = NULL;
- }
-+
-+ /* Free int10 info */
-+ if (pInt10)
-+ xf86FreeInt10(pInt10);
-
- vgaHWFreeHWRec(pScrn);
- RADEONFreeRec(pScrn);
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c,v
-retrieving revision 1.2
-retrieving revision 1.3
-diff -u -r1.2 -r1.3
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c 2000/11/18 19:37:12 1.2
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c 2001/01/06 20:58:08 1.3
-@@ -1,6 +1,6 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c,v 1.2 2000/11/18 19:37:12 tsi Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c,v 1.3 2001/01/06 20:58:08 tsi Exp $ */
- /*
-- * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca
-+ * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v
-retrieving revision 1.5
-retrieving revision 1.6
-diff -u -r1.5 -r1.6
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c 2000/12/13 02:45:00 1.5
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c 2001/01/06 20:19:11 1.6
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.5 2000/12/13 02:45:00 tsi Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.6 2001/01/06 20:19:11 tsi Exp $ */
- /*
- * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
- * VA Linux Systems Inc., Fremont, California.
-@@ -73,6 +73,8 @@
- * Return options defined in the radeon submodule which will have been
- * loaded by this point.
- */
-+ if ((chipid >> 16) == PCI_VENDOR_ATI)
-+ chipid -= PCI_VENDOR_ATI << 16;
- for (i = 0; RADEONPciChipsets[i].PCIid > 0; i++) {
- if (chipid == RADEONPciChipsets[i].PCIid)
- return RADEONOptions;
-@@ -146,7 +148,7 @@
- pEnt = xf86GetEntityInfo(usedChips[i]);
-
- if (pEnt->active) {
-- ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0);
-+ ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0);
-
- #ifdef XFree86LOADER
- if (!xf86LoadSubModule(pScrn, "radeon")) {
-@@ -158,6 +160,7 @@
-
- xf86LoaderReqSymLists(RADEONSymbols, NULL);
-
-+#ifndef ELFDEBUG
- /* Workaround for possible loader bug */
- # define RADEONPreInit \
- (xf86PreInitProc*) LoaderSymbol("RADEONPreInit")
-@@ -175,6 +178,7 @@
- (xf86FreeScreenProc*) LoaderSymbol("RADEONFreeScreen")
- # define RADEONValidMode \
- (xf86ValidModeProc*) LoaderSymbol("RADEONValidMode")
-+#endif
-
- #endif
-
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/etc/pcitweak.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/etc/pcitweak.c,v
-retrieving revision 1.14
-retrieving revision 1.15
-diff -u -r1.14 -r1.15
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/etc/pcitweak.c 2000/08/10 17:40:34 1.14
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/etc/pcitweak.c 2001/01/06 20:19:12 1.15
-@@ -5,7 +5,7 @@
- *
- * Author: David Dawes <dawes@xfree86.org>
- */
--/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/pcitweak.c,v 1.14 2000/08/10 17:40:34 dawes Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/pcitweak.c,v 1.15 2001/01/06 20:19:12 tsi Exp $ */
-
- #include "X.h"
- #include "os.h"
-@@ -31,6 +31,8 @@
- extern char *optarg;
- extern int optind, opterr;
- #endif
-+
-+pciVideoPtr *xf86PciVideoInfo = NULL;
-
- static void usage(void);
- static Bool parsePciBusString(const char *id, int *bus, int *device, int *func);
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/etc/scanpci.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v
-retrieving revision 3.80
-retrieving revision 3.81
-diff -u -r3.80 -r3.81
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/etc/scanpci.c 2000/06/20 19:38:04 3.80
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/etc/scanpci.c 2001/01/06 20:19:12 3.81
-@@ -21,7 +21,7 @@
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
--/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.80 2000/06/20 19:38:04 eich Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.81 2001/01/06 20:19:12 tsi Exp $ */
-
- #include "X.h"
- #include "os.h"
-@@ -47,6 +47,8 @@
- extern char *optarg;
- extern int optind, opterr;
- #endif
-+
-+pciVideoPtr *xf86PciVideoInfo = NULL;
-
- void usage(void);
- void identify_card(pciConfigPtr pcr, int verbose);
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/generic.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/int10/generic.c,v
-retrieving revision 1.13
-retrieving revision 1.14
-diff -u -r1.13 -r1.14
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/generic.c 2000/11/21 23:10:38 1.13
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/generic.c 2001/01/06 20:19:13 1.14
-@@ -1,11 +1,10 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/generic.c,v 1.13 2000/11/21 23:10:38 tsi Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/generic.c,v 1.14 2001/01/06 20:19:13 tsi Exp $ */
- /*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
- * Copyright 1999 Egbert Eich
- */
- #include "xf86.h"
--#include "xf86str.h"
- #include "xf86_OSproc.h"
- #include "xf86_ansic.h"
- #include "xf86Pci.h"
-@@ -61,20 +60,19 @@
- void* base = 0;
- void* vbiosMem = 0;
- legacyVGARec vga;
--
-+
- screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex;
--
-+
- if (int10skip(xf86Screens[screen],entityIndex))
- return NULL;
-
-- pInt = (xf86Int10InfoPtr)xnfcalloc(1,sizeof(xf86Int10InfoRec));
-+ pInt = (xf86Int10InfoPtr)xnfcalloc(1, sizeof(xf86Int10InfoRec));
- pInt->entityIndex = entityIndex;
- if (!xf86Int10ExecSetup(pInt))
- goto error0;
- pInt->mem = &genericMem;
-- pInt->private = (pointer)xnfcalloc(1,sizeof(genericInt10Priv));
-- INTPriv(pInt)->alloc =
-- (pointer)xnfcalloc(1,ALLOC_ENTRIES(getpagesize()));
-+ pInt->private = (pointer)xnfcalloc(1, sizeof(genericInt10Priv));
-+ INTPriv(pInt)->alloc = (pointer)xnfcalloc(1, ALLOC_ENTRIES(getpagesize()));
- pInt->scrnIndex = screen;
- base = INTPriv(pInt)->base = xnfalloc(SYS_BIOS);
-
-@@ -85,11 +83,11 @@
- MapVRam(pInt);
- #ifdef _PC
- if (!sysMem)
-- sysMem = xf86MapVidMem(screen,VIDMEM_FRAMEBUFFER,SYS_BIOS,BIOS_SIZE);
-+ sysMem = xf86MapVidMem(screen, VIDMEM_FRAMEBUFFER, SYS_BIOS, BIOS_SIZE);
- INTPriv(pInt)->sysMem = sysMem;
--
-- if (xf86ReadBIOS(0,0,(unsigned char *)base,LOW_PAGE_SIZE) < 0) {
-- xf86DrvMsg(screen,X_ERROR,"Cannot read int vect\n");
-+
-+ if (xf86ReadBIOS(0, 0, base, LOW_PAGE_SIZE) < 0) {
-+ xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n");
- goto error1;
- }
-
-@@ -106,74 +104,79 @@
- "Unable to retrieve all of segment 0x%06X.\n", cs);
-
- if (xf86IsEntityPrimary(entityIndex)) {
-- cs = MEM_RW(pInt,((0x10<<2)+2));
-+ cs = MEM_RW(pInt, (0x10 << 2) + 2);
-
- vbiosMem = (unsigned char *)base + (cs << 4);
- if (!int10_check_bios(screen, cs, vbiosMem)) {
-- cs = MEM_RW(pInt,((0x42<<2)+2));
-+ cs = MEM_RW(pInt, (0x42 << 2) + 2);
- vbiosMem = (unsigned char *)base + (cs << 4);
- if (!int10_check_bios(screen, cs, vbiosMem)) {
- cs = V_BIOS >> 4;
- vbiosMem = (unsigned char *)base + (cs << 4);
- if (!int10_check_bios(screen, cs, vbiosMem)) {
-- xf86DrvMsg(screen,X_ERROR,"No V_BIOS found\n");
-+ xf86DrvMsg(screen, X_ERROR, "No V_BIOS found\n");
- goto error1;
- }
- }
- }
-- xf86DrvMsg(screen,X_INFO,"Primary V_BIOS segment is: 0x%x\n",cs);
--
-+ xf86DrvMsg(screen, X_INFO, "Primary V_BIOS segment is: 0x%x\n", cs);
-+
- set_return_trap(pInt);
- pInt->BIOSseg = cs;
- } else {
-- reset_int_vect(pInt);
-+ reset_int_vect(pInt);
- set_return_trap(pInt);
- vbiosMem = (unsigned char *)base + V_BIOS;
-- if (!mapPciRom(pInt,(unsigned char *)(vbiosMem))) {
-- xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (3)\n");
-+ if (!mapPciRom(pInt, vbiosMem)) {
-+ xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (3)\n");
- goto error1;
- }
- pInt->BIOSseg = V_BIOS >> 4;
- pInt->num = 0xe6;
-- LockLegacyVGA(screen, &vga);
-+ LockLegacyVGA(screen, &vga);
- xf86ExecX86int10(pInt);
- UnlockLegacyVGA(screen, &vga);
- }
- #else
- if (!sysMem) {
- sysMem = xnfalloc(BIOS_SIZE);
-- setup_system_bios((memType)sysMem);
-+ setup_system_bios(sysMem);
- }
- INTPriv(pInt)->sysMem = sysMem;
- setup_int_vect(pInt);
- set_return_trap(pInt);
-- vbiosMem = (unsigned char *)base + V_BIOS;
-- {
-- EntityInfoPtr pEnt = xf86GetEntityInfo(pInt->entityIndex);
-- switch (pEnt->location.type) {
-- case BUS_PCI:
-- if (!mapPciRom(pInt,(unsigned char *)(vbiosMem))) {
-- xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (4)\n");
-- goto error1;
-- }
-- break;
-- case BUS_ISA:
-- (void)memset(vbiosMem, 0, V_BIOS_SIZE);
-- if (xf86ReadBIOS(V_BIOS, 0, vbiosMem, V_BIOS_SIZE) < V_BIOS_SIZE)
-- xf86DrvMsg(screen, X_WARNING,
-- "Unable to retrieve all of segment 0x0C0000.\n");
-- if (!int10_check_bios(screen, V_BIOS >> 4, vbiosMem)) {
-- xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (5)\n");
-- goto error1;
-- }
-- break;
-- default:
-+
-+ /*
-+ * Retrieve two segments: one at V_BIOS, the other 64kB beyond the first.
-+ * This'll catch any BIOS that might have been initialised before server
-+ * entry.
-+ */
-+ vbiosMem = (char *)base + V_BIOS;
-+ (void)memset(vbiosMem, 0, 2 * V_BIOS_SIZE);
-+ if (xf86ReadBIOS(V_BIOS, 0, vbiosMem, V_BIOS_SIZE) < V_BIOS_SIZE)
-+ xf86DrvMsg(screen, X_WARNING,
-+ "Unable to retrieve all of segment 0x0C0000.\n");
-+ else if (((unsigned char *)vbiosMem)[2] > 0x80)
-+ if (xf86ReadBIOS(V_BIOS + V_BIOS_SIZE, 0,
-+ (unsigned char *)vbiosMem + V_BIOS_SIZE, V_BIOS_SIZE) < V_BIOS_SIZE)
-+ xf86DrvMsg(screen, X_WARNING,
-+ "Unable to retrieve all of segment 0x0D0000.\n");
-+
-+ /*
-+ * If this adapter is the primary, use its post-init BIOS (if we can find
-+ * it).
-+ */
-+ if (!xf86IsEntityPrimary(entityIndex) ||
-+ !int10_check_bios(screen, V_BIOS >> 4, vbiosMem)) {
-+ if (!mapPciRom(pInt, vbiosMem)) {
-+ xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (4)\n");
- goto error1;
- }
- }
-+
- pInt->BIOSseg = V_BIOS >> 4;
- pInt->num = 0xe6;
-- LockLegacyVGA(screen, &vga);
-+ LockLegacyVGA(screen, &vga);
- xf86ExecX86int10(pInt);
- UnlockLegacyVGA(screen, &vga);
- #endif
-@@ -197,17 +200,17 @@
- int pagesize = getpagesize();
- int size = ((VRAM_SIZE + pagesize - 1)/pagesize) * pagesize;
-
-- INTPriv(pInt)->vRam = xf86MapVidMem(screen,VIDMEM_MMIO,V_RAM,size);
-+ INTPriv(pInt)->vRam = xf86MapVidMem(screen, VIDMEM_MMIO, V_RAM, size);
- }
-
--static void
-+static void
- UnmapVRam(xf86Int10InfoPtr pInt)
- {
- int screen = pInt->scrnIndex;
- int pagesize = getpagesize();
- int size = ((VRAM_SIZE + pagesize - 1)/pagesize) * pagesize;
-
-- xf86UnMapVidMem(screen,INTPriv(pInt)->vRam,size);
-+ xf86UnMapVidMem(screen, INTPriv(pInt)->vRam, size);
- }
-
- void
-@@ -221,7 +224,7 @@
- {
- if (!pInt)
- return;
-- if (Int10Current == pInt)
-+ if (Int10Current == pInt)
- Int10Current = NULL;
- xfree(INTPriv(pInt)->base);
- UnmapVRam(pInt);
-@@ -231,83 +234,79 @@
- }
-
- void *
--xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off)
-+xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off)
- {
- int pagesize = getpagesize();
- int num_pages = ALLOC_ENTRIES(pagesize);
- int i,j;
-
-- for (i=0;i<num_pages - num;i++) {
-+ for (i = 0; i < (num_pages - num); i++) {
- if (INTPriv(pInt)->alloc[i] == 0) {
-- for (j=i;j < num + i;j++)
-+ for (j = i; j < (num + i); j++)
- if (INTPriv(pInt)->alloc[j] != 0)
- break;
-- if (j == num + i)
-+ if (j == (num + i))
- break;
-- else
-- i = i + num;
-+ i += num;
- }
- }
-- if (i == num_pages - num)
-+ if (i == (num_pages - num))
- return NULL;
--
-- for (j = i; j < i + num; j++)
-+
-+ for (j = i; j < (i + num); j++)
- INTPriv(pInt)->alloc[j] = 1;
-
- *off = (i + 1) * pagesize;
--
-- return (void *)
-- ((char*)INTPriv(pInt)->base + (i + 1) * pagesize);
-+
-+ return (char *)INTPriv(pInt)->base + *off;
- }
-
- void
- xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
- {
- int pagesize = getpagesize();
-- int first = ((unsigned long)pbase
-- - (unsigned long)INTPriv(pInt)->base)
-- / pagesize - 1;
-+ int first = (((char *)pbase - (char *)INTPriv(pInt)->base) / pagesize) - 1;
- int i;
-
-- for (i = first; i < first + num; i++)
-+ for (i = first; i < (first + num); i++)
- INTPriv(pInt)->alloc[i] = 0;
- }
-
- #define OFF(addr) ((addr) & 0xffff)
- #define SYS(addr) ((addr) >= SYS_BIOS)
- #define V_ADDR(addr) \
-- (SYS(addr) ? ((char*)INTPriv(pInt)->sysMem) + (addr - SYS_BIOS) \
-- : ((char*)(INTPriv(pInt)->base) + addr))
-+ (SYS(addr) ? ((char*)INTPriv(pInt)->sysMem) + (addr - SYS_BIOS) \
-+ : ((char*)(INTPriv(pInt)->base) + addr))
- #define VRAM_ADDR(addr) (addr - V_RAM)
- #define VRAM_BASE (INTPriv(pInt)->vRam)
-
- #define VRAM(addr) ((addr >= V_RAM) && (addr < (V_RAM + VRAM_SIZE)))
- #define V_ADDR_RB(addr) \
-- (VRAM(addr)) ? MMIO_IN8((CARD8*)VRAM_BASE,VRAM_ADDR(addr)) \
-- : *(CARD8*) V_ADDR(addr)
-+ (VRAM(addr)) ? MMIO_IN8((CARD8*)VRAM_BASE,VRAM_ADDR(addr)) \
-+ : *(CARD8*) V_ADDR(addr)
- #define V_ADDR_RW(addr) \
-- (VRAM(addr)) ? MMIO_IN16((CARD16*)VRAM_BASE,VRAM_ADDR(addr)) \
-- : ldw_u((pointer)V_ADDR(addr))
-+ (VRAM(addr)) ? MMIO_IN16((CARD16*)VRAM_BASE,VRAM_ADDR(addr)) \
-+ : ldw_u((pointer)V_ADDR(addr))
- #define V_ADDR_RL(addr) \
-- (VRAM(addr)) ? MMIO_IN32((CARD32*)VRAM_BASE,VRAM_ADDR(addr)) \
-- : ldl_u((pointer)V_ADDR(addr))
-+ (VRAM(addr)) ? MMIO_IN32((CARD32*)VRAM_BASE,VRAM_ADDR(addr)) \
-+ : ldl_u((pointer)V_ADDR(addr))
-
- #define V_ADDR_WB(addr,val) \
-- if(VRAM(addr)) \
-- MMIO_OUT8((CARD8*)VRAM_BASE,VRAM_ADDR(addr),val); \
-- else \
-- *(CARD8*) V_ADDR(addr) = val;
-+ if(VRAM(addr)) \
-+ MMIO_OUT8((CARD8*)VRAM_BASE,VRAM_ADDR(addr),val); \
-+ else \
-+ *(CARD8*) V_ADDR(addr) = val;
- #define V_ADDR_WW(addr,val) \
-- if(VRAM(addr)) \
-- MMIO_OUT16((CARD16*)VRAM_BASE,VRAM_ADDR(addr),val); \
-- else \
-- stw_u((val),(pointer)(V_ADDR(addr)));
-+ if(VRAM(addr)) \
-+ MMIO_OUT16((CARD16*)VRAM_BASE,VRAM_ADDR(addr),val); \
-+ else \
-+ stw_u((val),(pointer)(V_ADDR(addr)));
-
- #define V_ADDR_WL(addr,val) \
-- if (VRAM(addr)) \
-- MMIO_OUT32((CARD32*)VRAM_BASE,VRAM_ADDR(addr),val); \
-- else \
-- stl_u(val,(pointer)(V_ADDR(addr)));
-+ if (VRAM(addr)) \
-+ MMIO_OUT32((CARD32*)VRAM_BASE,VRAM_ADDR(addr),val); \
-+ else \
-+ stl_u(val,(pointer)(V_ADDR(addr)));
-
- static CARD8
- read_b(xf86Int10InfoPtr pInt, int addr)
-@@ -318,37 +317,24 @@
- static CARD16
- read_w(xf86Int10InfoPtr pInt, int addr)
- {
--#if X_BYTE_ORDER == X_BIG_ENDIAN
-- return ((V_ADDR_RB(addr))
-- || ((V_ADDR_RB(addr + 1)) << 8));
--#else
-- if (OFF(addr + 1) > 0) {
-+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
-+ if (OFF(addr + 1) > 0)
- return V_ADDR_RW(addr);
-- } else
-- return ((V_ADDR_RB(addr + 1))
-- || ((V_ADDR_RB(addr)) << 8));
--
- #endif
-+ return V_ADDR_RB(addr) | (V_ADDR_RB(addr + 1) << 8);
- }
-
- static CARD32
- read_l(xf86Int10InfoPtr pInt, int addr)
- {
--#if X_BYTE_ORDER == X_BIG_ENDIAN
-- return ((V_ADDR_RB(addr))
-- || ((V_ADDR_RB(addr + 1)) << 8)
-- || ((V_ADDR_RB(addr + 2)) << 16)
-- || ((V_ADDR_RB(addr + 3)) << 24));
--#else
-- if (OFF(addr + 3) > 2) {
-+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
-+ if (OFF(addr + 3) > 2)
- return V_ADDR_RL(addr);
-- } else {
-- return ((V_ADDR_RB(addr + 3))
-- || ((V_ADDR_RB(addr + 2)) << 8)
-- || ((V_ADDR_RB(addr + 1)) << 16)
-- || ((V_ADDR_RB(addr)) << 24));
-- }
- #endif
-+ return V_ADDR_RB(addr) |
-+ (V_ADDR_RB(addr + 1) << 8) |
-+ (V_ADDR_RB(addr + 2) << 16) |
-+ (V_ADDR_RB(addr + 3) << 24);
- }
-
- static void
-@@ -360,49 +346,29 @@
- static void
- write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val)
- {
--#if X_BYTE_ORDER == X_BIG_ENDIAN
-- V_ADDR_WB(addr,val);
-- V_ADDR_WB(addr + 1,val >> 8);
--#else
-- if (OFF(addr + 1) > 0) {
-- V_ADDR_WW(addr,val);
-- } else {
-- V_ADDR_WB(addr + 1,val);
-- V_ADDR_WB(addr,val >> 8);
-- }
-+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
-+ if (OFF(addr + 1) > 0)
-+ V_ADDR_WW(addr, val);
- #endif
-+ V_ADDR_WB(addr, val);
-+ V_ADDR_WB(addr + 1, val >> 8);
- }
-
- static void
- write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val)
- {
--#if X_BYTE_ORDER == X_BIG_ENDIAN
-- V_ADDR_WB(addr,val);
-+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
-+ if (OFF(addr + 3) > 2)
-+ V_ADDR_WL(addr, val);
-+#endif
-+ V_ADDR_WB(addr, val);
- V_ADDR_WB(addr + 1, val >> 8);
- V_ADDR_WB(addr + 2, val >> 16);
- V_ADDR_WB(addr + 3, val >> 24);
--#else
-- if (OFF(addr + 3) > 2) {
-- V_ADDR_WL(addr,val);
-- } else {
-- V_ADDR_WB(addr + 3, val);
-- V_ADDR_WB(addr + 2, val >> 8);
-- V_ADDR_WB(addr + 1, val >> 16);
-- V_ADDR_WB(addr, val >> 24);
-- }
--#endif
- }
-
- pointer
- xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr)
- {
-- return (pointer) V_ADDR(addr);
-+ return V_ADDR(addr);
- }
--
--
--
--
--
--
--
--
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c,v
-retrieving revision 1.11
-retrieving revision 1.12
-diff -u -r1.11 -r1.12
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c 2000/12/06 15:35:26 1.11
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c 2001/01/06 20:19:13 1.12
-@@ -1,12 +1,12 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_exec.c,v 1.11 2000/12/06 15:35:26 eich Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_exec.c,v 1.12 2001/01/06 20:19:13 tsi Exp $ */
- /*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
- * Copyright 1999 Egbert Eich
- *
-- * Part of this is based on code taken form DOSEMU
-+ * Part of this is based on code taken from DOSEMU
- * (C) Copyright 1992, ..., 1999 the "DOSEMU-Development-Team"
-- */
-+ */
-
- /*
- * To debug port accesses define PRINT_PORT.
-@@ -15,7 +15,6 @@
- * on PIO.
- */
- #include "xf86.h"
--#include "xf86str.h"
- #include "xf86_OSproc.h"
- #include "xf86_ansic.h"
- #include "compiler.h"
-@@ -44,17 +43,15 @@
- X86_EDX = (CARD32) pInt->dx;
- X86_ESI = (CARD32) pInt->si;
- X86_EDI = (CARD32) pInt->di;
-- X86_ES = (CARD32) pInt->es;
- X86_EBP = (CARD32) pInt->bp;
-- X86_EIP = 0;
-- X86_CS = 0x60; /* address of 'hlt' */
-- X86_ESP = 0x100;
-- X86_SS = 0x30; /* This is the standard pc bios stack */
-- X86_DS = 0x40; /* standard pc ds */
-+ X86_ESP = 0x1000; X86_SS = pInt->stackseg >> 4;
-+ X86_EIP = 0x0600; X86_CS = 0x0; /* address of 'hlt' */
-+ X86_DS = 0x40; /* standard pc ds */
-+ X86_ES = pInt->es;
- X86_FS = 0;
- X86_GS = 0;
-- X86_EFLAGS = (X86_IF_MASK | X86_IOPL_MASK);
--
-+ X86_EFLAGS = X86_IF_MASK | X86_IOPL_MASK;
-+
- return xf86BlockSIGIO();
- }
-
-@@ -68,188 +65,23 @@
- pInt->dx = (CARD16) X86_EDX;
- pInt->si = (CARD16) X86_ESI;
- pInt->di = (CARD16) X86_EDI;
-+ pInt->es = (CARD16) X86_ES;
- pInt->bp = (CARD16) X86_EBP;
- pInt->flags = (CARD16) X86_FLAGS;
- }
-
--#define SEG_ADR(type, seg, reg) type((seg << 4) \
-- + (X86_##reg))
--#define SEG_EADR(type, seg, reg) type((seg << 4) \
-- + (X86_E##reg))
--#ifndef _X86EMU
--/* get the linear address */
--#define LIN_PREF_SI ((pref_seg << 4) + X86_SI)
--#define LWECX (prefix66 ^ prefix67 ? X86_ECX : X86_CX)
--#define LWECX_ZERO {if (prefix66 ^ prefix67) X86_ECX = 0; else X86_CX = 0;}
--#define DF (1 << 10)
--
--
--/* vm86 fault handling */
--Bool
--vm86_GP_fault(xf86Int10InfoPtr pInt)
--{
-- unsigned char *csp, *lina;
-- CARD32 org_eip;
-- int pref_seg;
-- int done,is_rep,prefix66,prefix67;
--
--
-- csp = lina = SEG_ADR((unsigned char *), X86_CS, IP);
--
-- is_rep = 0;
-- prefix66 = prefix67 = 0;
-- pref_seg = -1;
--
-- /* eat up prefixes */
-- done = 0;
-- do {
-- switch (MEM_RB(pInt,(int)csp++)) {
-- case 0x66: /* operand prefix */ prefix66=1; break;
-- case 0x67: /* address prefix */ prefix67=1; break;
-- case 0x2e: /* CS */ pref_seg=X86_CS; break;
-- case 0x3e: /* DS */ pref_seg=X86_DS; break;
-- case 0x26: /* ES */ pref_seg=X86_ES; break;
-- case 0x36: /* SS */ pref_seg=X86_SS; break;
-- case 0x65: /* GS */ pref_seg=X86_GS; break;
-- case 0x64: /* FS */ pref_seg=X86_FS; break;
-- case 0xf2: /* repnz */
-- case 0xf3: /* rep */ is_rep=1; break;
-- default: done=1;
-- }
-- } while (!done);
-- csp--; /* oops one too many */
-- org_eip = X86_EIP;
-- X86_IP += (csp - lina);
--
-- switch (MEM_RB(pInt,(int)csp)) {
-- case 0x6c: /* insb */
-- /* NOTE: ES can't be overwritten; prefixes 66,67 should use esi,edi,ecx
-- * but is anyone using extended regs in real mode? */
-- /* WARNING: no test for DI wrapping! */
-- X86_EDI += port_rep_inb(pInt,X86_DX,SEG_EADR((CARD32),X86_ES,DI),
-- X86_FLAGS & DF, (is_rep? LWECX:1));
-- if (is_rep) LWECX_ZERO;
-- X86_IP++;
-- break;
--
-- case 0x6d: /* (rep) insw / insd */
-- /* NOTE: ES can't be overwritten */
-- /* WARNING: no test for _DI wrapping! */
-- if (prefix66) {
-- X86_DI += port_rep_inl(pInt,X86_DX,SEG_ADR((CARD32),X86_ES,DI),
-- X86_EFLAGS & DF, (is_rep? LWECX:1));
-- }
-- else {
-- X86_DI += port_rep_inw(pInt,X86_DX,SEG_ADR((CARD32),X86_ES,DI),
-- X86_FLAGS & DF, (is_rep? LWECX:1));
-- }
-- if (is_rep) LWECX_ZERO;
-- X86_IP++;
-- break;
--
-- case 0x6e: /* (rep) outsb */
-- if (pref_seg < 0) pref_seg = X86_DS;
-- /* WARNING: no test for _SI wrapping! */
-- X86_SI += port_rep_outb(pInt,X86_DX,(CARD32)LIN_PREF_SI, X86_FLAGS&DF,
-- (is_rep? LWECX:1));
-- if (is_rep) LWECX_ZERO;
-- X86_IP++;
-- break;
--
-- case 0x6f: /* (rep) outsw / outsd */
-- if (pref_seg < 0) pref_seg = X86_DS;
-- /* WARNING: no test for _SI wrapping! */
-- if (prefix66) {
-- X86_SI += port_rep_outl(pInt,X86_DX,(CARD32)LIN_PREF_SI,
-- X86_EFLAGS&DF, (is_rep? LWECX:1));
-- }
-- else {
-- X86_SI += port_rep_outw(pInt,X86_DX,(CARD32)LIN_PREF_SI,
-- X86_FLAGS & DF, (is_rep? LWECX:1));
-- }
-- if (is_rep) LWECX_ZERO;
-- X86_IP++;
-- break;
--
-- case 0xe5: /* inw xx, inl xx */
-- if (prefix66) X86_EAX = p_inl((int) MEM_RB(pInt,(int)(csp+1)));
-- else X86_AX = p_inw((int) (int)(csp[1]));
-- X86_IP += 2;
-- break;
-- case 0xe4: /* inb xx */
-- X86_AX &= ~(CARD32)0xff;
-- X86_AL |= p_inb((int) MEM_RB(pInt,(int)(csp+1)));
-- X86_IP += 2;
-- break;
-- case 0xed: /* inw dx, inl dx */
-- if (prefix66) X86_EAX = p_inl(X86_EDX);
-- else X86_AX = p_inw(X86_DX);
-- X86_IP += 1;
-- break;
-- case 0xec: /* inb dx */
-- X86_AX &= ~(CARD32)0xff;
-- X86_AL |= p_inb(X86_DX);
-- X86_IP += 1;
-- break;
--
-- case 0xe7: /* outw xx */
-- if (prefix66) p_outl((int)MEM_RB(pInt,(int)(csp+1)), X86_EAX);
-- else p_outw((int)MEM_RB(pInt,(int)(csp+1)), X86_AX);
-- X86_IP += 2;
-- break;
-- case 0xe6: /* outb xx */
-- p_outb((int) MEM_RB(pInt,(int)(csp+1)), X86_AL);
-- X86_IP += 2;
-- break;
-- case 0xef: /* outw dx */
-- if (prefix66) p_outl(X86_DX, X86_EAX);
-- else p_outw(X86_DX, X86_AX);
-- X86_IP += 1;
-- break;
-- case 0xee: /* outb dx */
-- p_outb(X86_DX, X86_AL);
-- X86_IP += 1;
-- break;
--
-- case 0xf4:
--#ifdef DEBUG
-- ErrorF("hlt at %p\n", lina);
--#endif
-- return FALSE;
--
-- case 0x0f:
-- xf86DrvMsg(pInt->scrnIndex,
-- X_ERROR,"CPU 0x0f Trap at eip=0x%lx\n",X86_EIP);
-- goto op0ferr;
-- break;
--
-- case 0xf0: /* lock */
-- default:
-- xf86DrvMsg(pInt->scrnIndex,X_ERROR,"unknown reason for exception\n");
-- dump_registers(pInt);
-- stack_trace(pInt);
--
-- op0ferr:
-- dump_code(pInt);
-- xf86DrvMsg(pInt->scrnIndex,X_ERROR,"cannot continue\n");
-- return FALSE;
-- } /* end of switch() */
-- return TRUE;
--}
--#endif
--
- /* general software interrupt handler */
- CARD32
- getIntVect(xf86Int10InfoPtr pInt,int num)
- {
-- return (MEM_RW(pInt,(num << 2)) + (MEM_RW(pInt,((num << 2) + 2)) << 4));
-+ return MEM_RW(pInt, num << 2) + (MEM_RW(pInt, (num << 2) + 2) << 4);
- }
-
- void
- pushw(xf86Int10InfoPtr pInt, CARD16 val)
- {
- X86_ESP -= 2;
-- MEM_WW(pInt,((CARD32) X86_SS << 4) + X86_SP,val);
-+ MEM_WW(pInt, ((CARD32) X86_SS << 4) + X86_SP, val);
- }
-
- int
-@@ -258,11 +90,11 @@
- CARD32 eflags;
- #ifndef _PC
- /* check if bios vector is initialized */
-- if (MEM_RW(pInt,(num<<2)+2) == (SYS_BIOS >> 4)) { /* SYS_BIOS_SEG ?*/
-+ if (MEM_RW(pInt, (num << 2) + 2) == (SYS_BIOS >> 4)) { /* SYS_BIOS_SEG ?*/
- #ifdef PRINT_INT
-- ErrorF("card BIOS not loaded\n");
-+ ErrorF("card BIOS not loaded\n");
- #endif
-- return 0;
-+ return 0;
- }
- #endif
- #ifdef PRINT_INT
-@@ -275,11 +107,11 @@
- #endif
- pushw(pInt, eflags);
- pushw(pInt, X86_CS);
-- pushw(pInt, (CARD16)X86_EIP);
-- X86_CS = MEM_RW(pInt,((num << 2) + 2));
-- X86_EIP = (X86_EIP & 0xFFFF0000) | MEM_RW(pInt,(num << 2));
-+ pushw(pInt, X86_IP);
-+ X86_CS = MEM_RW(pInt, (num << 2) + 2);
-+ X86_IP = MEM_RW(pInt, num << 2);
- #ifdef PRINT_INT
-- ErrorF("0x%x:%lx\n",X86_CS,X86_EIP);
-+ ErrorF("0x%x:%lx\n", X86_CS, X86_EIP);
- #endif
- return 1;
- }
-@@ -291,52 +123,50 @@
- int i;
- CARD32 lina = SEG_ADR((CARD32), X86_CS, IP);
-
-- ErrorF("code at 0x%8.8lx: ",lina);
-- for (i=0; i<0x10; i++)
-- ErrorF("%2.2x ",MEM_RB(pInt,lina + i));
-- ErrorF("\n ");
-- for (; i<0x20; i++)
-- ErrorF("%2.2x ",MEM_RB(pInt,lina + i));
-- ErrorF("\n");
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, "code at 0x%8.8lx:\n", lina);
-+ for (i=0; i<0x10; i++)
-+ xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i));
-+ xf86ErrorFVerb(3, "\n");
-+ for (; i<0x20; i++)
-+ xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i));
-+ xf86ErrorFVerb(3, "\n");
- }
-
--#define PRINT(x) ErrorF(#x":%4.4x ",x)
--#define PRINT_FLAGS(x) ErrorF(#x":%8.8x ",x)
- void
- dump_registers(xf86Int10InfoPtr pInt)
- {
-- PRINT(X86_AX);
-- PRINT(X86_BX);
-- PRINT(X86_CX);
-- PRINT(X86_DX);
-- ErrorF("\n");
-- PRINT(X86_IP);
-- PRINT(X86_SI);
-- PRINT(X86_DI);
-- PRINT(X86_BP);
-- PRINT(X86_SP);
-- ErrorF("\n");
-- PRINT(X86_CS);
-- PRINT(X86_SS);
-- PRINT(X86_ES);
-- PRINT(X86_DS);
-- PRINT(X86_FS);
-- PRINT(X86_GS);
-- ErrorF("\n");
-- PRINT_FLAGS(X86_EFLAGS);
-- ErrorF("\n");
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
-+ "EAX=0x%8.8x, EBX=0x%8.8x, ECX=0x%8.8x, EDX=0x%8.8x\n",
-+ X86_EAX, X86_EBX, X86_ECX, X86_EDX);
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
-+ "ESP=0x%8.8x, EBP=0x%8.8x, ESI=0x%8.8x, EDI=0x%8.8x\n",
-+ X86_ESP, X86_EBP, X86_ESI, X86_EDI);
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
-+ "CS=0x%4.4x, SS=0x%4.4x,"
-+ " DS=0x%4.4x, ES=0x%4.4x, FS=0x%4.4x, GS=0x%4.4x\n",
-+ X86_CS, X86_SS, X86_DS, X86_ES, X86_FS, X86_GS);
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
-+ "EIP=0x%8.8x, EFLAGS=0x%8.8x\n", X86_EIP, X86_EFLAGS);
- }
-
- void
- stack_trace(xf86Int10InfoPtr pInt)
- {
-- int i;
-- CARD32 stack = SEG_ADR((CARD32), X86_SS, SP);
--
-- ErrorF("stack at 0x%8.8lx:\n",stack);
-- for (i=0; i < 0x10; i++)
-- ErrorF("%2.2x ",MEM_RB(pInt,stack + i));
-- ErrorF("\n");
-+ int i = 0;
-+ CARD32 stack = SEG_ADR((CARD32), X86_SS, SP);
-+ CARD32 tail = (CARD32)((X86_SS << 4) + 0x1000);
-+
-+ if (stack >= tail) return;
-+
-+ xf86MsgVerb(X_INFO, 3, "stack at 0x%8.8lx:\n", stack);
-+ for (; stack < tail; stack++) {
-+ xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, stack));
-+ i = (i + 1) % 0x10;
-+ if (!i)
-+ xf86ErrorFVerb(3, "\n");
-+ }
-+ if (i)
-+ xf86ErrorFVerb(3, "\n");
- }
-
- int
-@@ -347,13 +177,13 @@
- CARD32 dst = base;
- #ifdef PRINT_PORT
- ErrorF(" rep_insb(%#x) %d bytes at %p %s\n",
-- port, count, base, d_f?"up":"down");
-+ port, count, base, d_f ? "up" : "down");
- #endif
- while (count--) {
-- MEM_WB(pInt,dst,inb(port));
-+ MEM_WB(pInt, dst, x_inb(port));
- dst += inc;
- }
-- return (dst-base);
-+ return dst - base;
- }
-
- int
-@@ -362,15 +192,15 @@
- {
- register int inc = d_f ? -2 : 2;
- CARD32 dst = base;
--#ifdef PRINT_PORT
-+#ifdef PRINT_PORT
- ErrorF(" rep_insw(%#x) %d bytes at %p %s\n",
-- port, count, base, d_f?"up":"down");
-+ port, count, base, d_f ? "up" : "down");
- #endif
- while (count--) {
-- MEM_WW(pInt,dst,inw(port));
-+ MEM_WW(pInt, dst, x_inw(port));
- dst += inc;
- }
-- return (dst-base);
-+ return dst - base;
- }
-
- int
-@@ -379,15 +209,15 @@
- {
- register int inc = d_f ? -4 : 4;
- CARD32 dst = base;
--#ifdef PRINT_PORT
-+#ifdef PRINT_PORT
- ErrorF(" rep_insl(%#x) %d bytes at %p %s\n",
-- port, count, base, d_f?"up":"down");
-+ port, count, base, d_f ? "up" : "down");
- #endif
- while (count--) {
-- MEM_WL(pInt,dst,inl(port));
-+ MEM_WL(pInt, dst, x_inl(port));
- dst += inc;
- }
-- return (dst-base);
-+ return dst - base;
- }
-
- int
-@@ -396,15 +226,15 @@
- {
- register int inc = d_f ? -1 : 1;
- CARD32 dst = base;
--#ifdef PRINT_PORT
-+#ifdef PRINT_PORT
- ErrorF(" rep_outb(%#x) %d bytes at %p %s\n",
-- port, count, base, d_f?"up":"down");
-+ port, count, base, d_f ? "up" : "down");
- #endif
- while (count--) {
-- outb(port,MEM_RB(pInt,dst));
-+ x_outb(port, MEM_RB(pInt, dst));
- dst += inc;
- }
-- return (dst-base);
-+ return dst - base;
- }
-
- int
-@@ -413,15 +243,15 @@
- {
- register int inc = d_f ? -2 : 2;
- CARD32 dst = base;
--#ifdef PRINT_PORT
-+#ifdef PRINT_PORT
- ErrorF(" rep_outw(%#x) %d bytes at %p %s\n",
-- port, count, base, d_f?"up":"down");
-+ port, count, base, d_f ? "up" : "down");
- #endif
- while (count--) {
-- outw(port,MEM_RW(pInt,dst));
-+ x_outw(port, MEM_RW(pInt, dst));
- dst += inc;
- }
-- return (dst-base);
-+ return dst - base;
- }
-
- int
-@@ -430,27 +260,36 @@
- {
- register int inc = d_f ? -4 : 4;
- CARD32 dst = base;
--#ifdef PRINT_PORT
-+#ifdef PRINT_PORT
- ErrorF(" rep_outl(%#x) %d bytes at %p %s\n",
-- port, count, base, d_f?"up":"down");
-+ port, count, base, d_f ? "up" : "down");
- #endif
- while (count--) {
-- outl(port,MEM_RL(pInt,dst));
-+ x_outl(port, MEM_RL(pInt, dst));
- dst += inc;
- }
-- return (dst-base);
-+ return dst - base;
- }
-
--#if defined(PRINT_PORT) || (!defined(_PC) && !defined(_PC_IO))
- CARD8
- x_inb(CARD16 port)
- {
- CARD8 val;
-
-- val = inb(port);
--#ifdef PRINT_PORT
-- ErrorF(" inb(%#x) = %2.2x\n",port,val);
-+ if (port >= 0x0100) { /* Don't interfere with mainboard */
-+ val = inb(port);
-+#ifdef PRINT_PORT
-+ ErrorF(" inb(%#x) = %2.2x\n", port, val);
- #endif
-+ } else {
-+ val = 0;
-+ xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
-+ "inb 0x%4.4x\n", port);
-+ if (xf86GetVerbosity() > 3) {
-+ dump_registers(Int10Current);
-+ stack_trace(Int10Current);
-+ }
-+ }
- return val;
- }
-
-@@ -460,8 +299,8 @@
- CARD16 val;
-
- val = inw(port);
--#ifdef PRINT_PORT
-- ErrorF(" inw(%#x) = %4.4x\n",port,val);
-+#ifdef PRINT_PORT
-+ ErrorF(" inw(%#x) = %4.4x\n", port, val);
- #endif
- return val;
- }
-@@ -469,19 +308,29 @@
- void
- x_outb(CARD16 port, CARD8 val)
- {
--#ifdef PRINT_PORT
-- ErrorF(" outb(%#x, %2.2x)\n",port,val);
-+ if (port >= 0x0100) { /* Don't interfere with mainboard */
-+#ifdef PRINT_PORT
-+ ErrorF(" outb(%#x, %2.2x)\n", port, val);
- #endif
-- outb(port,val);
-+ outb(port, val);
-+ } else {
-+ xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
-+ "outb 0x%4.4x,0x%2.2x\n", port, val);
-+ if (xf86GetVerbosity() > 3) {
-+ dump_registers(Int10Current);
-+ stack_trace(Int10Current);
-+ }
-+ }
- }
-
- void
- x_outw(CARD16 port, CARD16 val)
- {
--#ifdef PRINT_PORT
-- ErrorF(" outw(%#x, %4.4x)\n",port,val);
-+#ifdef PRINT_PORT
-+ ErrorF(" outw(%#x, %4.4x)\n", port, val);
- #endif
-- outw(port,val);
-+
-+ outw(port, val);
- }
-
- CARD32
-@@ -489,13 +338,13 @@
- {
- CARD32 val;
-
--#if !defined (_PC) && !defined (_PC_PCI)
-- if (!pciCfg1in(port,&val))
-+#if !defined(_PC) && !defined(_PC_PCI)
-+ if (!pciCfg1in(port, &val))
- #endif
- val = inl(port);
-
- #ifdef PRINT_PORT
-- ErrorF(" inl(%#x) = %8.8x\n",port,val);
-+ ErrorF(" inl(%#x) = %8.8x\n", port, val);
- #endif
- return val;
- }
-@@ -504,52 +353,52 @@
- x_outl(CARD16 port, CARD32 val)
- {
- #ifdef PRINT_PORT
-- ErrorF(" outl(%#x, %8.8x)\n",port,val);
-+ ErrorF(" outl(%#x, %8.8x)\n", port, val);
- #endif
--#if !defined (_PC) && !defined (_PC_PCI)
-- if (!pciCfg1out(port,val))
-+
-+#if !defined(_PC) && !defined(_PC_PCI)
-+ if (!pciCfg1out(port, val))
- #endif
-- outl(port,val);
-+ outl(port, val);
- }
--#endif
-
- CARD8
- Mem_rb(int addr)
- {
-- return Int10Current->mem->rb(Int10Current,addr);
-+ return (*Int10Current->mem->rb)(Int10Current, addr);
- }
-
- CARD16
- Mem_rw(int addr)
- {
-- return Int10Current->mem->rw(Int10Current,addr);
-+ return (*Int10Current->mem->rw)(Int10Current, addr);
- }
-
- CARD32
- Mem_rl(int addr)
- {
-- return Int10Current->mem->rl(Int10Current,addr);
-+ return (*Int10Current->mem->rl)(Int10Current, addr);
- }
-
- void
--Mem_wb(int addr,CARD8 val)
-+Mem_wb(int addr, CARD8 val)
- {
-- Int10Current->mem->wb(Int10Current,addr,val);
-+ (*Int10Current->mem->wb)(Int10Current, addr, val);
- }
-
- void
--Mem_ww(int addr,CARD16 val)
-+Mem_ww(int addr, CARD16 val)
- {
-- Int10Current->mem->ww(Int10Current,addr,val);
-+ (*Int10Current->mem->ww)(Int10Current, addr, val);
- }
-
- void
--Mem_wl(int addr,CARD32 val)
-+Mem_wl(int addr, CARD32 val)
- {
-- Int10Current->mem->wl(Int10Current,addr,val);
-+ (*Int10Current->mem->wl)(Int10Current, addr, val);
- }
-
--#if !defined (_PC) && !defined (_PC_PCI)
-+#if !defined(_PC) && !defined(_PC_PCI)
- static CARD32 PciCfg1Addr = 0;
-
- #define TAG(Cfg1Addr) (Cfg1Addr & 0xffff00)
-@@ -562,7 +411,7 @@
- *val = PciCfg1Addr;
- return 1;
- }
-- else if (addr == 0xCFC) {
-+ if (addr == 0xCFC) {
- *val = pciReadLong(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr));
- return 1;
- }
-@@ -576,7 +425,7 @@
- PciCfg1Addr = val;
- return 1;
- }
-- else if (addr == 0xCFC) {
-+ if (addr == 0xCFC) {
- pciWriteLong(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr),val);
- return 1;
- }
-@@ -603,7 +452,7 @@
- * disable registers before we call the BIOS initialization and
- * restore the original values afterwards. In beween we hold our
- * breath. To get to a (possibly exising) ISA card need to disable
-- * our current PCI card.
-+ * our current PCI card.
- */
- /*
- * This is just for booting: we just want to catch pure
-@@ -615,25 +464,25 @@
- void
- LockLegacyVGA(int screenIndex,legacyVGAPtr vga)
- {
-- xf86SetCurrentAccess(FALSE,xf86Screens[screenIndex]);
-+ xf86SetCurrentAccess(FALSE, xf86Screens[screenIndex]);
- vga->save_msr = inb(0x3CC);
- vga->save_vse = inb(0x3C3);
- vga->save_46e8 = inb(0x46e8);
- vga->save_pos102 = inb(0x102);
-- outb(0x3C2,~(CARD8)0x03 & vga->save_msr);
-- outb(0x3C3,~(CARD8)0x01 & vga->save_vse);
-+ outb(0x3C2, ~(CARD8)0x03 & vga->save_msr);
-+ outb(0x3C3, ~(CARD8)0x01 & vga->save_vse);
- outb(0x46e8, ~(CARD8)0x08 & vga->save_46e8);
- outb(0x102, ~(CARD8)0x01 & vga->save_pos102);
-- xf86SetCurrentAccess(TRUE,xf86Screens[screenIndex]);
-+ xf86SetCurrentAccess(TRUE, xf86Screens[screenIndex]);
- }
-
- void
- UnlockLegacyVGA(int screenIndex, legacyVGAPtr vga)
- {
-- xf86SetCurrentAccess(FALSE,xf86Screens[screenIndex]);
-+ xf86SetCurrentAccess(FALSE, xf86Screens[screenIndex]);
- outb(0x102, vga->save_pos102);
- outb(0x46e8, vga->save_46e8);
- outb(0x3C3, vga->save_vse);
- outb(0x3C2, vga->save_msr);
-- xf86SetCurrentAccess(TRUE,xf86Screens[screenIndex]);
-+ xf86SetCurrentAccess(TRUE, xf86Screens[screenIndex]);
- }
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v
-retrieving revision 1.14
-retrieving revision 1.15
-diff -u -r1.14 -r1.15
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c 2000/12/02 15:31:01 1.14
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c 2001/01/06 20:19:13 1.15
-@@ -1,11 +1,10 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.14 2000/12/02 15:31:01 tsi Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.15 2001/01/06 20:19:13 tsi Exp $ */
- /*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
- * Copyright 1999 Egbert Eich
- */
- #include "xf86.h"
--#include "xf86str.h"
- #include "xf86_OSproc.h"
- #include "xf86_ansic.h"
- #include "compiler.h"
-@@ -21,14 +20,14 @@
- } INT10Opts;
-
- static OptionInfoRec INT10Options[] = {
-- {OPT_NOINT10, "NoINT10", OPTV_BOOLEAN, {0}, FALSE },
-- { -1, NULL, OPTV_NONE, {0}, FALSE },
-+ {OPT_NOINT10, "NoINT10", OPTV_BOOLEAN, {0}, FALSE},
-+ { -1, NULL, OPTV_NONE, {0}, FALSE},
- };
-
- #define nINT10Options (sizeof(INT10Options) / sizeof(INT10Options[0]))
-
- #ifdef DEBUG
--void
-+void
- dprint(unsigned long start, unsigned long size)
- {
- int i,j;
-@@ -37,7 +36,7 @@
- for (j = 0; j < (size >> 4); j++) {
- char *d = c;
- ErrorF("\n0x%lx: ",(unsigned long)c);
-- for (i = 0; i<16; i++)
-+ for (i = 0; i<16; i++)
- ErrorF("%2.2x ",(unsigned char) (*(c++)));
- c = d;
- for (i = 0; i<16; i++) {
-@@ -49,8 +48,8 @@
- ErrorF("\n");
- }
- #endif
--
-
-+#ifndef _PC
- /*
- * here we are really paranoid about faking a "real"
- * BIOS. Most of this information was pulled from
-@@ -59,66 +58,64 @@
- void
- setup_int_vect(xf86Int10InfoPtr pInt)
- {
-- const CARD16 cs = (SYS_BIOS >> 4);
-- const CARD16 ip = 0x0;
- int i;
--
-+
- /* let the int vects point to the SYS_BIOS seg */
-- for (i=0; i<0x80; i++) {
-- MEM_WW(pInt,(i<<2),ip);
-- MEM_WW(pInt,((i<<2)+2),cs);
-+ for (i = 0; i < 0x80; i++) {
-+ MEM_WW(pInt, i << 2, 0);
-+ MEM_WW(pInt, (i << 2) + 2, SYS_BIOS >> 4);
- }
-- /* video interrupts default location */
-- MEM_WW(pInt,(0x42<<2),0xf065);
-- MEM_WW(pInt,(0x10<<2),0xf065);
-- MEM_WW(pInt,(0x6D<<2),0xf065);
-- /* video param table default location (int 1d) */
-- MEM_WW(pInt,(0x1d<<2),0xf0A4);
-+
-+ reset_int_vect(pInt);
- /* font tables default location (int 1F) */
-- MEM_WW(pInt,(0x1f<<2),0xfa6e);
-+ MEM_WW(pInt,0x1f<<2,0xfa6e);
-
-- /* int 11 default location */
-- MEM_WW(pInt,(0x11<<2),0xf84d);
-- /* int 12 default location */
-- MEM_WW(pInt,(0x12<<2),0xf841);
-- /* int 15 default location */
-- MEM_WW(pInt,(0x15<<2),0xf859);
-- /* int 1A default location */
-- MEM_WW(pInt,(0x1a<<2),0xff6e);
-- /* int 05 default location */
-- MEM_WW(pInt,(0x05<<2),0xff54);
-- /* int 08 default location */
-- MEM_WW(pInt,(0x08<<2),0xfea5);
-- /* int 13 default location (fdd) */
-- MEM_WW(pInt,(0x13<<2),0xec59);
-- /* int 0E default location */
-- MEM_WW(pInt,(0x0e<<2),0xef57);
-- /* int 17 default location */
-- MEM_WW(pInt,(0x17<<2),0xefd2);
-+ /* int 11 default location (Get Equipment Configuration) */
-+ MEM_WW(pInt, 0x11 << 2, 0xf84d);
-+ /* int 12 default location (Get Conventional Memory Size) */
-+ MEM_WW(pInt, 0x12 << 2, 0xf841);
-+ /* int 15 default location (I/O System Extensions) */
-+ MEM_WW(pInt, 0x15 << 2, 0xf859);
-+ /* int 1A default location (RTC, PCI and others) */
-+ MEM_WW(pInt, 0x1a << 2, 0xff6e);
-+ /* int 05 default location (Bound Exceeded) */
-+ MEM_WW(pInt, 0x05 << 2, 0xff54);
-+ /* int 08 default location (Double Fault) */
-+ MEM_WW(pInt, 0x08 << 2, 0xfea5);
-+ /* int 13 default location (Disk) */
-+ MEM_WW(pInt, 0x13 << 2, 0xec59);
-+ /* int 0E default location (Page Fault) */
-+ MEM_WW(pInt, 0x0e << 2, 0xef57);
-+ /* int 17 default location (Parallel Port) */
-+ MEM_WW(pInt, 0x17 << 2, 0xefd2);
- /* fdd table default location (int 1e) */
-- MEM_WW(pInt,(0x1e<<2),0xefc7);
-+ MEM_WW(pInt, 0x1e << 2, 0xefc7);
-+
-+ /* Set Equipment flag to VGA */
-+ i = MEM_RB(pInt, 0x0410) & 0xCF;
-+ MEM_WB(pInt, 0x0410, i);
-+ /* XXX Perhaps setup more of the BDA here. See also int42(0x00). */
- }
-+#endif
-
- int
- setup_system_bios(memType base_addr)
- {
-- char *date = "06/01/99";
-- char *eisa_ident = "PCI/ISA";
-- CARD16 *base = (CARD16*) base_addr;
--
-+ char *base = (char *) base_addr;
-+
- /*
- * we trap the "industry standard entry points" to the BIOS
- * and all other locations by filling them with "hlt"
- * TODO: implement hlt-handler for these
- */
-- memset((void *)(base),0xf4,0x10000);
-+ memset(base, 0xf4, 0x10000);
-
- /* set bios date */
-- strcpy((((char *)base) + 0xFFF5),date);
-+ strcpy(base + 0x0FFF5, "06/11/99");
- /* set up eisa ident string */
-- strcpy((((char *)base) + 0xFFD9),eisa_ident);
-+ strcpy(base + 0x0FFD9, "PCI_ISA");
- /* write system model id for IBM-AT */
-- *(((unsigned char *)base) + 0xFFFE) = 0xfc;
-+ *((unsigned char *)(base + 0x0FFFE)) = 0xfc;
-
- return 1;
- }
-@@ -126,23 +123,65 @@
- void
- reset_int_vect(xf86Int10InfoPtr pInt)
- {
-- MEM_WW(pInt,(0x10<<2),0xf065);
-- MEM_WW(pInt,((0x10<<2)+2),(SYS_BIOS >> 4));
-- MEM_WW(pInt,(0x42<<2),0xf065);
-- MEM_WW(pInt,((0x42<<2)+2),(SYS_BIOS >> 4));
-- MEM_WW(pInt,(0x6D<<2),0xf065);
-- MEM_WW(pInt,((0x6D<<2)+2),(SYS_BIOS >> 4));
-- }
-+ /*
-+ * This table is normally located at 0xF000:0xF0A4. However, int 0x42,
-+ * function 0 (Mode Set) expects it (or a copy) somewhere in the bottom
-+ * 64kB. Note that because this data doesn't survive POST, int 0x42 should
-+ * only be used during EGA/VGA BIOS initialisation.
-+ */
-+ static const CARD8 VideoParms[] = {
-+ /* Timing for modes 0x00 & 0x01 */
-+ 0x38, 0x28, 0x2d, 0x0a, 0x1f, 0x06, 0x19, 0x1c,
-+ 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
-+ /* Timing for modes 0x02 & 0x03 */
-+ 0x71, 0x50, 0x5a, 0x0a, 0x1f, 0x06, 0x19, 0x1c,
-+ 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
-+ /* Timing for modes 0x04, 0x05 & 0x06 */
-+ 0x38, 0x28, 0x2d, 0x0a, 0x7f, 0x06, 0x64, 0x70,
-+ 0x02, 0x01, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
-+ /* Timing for mode 0x07 */
-+ 0x61, 0x50, 0x52, 0x0f, 0x19, 0x06, 0x19, 0x19,
-+ 0x02, 0x0d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00,
-+ /* Display page lengths in little endian order */
-+ 0x00, 0x08, /* Modes 0x00 and 0x01 */
-+ 0x00, 0x10, /* Modes 0x02 and 0x03 */
-+ 0x00, 0x40, /* Modes 0x04 and 0x05 */
-+ 0x00, 0x40, /* Modes 0x06 and 0x07 */
-+ /* Number of columns for each mode */
-+ 40, 40, 80, 80, 40, 40, 80, 80,
-+ /* CGA Mode register value for each mode */
-+ 0x2c, 0x28, 0x2d, 0x29, 0x2a, 0x2e, 0x1e, 0x29,
-+ /* Padding */
-+ 0x00, 0x00, 0x00, 0x00
-+ };
-+ int i;
-+
-+ for (i = 0; i < sizeof(VideoParms); i++)
-+ MEM_WB(pInt, i + (0x1000 - sizeof(VideoParms)), VideoParms[i]);
-+ MEM_WW(pInt, 0x1d << 2, 0x1000 - sizeof(VideoParms));
-+ MEM_WW(pInt, (0x1d << 2) + 2, 0);
-+
-+ MEM_WW(pInt, 0x10 << 2, 0xf065);
-+ MEM_WW(pInt, (0x10 << 2) + 2, SYS_BIOS >> 4);
-+ MEM_WW(pInt, 0x42 << 2, 0xf065);
-+ MEM_WW(pInt, (0x42 << 2) + 2, SYS_BIOS >> 4);
-+ MEM_WW(pInt, 0x6D << 2, 0xf065);
-+ MEM_WW(pInt, (0x6D << 2) + 2, SYS_BIOS >> 4);
-+}
-
- void
- set_return_trap(xf86Int10InfoPtr pInt)
--{
-+{
- /*
-- * here we also set the exit condition:
-- * we return when we encounter 'hlt' (^=0xf4) this
-- * will be located at address 0x600 in x86 memory.
-+ * Here we set the exit condition: We return when we encounter
-+ * 'hlt' (=0xf4), which we locate at address 0x600 in x86 memory.
- */
-- MEM_WB(pInt,0x600,0xf4);
-+ MEM_WB(pInt, 0x0600, 0xf4);
-+
-+ /*
-+ * Allocate a segment for the stack
-+ */
-+ xf86Int10AllocPages(pInt, 1, &pInt->stackseg);
- }
-
- Bool
-@@ -150,7 +189,7 @@
- {
- Bool noint10 = FALSE;
- EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
--
-+
- if (pEnt->device && pEnt->device->options) {
- OptionInfoRec options[nINT10Options];
-
-@@ -170,12 +209,12 @@
- int size;
-
- if ((codeSeg & 0x1f) || /* Not 512-byte aligned otherwise */
-- ((codeSeg << 4) < V_BIOS) ||
-+ ((codeSeg << 4) < V_BIOS) ||
- ((codeSeg << 4) >= SYS_SIZE))
-- return FALSE;
-+ return FALSE;
-
- if (xf86IsPc98())
-- return FALSE;
-+ return FALSE;
-
- if ((*vbiosMem != 0x55) || (*(vbiosMem+1) != 0xAA) || !*(vbiosMem+2))
- return FALSE;
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/pci.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/int10/pci.c,v
-retrieving revision 1.5
-retrieving revision 1.6
-diff -u -r1.5 -r1.6
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/pci.c 2000/12/02 15:31:01 1.5
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/pci.c 2001/01/06 20:19:13 1.6
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/pci.c,v 1.5 2000/12/02 15:31:01 tsi Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/pci.c,v 1.6 2001/01/06 20:19:13 tsi Exp $ */
-
- /*
- * XFree86 int10 module
-@@ -7,7 +7,6 @@
- */
- #include "xf86Pci.h"
- #include "xf86.h"
--#include "xf86str.h"
- #include "xf86_ansic.h"
- #define _INT10_PRIVATE
- #include "xf86int10.h"
-@@ -18,7 +17,7 @@
- PCITAG tag;
- unsigned long offset = 0;
- unsigned char *mem, *ptr;
-- int length, rlength, blength;
-+ int length;
-
- pciVideoPtr pvp = xf86GetPciInfoForEntity(pInt->entityIndex);
-
-@@ -30,25 +29,18 @@
- }
-
- tag = pciTag(pvp->bus,pvp->device,pvp->func);
-- rlength = blength = 1 << pvp->biosSize;
-+ length = 1 << pvp->biosSize;
-
-- /* Read in entire PCI ROM in 64kB chunks */
-- mem = ptr = xnfcalloc(blength, 1);
-- while ((length = rlength) > 0) {
-- if (length > 0x10000) length = 0x10000;
-- if (xf86ReadPciBIOS(offset, tag, -1, ptr, length) < length) {
-- xfree(mem);
-+ /* Read in entire PCI ROM */
-+ mem = ptr = xnfcalloc(length, 1);
-+ if (xf86ReadPciBIOS(offset, tag, -1, ptr, length) < length) {
-+ xfree(mem);
- #ifdef DEBUG
-- ErrorF("mapPciRom: cannot read BIOS\n");
-+ ErrorF("mapPciRom: cannot read BIOS\n");
- #endif
-- return 0;
-- }
-- offset += length;
-- rlength -= length;
-- ptr += length;
-+ return 0;
- }
-
-- ptr = mem;
- while ((ptr[0] == 0x55) && (ptr[1] == 0xAA)) {
- unsigned short data_off = ptr[0x18] | (ptr[0x19] << 8);
- unsigned char *data = ptr + data_off;
-@@ -63,10 +55,10 @@
- #ifdef PRINT_PCI
- ErrorF("data segment in BIOS: 0x%x, type: 0x%x\n", data_off, type);
- #endif
-- if (type) { /* not PC-AT image: find next one */
-+ if (type) { /* not PC-AT image: find next one */
- unsigned int image_length;
- unsigned char indicator = data[0x15];
-- if (indicator & 0x80) /* last image */
-+ if (indicator & 0x80) /* last image */
- break;
- image_length = (data[0x10] | (data[0x11] << 8)) << 9;
- #ifdef PRINT_PCI
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86int10.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/int10/xf86int10.c,v
-retrieving revision 1.5
-retrieving revision 1.6
-diff -u -r1.5 -r1.6
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86int10.c 2000/04/04 19:25:18 1.5
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86int10.c 2001/01/06 20:19:13 1.6
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.c,v 1.5 2000/04/04 19:25:18 dawes Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.c,v 1.6 2001/01/06 20:19:13 tsi Exp $ */
- /*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
-@@ -6,7 +6,6 @@
- */
-
- #include "xf86.h"
--#include "xf86str.h"
- #include "xf86_ansic.h"
- #include "compiler.h"
- #include "xf86Pci.h"
-@@ -14,10 +13,14 @@
- #include "xf86int10.h"
- #include "int10Defines.h"
-
-+#define REG pInt
-+
- xf86Int10InfoPtr Int10Current = NULL;
-
- static int int1A_handler(xf86Int10InfoPtr pInt);
-+#ifndef _PC
- static int int42_handler(xf86Int10InfoPtr pInt);
-+#endif
- static int intE6_handler(xf86Int10InfoPtr pInt);
- static PCITAG findPci(unsigned short bx);
- static CARD32 pciSlotBX(pciVideoPtr pvp);
-@@ -26,88 +29,557 @@
- int_handler(xf86Int10InfoPtr pInt)
- {
- int num = pInt->num;
-+ int ret = 0;
-
- switch (num) {
-+#ifndef _PC
- case 0x10:
- case 0x42:
-- if (!(int42_handler(pInt)))
-- goto bios_handler;
-- else return 1;
-+ case 0x6D:
-+ if (getIntVect(pInt, num) == I_S_DEFAULT_INT_VECT)
-+ ret = int42_handler(pInt);
-+ break;
-+#endif
- case 0x1A:
-- if(!(int1A_handler(pInt)))
-- goto bios_handler;
-- else return 1;
-+ ret = int1A_handler(pInt);
-+ break;
- case 0xe6:
-- if (!(intE6_handler(pInt)))
-- goto bios_handler;
-- else return 1;
-+ ret = intE6_handler(pInt);
-+ break;
- default:
-- goto bios_handler;
-+ break;
- }
-- bios_handler:
-- return run_bios_int(num,pInt);
-+
-+ if (!ret)
-+ ret = run_bios_int(num, pInt);
-+
-+ if (!ret) {
-+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
-+ "Halting on int 0x%2.2x!\n", num);
-+ dump_registers(pInt);
-+ stack_trace(pInt);
-+ }
-+
-+ return ret;
- }
-
-+#ifndef _PC
- /*
-- * The system-BIOS provides int10 ax=1200 and ax=1201 functions
-- * before the video bios is installed. The int10_handler below
-- * provides these functions, too. However there have been cases
-- * in which disabling generic video has caused problems. Therefore
-- * it has been disabled by default. To reenable it do:
-- * #define DO_GENERIC_INT10
-+ * This is derived from a number of PC system BIOS'es. The intent here is to
-+ * provide very primitive video support, before an EGA/VGA BIOS installs its
-+ * own interrupt vector. Here, "Ignored" calls should remain so. "Not
-+ * Implemented" denotes functionality that can be implemented should the need
-+ * arise. What are "Not Implemented" throughout are video memory accesses.
-+ * Also, very little input validity checking is done here.
- */
- static int
- int42_handler(xf86Int10InfoPtr pInt)
- {
--#define REG pInt
--#ifdef DO_GENERIC_INT10
-- unsigned char c;
--#endif
-- int num = pInt->num;
--#ifdef PRINT_INT
-- ErrorF("int 0x%x: ax:0x%x bx:0x%x cx:0x%x dx:0x%x\n",num,
-- X86_EAX,X86_EBX,X86_ECX,X86_EDX);
--#endif
-- /*
-- * video bios has modified these -
-- * leave it to the video bios to do this
-- */
-+ switch (X86_AH) {
-+ case 0x00:
-+ /* Set Video Mode */
-+ /* Enter: AL = video mode number */
-+ /* Leave: Nothing */
-+ /* Implemented (except for clearing the screen) */
-+ { /* Localise */
-+ int i;
-+ CARD16 ioport, int1d, regvals, tmp;
-+ CARD8 mode, cgamode, cgacolour;
-+
-+ /*
-+ * Ignore all mode numbers but 0x00-0x13. Some systems also ignore
-+ * 0x0B and 0x0C, but don't do that here.
-+ */
-+ if (X86_AL > 0x13)
-+ break;
-+
-+ /*
-+ * You didn't think that was really the mode set, did you? There
-+ * are only so many slots in the video parameter table...
-+ */
-+ mode = X86_AL;
-+ ioport = 0x03D4;
-+ switch (MEM_RB(pInt, 0x0410) & 0x30) {
-+ case 0x30: /* MDA */
-+ mode = 0x07; /* Force mode to 0x07 */
-+ ioport = 0x03B4;
-+ break;
-+ case 0x10: /* CGA 40x25 */
-+ if (mode >= 0x07)
-+ mode = 0x01;
-+ break;
-+ case 0x20: /* CGA 80x25 (MCGA?) */
-+ if (mode >= 0x07)
-+ mode = 0x03;
-+ break;
-+ case 0x00: /* EGA/VGA */
-+ if (mode >= 0x07) /* Don't try MDA timings */
-+ mode = 0x01; /* !?!?! */
-+ break;
-+ }
-+
-+ /* Locate data in video parameter table */
-+ int1d = MEM_RW(pInt, 0x1d << 2);
-+ regvals = ((mode >> 1) << 4) + int1d;
-+ cgacolour = 0x30;
-+ if (mode == 0x06) {
-+ regvals -= 0x10;
-+ cgacolour = 0x3F;
-+ }
-+
-+ /** Update BIOS Data Area **/
-+
-+ /* Video mode */
-+ MEM_WB(pInt, 0x0449, mode);
-+
-+ /* Columns */
-+ tmp = MEM_RB(pInt, mode + int1d + 0x48);
-+ MEM_WW(pInt, 0x044A, tmp);
-+
-+ /* Page length */
-+ tmp = MEM_RW(pInt, (mode & 0x06) + int1d + 0x40);
-+ MEM_WW(pInt, 0x044C, tmp);
-+
-+ /* Start Address */
-+ MEM_WW(pInt, 0x044E, 0);
-+
-+ /* Cursor positions, one for each display page */
-+ for (i = 0x0450; i < 0x0460; i += 2)
-+ MEM_WW(pInt, i, 0);
-+
-+ /* Cursor start & end scanlines */
-+ tmp = MEM_RB(pInt, regvals + 0x0B);
-+ MEM_WB(pInt, 0x0460, tmp);
-+ tmp = MEM_RB(pInt, regvals + 0x0A);
-+ MEM_WB(pInt, 0x0461, tmp);
-+
-+ /* Current display page number */
-+ MEM_WB(pInt, 0x0462, 0);
-+
-+ /* CRTC I/O address */
-+ MEM_WW(pInt, 0x0463, ioport);
-+
-+ /* CGA Mode register value */
-+ cgamode = MEM_RB(pInt, mode + int1d + 0x50);
-+ MEM_WB(pInt, 0x0465, cgamode);
-+
-+ /* CGA Colour register value */
-+ MEM_WB(pInt, 0x0466, cgacolour);
-+
-+ /* Rows */
-+ MEM_WB(pInt, 0x0484, (25 - 1));
-+
-+ /* Programme the mode */
-+ outb(ioport + 4, cgamode & 0x37); /* Turn off screen */
-+ for (i = 0; i < 0x10; i++) {
-+ tmp = MEM_RB(pInt, regvals + i);
-+ outb(ioport, i);
-+ outb(ioport + 1, tmp);
-+ }
-+ outb(ioport + 5, cgacolour); /* Select colour mode */
-+ outb(ioport + 4, cgamode); /* Turn on screen */
-+ }
-+ break;
-+
-+ case 0x01:
-+ /* Set Cursor Type */
-+ /* Enter: CH = starting line for cursor */
-+ /* CL = ending line for cursor */
-+ /* Leave: Nothing */
-+ /* Implemented */
-+ { /* Localise */
-+ CARD16 ioport = MEM_RW(pInt, 0x0463);
-+
-+ MEM_WB(pInt, 0x0460, X86_CL);
-+ MEM_WB(pInt, 0x0461, X86_CH);
-+
-+ outb(ioport, 0x0A);
-+ outb(ioport + 1, X86_CH);
-+ outb(ioport, 0x0B);
-+ outb(ioport + 1, X86_CL);
-+ }
-+ break;
-+
-+ case 0x02:
-+ /* Set Cursor Position */
-+ /* Enter: BH = display page number */
-+ /* DH = row */
-+ /* DL = column */
-+ /* Leave: Nothing */
-+ /* Implemented */
-+ { /* Localise */
-+ CARD16 offset, ioport;
-+
-+ MEM_WB(pInt, (X86_BH << 1) + 0x0450, X86_DL);
-+ MEM_WB(pInt, (X86_BH << 1) + 0x0451, X86_DH);
-+
-+ if (X86_BH != MEM_RB(pInt, 0x0462))
-+ break;
-+
-+ offset = (X86_DH * MEM_RW(pInt, 0x044A)) + X86_DL;
-+ offset += MEM_RW(pInt, 0x044E) << 1;
-+
-+ ioport = MEM_RW(pInt, 0x0463);
-+ outb(ioport, 0x0E);
-+ outb(ioport + 1, offset >> 8);
-+ outb(ioport, 0x0F);
-+ outb(ioport + 1, offset & 0xFF);
-+ }
-+ break;
-+
-+ case 0x03:
-+ /* Get Cursor Position */
-+ /* Enter: BH = display page number */
-+ /* Leave: CH = starting line for cursor */
-+ /* CL = ending line for cursor */
-+ /* DH = row */
-+ /* DL = column */
-+ /* Implemented */
-+ { /* Localise */
-+ X86_CL = MEM_RB(pInt, 0x0460);
-+ X86_CH = MEM_RB(pInt, 0x0461);
-+ X86_DL = MEM_RB(pInt, (X86_BH << 1) + 0x0450);
-+ X86_DH = MEM_RB(pInt, (X86_BH << 1) + 0x0451);
-+ }
-+ break;
-+
-+ case 0x04:
-+ /* Get Light Pen Position */
-+ /* Enter: Nothing */
-+ /* Leave: AH = 0x01 (down/triggered) or 0x00 (not) */
-+ /* BX = pixel column */
-+ /* CX = pixel row */
-+ /* DH = character row */
-+ /* DL = character column */
-+ /* Not Implemented */
-+ { /* Localise */
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
-+ "int 0x%2.2x(AH=0x04) -- Get Light Pen Position\n", pInt->num);
-+ if (xf86GetVerbosity() > 3) {
-+ dump_registers(pInt);
-+ stack_trace(pInt);
-+ }
-+ X86_AH = X86_BX = X86_CX = X86_DX = 0;
-+ }
-+ break;
-+
-+ case 0x05:
-+ /* Set Display Page */
-+ /* Enter: AL = display page number */
-+ /* Leave: Nothing */
-+ /* Implemented */
-+ { /* Localise */
-+ CARD16 start, ioport = MEM_RW(pInt, 0x0463);
-+ CARD8 x, y;
-+
-+ /* Calculate new start address */
-+ MEM_WB(pInt, 0x0462, X86_AL);
-+ start = X86_AL * MEM_RW(pInt, 0x044C);
-+ MEM_WW(pInt, 0x044E, start);
-+ start <<= 1;
-+
-+ /* Update start address */
-+ outb(ioport, 0x0C);
-+ outb(ioport + 1, start >> 8);
-+ outb(ioport, 0x0D);
-+ outb(ioport + 1, start & 0xFF);
-+
-+ /* Switch cursor position */
-+ y = MEM_RB(pInt, (X86_AL << 1) + 0x0450);
-+ x = MEM_RB(pInt, (X86_AL << 1) + 0x0451);
-+ start += (y * MEM_RW(pInt, 0x044A)) + x;
-+
-+ /* Update cursor position */
-+ outb(ioport, 0x0E);
-+ outb(ioport + 1, start >> 8);
-+ outb(ioport, 0x0F);
-+ outb(ioport + 1, start & 0xFF);
-+ }
-+ break;
-+
-+ case 0x06:
-+ /* Initialise or Scroll Window Up */
-+ /* Enter: AL = lines to scroll up */
-+ /* BH = attribute for blank */
-+ /* CH = upper y of window */
-+ /* CL = left x of window */
-+ /* DH = lower y of window */
-+ /* DL = right x of window */
-+ /* Leave: Nothing */
-+ /* Not Implemented */
-+ { /* Localise */
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
-+ "int 0x%2.2x(AH=0x06) -- Initialise or Scroll Window Up\n",
-+ pInt->num);
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
-+ " AL=0x%2.2x, BH=0x%2.2x,"
-+ " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n",
-+ X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL);
-+ if (xf86GetVerbosity() > 3) {
-+ dump_registers(pInt);
-+ stack_trace(pInt);
-+ }
-+ }
-+ break;
-+
-+ case 0x07:
-+ /* Initialise or Scroll Window Down */
-+ /* Enter: AL = lines to scroll down */
-+ /* BH = attribute for blank */
-+ /* CH = upper y of window */
-+ /* CL = left x of window */
-+ /* DH = lower y of window */
-+ /* DL = right x of window */
-+ /* Leave: Nothing */
-+ /* Not Implemented */
-+ { /* Localise */
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
-+ "int 0x%2.2x(AH=0x07) -- Initialise or Scroll Window Down\n",
-+ pInt->num);
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
-+ " AL=0x%2.2x, BH=0x%2.2x,"
-+ " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n",
-+ X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL);
-+ if (xf86GetVerbosity() > 3) {
-+ dump_registers(pInt);
-+ stack_trace(pInt);
-+ }
-+ }
-+ break;
-+
-+ case 0x08:
-+ /* Read Character and Attribute at Cursor */
-+ /* Enter: BH = display page number */
-+ /* Leave: AH = attribute */
-+ /* AL = character */
-+ /* Not Implemented */
-+ { /* Localise */
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
-+ "int 0x%2.2x(AH=0x08) -- Read Character and Attribute at"
-+ " Cursor\n", pInt->num);
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
-+ "BH=0x%2.2x\n", X86_BH);
-+ if (xf86GetVerbosity() > 3) {
-+ dump_registers(pInt);
-+ stack_trace(pInt);
-+ }
-+ X86_AX = 0;
-+ }
-+ break;
-+
-+ case 0x09:
-+ /* Write Character and Attribute at Cursor */
-+ /* Enter: AL = character */
-+ /* BH = display page number */
-+ /* BL = attribute (text) or colour (graphics) */
-+ /* CX = replication count */
-+ /* Leave: Nothing */
-+ /* Not Implemented */
-+ { /* Localise */
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
-+ "int 0x%2.2x(AH=0x09) -- Write Character and Attribute at"
-+ " Cursor\n", pInt->num);
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
-+ "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n",
-+ X86_AL, X86_BH, X86_BL, X86_CX);
-+ if (xf86GetVerbosity() > 3) {
-+ dump_registers(pInt);
-+ stack_trace(pInt);
-+ }
-+ }
-+ break;
-+
-+ case 0x0a:
-+ /* Write Character at Cursor */
-+ /* Enter: AL = character */
-+ /* BH = display page number */
-+ /* BL = colour */
-+ /* CX = replication count */
-+ /* Leave: Nothing */
-+ /* Not Implemented */
-+ { /* Localise */
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
-+ "int 0x%2.2x(AH=0x0A) -- Write Character at Cursor\n",
-+ pInt->num);
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
-+ "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n",
-+ X86_AL, X86_BH, X86_BL, X86_CX);
-+ if (xf86GetVerbosity() > 3) {
-+ dump_registers(pInt);
-+ stack_trace(pInt);
-+ }
-+ }
-+ break;
-+
-+ case 0x0b:
-+ /* Set Palette, Background or Border */
-+ /* Enter: BH = 0x00 or 0x01 */
-+ /* BL = colour or palette (respectively) */
-+ /* Leave: Nothing */
-+ /* Implemented */
-+ { /* Localise */
-+ CARD16 ioport = MEM_RW(pInt, 0x0463) + 5;
-+ CARD8 cgacolour = MEM_RB(pInt, 0x0466);
-+
-+ if (X86_BH) {
-+ cgacolour &= 0xDF;
-+ cgacolour |= (X86_BL & 0x01) << 5;
-+ } else {
-+ cgacolour &= 0xE0;
-+ cgacolour |= X86_BL & 0x1F;
-+ }
-+
-+ MEM_WB(pInt, 0x0466, cgacolour);
-+ outb(ioport, cgacolour);
-+ }
-+ break;
-+
-+ case 0x0c:
-+ /* Write Graphics Pixel */
-+ /* Enter: AL = pixel value */
-+ /* BH = display page number */
-+ /* CX = column */
-+ /* DX = row */
-+ /* Leave: Nothing */
-+ /* Not Implemented */
-+ { /* Localise */
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
-+ "int 0x%2.2x(AH=0x0C) -- Write Graphics Pixel\n", pInt->num);
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
-+ "AL=0x%2.2x, BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n",
-+ X86_AL, X86_BH, X86_CX, X86_DX);
-+ if (xf86GetVerbosity() > 3) {
-+ dump_registers(pInt);
-+ stack_trace(pInt);
-+ }
-+ }
-+ break;
-+
-+ case 0x0d:
-+ /* Read Graphics Pixel */
-+ /* Enter: BH = display page number */
-+ /* CX = column */
-+ /* DX = row */
-+ /* Leave: AL = pixel value */
-+ /* Not Implemented */
-+ { /* Localise */
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
-+ "int 0x%2.2x(AH=0x0D) -- Read Graphics Pixel\n", pInt->num);
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
-+ "BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n",
-+ X86_BH, X86_CX, X86_DX);
-+ if (xf86GetVerbosity() > 3) {
-+ dump_registers(pInt);
-+ stack_trace(pInt);
-+ }
-+ X86_AL = 0;
-+ }
-+ break;
-+
-+ case 0x0e:
-+ /* Write Character in Teletype Mode */
-+ /* Enter: AL = character */
-+ /* BH = display page number */
-+ /* BL = foreground colour */
-+ /* Leave: Nothing */
-+ /* Not Implemented */
-+ /* WARNING: Emulation of BEL characters will require */
-+ /* emulation of RTC and PC speaker I/O. */
-+ /* Also, this recurses through int 0x10 */
-+ /* which might or might not have been */
-+ /* installed yet. */
-+ { /* Localise */
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
-+ "int 0x%2.2x(AH=0x0E) -- Write Character in Teletype Mode\n",
-+ pInt->num);
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
-+ "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x\n",
-+ X86_AL, X86_BH, X86_BL);
-+ if (xf86GetVerbosity() > 3) {
-+ dump_registers(pInt);
-+ stack_trace(pInt);
-+ }
-+ }
-+ break;
-+
-+ case 0x0f:
-+ /* Get Video Mode */
-+ /* Enter: Nothing */
-+ /* Leave: AH = number of columns */
-+ /* AL = video mode number */
-+ /* BH = display page number */
-+ /* Implemented */
-+ { /* Localise */
-+ X86_AH = MEM_RW(pInt, 0x044A);
-+ X86_AL = MEM_RB(pInt, 0x0449);
-+ X86_BH = MEM_RB(pInt, 0x0462);
-+ }
-+ break;
-
-- if (getIntVect(pInt,num) != I_S_DEFAULT_INT_VECT) {
-- return 0;
-- }
--
-- if ((X86_EBX & 0xff) == 0x32) {
-- switch (X86_EAX & 0xFFFF) {
-- case 0x1200:
--#ifdef PRINT_INT
-- ErrorF("enabling video\n");
--#endif
--#ifdef DO_GENERIC_INT10
-- c = inb(0x3cc);
-- c |= 0x02;
-- outb(0x3c2,c);
--#endif
-- return 1;
-- case 0x1201:
--#ifdef PRINT_INT
-- ErrorF("disabling video\n");
--#endif
--#ifdef DO_GENERIC_INT10
-- c = inb(0x3cc);
-- c &= ~0x02;
-- outb(0x3c2,c);
--#endif
-- return 1;
-- default:
-- break;
-+ case 0x10:
-+ /* Colour Control (subfunction in AL) */
-+ /* Enter: Various */
-+ /* Leave: Various */
-+ /* Ignored */
-+ break;
-+
-+ case 0x11:
-+ /* Font Control (subfunction in AL) */
-+ /* Enter: Various */
-+ /* Leave: Various */
-+ /* Ignored */
-+ break;
-+
-+ case 0x12:
-+ /* Miscellaneous (subfunction in BL) */
-+ /* Enter: Various */
-+ /* Leave: Various */
-+ /* Ignored. Previous code here optionally allowed */
-+ /* the enabling and disabling of VGA, but no system */
-+ /* BIOS I've come across actually implements it. */
-+ break;
-+
-+ case 0x13:
-+ /* Write String in Teletype Mode */
-+ /* Enter: AL = write mode */
-+ /* BL = attribute (if (AL & 0x02) == 0) */
-+ /* CX = string length */
-+ /* DH = row */
-+ /* DL = column */
-+ /* ES:BP = string segment:offset */
-+ /* Leave: Nothing */
-+ /* Not Implemented */
-+ /* WARNING: Emulation of BEL characters will require */
-+ /* emulation of RTC and PC speaker I/O. */
-+ /* Also, this recurses through int 0x10 */
-+ /* which might or might not have been */
-+ /* installed yet. */
-+ { /* Localise */
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
-+ "int 0x%2.2x(AH=0x13) -- Write String in Teletype Mode\n",
-+ pInt->num);
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
-+ "AL=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x,"
-+ " DH=0x%2.2x, DL=0x%2.2x, ES:BP=0x%4.4x:0x%4.4x\n",
-+ X86_AL, X86_BL, X86_CX, X86_DH, X86_DL, X86_ES, X86_BP);
-+ if (xf86GetVerbosity() > 3) {
-+ dump_registers(pInt);
-+ stack_trace(pInt);
-+ }
- }
-+ break;
-+
-+ default:
-+ /* Various extensions */
-+ /* Enter: Various */
-+ /* Leave: Various */
-+ /* Ignored */
-+ break;
- }
-- if (num == 0x42)
-- return 1;
-- else
-- return 0;
-+
-+ return 1;
- }
-+#endif
-
- #define SUCCESSFUL 0x00
- #define DEVICE_NOT_FOUND 0x86
-@@ -118,164 +590,159 @@
- {
- PCITAG tag;
- pciVideoPtr pvp;
--
-- if (! (pvp = xf86GetPciInfoForEntity(pInt->entityIndex)))
-+
-+ if (!(pvp = xf86GetPciInfoForEntity(pInt->entityIndex)))
- return 0; /* oops */
-
- #ifdef PRINT_INT
- ErrorF("int 0x1a: ax=0x%x bx=0x%x cx=0x%x dx=0x%x di=0x%x es=0x%x\n",
-- X86_EAX,X86_EBX,X86_ECX,X86_EDX,X86_EDI,X86_ESI);
-+ X86_EAX, X86_EBX, X86_ECX, X86_EDX, X86_EDI, X86_ESI);
- #endif
-- switch (X86_EAX & 0xFFFF) {
-+ switch (X86_AX) {
- case 0xb101:
-- X86_EAX &= 0xFF00; /* no config space/special cycle support */
-+ X86_EAX &= 0xFF00; /* no config space/special cycle support */
- X86_EDX = 0x20494350; /* " ICP" */
-- X86_EBX = 0x0210; /* Version 2.10 */
-- X86_ECX &= 0xFF00;
-+ X86_EBX = 0x0210; /* Version 2.10 */
-+ X86_ECX &= 0xFF00;
- X86_ECX |= (pciNumBuses & 0xFF); /* Max bus number in system */
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- #ifdef PRINT_INT
- ErrorF("ax=0x%x dx=0x%x bx=0x%x cx=0x%x flags=0x%x\n",
-- X86_EAX,X86_EDX,X86_EBX,X86_ECX,X86_EFLAGS);
-+ X86_EAX, X86_EDX, X86_EBX, X86_ECX, X86_EFLAGS);
- #endif
- return 1;
- case 0xb102:
-- if ((X86_EDX & 0xFFFF) == pvp->vendor &&
-- (X86_ECX & 0xFFFF) ==pvp->chipType &&
-- X86_ESI == 0) {
-- X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8);
-+ if (X86_DX == pvp->vendor && X86_CX == pvp->chipType && X86_ESI == 0) {
-+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
-- X86_EBX = pciSlotBX(pvp);
-+ X86_EBX = pciSlotBX(pvp);
- }
- #ifdef SHOW_ALL_DEVICES
-- else if ((pvp = xf86FindPciDeviceVendor(X86_EDX,X86_ECX,X86_ESI,pvp))
-- != NULL) {
-- X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8);
-+ else
-+ if ((pvp = xf86FindPciDeviceVendor(X86_EDX, X86_ECX, X86_ESI, pvp))) {
-+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- X86_EBX = pciSlotBX(pvp);
- }
- #endif
- else {
-- X86_EAX = (X86_EAX & 0x00FF) | (DEVICE_NOT_FOUND << 8);
-+ X86_EAX = X86_AL | (DEVICE_NOT_FOUND << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
- #ifdef PRINT_INT
-- ErrorF("ax=0x%x bx=0x%x flags=0x%x\n",
-- X86_EAX,X86_EBX,X86_EFLAGS);
-+ ErrorF("ax=0x%x bx=0x%x flags=0x%x\n", X86_EAX, X86_EBX, X86_EFLAGS);
- #endif
- return 1;
- case 0xb103:
-- if ((X86_ECX & 0xFF) == pvp->interface &&
-- ((X86_ECX & 0xFF00) >> 8) == pvp->subclass &&
-+ if (X86_CL == pvp->interface &&
-+ X86_CH == pvp->subclass &&
- ((X86_ECX & 0xFFFF0000) >> 16) == pvp->class) {
-- X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8);
-+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EBX = pciSlotBX(pvp);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- }
- #ifdef SHOW_ALL_DEVICES
-- else if ((pvp = xf86FindPciClass(X86_ECX & 0xFF,
-- (X86_ECX & 0xff00) >> 8,
-+ else if ((pvp = xf86FindPciClass(X86_CL, X86_CH,
- (X86_ECX & 0xffff0000) >> 16,
-- X86_ESI,pvp))!= NULL) {
-- X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8);
-+ X86_ESI, pvp))) {
-+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- X86_EBX = pciSlotBX(pvp);
- }
- #endif
- else {
-- X86_EAX = (X86_EAX & 0x00FF) | (DEVICE_NOT_FOUND << 8);
-+ X86_EAX = X86_AL | (DEVICE_NOT_FOUND << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
- #ifdef PRINT_INT
-- ErrorF("ax=0x%x flags=0x%x\n",X86_EAX,X86_EFLAGS);
-+ ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
- #endif
- return 1;
- case 0xb108:
- if ((tag = findPci(X86_EBX))) {
-- X86_ECX &= 0xFFFFFF00;
-- X86_ECX |= pciReadByte(tag,X86_EDI);
-- X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8);
-+ X86_CL = pciReadByte(tag, X86_EDI);
-+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
-- X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
-+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
- #ifdef PRINT_INT
-- ErrorF("ax=0x%x cx=0x%x flags=0x%x\n",
-- X86_EAX,X86_ECX,X86_EFLAGS);
-+ ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS);
- #endif
- return 1;
- case 0xb109:
- if ((tag = findPci(X86_EBX))) {
-- X86_ECX &= 0xFFFF0000;
-- X86_ECX |= pciReadWord(tag,X86_EDI);
-- X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8);
-+ X86_CX = pciReadWord(tag, X86_EDI);
-+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
-- X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
-+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
- #ifdef PRINT_INT
-- ErrorF("ax=0x%x cx=0x%x flags=0x%x\n",
-- X86_EAX,X86_ECX,X86_EFLAGS);
-+ ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS);
- #endif
- return 1;
- case 0xb10a:
- if ((tag = findPci(X86_EBX))) {
-- X86_ECX &= 0;
-- X86_ECX |= pciReadLong(tag, X86_EDI);
-- X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8);
-+ X86_ECX = pciReadLong(tag, X86_EDI);
-+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
-- X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
-+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
- #ifdef PRINT_INT
-- ErrorF("ax=0x%x cx=0x%x flags=0x%x\n",
-- X86_EAX,X86_ECX,X86_EFLAGS);
-+ ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS);
- #endif
- return 1;
- case 0xb10b:
- if ((tag = findPci(X86_EBX))) {
-- pciWriteByte(tag,X86_EDI,(CARD8)X86_ECX);
-- X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8);
-+ pciWriteByte(tag, X86_EDI, X86_CL);
-+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
-- X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
-+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
- #ifdef PRINT_INT
-- ErrorF("ax=0x%x flags=0x%x\n", X86_EAX,X86_EFLAGS);
-+ ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
- #endif
- return 1;
- case 0xb10c:
- if ((tag = findPci(X86_EBX))) {
-- pciWriteWord(tag,X86_EDI,(CARD16)X86_ECX);
-- X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8);
-+ pciWriteWord(tag, X86_EDI, X86_CX);
-+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
-- X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
-+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
- #ifdef PRINT_INT
-- ErrorF("ax=0x%x flags=0x%x\n", X86_EAX,X86_EFLAGS);
-+ ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
- #endif
- return 1;
- case 0xb10d:
- if ((tag = findPci(X86_EBX))) {
-- pciWriteLong(tag,X86_EDI,(CARD32)X86_ECX);
-- X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8);
-+ pciWriteLong(tag, X86_EDI, X86_ECX);
-+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
-- X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
-+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
- #ifdef PRINT_INT
-- ErrorF("ax=0x%x flags=0x%x\n", X86_EAX,X86_EFLAGS);
-+ ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
- #endif
- return 1;
- default:
-- return 0;
-+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
-+ "int 0x1a subfunction\n");
-+ dump_registers(pInt);
-+ if (xf86GetVerbosity() > 3)
-+ stack_trace(pInt);
-+ return 1;
- }
- }
-
-@@ -285,15 +752,15 @@
- int bus = (bx >> 8) & 0xFF;
- int dev = (bx >> 3) & 0x1F;
- int func = bx & 0x7;
-- if (xf86IsPciDevPresent(bus,dev,func))
-- return pciTag(bus,dev,func);
-+ if (xf86IsPciDevPresent(bus, dev, func))
-+ return pciTag(bus, dev, func);
- return 0;
- }
-
- static CARD32
- pciSlotBX(pciVideoPtr pvp)
- {
-- return ((pvp->bus << 8) | (pvp->device << 3) | (pvp->func));
-+ return (pvp->bus << 8) | (pvp->device << 3) | (pvp->func);
- }
-
- /*
-@@ -304,12 +771,10 @@
- {
- pciVideoPtr pvp;
-
-- if ((pvp = xf86GetPciInfoForEntity(pInt->entityIndex))) {
-- X86_AX = (CARD16)(((pvp->bus) << 8)
-- | (pvp->device << 3) | (pvp->func & 0x7));
-- }
-- pushw(pInt,X86_CS);
-- pushw(pInt,(CARD16)X86_EIP);
-+ if ((pvp = xf86GetPciInfoForEntity(pInt->entityIndex)))
-+ X86_AX = (pvp->bus << 8) | (pvp->device << 3) | (pvp->func & 0x7);
-+ pushw(pInt, X86_CS);
-+ pushw(pInt, X86_IP);
- X86_CS = pInt->BIOSseg;
- X86_EIP = 0x0003;
- X86_ES = 0; /* standard pc es */
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h,v
-retrieving revision 1.15
-retrieving revision 1.16
-diff -u -r1.15 -r1.16
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h 2000/12/06 18:08:55 1.15
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h 2001/01/06 20:19:13 1.16
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.h,v 1.15 2000/12/06 18:08:55 eich Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.h,v 1.16 2001/01/06 20:19:13 tsi Exp $ */
-
- /*
- * XFree86 int10 module
-@@ -12,11 +12,11 @@
- #include "Xmd.h"
- #include "Xdefs.h"
-
--#define SEG_ADDR(x) ((x>>4) & 0xF000)
--#define SEG_OFF(x) (x & 0xFFFF)
-+#define SEG_ADDR(x) (((x) >> 4) & 0x00F000)
-+#define SEG_OFF(x) ((x) & 0x0FFFF)
-
- /* int10 info structure */
--typedef struct {
-+typedef struct {
- int entityIndex;
- int scrnIndex;
- pointer cpuRegs;
-@@ -33,15 +33,16 @@
- int es;
- int bp;
- int flags;
-- } xf86Int10InfoRec, *xf86Int10InfoPtr;
-+ int stackseg;
-+} xf86Int10InfoRec, *xf86Int10InfoPtr;
-
- typedef struct _int10Mem {
-- CARD8(*rb)(xf86Int10InfoPtr,int);
-- CARD16(*rw)(xf86Int10InfoPtr,int);
-- CARD32(*rl)(xf86Int10InfoPtr,int);
-- void(*wb)(xf86Int10InfoPtr,int,CARD8);
-- void(*ww)(xf86Int10InfoPtr,int,CARD16);
-- void(*wl)(xf86Int10InfoPtr,int,CARD32);
-+ CARD8(*rb)(xf86Int10InfoPtr, int);
-+ CARD16(*rw)(xf86Int10InfoPtr, int);
-+ CARD32(*rl)(xf86Int10InfoPtr, int);
-+ void(*wb)(xf86Int10InfoPtr, int, CARD8);
-+ void(*ww)(xf86Int10InfoPtr, int, CARD16);
-+ void(*wl)(xf86Int10InfoPtr, int, CARD32);
- } int10MemRec, *int10MemPtr;
-
- typedef struct {
-@@ -54,7 +55,7 @@
- /* OS dependent functions */
- xf86Int10InfoPtr xf86InitInt10(int entityIndex);
- void xf86FreeInt10(xf86Int10InfoPtr pInt);
--void * xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off);
-+void *xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off);
- void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num);
- pointer xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr);
-
-@@ -78,23 +79,25 @@
- #define V_BIOS 0xC0000
- #define HIGH_MEM V_BIOS
- #define HIGH_MEM_SIZE (SYS_BIOS - HIGH_MEM)
-+#define SEG_ADR(type, seg, reg) type((seg << 4) + (X86_##reg))
-+#define SEG_EADR(type, seg, reg) type((seg << 4) + (X86_E##reg))
-
- #define X86_TF_MASK 0x00000100
- #define X86_IF_MASK 0x00000200
--#define X86_IOPL_MASK 0x00003000
-+#define X86_IOPL_MASK 0x00003000
- #define X86_NT_MASK 0x00004000
- #define X86_VM_MASK 0x00020000
- #define X86_AC_MASK 0x00040000
--#define X86_VIF_MASK 0x00080000 /* virtual interrupt flag */
--#define X86_VIP_MASK 0x00100000 /* virtual interrupt pending */
-+#define X86_VIF_MASK 0x00080000 /* virtual interrupt flag */
-+#define X86_VIP_MASK 0x00100000 /* virtual interrupt pending */
- #define X86_ID_MASK 0x00200000
-
--#define MEM_RB(name,addr) name->mem->rb(name,addr)
--#define MEM_RW(name,addr) name->mem->rw(name,addr)
--#define MEM_RL(name,addr) name->mem->rl(name,addr)
--#define MEM_WB(name,addr,val) name->mem->wb(name,addr,val)
--#define MEM_WW(name,addr,val) name->mem->ww(name,addr,val)
--#define MEM_WL(name,addr,val) name->mem->wl(name,addr,val)
-+#define MEM_RB(name, addr) (*name->mem->rb)(name, addr)
-+#define MEM_RW(name, addr) (*name->mem->rw)(name, addr)
-+#define MEM_RL(name, addr) (*name->mem->rl)(name, addr)
-+#define MEM_WB(name, addr, val) (*name->mem->wb)(name, addr, val)
-+#define MEM_WW(name, addr, val) (*name->mem->ww)(name, addr, val)
-+#define MEM_WL(name, addr, val) (*name->mem->wl)(name, addr, val)
-
- /* OS dependent functions */
- void MapCurrentInt10(xf86Int10InfoPtr pInt);
-@@ -108,8 +111,7 @@
- /* helper_exec.c */
- int setup_int(xf86Int10InfoPtr pInt);
- void finish_int(xf86Int10InfoPtr, int sig);
--CARD32 getIntVect(xf86Int10InfoPtr pInt,int num);
--int vm86_GP_fault(xf86Int10InfoPtr pInt);
-+CARD32 getIntVect(xf86Int10InfoPtr pInt, int num);
- void pushw(xf86Int10InfoPtr pInt, CARD16 val);
- int run_bios_int(int num, xf86Int10InfoPtr pInt);
- void dump_code(xf86Int10InfoPtr pInt);
-@@ -117,7 +119,7 @@
- void stack_trace(xf86Int10InfoPtr pInt);
- xf86Int10InfoPtr getInt10Rec(int entityIndex);
- CARD8 bios_checksum(CARD8 *start, int size);
--void LockLegacyVGA(int screenIndex,legacyVGAPtr vga);
-+void LockLegacyVGA(int screenIndex, legacyVGAPtr vga);
- void UnlockLegacyVGA(int screenIndex, legacyVGAPtr vga);
- int port_rep_inb(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
-@@ -139,30 +141,12 @@
- CARD32 x_inl(CARD16 port);
- void x_outl(CARD16 port, CARD32 val);
-
--#ifndef _INT10_NO_INOUT_MACROS
--#if defined(PRINT_PORT) || (!defined(_PC) && !defined(_PC_IO))
--# define p_inb x_inb
--# define p_inw x_inw
--# define p_outb x_outb
--# define p_outw x_outw
--# define p_inl x_inl
--# define p_outl x_outl
--#else
--# define p_inb inb
--# define p_inw inw
--# define p_outb outb
--# define p_outw outw
--# define p_inl inl
--# define p_outl outl
--#endif
--#endif
--
- CARD8 Mem_rb(int addr);
- CARD16 Mem_rw(int addr);
- CARD32 Mem_rl(int addr);
--void Mem_wb(int addr,CARD8 val);
--void Mem_ww(int addr,CARD16 val);
--void Mem_wl(int addr,CARD32 val);
-+void Mem_wb(int addr, CARD8 val);
-+void Mem_ww(int addr, CARD16 val);
-+void Mem_wl(int addr, CARD32 val);
-
- /* helper_mem.c */
- void setup_int_vect(xf86Int10InfoPtr pInt);
-@@ -177,9 +161,7 @@
- #endif
-
- /* pci.c */
--int mapPciRom(xf86Int10InfoPtr pInt, unsigned char * address);
-+int mapPciRom(xf86Int10InfoPtr pInt, unsigned char *address);
-
- #endif /* _INT10_PRIVATE */
- #endif /* _XF86INT10_H */
--
--
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c,v
-retrieving revision 1.9
-retrieving revision 1.10
-diff -u -r1.9 -r1.10
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c 2000/12/06 15:35:26 1.9
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c 2001/01/06 20:19:13 1.10
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c,v 1.9 2000/12/06 15:35:26 eich Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c,v 1.10 2001/01/06 20:19:13 tsi Exp $ */
- /*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
-@@ -6,128 +6,65 @@
- */
- #include <x86emu.h>
- #include "xf86.h"
--#include "xf86str.h"
- #include "xf86_ansic.h"
- #include "compiler.h"
- #include "xf86_OSproc.h"
- #include "xf86Pci.h"
- #include "xf86_libc.h"
- #define _INT10_PRIVATE
--#define _INT10_NO_INOUT_MACROS
- #include "xf86int10.h"
- #include "int10Defines.h"
-
--#define M _X86EMU_env
-+#define M _X86EMU_env
-
--#if defined(PRINT_PORT) || (!defined(_PC) && !defined(_PC_IO))
--# define p_inb x_inb
--# define p_inw x_inw
--# define p_outb x_outb
--# define p_outw x_outw
--# define p_inl x_inl
--# define p_outl x_outl
--#else
--# define p_inb f_inb
--# define p_inw f_inw
--# define p_outb f_outb
--# define p_outw f_outw
--# define p_inl f_inl
--# define p_outl f_outl
--#endif
--
--/*
-- * inb/outb, etc are not available as functions (compler.h) on all
-- * platforms (eg SVR4.0 with cc). This provides versions that are guaranteed
-- * to be functions.
-- */
--
--static CARD8
--f_inb(CARD16 port)
--{
-- return inb(port);
--}
--
--static CARD16
--f_inw(CARD16 port)
--{
-- return inw(port);
--}
--
--static CARD32
--f_inl(CARD16 port)
--{
-- return inl(port);
--}
--
--static void
--f_outb(CARD16 port, CARD8 val)
--{
-- outb(port, val);
--}
--
--static void
--f_outw(CARD16 port, CARD16 val)
--{
-- outw(port,val);
--}
--
--static void
--f_outl(CARD16 port, CARD32 val)
--{
-- outl(port,val);
--}
--
- static void
- x86emu_do_int(int num)
- {
- Int10Current->num = num;
-
- if (!int_handler(Int10Current)) {
-- xf86DrvMsg(Int10Current->scrnIndex,
-- X_ERROR,"\nUnknown vm86_int: %X\n\n",num);
- X86EMU_halt_sys();
- }
-- return;
- }
--
-+
- void
- xf86ExecX86int10(xf86Int10InfoPtr pInt)
- {
- int sig = setup_int(pInt);
-
- if (int_handler(pInt)) {
-- X86EMU_exec();
-+ X86EMU_exec();
- }
--
-+
- finish_int(pInt, sig);
- }
--
-+
- Bool
- xf86Int10ExecSetup(xf86Int10InfoPtr pInt)
- {
- int i;
- X86EMU_intrFuncs intFuncs[256];
- X86EMU_pioFuncs pioFuncs = {
-- (u8(*)(u16))p_inb,
-- (u16(*)(u16))p_inw,
-- (u32(*)(u16))p_inl,
-- (void(*)(u16,u8))p_outb,
-- (void(*)(u16,u16))p_outw,
-- (void(*)(u16,u32))p_outl
-+ (u8(*)(u16))x_inb,
-+ (u16(*)(u16))x_inw,
-+ (u32(*)(u16))x_inl,
-+ (void(*)(u16, u8))x_outb,
-+ (void(*)(u16, u16))x_outw,
-+ (void(*)(u16, u32))x_outl
- };
--
-+
- X86EMU_memFuncs memFuncs = {
- (u8(*)(u32))Mem_rb,
- (u16(*)(u32))Mem_rw,
- (u32(*)(u32))Mem_rl,
-- (void(*)(u32,u8))Mem_wb,
-- (void(*)(u32,u16))Mem_ww,
-- (void(*)(u32,u32))Mem_wl
-+ (void(*)(u32, u8))Mem_wb,
-+ (void(*)(u32, u16))Mem_ww,
-+ (void(*)(u32, u32))Mem_wl
- };
-
- X86EMU_setupMemFuncs(&memFuncs);
--
-- pInt->cpuRegs = &M;
-+
-+ pInt->cpuRegs = &M;
- M.mem_base = 0;
- M.mem_size = 1024*1024 + 1024;
- X86EMU_setupPioFuncs(&pioFuncs);
-@@ -146,5 +83,3 @@
- VErrorF(fmt, argptr);
- va_end(argptr);
- }
--
--
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h,v
-retrieving revision 1.1
-retrieving revision 1.2
-diff -u -r1.1 -r1.2
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h 2000/01/23 04:44:35 1.1
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h 2001/01/06 20:19:13 1.2
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h,v 1.1 2000/01/23 04:44:35 dawes Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h,v 1.2 2001/01/06 20:19:13 tsi Exp $ */
- /*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
-@@ -8,7 +8,7 @@
- #define XF86X86EMU_H_
- #include <x86emu.h>
-
--#define M _X86EMU_env
-+#define M _X86EMU_env
-
- #define X86_EAX M.x86.R_EAX
- #define X86_EBX M.x86.R_EBX
-@@ -37,10 +37,15 @@
- #define X86_SS M.x86.R_SS
- #define X86_FS M.x86.R_FS
- #define X86_GS M.x86.R_GS
--
-+
- #define X86_AL M.x86.R_AL
- #define X86_BL M.x86.R_BL
- #define X86_CL M.x86.R_CL
- #define X86_DL M.x86.R_DL
-+
-+#define X86_AH M.x86.R_AH
-+#define X86_BH M.x86.R_BH
-+#define X86_CH M.x86.R_CH
-+#define X86_DH M.x86.R_DH
-
- #endif
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/loader/elf.h
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/loader/elf.h,v
-retrieving revision 1.9
-retrieving revision 1.10
-diff -u -r1.9 -r1.10
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/loader/elf.h 2000/09/07 19:06:52 1.9
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/loader/elf.h 2001/01/06 20:19:13 1.10
-@@ -1,11 +1,11 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elf.h,v 1.9 2000/09/07 19:06:52 anderson Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elf.h,v 1.10 2001/01/06 20:19:13 tsi Exp $ */
-
-
--typedef unsigned long Elf32_Addr;
-+typedef unsigned int Elf32_Addr;
- typedef unsigned short Elf32_Half;
--typedef unsigned long Elf32_Off;
-+typedef unsigned int Elf32_Off;
- typedef long Elf32_Sword;
--typedef unsigned long Elf32_Word;
-+typedef unsigned int Elf32_Word;
-
- typedef unsigned long Elf64_Addr;
- typedef unsigned short Elf64_Half;
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/loader/elfloader.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v
-retrieving revision 1.31
-retrieving revision 1.32
-diff -u -r1.31 -r1.32
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/loader/elfloader.c 2000/12/13 16:52:01 1.31
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/loader/elfloader.c 2001/01/06 20:19:14 1.32
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.31 2000/12/13 16:52:01 tsi Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.32 2001/01/06 20:19:14 tsi Exp $ */
-
- /*
- *
-@@ -61,7 +61,11 @@
- #endif
- #endif
-
--#if defined (__alpha__) || defined (__ia64__) || (defined (__sparc__) && (defined (__arch64__) || defined (__sparcv9)))
-+#if defined (__alpha__) || \
-+ defined (__ia64__) || \
-+ (defined (__sparc__) && \
-+ (defined (__arch64__) || \
-+ defined (__sparcv9)))
- typedef Elf64_Ehdr Elf_Ehdr;
- typedef Elf64_Shdr Elf_Shdr;
- typedef Elf64_Sym Elf_Sym;
-@@ -135,6 +139,16 @@
- #define ELF_R_TYPE ELF32_R_TYPE
- #endif
-
-+#if defined(__powerpc__) || \
-+ defined(__mc68000__) || \
-+ defined(__alpha__) || \
-+ defined(__sparc__) || \
-+ defined(__ia64__)
-+typedef Elf_Rela Elf_Rel_t;
-+#else
-+typedef Elf_Rel Elf_Rel_t;
-+#endif
-+
- /*
- * This structure contains all of the information about a module
- * that has been loaded.
-@@ -222,12 +236,7 @@
- * to try later after more modules have been loaded.
- */
- typedef struct _elf_reloc {
--#if defined(i386)
-- Elf_Rel *rel;
--#endif
--#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__)
-- Elf_Rela *rel;
--#endif
-+ Elf_Rel_t *rel;
- ELFModulePtr file;
- unsigned char *secp;
- struct _elf_reloc *next;
-@@ -251,33 +260,25 @@
- static char *ElfGetStringIndex(ELFModulePtr, int, int);
- static char *ElfGetString(ELFModulePtr, int);
- static char *ElfGetSectionName(ELFModulePtr, int);
--#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__)
--static ELFRelocPtr ElfDelayRelocation(ELFModulePtr, unsigned char *, Elf_Rela *);
--#else
--static ELFRelocPtr ElfDelayRelocation(ELFModulePtr, unsigned char *, Elf_Rel *);
--#endif
-+static ELFRelocPtr ElfDelayRelocation(ELFModulePtr, unsigned char *, Elf_Rel_t *);
- static ELFCommonPtr ElfAddCOMMON(Elf_Sym *);
- static int ElfCOMMONSize(void);
- static int ElfCreateCOMMON(ELFModulePtr,LOOKUP *);
- static char *ElfGetSymbolNameIndex(ELFModulePtr, int, int);
- static char *ElfGetSymbolName(ELFModulePtr, int);
- static Elf_Addr ElfGetSymbolValue(ELFModulePtr, int);
--#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__)
--static ELFRelocPtr Elf_RelocateEntry(ELFModulePtr, unsigned char *, Elf_Rela *, int);
--#else
--static ELFRelocPtr Elf_RelocateEntry(ELFModulePtr, unsigned char *, Elf_Rel *, int);
--#endif
-+static ELFRelocPtr Elf_RelocateEntry(ELFModulePtr, unsigned char *, Elf_Rel_t *, int);
- static ELFRelocPtr ELFCollectRelocations(ELFModulePtr, int);
- static LOOKUP *ELF_GetSymbols(ELFModulePtr, unsigned short **);
- static void ELFCollectSections(ELFModulePtr, int, int *, int *);
- #if defined(__alpha__) || defined(__ia64__)
--static void ElfAddGOT(ELFModulePtr, Elf_Rela *);
-+static void ElfAddGOT(ELFModulePtr, Elf_Rel_t *);
- static int ELFCreateGOT(ELFModulePtr, int);
- #endif
- #if defined(__ia64__)
- static void ElfAddOPD(ELFModulePtr, int, LOOKUP *);
- static void ELFCreateOPD(ELFModulePtr);
--static void ElfAddPLT(ELFModulePtr, Elf_Rela *);
-+static void ElfAddPLT(ELFModulePtr, Elf_Rel_t *);
- static void ELFCreatePLT(ELFModulePtr);
- enum ia64_operand {
- IA64_OPND_IMM22,
-@@ -343,12 +344,7 @@
- ElfDelayRelocation(elffile,secp,rel)
- ELFModulePtr elffile;
- unsigned char *secp;
--#if defined(i386)
--Elf_Rel *rel;
--#endif
--#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__)
--Elf_Rela *rel;
--#endif
-+Elf_Rel_t *rel;
- {
- ELFRelocPtr reloc;
-
-@@ -361,11 +357,17 @@
- reloc->rel=rel;
- reloc->next=0;
- #ifdef ELFDEBUG
-- ELFDEBUG("ElfDelayRelocation %lx: file %lx, sec %lx, r_offset 0x%x, r_info 0x%x", reloc, elffile, secp, rel->r_offset, rel->r_info);
--#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__)
-- ELFDEBUG(", r_addend 0x%x", rel->r_addend);
-+ ELFDEBUG("ElfDelayRelocation %lx: file %lx, sec %lx,"
-+ " r_offset 0x%lx, r_info 0x%x",
-+ reloc, elffile, secp, rel->r_offset, rel->r_info);
-+#if defined(__powerpc__) || \
-+ defined(__mc68000__) || \
-+ defined(__alpha__) || \
-+ defined(__sparc__) || \
-+ defined(__ia64__)
-+ ELFDEBUG(", r_addend 0x%lx", rel->r_addend);
- #endif
-- ELFDEBUG("\n" );
-+ ELFDEBUG("\n");
- #endif
- return reloc;
- }
-@@ -396,7 +398,11 @@
-
- for (common = listCOMMON; common; common = common->next) {
- size+=common->sym->st_size;
--#if defined(__alpha__) || defined(__ia64__) || (defined(__sparc__) && (defined(__arch64__) || defined(__sparcv9)))
-+#if defined(__alpha__) || \
-+ defined(__ia64__) || \
-+ (defined(__sparc__) && \
-+ (defined(__arch64__) || \
-+ defined(__sparcv9)))
- size = (size+7)&~0x7;
- #endif
- }
-@@ -417,7 +423,11 @@
-
- for (common = listCOMMON; common; common = common->next) {
- size+=common->sym->st_size;
--#if defined(__alpha__) || defined(__ia64__) || (defined(__sparc__) && (defined(__arch64__) || defined(__sparcv9)))
-+#if defined(__alpha__) || \
-+ defined(__ia64__) || \
-+ (defined(__sparc__) && \
-+ (defined(__arch64__) || \
-+ defined(__sparcv9)))
- size = (size+7)&~0x7;
- #endif
- numsyms++;
-@@ -453,10 +463,12 @@
- /* this is xstrdup because is should be more efficient. it is freed
- * with xf86loaderfree
- */
-- pLookup[l].symName = xf86loaderstrdup(ElfGetString(elffile,common->sym->st_name));
-+ pLookup[l].symName =
-+ xf86loaderstrdup(ElfGetString(elffile,common->sym->st_name));
- pLookup[l].offset = (funcptr)(elffile->common + offset);
- #ifdef ELFDEBUG
-- ELFDEBUG("Adding common %lx %s\n", pLookup[l].offset, pLookup[l].symName );
-+ ELFDEBUG("Adding common %lx %s\n",
-+ pLookup[l].offset, pLookup[l].symName);
- #endif
-
- /* Record the symbol address for gdb */
-@@ -468,7 +480,11 @@
- }
- listCOMMON=common->next;
- offset+=common->sym->st_size;
--#if defined(__alpha__) || defined(__ia64__) || (defined(__sparc__) && (defined(__arch64__) || defined(__sparcv9)))
-+#if defined(__alpha__) || \
-+ defined(__ia64__) || \
-+ (defined(__sparc__) && \
-+ (defined(__arch64__) || \
-+ defined(__sparcv9)))
- offset = (offset+7)&~0x7;
- #endif
- xf86loaderfree(common);
-@@ -549,18 +565,7 @@
- ELFModulePtr elffile;
- int index;
- {
-- char *name,*symname;
-- symname=ElfGetSymbolNameIndex( elffile, index, elffile->symndx );
-- if( symname == NULL )
-- return NULL;
--
-- name=xf86loadermalloc(strlen(symname)+1);
-- if (!name)
-- FatalError("ELFGetSymbolName: Out of memory\n");
--
-- strcpy(name,symname);
--
-- return name;
-+ return ElfGetSymbolNameIndex(elffile, index, elffile->symndx);
- }
-
- static Elf_Addr
-@@ -619,7 +624,7 @@
- break;
- }
- #ifdef ELFDEBUG
-- ELFDEBUG( "%x\t", symbol );
-+ ELFDEBUG( "%lx\t", symbol );
- ELFDEBUG( "%lx\t", symval );
- ELFDEBUG( "%s\n", symname ? symname : "NULL");
- #endif
-@@ -711,8 +716,8 @@
- break;
- }
- #ifdef ELFDEBUG
-- ELFDEBUG( "ElfGetPlt: symbol=%x\t", symbol );
-- ELFDEBUG( "newval=%x\t", symval );
-+ ELFDEBUG( "ElfGetPlt: symbol=%lx\t", symbol );
-+ ELFDEBUG( "newval=%lx\t", symval );
- ELFDEBUG( "name=\"%s\"\n", symname ? symname : "NULL");
- #endif
- break;
-@@ -738,20 +743,18 @@
- static void
- ElfAddGOT(elffile,rel)
- ELFModulePtr elffile;
--Elf_Rela *rel;
-+Elf_Rel_t *rel;
- {
- ELFGotEntryPtr gotent;
-
- #ifdef ELFDEBUG
- {
- Elf_Sym *sym;
-- char *namestr;
-
- sym=(Elf_Sym *)&(elffile->symtab[ELF_R_SYM(rel->r_info)]);
- if( sym->st_name) {
- ELFDEBUG("ElfAddGOT: Adding GOT entry for %s\n",
-- namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
-- xf86loaderfree(namestr);
-+ ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
- }
- else
- ELFDEBUG("ElfAddGOT: Adding GOT entry for %s\n",
-@@ -799,9 +802,7 @@
- int gotsize;
- #ifdef ELFDEBUG
- ELFDEBUG( "ELFCreateGOT: %x entries in the GOT\n", elffile->gotsize/8 );
--#endif
-
--#ifdef ELFDEBUG
- /*
- * Hmmm. Someone is getting here without any got entries, but they
- * may still have R_ALPHA_GPDISP relocations against the got.
-@@ -836,7 +837,8 @@
- gots->freeptr = gots->freeptr + elffile->gotsize;
- gots->nuses++;
- #ifdef ELFDEBUG
-- ELFDEBUG( "ELFCreateGOT: GOT address %lx in shared GOT, nuses %d\n", elffile->got, gots->nuses );
-+ ELFDEBUG( "ELFCreateGOT: GOT address %lx in shared GOT, nuses %d\n",
-+ elffile->got, gots->nuses );
- #endif
- return TRUE;
- }
-@@ -930,22 +932,18 @@
- ELFCreateOPD(elffile)
- ELFModulePtr elffile;
- {
-- ELFOpdPtr opdent, last = NULL;
-+ ELFOpdPtr opdent;
-
- if (elffile->got == NULL)
- ErrorF( "ELFCreateOPD() Unallocated GOT!!!!\n" );
-
-- for (opdent = elffile->opd_entries; opdent; last = opdent, opdent = opdent->next) {
-- if (last && last->index == -1)
-- xf86loaderfree(last);
-+ for (opdent = elffile->opd_entries; opdent; opdent = opdent->next) {
- if (opdent->index != -1)
- continue;
- ((unsigned long *)(elffile->got+opdent->offset))[0] = (long)opdent->l->offset;
- ((unsigned long *)(elffile->got+opdent->offset))[1] = (long)elffile->got;
- opdent->l->offset = (funcptr)(elffile->got+opdent->offset);
- }
-- if (last && last->index == -1)
-- xf86loaderfree(last);
- }
-
- /*
-@@ -954,20 +952,18 @@
- static void
- ElfAddPLT(elffile,rel)
- ELFModulePtr elffile;
--Elf_Rela *rel;
-+Elf_Rel_t *rel;
- {
- ELFPltEntryPtr pltent;
-
- #ifdef ELFDEBUG
- {
- Elf_Sym *sym;
-- char *namestr;
-
- sym=(Elf_Sym *)&(elffile->symtab[ELF_R_SYM(rel->r_info)]);
- if( sym->st_name) {
- ELFDEBUG("ElfAddPLT: Adding PLT entry for %s\n",
-- namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
-- xf86loaderfree(namestr);
-+ ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
- }
- else
- ErrorF("ElfAddPLT: Add PLT entry for section??\n");
-@@ -1046,7 +1042,7 @@
- case 0: data = *data128; break;
- case 1: memcpy(&data, (char *)data128 + 5, 8); break;
- case 2: memcpy(&data, (char *)data128 + 10, 6); break;
-- default: FatalError("Unexpected slot in nIA64InstallReloc()\n");
-+ default: FatalError("Unexpected slot in IA64InstallReloc()\n");
- }
- switch (opnd) {
- case IA64_OPND_IMM22:
-@@ -1072,7 +1068,7 @@
- case 0: *data128 = data; break;
- case 1: memcpy((char *)data128 + 5, &data, 8); break;
- case 2: memcpy((char *)data128 + 10, &data, 6); break;
-- default: FatalError("Unexpected slot in nIA64InstallReloc()\n");
-+ default: FatalError("Unexpected slot in IA64InstallReloc()\n");
- }
- #ifdef ELFDEBUG
- ELFDEBUG( "After [%016lx%016lx]\n", data128[1], data128[0]);
-@@ -1091,12 +1087,7 @@
- Elf_RelocateEntry(elffile, secp, rel, force)
- ELFModulePtr elffile;
- unsigned char *secp; /* Begining of the target section */
--#if defined(i386)
--Elf_Rel *rel;
--#endif
--#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__)
--Elf_Rela *rel;
--#endif
-+Elf_Rel_t *rel;
- int force;
- {
- unsigned int *dest32; /* address of the 32 bit place being modified */
-@@ -1109,11 +1100,7 @@
- #if defined(__alpha__)
- unsigned int *dest32h; /* address of the high 32 bit place being modified */
- unsigned long *dest64;
--#if 0 /* XXX unused */
-- unsigned long *gp=(unsigned long *)elffile->got+0x8000; /*
-- * location of the got table */
- #endif
--#endif
- #if defined(__ia64__)
- unsigned long *dest64;
- unsigned long *dest128;
-@@ -1121,16 +1108,17 @@
- Elf_Addr symval = 0; /* value of the indicated symbol */
-
- #ifdef ELFDEBUG
--#if defined(i386)
- ELFDEBUG( "%lx %d %d\n", rel->r_offset,
-- ELF_R_SYM(rel->r_info),ELF_R_TYPE(rel->r_info) );
-+ ELF_R_SYM(rel->r_info), ELF_R_TYPE(rel->r_info) );
-+#if defined(__powerpc__) || \
-+ defined(__mc68000__) || \
-+ defined(__alpha__) || \
-+ defined(__sparc__) || \
-+ defined(__ia64__)
-+ ELFDEBUG( "%lx", rel->r_addend );
- #endif
--#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__)
-- ELFDEBUG( "%x %d %d %x\n", rel->r_offset,
-- ELF_R_SYM(rel->r_info),ELF_R_TYPE(rel->r_info),
-- rel->r_addend );
-+ ELFDEBUG("\n");
- #endif
--#endif
- #if defined(__alpha__)
- if (ELF_R_SYM(rel->r_info) && ELF_R_TYPE(rel->r_info) != R_ALPHA_GPDISP) {
- #else
-@@ -1142,10 +1130,8 @@
- symval = (Elf_Addr) &LoaderDefaultFunc;
- } else {
- #ifdef ELFDEBUG
-- char *namestr;
-- namestr = ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info));
-- ELFDEBUG("***Unable to resolve symbol %s\n", namestr);
-- xf86loaderfree(namestr);
-+ ELFDEBUG("***Unable to resolve symbol %s\n",
-+ ElfGetSymbolName(elffile, ELF_R_SYM(rel->r_info)));
- #endif
- return ElfDelayRelocation(elffile,secp,rel);
- }
-@@ -1170,16 +1156,12 @@
- case R_386_PC32:
- dest32=(unsigned int *)(secp+rel->r_offset);
- #ifdef ELFDEBUG
-- {
-- char *namestr;
- ELFDEBUG( "R_386_PC32 %s\t",
-- namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
-- xf86loaderfree(namestr);
-+ ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
- ELFDEBUG( "secp=%x\t", secp );
- ELFDEBUG( "symval=%lx\t", symval );
- ELFDEBUG( "dest32=%x\t", dest32 );
- ELFDEBUG( "*dest32=%8.8lx\t", *dest32 );
-- }
- #endif
-
- *dest32=symval+(*dest32)-(Elf_Addr)dest32; /* S + A - P */
-@@ -1188,7 +1170,7 @@
- ELFDEBUG( "*dest32=%8.8lx\n", *dest32 );
- #endif
-
-- break;
-+ break;
- #endif /* i386 */
- #if defined(__alpha__)
- case R_ALPHA_NONE:
-@@ -1216,16 +1198,12 @@
- dest32=(unsigned int *)dest64;
-
- #ifdef ELFDEBUG
-- {
-- char *namestr;
- ELFDEBUG( "R_ALPHA_GPREL32 %s\t",
-- namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
-- xf86loaderfree(namestr);
-+ ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
- ELFDEBUG( "secp=%lx\t", secp );
- ELFDEBUG( "symval=%lx\t", symval );
- ELFDEBUG( "dest32=%lx\t", dest32 );
- ELFDEBUG( "*dest32=%8.8x\t", *dest32 );
-- }
- #endif
- symval += rel->r_addend;
- symval = ((unsigned char *)symval)-((unsigned char *)elffile->got);
-@@ -1249,16 +1227,12 @@
- ELFGotEntryPtr gotent;
- dest32=(unsigned int *)(secp+rel->r_offset);
- #ifdef ELFDEBUG
-- {
-- char *namestr;
- ELFDEBUG( "R_ALPHA_LITERAL %s\t",
-- namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
-- xf86loaderfree(namestr);
-+ ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
- ELFDEBUG( "secp=%lx\t", secp );
- ELFDEBUG( "symval=%lx\t", symval );
- ELFDEBUG( "dest32=%lx\t", dest32 );
- ELFDEBUG( "*dest32=%8.8x\t", *dest32 );
-- }
- #endif
-
- for (gotent=elffile->got_entries;gotent;gotent=gotent->next) {
-@@ -1311,11 +1285,8 @@
- dest32=(unsigned int *)((secp+rel->r_offset)+rel->r_addend);
-
- #ifdef ELFDEBUG
-- {
-- char *namestr;
- ELFDEBUG( "R_ALPHA_GPDISP %s\t",
-- namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
-- xf86loaderfree(namestr);
-+ ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
- ELFDEBUG( "secp=%lx\t", secp );
- ELFDEBUG( "got=%lx\t", elffile->got );
- ELFDEBUG( "gp=%lx\t", gp );
-@@ -1323,13 +1294,10 @@
- ELFDEBUG( "*dest32=%8.8x\t", *dest32 );
- ELFDEBUG( "dest32h=%lx\t", dest32h );
- ELFDEBUG( "*dest32h=%8.8x\t", *dest32h );
-- }
- #endif
- if ((*dest32h >> 26) != 9 || (*dest32 >> 26) != 8) {
-- char *namestr;
- ErrorF( "***Bad instructions in relocating %s\n",
-- namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
-- xf86loaderfree(namestr);
-+ ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
- }
-
- symval = (*dest32h & 0xffff) << 16 | (*dest32 & 0xffff);
-@@ -1362,16 +1330,12 @@
- case R_ALPHA_HINT:
- dest32=(unsigned int *)((secp+rel->r_offset)+rel->r_addend);
- #ifdef ELFDEBUG
-- {
-- char *namestr;
- ELFDEBUG( "R_ALPHA_HINT %s\t",
-- namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
-- xf86loaderfree(namestr);
-+ ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
- ELFDEBUG( "secp=%lx\t", secp );
- ELFDEBUG( "symval=%lx\t", symval );
- ELFDEBUG( "dest32=%lx\t", dest32 );
- ELFDEBUG( "*dest32=%8.8x\t", *dest32 );
-- }
- #endif
-
- #ifdef ELFDEBUG
-@@ -1405,32 +1369,30 @@
- case R_68K_32:
- dest32=(unsigned long *)(secp+rel->r_offset);
- #ifdef ELFDEBUG
--ELFDEBUG( "R_68K_32\t", dest32 );
--ELFDEBUG( "dest32=%x\t", dest32 );
--ELFDEBUG( "*dest32=%8.8x\t", *dest32 );
-+ ELFDEBUG( "R_68K_32\t", dest32 );
-+ ELFDEBUG( "dest32=%x\t", dest32 );
-+ ELFDEBUG( "*dest32=%8.8x\t", *dest32 );
- #endif
- *dest32=symval+(*dest32); /* S + A */
- #ifdef ELFDEBUG
--ELFDEBUG( "*dest32=%8.8x\n", *dest32 );
-+ ELFDEBUG( "*dest32=%8.8x\n", *dest32 );
- #endif
- break;
- case R_68K_PC32:
- dest32=(unsigned long *)(secp+rel->r_offset);
- #ifdef ELFDEBUG
--char *namestr;
--ELFDEBUG( "R_68K_PC32 %s\t",
-- namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
--xf86loaderfree(namestr);
--ELFDEBUG( "secp=%x\t", secp );
--ELFDEBUG( "symval=%x\t", symval );
--ELFDEBUG( "dest32=%x\t", dest32 );
--ELFDEBUG( "*dest32=%8.8x\t", *dest32 );
-+ ELFDEBUG( "R_68K_PC32 %s\t",
-+ ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
-+ ELFDEBUG( "secp=%x\t", secp );
-+ ELFDEBUG( "symval=%x\t", symval );
-+ ELFDEBUG( "dest32=%x\t", dest32 );
-+ ELFDEBUG( "*dest32=%8.8x\t", *dest32 );
- #endif
-
- *dest32=symval+(*dest32)-(Elf_Addr)dest32; /* S + A - P */
-
- #ifdef ELFDEBUG
--ELFDEBUG( "*dest32=%8.8x\n", *dest32 );
-+ ELFDEBUG( "*dest32=%8.8x\n", *dest32 );
- #endif
-
- break;
-@@ -1900,7 +1862,8 @@
- if (rel->r_addend)
- FatalError("\nAddend for R_IA64_LTOFF_FPTR22 not supported\n");
- #ifdef ELFDEBUG
-- ELFDEBUG( "opd=%016lx.%016lx\n", ((long *)symval)[0], ((long *)symval)[1] );
-+ ELFDEBUG( "opd=%016lx.%016lx\n",
-+ ((long *)symval)[0], ((long *)symval)[1] );
- #endif
- /* FALLTHROUGH */
- case R_IA64_LTOFF22:
-@@ -1908,18 +1871,14 @@
- ELFGotEntryPtr gotent;
- dest128=(unsigned long *)(secp+(rel->r_offset&~3));
- #ifdef ELFDEBUG
-- {
-- char *namestr;
- ELFDEBUG( "%s %s\t", ELF_R_TYPE(rel->r_info) == R_IA64_LTOFF22 ?
- "R_IA64_LTOFF22" : "R_IA64_LTOFF_FPTR22",
-- namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
-- xf86loaderfree(namestr);
-+ ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
- ELFDEBUG( "secp=%lx\t", secp );
- ELFDEBUG( "symval=%lx\t", symval );
- ELFDEBUG( "dest128=%lx\t", dest128 );
-- ELFDEBUG( "slot=%ld\t", rel->r_offset & 3);
-- ELFDEBUG( "*dest128=[%016lx%016lx]\t", dest128[1], dest128[0]);
-- }
-+ ELFDEBUG( "slot=%d\n", rel->r_offset & 3);
-+ ELFDEBUG( "*dest128=[%016lx%016lx]\n", dest128[1], dest128[0]);
- #endif
-
- for (gotent=elffile->got_entries;gotent;gotent=gotent->next) {
-@@ -1933,7 +1892,7 @@
- *(unsigned long *)(elffile->got+gotent->offset) =
- symval+rel->r_addend;
- #ifdef ELFDEBUG
-- ELFDEBUG("Setting gotent[%x]=%lx\t",
-+ ELFDEBUG("Setting gotent[%x]=%lx\n",
- gotent->offset, symval+rel->r_addend);
- #endif
- if ((gotent->offset & 0xffe00000) != 0)
-@@ -1951,18 +1910,14 @@
- ELFPltEntryPtr pltent;
- dest128=(unsigned long *)(secp+(rel->r_offset&~3));
- #ifdef ELFDEBUG
-- {
-- char *namestr;
- ELFDEBUG( "R_IA64_PCREL21B %s\t",
-- namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
-- xf86loaderfree(namestr);
-+ ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
- ELFDEBUG( "secp=%lx\t", secp );
- ELFDEBUG( "symval=%lx\t", symval );
- ELFDEBUG( "opd=%lx.%lx\t", ((long *)symval)[0], ((long *)symval)[1]);
- ELFDEBUG( "dest128=%lx\t", dest128 );
-- ELFDEBUG( "slot=%ld\t", rel->r_offset & 3);
-- ELFDEBUG( "*dest128=[%016lx%016lx]\t", dest128[1], dest128[0]);
-- }
-+ ELFDEBUG( "slot=%d\n", rel->r_offset & 3);
-+ ELFDEBUG( "*dest128=[%016lx%016lx]\n", dest128[1], dest128[0]);
- #endif
- if (rel->r_addend)
- FatalError("\nAddend for PCREL21B not supported\n");
-@@ -2010,16 +1965,12 @@
- case R_IA64_FPTR64LSB:
- dest64=(unsigned long *)(secp+rel->r_offset);
- #ifdef ELFDEBUG
-- {
-- char *namestr;
- ELFDEBUG( "R_IA64_FPTR64LSB %s\t",
-- namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
-- xf86loaderfree(namestr);
-+ ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
- ELFDEBUG( "secp=%lx\t", secp );
- ELFDEBUG( "symval=%lx\t", symval );
- ELFDEBUG( "dest64=%lx\t", dest64 );
- ELFDEBUG( "opd=%016lx.%016lx\n", ((long *)symval)[0], ((long *)symval)[1] );
-- }
- #endif
-
- if (rel->r_addend)
-@@ -2030,15 +1981,11 @@
- case R_IA64_DIR64LSB:
- dest64=(unsigned long *)(secp+rel->r_offset);
- #ifdef ELFDEBUG
-- {
-- char *namestr;
- ELFDEBUG( "R_IA64_DIR64LSB %s\t",
-- namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
-- xf86loaderfree(namestr);
-+ ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
- ELFDEBUG( "secp=%lx\t", secp );
- ELFDEBUG( "symval=%lx\t", symval );
-- ELFDEBUG( "dest64=%lx\t", dest64 );
-- }
-+ ELFDEBUG( "dest64=%lx\n", dest64 );
- #endif
- *dest64 = symval + rel->r_addend;
- break;
-@@ -2046,26 +1993,22 @@
- case R_IA64_GPREL22:
- dest128=(unsigned long *)(secp+(rel->r_offset&~3));
- #ifdef ELFDEBUG
-- {
-- char *namestr;
- ELFDEBUG( "R_IA64_GPREL22 %s\t",
-- namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
-- xf86loaderfree(namestr);
-+ ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) );
- ELFDEBUG( "secp=%lx\t", secp );
- ELFDEBUG( "symval=%lx\t", symval );
- ELFDEBUG( "dest128=%lx\t", dest128 );
-- ELFDEBUG( "slot=%ld\t", rel->r_offset & 3);
-- ELFDEBUG( "*dest128=[%016lx%016lx]\t", dest128[1], dest128[0]);
-- }
-+ ELFDEBUG( "slot=%d\n", rel->r_offset & 3);
-+ ELFDEBUG( "*dest128=[%016lx%016lx]\n", dest128[1], dest128[0]);
- #endif
-- IA64InstallReloc(dest128, rel->r_offset & 3, IA64_OPND_IMM22, symval + rel->r_addend - (long)elffile->got);
-+ IA64InstallReloc(dest128, rel->r_offset & 3, IA64_OPND_IMM22,
-+ symval + rel->r_addend - (long)elffile->got);
- break;
-
- #endif
- default:
-- ErrorF(
-- "Elf_RelocateEntry() Unsupported relocation type %d\n",
-- ELF_R_TYPE(rel->r_info) );
-+ ErrorF("Elf_RelocateEntry() Unsupported relocation type %d\n",
-+ ELF_R_TYPE(rel->r_info));
- break;
- }
- return 0;
-@@ -2078,12 +2021,7 @@
- {
- int i, numrel;
- Elf_Shdr *sect=&(elffile->sections[index]);
--#if defined(i386)
-- Elf_Rel *rel=(Elf_Rel *)elffile->saddr[index];
--#endif
--#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__sparc__) || defined(__ia64__)
-- Elf_Rela *rel=(Elf_Rela *)elffile->saddr[index];
--#endif
-+ Elf_Rel_t *rel=(Elf_Rel_t *)elffile->saddr[index];
- Elf_Sym *syms;
- unsigned char *secp; /* Begining of the target section */
- ELFRelocPtr reloc_head = NULL;
-@@ -2101,7 +2039,7 @@
- #if defined(__alpha__)
- if( ELF_R_TYPE(rel[i].r_info) == R_ALPHA_LITERAL) {
- ElfAddGOT(elffile,&rel[i]);
-- }
-+ }
- #endif
- #if defined(__ia64__)
- if (ELF_R_TYPE(rel[i].r_info) == R_IA64_LTOFF22
-@@ -2500,7 +2438,7 @@
- elffile->reltxtndx=i;
- elffile->reltxtsize=SecSize(i);
- #ifdef ELFDEBUG
-- ELFDEBUG(".rela.text starts at %x\n", elffile->reltext );
-+ ELFDEBUG(".rela.text starts at %lx\n", elffile->reltext );
- #endif
- continue;
- }
-@@ -2514,7 +2452,7 @@
- elffile->reldatndx=i;
- elffile->reldatsize=SecSize(i);
- #ifdef ELFDEBUG
-- ELFDEBUG(".rela.data starts at %x\n", elffile->reldata );
-+ ELFDEBUG(".rela.data starts at %lx\n", elffile->reldata );
- #endif
- continue;
- }
-@@ -2528,7 +2466,7 @@
- elffile->relsdatndx=i;
- elffile->relsdatsize=SecSize(i);
- #ifdef ELFDEBUG
-- ELFDEBUG(".rela.sdata starts at %x\n", elffile->relsdata );
-+ ELFDEBUG(".rela.sdata starts at %lx\n", elffile->relsdata );
- #endif
- continue;
- }
-@@ -2542,7 +2480,7 @@
- elffile->relrodatndx=i;
- elffile->relrodatsize=SecSize(i);
- #ifdef ELFDEBUG
-- ELFDEBUG(".rela.rodata starts at %x\n", elffile->relrodata );
-+ ELFDEBUG(".rela.rodata starts at %lx\n", elffile->relrodata );
- #endif
- continue;
- }
-@@ -2724,7 +2662,8 @@
- /*
- * Get the ELF header
- */
-- elffile->header=(Elf_Ehdr*)_LoaderFileToMem(elffd,0,sizeof(Elf_Ehdr),"header");
-+ elffile->header=
-+ (Elf_Ehdr*)_LoaderFileToMem(elffd, 0, sizeof(Elf_Ehdr), "header");
- header=(Elf_Ehdr *)elffile->header;
-
- /*
-@@ -2732,8 +2671,9 @@
- */
- elffile->numsh=header->e_shnum;
- elffile->secsize=(header->e_shentsize*header->e_shnum);
-- elffile->sections=(Elf_Shdr *)_LoaderFileToMem(elffd,header->e_shoff,
-- elffile->secsize, "sections");
-+ elffile->sections=
-+ (Elf_Shdr *)_LoaderFileToMem(elffd, header->e_shoff, elffile->secsize,
-+ "sections");
- #if defined(__alpha__) || defined(__ia64__)
- /*
- * Need to allocate space for the .got section which will be
-@@ -2782,8 +2722,9 @@
- * Get the section header string table
- */
- elffile->shstrsize = SecSize(header->e_shstrndx);
-- elffile->shstraddr = _LoaderFileToMem(elffd,SecOffset(header->e_shstrndx),
-- SecSize(header->e_shstrndx),".shstrtab");
-+ elffile->shstraddr =
-+ _LoaderFileToMem(elffd, SecOffset(header->e_shstrndx),
-+ SecSize(header->e_shstrndx), ".shstrtab");
- elffile->shstrndx = header->e_shstrndx;
- #if defined(__alpha__) || defined(__ia64__)
- /*
-@@ -2991,6 +2932,10 @@
- {
- ELFModulePtr elffile = (ELFModulePtr)modptr;
- ELFRelocPtr relptr, reltptr, *brelptr;
-+#ifdef __ia64__
-+ ELFOpdPtr opdent;
-+ ELFPltEntryPtr pltent;
-+#endif
-
- /*
- * Delete any unresolved relocations
-@@ -3031,8 +2976,14 @@
- #if defined(__alpha__) || defined(__ia64__)
- if (elffile->shared_got) {
- elffile->shared_got->nuses--;
-- if (!elffile->shared_got->nuses)
-+ if (!elffile->shared_got->nuses) {
-+ ELFGotPtr *pgot = &ELFSharedGOTs;
-+ while (*pgot && *pgot != elffile->shared_got)
-+ pgot = &(*pgot)->next;
-+ if (*pgot)
-+ *pgot = elffile->shared_got->next;
- xf86loaderfree(elffile->shared_got);
-+ }
- }
- #endif
- #else
-@@ -3045,13 +2996,21 @@
- CheckandFreeFile(elffile->rodata,elffile->rodatsize);
- CheckandFreeFile(elffile->rodata1,elffile->rodat1size);
- CheckandFree(elffile->common,elffile->comsize);
--#if defined(__ia64__)
-- CheckandFree(elffile->plt,elffile->pltsize);
--#endif
- #if defined(__alpha__) || defined(__ia64__)
- CheckandFree(elffile->got,elffile->gotsize);
- #endif
- #endif
-+#if defined(__ia64__)
-+ CheckandFree(elffile->plt,elffile->pltsize);
-+ while ((pltent = elffile->plt_entries)) {
-+ elffile->plt_entries = pltent->next;
-+ xf86loaderfree(pltent);
-+ }
-+ while ((opdent = elffile->opd_entries)) {
-+ elffile->opd_entries = opdent->next;
-+ xf86loaderfree(opdent);
-+ }
-+#endif
- CheckandFreeFile(elffile->reltext,elffile->reltxtsize);
- CheckandFreeFile(elffile->reldata,elffile->reldatsize);
- CheckandFreeFile(elffile->relrodata,elffile->relrodatsize);
-@@ -3086,4 +3045,3 @@
- }
- return NULL;
- }
--
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h,v
-retrieving revision 1.1
-retrieving revision 1.2
-diff -u -r1.1 -r1.2
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h 2000/01/23 04:44:35 1.1
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h 2001/01/06 20:19:14 1.2
-@@ -1,46 +1,55 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h,v 1.1 2000/01/23 04:44:35 dawes Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h,v 1.2 2001/01/06 20:19:14 tsi Exp $ */
-+
-+#ifndef _INT10DEFINES_H_
-+#define _INT10DEFINES_H_ 1
-+
- #ifdef _VM86_LINUX
-
- #include <asm/vm86.h>
-
--#define CPU_R(type,name) \
-- (*((type *)&(((struct vm86_struct *)REG->cpuRegs)->regs.##name)))
--#define CPU_RD(name) CPU_R(CARD32,name)
--#define CPU_RW(name) CPU_R(CARD16,name)
--#define CPU_RB(name) CPU_R(CARD8,name)
--
--#define X86_EAX CPU_RD(eax)
--#define X86_EBX CPU_RD(ebx)
--#define X86_ECX CPU_RD(ecx)
--#define X86_EDX CPU_RD(edx)
--#define X86_ESI CPU_RD(esi)
--#define X86_EDI CPU_RD(edi)
--#define X86_EBP CPU_RD(ebp)
--#define X86_EIP CPU_RD(eip)
--#define X86_ESP CPU_RD(esp)
--#define X86_EFLAGS CPU_RD(eflags)
--
--#define X86_FLAGS CPU_RW(eflags)
--#define X86_AX CPU_RW(eax)
--#define X86_BX CPU_RW(ebx)
--#define X86_CX CPU_RW(ecx)
--#define X86_DX CPU_RW(edx)
--#define X86_SI CPU_RW(esi)
--#define X86_DI CPU_RW(edi)
--#define X86_BP CPU_RW(ebp)
--#define X86_IP CPU_RW(eip)
--#define X86_SP CPU_RW(esp)
--#define X86_CS CPU_RW(cs)
--#define X86_DS CPU_RW(ds)
--#define X86_ES CPU_RW(es)
--#define X86_SS CPU_RW(ss)
--#define X86_FS CPU_RW(fs)
--#define X86_GS CPU_RW(gs)
--
--#define X86_AL CPU_RB(eax)
--#define X86_BL CPU_RB(ebx)
--#define X86_CL CPU_RB(ecx)
--#define X86_DL CPU_RB(edx)
-+#define CPU_R(type,name,num) \
-+ (((type *)&(((struct vm86_struct *)REG->cpuRegs)->regs.##name))[num])
-+#define CPU_RD(name,num) CPU_R(CARD32,name,num)
-+#define CPU_RW(name,num) CPU_R(CARD16,name,num)
-+#define CPU_RB(name,num) CPU_R(CARD8,name,num)
-+
-+#define X86_EAX CPU_RD(eax,0)
-+#define X86_EBX CPU_RD(ebx,0)
-+#define X86_ECX CPU_RD(ecx,0)
-+#define X86_EDX CPU_RD(edx,0)
-+#define X86_ESI CPU_RD(esi,0)
-+#define X86_EDI CPU_RD(edi,0)
-+#define X86_EBP CPU_RD(ebp,0)
-+#define X86_EIP CPU_RD(eip,0)
-+#define X86_ESP CPU_RD(esp,0)
-+#define X86_EFLAGS CPU_RD(eflags,0)
-+
-+#define X86_FLAGS CPU_RW(eflags,0)
-+#define X86_AX CPU_RW(eax,0)
-+#define X86_BX CPU_RW(ebx,0)
-+#define X86_CX CPU_RW(ecx,0)
-+#define X86_DX CPU_RW(edx,0)
-+#define X86_SI CPU_RW(esi,0)
-+#define X86_DI CPU_RW(edi,0)
-+#define X86_BP CPU_RW(ebp,0)
-+#define X86_IP CPU_RW(eip,0)
-+#define X86_SP CPU_RW(esp,0)
-+#define X86_CS CPU_RW(cs,0)
-+#define X86_DS CPU_RW(ds,0)
-+#define X86_ES CPU_RW(es,0)
-+#define X86_SS CPU_RW(ss,0)
-+#define X86_FS CPU_RW(fs,0)
-+#define X86_GS CPU_RW(gs,0)
-+
-+#define X86_AL CPU_RB(eax,0)
-+#define X86_BL CPU_RB(ebx,0)
-+#define X86_CL CPU_RB(ecx,0)
-+#define X86_DL CPU_RB(edx,0)
-+
-+#define X86_AH CPU_RB(eax,1)
-+#define X86_BH CPU_RB(ebx,1)
-+#define X86_CH CPU_RB(ecx,1)
-+#define X86_DH CPU_RB(edx,1)
-
- #elif defined(_X86EMU)
-
-@@ -48,3 +57,4 @@
-
- #endif
-
-+#endif
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c,v
-retrieving revision 1.2
-retrieving revision 1.3
-diff -u -r1.2 -r1.3
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c 2000/11/06 19:24:08 1.2
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c 2001/01/06 20:19:14 1.3
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c,v 1.2 2000/11/06 19:24:08 dawes Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c,v 1.3 2001/01/06 20:19:14 tsi Exp $ */
-
- /* Resource information code */
-
-@@ -80,10 +80,12 @@
- RANGE(range,0xc0000,0xeffff,ResExcMemBlock);
- ret = xf86AddResToList(ret, &range, -1);
-
-- /* Fallback is to claim well known ports in the 0x0 - 0x3ff range */
-- /* Possibly should claim some of them as sparse ranges */
--
-- RANGE(range,0,0x1ff,ResExcIoBlock | ResEstimated);
-+ /*
-+ * Fallback would be to claim well known ports in the 0x0 - 0x3ff range
-+ * along with their sparse I/O aliases, but that's too imprecise. Instead
-+ * claim a bare minimum here.
-+ */
-+ RANGE(range, 0, 0x00ff, ResExcIoBlock); /* For mainboard */
- ret = xf86AddResToList(ret, &range, -1);
- /* XXX add others */
- return ret;
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v
-retrieving revision 1.42
-retrieving revision 1.43
-diff -u -r1.42 -r1.43
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c 2000/12/07 15:43:45 1.42
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c 2001/01/06 20:19:15 1.43
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.42 2000/12/07 15:43:45 tsi Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.43 2001/01/06 20:19:15 tsi Exp $ */
- /*
- * Pci.c - New server PCI access functions
- *
-@@ -1054,8 +1054,10 @@
- unsigned char *Buf, int Len)
- {
- ADDRESS hostbase;
-+ CARD8 *image = Buf;
-+ unsigned long offset;
- CARD32 romaddr, savebase = 0, romsave = 0, newbase = 0;
-- int ret;
-+ int ret, length, rlength, n;
-
- /* XXX This assumes that memory access is enabled */
-
-@@ -1067,24 +1069,23 @@
- romsave = pciReadLong(Tag, PCI_MAP_ROM_REG);
- romaddr = PCIGETROM(romsave);
- if ((newbase = getValidBIOSBase(Tag, &basereg)) != romaddr) {
-+RetryWithBase:
- romaddr = PCIGETROM(newbase);
-- if (romaddr != 0 && romaddr == newbase) {
--#if 1
-- /* move mem base out of the way if in conflict with ROM */
-+ if (romaddr) {
-+ /* move mem base out of the way if in conflicts with ROM */
- if ((basereg >= 0) && (basereg <= 5)) {
-- savebase = pciReadLong(Tag, PCI_MAP_REG_START + (basereg << 2));
-+ if (!savebase)
-+ savebase = pciReadLong(Tag, PCI_MAP_REG_START+(basereg<<2));
- if (PCIGETROM(savebase) == romaddr) {
- xf86MsgVerb(X_INFO,5,"xf86ReadPciBios: modifying membase[%i]"
- " for device %i:%i:%i\n", basereg,
- PCI_BUS_FROM_TAG(Tag), PCI_DEV_FROM_TAG(Tag),
- PCI_FUNC_FROM_TAG(Tag));
-- pciWriteLong(Tag, PCI_MAP_REG_START + (basereg << 2), 0);
-+ pciWriteLong(Tag, PCI_MAP_REG_START + (basereg << 2),
-+ (CARD32)~0);
- }
- }
--#endif
-- pciWriteLong(Tag, PCI_MAP_ROM_REG, romaddr);
-- } else
-- romaddr = 0;
-+ }
- }
-
-
-@@ -1092,10 +1093,10 @@
- xf86Msg(X_WARNING, "xf86ReadPciBIOS: cannot locate a BIOS address\n");
- return -1;
- }
-- else
-- xf86MsgVerb(X_INFO,5,"xf86ReadPciBIOS: found ValidBIOSBase for %i:%i:%i:"
-- " %x\n", PCI_BUS_FROM_TAG(Tag), PCI_DEV_FROM_TAG(Tag),
-- PCI_FUNC_FROM_TAG(Tag),newbase);
-+ xf86MsgVerb(X_INFO, 5,
-+ "xf86ReadPciBIOS: found ValidBIOSBase for %i:%i:%i: %x\n",
-+ PCI_BUS_FROM_TAG(Tag), PCI_DEV_FROM_TAG(Tag), PCI_FUNC_FROM_TAG(Tag),
-+ newbase);
-
- hostbase = pciBusAddrToHostAddr(Tag, PCI_MEM, PCIGETROM(romaddr));
- #ifdef DEBUG
-@@ -1103,8 +1104,38 @@
- #endif
- /* Enable ROM address decoding */
- pciWriteLong(Tag, PCI_MAP_ROM_REG, romaddr | PCI_MAP_ROM_DECODE_ENABLE);
-+
-+ /* Read BIOS in 64kB chunks */
-+ ret = 0;
-+ offset = Offset;
-+ while ((length = Len) > 0) {
-+ if (length > 0x10000) length = 0x10000;
-+ rlength = xf86ReadBIOS(hostbase, offset, image, length);
-+ if (rlength < 0) {
-+ ret = rlength;
-+ break;
-+ }
-+ ret += rlength;
-+ if (rlength < length) break;
-+ offset += length;
-+ image += length;
-+ Len -= length;
-+ }
-
-- ret = xf86ReadBIOS(hostbase, Offset, Buf, Len);
-+ if ((ret != Len) || (Buf[0] != 0x55) || (Buf[1] != 0xaa) || !Buf[2] ||
-+ (Len < (Buf[2] << 9))) {
-+ n = 0;
-+ if ((basereg >= 0) && (basereg <= 5) && xf86PciVideoInfo) do {
-+ pciVideoPtr pvp;
-+
-+ if (!(pvp = xf86PciVideoInfo[n++])) break;
-+ if (pciTag(pvp->bus, pvp->device, pvp->func) == Tag) {
-+ if (newbase == pvp->memBase[basereg]) break;
-+ newbase = pvp->memBase[basereg];
-+ goto RetryWithBase;
-+ }
-+ } while (1);
-+ }
-
- /* Restore ROM address decoding */
- pciWriteLong(Tag, PCI_MAP_ROM_REG, romsave);
-@@ -1129,7 +1160,8 @@
-
- size = readPciBIOS(Offset,Tag,basereg,Buf,Len);
-
-- if (size != -1 && Buf[0] == 0x55 && Buf[1] == 0xaa)
-+ if ((size == Len) && (Buf[0] == 0x55) && (Buf[1] == 0xaa) && Buf[2] &&
-+ (Len >= (Buf[2] << 9)))
- return size;
-
- num = pciTestMultiDeviceCard(PCI_BUS_FROM_TAG(Tag),
-@@ -1149,7 +1181,8 @@
- PCI_CMD_STAT_REG,(Acc2 | PCI_ENA));
- size = readPciBIOS(Offset,pTag[i],0,Buf,Len);
- ((WriteProcPtr)(pciLongFunc(pTag[i],WRITE)))(pTag[i],PCI_CMD_STAT_REG,Acc2);
-- if (size != -1 && ((CARD8*)Buf)[0] == 0x55 && ((CARD8*)Buf)[1] == 0xaa)
-+ if ((size == Len) && (Buf[0] == 0x55) && (Buf[1] == 0xaa) && Buf[2] &&
-+ (Len >= (Buf[2] << 9)))
- break;
- }
- ((WriteProcPtr)(pciLongFunc(Tag,WRITE)))(Tag,PCI_CMD_STAT_REG,Acc1);
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v
-retrieving revision 3.11
-retrieving revision 3.12
-diff -u -r3.11 -r3.12
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c 2000/10/17 16:53:20 3.11
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c 2001/01/06 20:19:15 3.12
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v 3.11 2000/10/17 16:53:20 tsi Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v 3.12 2001/01/06 20:19:15 tsi Exp $ */
-
- /* Resource information code */
-
-@@ -141,10 +141,12 @@
- RANGE(range,0xc0000,0xeffff,ResExcMemBlock);
- ret = xf86AddResToList(ret, &range, -1);
-
-- /* Fallback is to claim well known ports in the 0x0 - 0x3ff range */
-- /* Possibly should claim some of them as sparse ranges */
--
-- RANGE(range,0,0x1ff,ResExcIoBlock | ResEstimated);
-+ /*
-+ * Fallback would be to claim well known ports in the 0x0 - 0x3ff range
-+ * along with their sparse I/O aliases, but that's too imprecise. Instead
-+ * claim a bare minimum here.
-+ */
-+ RANGE(range, 0, 0x00ff, ResExcIoBlock); /* For mainboard */
- ret = xf86AddResToList(ret, &range, -1);
- /* XXX add others */
- return ret;
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v
-retrieving revision 1.19
-retrieving revision 1.20
-diff -u -r1.19 -r1.20
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c 2000/12/06 15:35:31 1.19
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c 2001/01/06 20:19:15 1.20
-@@ -1,10 +1,9 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.19 2000/12/06 15:35:31 eich Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.20 2001/01/06 20:19:15 tsi Exp $ */
- /*
- * linux specific part of the int10 module
- * Copyright 1999 Egbert Eich
- */
- #include "xf86.h"
--#include "xf86str.h"
- #include "xf86_OSproc.h"
- #include "xf86_ansic.h"
- #include "xf86Pci.h"
-@@ -28,12 +27,12 @@
-
- static int counter = 0;
-
--static CARD8 read_b(xf86Int10InfoPtr pInt,int addr);
--static CARD16 read_w(xf86Int10InfoPtr pInt,int addr);
--static CARD32 read_l(xf86Int10InfoPtr pInt,int addr);
--static void write_b(xf86Int10InfoPtr pInt,int addr, CARD8 val);
--static void write_w(xf86Int10InfoPtr pInt,int addr, CARD16 val);
--static void write_l(xf86Int10InfoPtr pInt,int addr, CARD32 val);
-+static CARD8 read_b(xf86Int10InfoPtr pInt, int addr);
-+static CARD16 read_w(xf86Int10InfoPtr pInt, int addr);
-+static CARD32 read_l(xf86Int10InfoPtr pInt, int addr);
-+static void write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val);
-+static void write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val);
-+static void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val);
-
- int10MemRec linuxMem = {
- read_b,
-@@ -70,20 +69,20 @@
- legacyVGARec vga;
-
- screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex;
-- if (int10skip(xf86Screens[screen],entityIndex))
-+ if (int10skip(xf86Screens[screen], entityIndex))
- return NULL;
-
- if ((!vidMem) || (!sysMem)) {
-- if ((fd = open(DEV_MEM,O_RDWR,0)) >= 0) {
-+ if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
- if (!sysMem) {
- #ifdef DEBUG
- ErrorF("Mapping sys bios area\n");
- #endif
-- if ((sysMem = mmap((void *)(SYS_BIOS),BIOS_SIZE,PROT_READ
-- | PROT_WRITE | PROT_EXEC,
-- MAP_SHARED | MAP_FIXED,fd, SYS_BIOS))
-+ if ((sysMem = mmap((void *)(SYS_BIOS), BIOS_SIZE,
-+ PROT_READ | PROT_WRITE | PROT_EXEC,
-+ MAP_SHARED | MAP_FIXED, fd, SYS_BIOS))
- == MAP_FAILED) {
-- xf86DrvMsg(screen,X_ERROR,"Cannot map SYS BIOS\n");
-+ xf86DrvMsg(screen, X_ERROR, "Cannot map SYS BIOS\n");
- close(fd);
- goto error0;
- }
-@@ -92,33 +91,33 @@
- #ifdef DEBUG
- ErrorF("Mapping VRAM area\n");
- #endif
-- if ((vidMem = mmap((void *)(V_RAM),VRAM_SIZE,PROT_READ
-- | PROT_WRITE | PROT_EXEC,
-- MAP_SHARED | MAP_FIXED,fd, V_RAM))
-+ if ((vidMem = mmap((void *)(V_RAM), VRAM_SIZE,
-+ PROT_READ | PROT_WRITE | PROT_EXEC,
-+ MAP_SHARED | MAP_FIXED, fd, V_RAM))
- == MAP_FAILED) {
-- xf86DrvMsg(screen,X_ERROR,"Cannot map V_RAM\n");
-+ xf86DrvMsg(screen, X_ERROR, "Cannot map V_RAM\n");
- close(fd);
- goto error0;
- }
- }
- close(fd);
- } else {
-- xf86DrvMsg(screen,X_ERROR,"Cannot open %s\n",DEV_MEM);
-+ xf86DrvMsg(screen, X_ERROR, "Cannot open %s\n", DEV_MEM);
- goto error0;
- }
- }
--
-- pInt = (xf86Int10InfoPtr)xnfcalloc(1,sizeof(xf86Int10InfoRec));
-+
-+ pInt = (xf86Int10InfoPtr)xnfcalloc(1, sizeof(xf86Int10InfoRec));
- pInt->scrnIndex = screen;
- pInt->entityIndex = entityIndex;
- if (!xf86Int10ExecSetup(pInt))
- goto error0;
- pInt->mem = &linuxMem;
- pagesize = getpagesize();
-- pInt->private = (pointer)xnfcalloc(1,sizeof(linuxInt10Priv));
-+ pInt->private = (pointer)xnfcalloc(1, sizeof(linuxInt10Priv));
- ((linuxInt10Priv*)pInt->private)->screen = screen;
-- ((linuxInt10Priv*)pInt->private)->alloc =
-- (pointer)xnfcalloc(1,ALLOC_ENTRIES(pagesize));
-+ ((linuxInt10Priv*)pInt->private)->alloc =
-+ (pointer)xnfcalloc(1, ALLOC_ENTRIES(pagesize));
-
- #ifdef DEBUG
- ErrorF("Mapping high memory area\n");
-@@ -135,23 +134,23 @@
- ErrorF("Mapping 640kB area\n");
- #endif
- if ((low_mem = shmget(counter++, V_RAM,
-- IPC_CREAT|SHM_R|SHM_W)) == -1)
-+ IPC_CREAT | SHM_R | SHM_W)) == -1)
- goto error2;
--
-+
- ((linuxInt10Priv*)pInt->private)->lowMem = low_mem;
-- base = shmat(low_mem,0,0);
-+ base = shmat(low_mem, 0, 0);
- ((linuxInt10Priv *)pInt->private)->base = base;
-- base_high = shmat(high_mem,0,0);
-- ((linuxInt10Priv *)pInt->private)->base_high = base_high;
--
-- MapCurrentInt10(pInt);
-+ base_high = shmat(high_mem, 0, 0);
-+ ((linuxInt10Priv*)pInt->private)->base_high = base_high;
-+
-+ MapCurrentInt10(pInt);
- Int10Current = pInt;
--
-+
- #ifdef DEBUG
- ErrorF("Mapping int area\n");
- #endif
-- if (xf86ReadBIOS(0,0,(unsigned char *)0,LOW_PAGE_SIZE) < 0) {
-- xf86DrvMsg(screen,X_ERROR,"Cannot read int vect\n");
-+ if (xf86ReadBIOS(0, 0, (unsigned char *)0, LOW_PAGE_SIZE) < 0) {
-+ xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n");
- goto error3;
- }
-
-@@ -165,33 +164,33 @@
- if (xf86ReadBIOS(cs, 0, (pointer)cs, V_BIOS_SIZE) < V_BIOS_SIZE)
- xf86DrvMsg(screen, X_WARNING,
- "Unable to retrieve all of segment 0x%06X.\n", cs);
--
-+
- if (xf86IsEntityPrimary(entityIndex)) {
-- cs = ((CARD16*)0)[(0x10<<1)+1];
-+ cs = ((CARD16*)0)[(0x10 <<1) + 1];
- bios_base = (unsigned char *)(cs << 4);
--
-+
- if (!int10_check_bios(screen, cs, bios_base)) {
-- cs = ((CARD16*)0)[(0x42<<1)+1];
-+ cs = ((CARD16*)0)[(0x42 << 1) + 1];
- bios_base = (unsigned char *)(cs << 4);
- if (!int10_check_bios(screen, cs, bios_base)) {
- cs = V_BIOS >> 4;
- bios_base = (unsigned char *)(cs << 4);
- if (!int10_check_bios(screen, cs, bios_base)) {
-- xf86DrvMsg(screen,X_ERROR,"No V_BIOS found\n");
-+ xf86DrvMsg(screen, X_ERROR, "No V_BIOS found\n");
- goto error3;
- }
- }
- }
-- xf86DrvMsg(screen,X_INFO,"Primary V_BIOS segment is: 0x%x\n",cs);
-+ xf86DrvMsg(screen, X_INFO, "Primary V_BIOS segment is: 0x%x\n", cs);
-
- pInt->BIOSseg = cs;
- set_return_trap(pInt);
- } else {
-- if (!mapPciRom(pInt,(unsigned char *)(V_BIOS))) {
-- xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS\n");
-+ if (!mapPciRom(pInt, (unsigned char *)(V_BIOS))) {
-+ xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS\n");
- goto error3;
- }
--
-+
- pInt->BIOSseg = V_BIOS >> 4;
- pInt->num = 0xe6;
- reset_int_vect(pInt);
-@@ -201,20 +200,20 @@
- UnlockLegacyVGA(screen, &vga);
- }
- #ifdef DEBUG
-- dprint(0xc0000,0x20);
-+ dprint(0xc0000, 0x20);
- #endif
--
-+
- return pInt;
--
-+
- error3:
- shmdt(base_high);
- shmdt(base);
- shmdt(0);
- shmdt((char*)HIGH_MEM);
-- shmctl(low_mem,IPC_RMID,NULL);
-+ shmctl(low_mem, IPC_RMID, NULL);
- Int10Current = NULL;
- error2:
-- shmctl(high_mem,IPC_RMID,NULL);
-+ shmctl(high_mem, IPC_RMID,NULL);
- error1:
- xfree(((linuxInt10Priv*)pInt->private)->alloc);
- xfree(pInt->private);
-@@ -230,120 +229,119 @@
- shmdt(0);
- shmdt((char*)HIGH_MEM);
- }
-- shmat(((linuxInt10Priv *)pInt->private)->lowMem,(char*)1,SHM_RND);
-- shmat(((linuxInt10Priv *)pInt->private)->highMem,(char*)HIGH_MEM,0);
-+ shmat(((linuxInt10Priv*)pInt->private)->lowMem, (char*)1, SHM_RND);
-+ shmat(((linuxInt10Priv*)pInt->private)->highMem, (char*)HIGH_MEM, 0);
- }
-
- void
- xf86FreeInt10(xf86Int10InfoPtr pInt)
- {
- if (!pInt)
-- return;
-+ return;
- if (Int10Current == pInt) {
- shmdt(0);
- shmdt((char*)HIGH_MEM);
- Int10Current = NULL;
- }
-- shmdt(((linuxInt10Priv *)pInt->private)->base_high);
-- shmdt(((linuxInt10Priv *)pInt->private)->base);
-- shmctl(((linuxInt10Priv *)pInt->private)->lowMem,IPC_RMID,NULL);
-- shmctl(((linuxInt10Priv *)pInt->private)->highMem,IPC_RMID,NULL);
-+ shmdt(((linuxInt10Priv*)pInt->private)->base_high);
-+ shmdt(((linuxInt10Priv*)pInt->private)->base);
-+ shmctl(((linuxInt10Priv*)pInt->private)->lowMem, IPC_RMID, NULL);
-+ shmctl(((linuxInt10Priv*)pInt->private)->highMem, IPC_RMID, NULL);
- xfree(((linuxInt10Priv*)pInt->private)->alloc);
- xfree(pInt->private);
- xfree(pInt);
- }
-
- void *
--xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off)
-+xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off)
- {
- int pagesize = getpagesize();
- int num_pages = ALLOC_ENTRIES(pagesize);
-- int i,j;
-+ int i, j;
-
-- for (i=0;i<num_pages - num;i++) {
-+ for (i = 0; i < (num_pages - num); i++) {
- if (((linuxInt10Priv*)pInt->private)->alloc[i] == 0) {
-- for (j=i;j < num + i;j++)
-+ for (j = i; j < (num + i); j++)
- if ((((linuxInt10Priv*)pInt->private)->alloc[j] != 0))
- break;
-- if (j == num + i)
-+ if (j == (num + i))
- break;
- else
- i = i + num;
- }
- }
-- if (i == num_pages - num)
-+ if (i == (num_pages - num))
- return NULL;
--
-- for (j = i; j < i + num; j++)
-+
-+ for (j = i; j < (i + num); j++)
- ((linuxInt10Priv*)pInt->private)->alloc[j] = 1;
-
- *off = (i + 1) * pagesize;
--
-- return (void *)
-- (((linuxInt10Priv*)pInt->private)->base + (i + 1) * pagesize);
-+
-+ return ((linuxInt10Priv*)pInt->private)->base + ((i + 1) * pagesize);
- }
-
- void
- xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
- {
- int pagesize = getpagesize();
-- int first = ((unsigned long)pbase
-+ int first = (((unsigned long)pbase
- - (unsigned long)((linuxInt10Priv*)pInt->private)->base)
-- / pagesize - 1;
-+ / pagesize) - 1;
- int i;
-
-- for (i = first; i < first + num; i++)
-+ for (i = first; i < (first + num); i++)
- ((linuxInt10Priv*)pInt->private)->alloc[i] = 0;
- }
-
- static CARD8
--read_b(xf86Int10InfoPtr pInt,int addr)
-+read_b(xf86Int10InfoPtr pInt, int addr)
- {
-- return *((CARD8 *)(addr));
-+ return *((CARD8 *)addr);
- }
-
- static CARD16
--read_w(xf86Int10InfoPtr pInt,int addr)
-+read_w(xf86Int10InfoPtr pInt, int addr)
- {
-- return *((CARD16 *)(addr));
-+ return *((CARD16 *)addr);
- }
-
- static CARD32
--read_l(xf86Int10InfoPtr pInt,int addr)
-+read_l(xf86Int10InfoPtr pInt, int addr)
- {
-- return *((CARD32 *)(addr));
-+ return *((CARD32 *)addr);
- }
-
- static void
--write_b(xf86Int10InfoPtr pInt,int addr, CARD8 val)
-+write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val)
- {
-- *((CARD8 *)(addr)) = (CARD8)val;
-+ *((CARD8 *)addr) = val;
- }
-
- static void
--write_w(xf86Int10InfoPtr pInt,int addr, CARD16 val)
-+write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val)
- {
-- *((CARD16 *)(addr)) = (CARD16)val;
-+ *((CARD16 *)addr) = val;
- }
-
- static
--void write_l(xf86Int10InfoPtr pInt,int addr, CARD32 val)
-+void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val)
- {
-- *((CARD32 *)(addr)) = (CARD32)val;
-+ *((CARD32 *)addr) = val;
- }
-
- pointer
- xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr)
- {
- if (addr < V_RAM)
-- return (pointer)(((linuxInt10Priv*)pInt->private)->base + addr);
-+ return ((linuxInt10Priv*)pInt->private)->base + addr;
- else if (addr < V_BIOS)
-- return (pointer) addr;
-+ return (pointer)addr;
- else if (addr < SYS_BIOS)
-- return (pointer)(((linuxInt10Priv*)pInt->private)->base_high
-+ return (pointer)(((linuxInt10Priv*)pInt->private)->base_high
- - V_BIOS + addr);
- else
-- return (pointer) addr;
-+ return (pointer)addr;
- }
-
- #ifdef _VM86_LINUX
-@@ -355,38 +353,200 @@
- {
- #define VM86S ((struct vm86_struct *)pInt->cpuRegs)
-
-- pInt->cpuRegs = (pointer) xnfcalloc(1,sizeof(struct vm86_struct));
-+ pInt->cpuRegs = (pointer)xnfcalloc(1, sizeof(struct vm86_struct));
- VM86S->flags = 0;
- VM86S->screen_bitmap = 0;
- VM86S->cpu_type = CPU_586;
-- memset(&VM86S->int_revectored, 0xff,sizeof(VM86S->int_revectored)) ;
-- memset(&VM86S->int21_revectored, 0xff,sizeof(VM86S->int21_revectored)) ;
-+ memset(&VM86S->int_revectored, 0xff, sizeof(VM86S->int_revectored));
-+ memset(&VM86S->int21_revectored, 0xff, sizeof(VM86S->int21_revectored));
-+ return TRUE;
-+}
-+
-+/* get the linear address */
-+#define LIN_PREF_SI ((pref_seg << 4) + X86_SI)
-+#define LWECX ((prefix66 ^ prefix67) ? X86_ECX : X86_CX)
-+#define LWECX_ZERO {if (prefix66 ^ prefix67) X86_ECX = 0; else X86_CX = 0;}
-+#define DF (1 << 10)
-+
-+/* vm86 fault handling */
-+static Bool
-+vm86_GP_fault(xf86Int10InfoPtr pInt)
-+{
-+ unsigned char *csp, *lina;
-+ CARD32 org_eip;
-+ int pref_seg;
-+ int done, is_rep, prefix66, prefix67;
-+
-+ csp = lina = SEG_ADR((unsigned char *), X86_CS, IP);
-+
-+ is_rep = 0;
-+ prefix66 = prefix67 = 0;
-+ pref_seg = -1;
-+
-+ /* eat up prefixes */
-+ done = 0;
-+ do {
-+ switch (MEM_RB(pInt, (int)csp++)) {
-+ case 0x66: /* operand prefix */ prefix66=1; break;
-+ case 0x67: /* address prefix */ prefix67=1; break;
-+ case 0x2e: /* CS */ pref_seg=X86_CS; break;
-+ case 0x3e: /* DS */ pref_seg=X86_DS; break;
-+ case 0x26: /* ES */ pref_seg=X86_ES; break;
-+ case 0x36: /* SS */ pref_seg=X86_SS; break;
-+ case 0x65: /* GS */ pref_seg=X86_GS; break;
-+ case 0x64: /* FS */ pref_seg=X86_FS; break;
-+ case 0xf2: /* repnz */
-+ case 0xf3: /* rep */ is_rep=1; break;
-+ default: done=1;
-+ }
-+ } while (!done);
-+ csp--; /* oops one too many */
-+ org_eip = X86_EIP;
-+ X86_IP += (csp - lina);
-+
-+ switch (MEM_RB(pInt, (int)csp)) {
-+ case 0x6c: /* insb */
-+ /* NOTE: ES can't be overwritten; prefixes 66,67 should use esi,edi,ecx
-+ * but is anyone using extended regs in real mode? */
-+ /* WARNING: no test for DI wrapping! */
-+ X86_EDI += port_rep_inb(pInt, X86_DX, SEG_EADR((CARD32), X86_ES, DI),
-+ X86_FLAGS & DF, is_rep ? LWECX : 1);
-+ if (is_rep) LWECX_ZERO;
-+ X86_IP++;
-+ break;
-+
-+ case 0x6d: /* (rep) insw / insd */
-+ /* NOTE: ES can't be overwritten */
-+ /* WARNING: no test for _DI wrapping! */
-+ if (prefix66) {
-+ X86_DI += port_rep_inl(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI),
-+ X86_EFLAGS & DF, is_rep ? LWECX : 1);
-+ }
-+ else {
-+ X86_DI += port_rep_inw(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI),
-+ X86_FLAGS & DF, is_rep ? LWECX : 1);
-+ }
-+ if (is_rep) LWECX_ZERO;
-+ X86_IP++;
-+ break;
-+
-+ case 0x6e: /* (rep) outsb */
-+ if (pref_seg < 0) pref_seg = X86_DS;
-+ /* WARNING: no test for _SI wrapping! */
-+ X86_SI += port_rep_outb(pInt, X86_DX, (CARD32)LIN_PREF_SI,
-+ X86_FLAGS & DF, is_rep ? LWECX : 1);
-+ if (is_rep) LWECX_ZERO;
-+ X86_IP++;
-+ break;
-+
-+ case 0x6f: /* (rep) outsw / outsd */
-+ if (pref_seg < 0) pref_seg = X86_DS;
-+ /* WARNING: no test for _SI wrapping! */
-+ if (prefix66) {
-+ X86_SI += port_rep_outl(pInt, X86_DX, (CARD32)LIN_PREF_SI,
-+ X86_EFLAGS & DF, is_rep ? LWECX : 1);
-+ }
-+ else {
-+ X86_SI += port_rep_outw(pInt, X86_DX, (CARD32)LIN_PREF_SI,
-+ X86_FLAGS & DF, is_rep ? LWECX : 1);
-+ }
-+ if (is_rep) LWECX_ZERO;
-+ X86_IP++;
-+ break;
-+
-+ case 0xe5: /* inw xx, inl xx */
-+ if (prefix66) X86_EAX = x_inl(csp[1]);
-+ else X86_AX = x_inw(csp[1]);
-+ X86_IP += 2;
-+ break;
-+
-+ case 0xe4: /* inb xx */
-+ X86_AL = x_inb(csp[1]);
-+ X86_IP += 2;
-+ break;
-+
-+ case 0xed: /* inw dx, inl dx */
-+ if (prefix66) X86_EAX = x_inl(X86_DX);
-+ else X86_AX = x_inw(X86_DX);
-+ X86_IP += 1;
-+ break;
-+
-+ case 0xec: /* inb dx */
-+ X86_AL = x_inb(X86_DX);
-+ X86_IP += 1;
-+ break;
-+
-+ case 0xe7: /* outw xx */
-+ if (prefix66) x_outl(csp[1], X86_EAX);
-+ else x_outw(csp[1], X86_AX);
-+ X86_IP += 2;
-+ break;
-+
-+ case 0xe6: /* outb xx */
-+ x_outb(csp[1], X86_AL);
-+ X86_IP += 2;
-+ break;
-+
-+ case 0xef: /* outw dx */
-+ if (prefix66) x_outl(X86_DX, X86_EAX);
-+ else x_outw(X86_DX, X86_AX);
-+ X86_IP += 1;
-+ break;
-+
-+ case 0xee: /* outb dx */
-+ x_outb(X86_DX, X86_AL);
-+ X86_IP += 1;
-+ break;
-+
-+ case 0xf4:
-+#ifdef DEBUG
-+ ErrorF("hlt at %p\n", lina);
-+#endif
-+ return FALSE;
-+
-+ case 0x0f:
-+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
-+ "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8x\n", X86_CS, X86_EIP);
-+ goto op0ferr;
-+
-+ case 0xf0: /* lock */
-+ default:
-+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown reason for exception\n");
-+
-+ op0ferr:
-+ dump_registers(pInt);
-+ stack_trace(pInt);
-+ dump_code(pInt);
-+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "cannot continue\n");
-+ return FALSE;
-+ } /* end of switch() */
- return TRUE;
- }
--
-+
- static int
- do_vm86(xf86Int10InfoPtr pInt)
- {
- int retval, signo;
--
-+
- xf86InterceptSignals(&signo);
- retval = vm86_rep(VM86S);
- xf86InterceptSignals(NULL);
-
- if (signo >= 0) {
-- xf86DrvMsg(pInt->scrnIndex, X_ERROR, "vm86() syscall generated signal %d.\n", signo);
-+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
-+ "vm86() syscall generated signal %d.\n", signo);
- dump_registers(pInt);
- dump_code(pInt);
- stack_trace(pInt);
- return 0;
- }
--
-+
- switch (VM86_TYPE(retval)) {
- case VM86_UNKNOWN:
- if (!vm86_GP_fault(pInt)) return 0;
- break;
- case VM86_STI:
-- xf86DrvMsg(pInt->scrnIndex,X_ERROR,"vm86_sti :-((\n");
-+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "vm86_sti :-((\n");
- dump_registers(pInt);
- dump_code(pInt);
- stack_trace(pInt);
-@@ -394,8 +554,8 @@
- case VM86_INTx:
- pInt->num = VM86_ARG(retval);
- if (!int_handler(pInt)) {
-- xf86DrvMsg(pInt->scrnIndex,
-- X_ERROR,"Unknown vm86_int: 0x%X\n\n",VM86_ARG(retval));
-+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
-+ "Unknown vm86_int: 0x%X\n\n", VM86_ARG(retval));
- dump_registers(pInt);
- dump_code(pInt);
- stack_trace(pInt);
-@@ -409,17 +569,17 @@
- * we used to warn here and bail out - but now the sigio stuff
- * always fires signals at us. So we just ignore them for now.
- */
-- xf86DrvMsg(pInt->scrnIndex,X_WARNING,"received signal\n");
-+ xf86DrvMsg(pInt->scrnIndex, X_WARNING, "received signal\n");
- return 0;
- default:
-- xf86DrvMsg(pInt->scrnIndex,X_ERROR,"unknown type(0x%x)=0x%x\n",
-- VM86_ARG(retval),VM86_TYPE(retval));
-+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown type(0x%x)=0x%x\n",
-+ VM86_ARG(retval), VM86_TYPE(retval));
- dump_registers(pInt);
- dump_code(pInt);
- stack_trace(pInt);
- return 0;
- }
--
-+
- return 1;
- }
-
-@@ -431,11 +591,11 @@
- if (int_handler(pInt))
- while(do_vm86(pInt)) {};
-
-- finish_int(pInt,sig);
-+ finish_int(pInt, sig);
- }
-
- static int
--vm86_rep(struct vm86_struct *ptr)
-+vm86_rep(struct vm86_struct *ptr)
- {
- int __res;
-
-@@ -455,9 +615,9 @@
- "b" ((struct vm86_struct *)ptr));
- #endif
-
-- if ((__res) < 0) {
-+ if (__res < 0) {
- errno = -__res;
-- __res=-1;
-+ __res = -1;
- }
- else errno = 0;
- return __res;
-Index: XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c
-===================================================================
-RCS file: /cvs/xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c,v
-retrieving revision 1.15
-retrieving revision 1.16
-diff -u -r1.15 -r1.16
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c 2000/04/23 19:27:03 1.15
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c 2001/01/06 20:19:15 1.16
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c,v 1.15 2000/04/23 19:27:03 tsi Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c,v 1.16 2001/01/06 20:19:15 tsi Exp $ */
-
- /* Standard resource information code */
-
-@@ -108,10 +108,12 @@
- RANGE(range,0xffe00000,0xffffffff,ResExcMemBlock | ResBios);
- ret = xf86AddResToList(ret, &range, -1);
-
-- /* Fallback is to claim well known ports in the 0x0 - 0x3ff range */
-- /* Possibly should claim some of them as sparse ranges */
--
-- RANGE(range,0,0x1ff,ResExcIoBlock | ResEstimated);
-+ /*
-+ * Fallback would be to claim well known ports in the 0x0 - 0x3ff range
-+ * along with their sparse I/O aliases, but that's too imprecise. Instead
-+ * claim a bare minimum here.
-+ */
-+ RANGE(range, 0, 0x00ff, ResExcIoBlock); /* For mainboard */
- ret = xf86AddResToList(ret, &range, -1);
- /* XXX add others */
- return ret;
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c.ia64-2 Sat Dec 2 10:31:00 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c Mon Jan 29 11:48:02 2001
-@@ -26,7 +26,7 @@
- *
- * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
- *
-- * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.8 2000/12/02 15:31:00 tsi Exp $
-+ * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.9 2001/01/11 03:36:59 tsi Exp $
- */
-
- #include "vesa.h"
-@@ -144,14 +144,30 @@
- #endif
- "cfbScreenInit",
- "mfbScreenInit",
-+ "cfb24_32ScreenInit",
- NULL
- };
-
- static const char *shadowSymbols[] = {
-- "ShadowInit",
-+ "shadowAlloc",
-+ "shadowInit",
-+ "shadowUpdatePacked",
-+ "shadowUpdatePlanar4",
-+ "shadowUpdatePlanar4x8",
- NULL
- };
-
-+static const char *vbeSymbols[] = {
-+ "VBEInit",
-+ "vbeDoEDID",
-+ NULL
-+};
-+
-+static const char *ddcSymbols[] = {
-+ "xf86PrintEDID",
-+ "xf86SetDDCproperties",
-+ NULL};
-+
- #ifdef XFree86LOADER
-
- /* Module loader interface */
-@@ -186,7 +202,11 @@
- {
- Initialised = TRUE;
- xf86AddDriver(&VESA, Module, 0);
-- LoaderRefSymLists(fbSymbols, shadowSymbols, NULL);
-+ LoaderRefSymLists(fbSymbols,
-+ shadowSymbols,
-+ vbeSymbols,
-+ ddcSymbols,
-+ NULL);
- return (pointer)TRUE;
- }
-
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/loader/elfloader.c.ia64-2 Mon Jan 29 11:48:01 2001
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/loader/elfloader.c Mon Jan 29 11:48:02 2001
-@@ -2932,10 +2932,6 @@
- {
- ELFModulePtr elffile = (ELFModulePtr)modptr;
- ELFRelocPtr relptr, reltptr, *brelptr;
--#ifdef __ia64__
-- ELFOpdPtr opdent;
-- ELFPltEntryPtr pltent;
--#endif
-
- /*
- * Delete any unresolved relocations
-@@ -2999,16 +2995,33 @@
- #if defined(__alpha__) || defined(__ia64__)
- CheckandFree(elffile->got,elffile->gotsize);
- #endif
--#endif
- #if defined(__ia64__)
- CheckandFree(elffile->plt,elffile->pltsize);
-- while ((pltent = elffile->plt_entries)) {
-- elffile->plt_entries = pltent->next;
-- xf86loaderfree(pltent);
-+#endif
-+#endif
-+#if defined(__alpha__) || defined(__ia64__)
-+ {
-+ ELFGotEntryPtr gotent;
-+ while((gotent = elffile->got_entries)) {
-+ elffile->got_entries = gotent->next;
-+ xf86loaderfree(gotent);
-+ }
- }
-- while ((opdent = elffile->opd_entries)) {
-- elffile->opd_entries = opdent->next;
-- xf86loaderfree(opdent);
-+#endif
-+#if defined(__ia64__)
-+ {
-+ ELFPltEntryPtr pltent;
-+ while ((pltent = elffile->plt_entries)) {
-+ elffile->plt_entries = pltent->next;
-+ xf86loaderfree(pltent);
-+ }
-+ }
-+ {
-+ ELFOpdPtr opdent;
-+ while ((opdent = elffile->opd_entries)) {
-+ elffile->opd_entries = opdent->next;
-+ xf86loaderfree(opdent);
-+ }
- }
- #endif
- CheckandFreeFile(elffile->reltext,elffile->reltxtsize);
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c.ia64-2 Tue Nov 14 13:20:38 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c Mon Jan 29 11:48:02 2001
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c,v 1.42 2000/11/14 18:20:38 dawes Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c,v 1.43 2001/01/11 03:37:00 tsi Exp $ */
-
- /*
- *
-@@ -1602,10 +1602,21 @@
- rgb blackColour = scrp->display->blackColour,
- whiteColour = scrp->display->whiteColour;
-
-- /* Detect default for black & white */
-- if (!blackColour.red && !blackColour.green && !blackColour.blue &&
-- !whiteColour.red && !whiteColour.green && !whiteColour.blue)
-- whiteColour.red = whiteColour.green = whiteColour.blue = 0x3F;
-+ if (blackColour.red > 0x3F) blackColour.red = 0x3F;
-+ if (blackColour.green > 0x3F) blackColour.green = 0x3F;
-+ if (blackColour.blue > 0x3F) blackColour.blue = 0x3F;
-+
-+ if (whiteColour.red > 0x3F) whiteColour.red = 0x3F;
-+ if (whiteColour.green > 0x3F) whiteColour.green = 0x3F;
-+ if (whiteColour.blue > 0x3F) whiteColour.blue = 0x3F;
-+
-+ if ((blackColour.red == whiteColour.red ) &&
-+ (blackColour.green == whiteColour.green) &&
-+ (blackColour.blue == whiteColour.blue )) {
-+ blackColour.red ^= 0x3F;
-+ blackColour.green ^= 0x3F;
-+ blackColour.blue ^= 0x3F;
-+ }
-
- /*
- * initialize default colormap for monochrome
-diff -ru XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/loader/elfloader.c /usr/src/redhat/BUILD/XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/loader/elfloader.c
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/loader/elfloader.c Fri Feb 16 12:03:12 2001
-+++ /usr/src/redhat/BUILD/XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/loader/elfloader.c Thu Feb 15 18:40:55 2001
-@@ -2920,7 +2920,9 @@
- flag = _LoaderHandleUnresolved(
- name, _LoaderHandleToName(erel->file->handle));
- if(flag) fatalsym = 1;
-- xf86loaderfree(name);
-+#ifndef __ia64__
-+ xf86loaderfree(name);
-+#endif
- erel=erel->next;
- }
- return fatalsym;
+++ /dev/null
---- XFree86-3.3.3/xc/config/cf/xfree86.cf.joy Mon Dec 7 15:50:14 1998
-+++ XFree86-3.3.3/xc/config/cf/xfree86.cf Mon Dec 7 15:50:36 1998
-@@ -684,7 +684,7 @@
- #endif
- #endif
- #ifndef JoystickSupport
--#define JoystickSupport NO
-+#define JoystickSupport YES
- #endif
-
- /*
+++ /dev/null
-diff -urN XFree86-4.0.3.orig/xc/programs/mkfontdir/mkfontdir.c XFree86-4.0.3/xc/programs/mkfontdir/mkfontdir.c
---- XFree86-4.0.3.orig/xc/programs/mkfontdir/mkfontdir.c Wed Nov 29 17:45:52 2000
-+++ XFree86-4.0.3/xc/programs/mkfontdir/mkfontdir.c Wed May 23 20:00:31 2001
-@@ -210,6 +210,7 @@
- fprintf (file, "%s %s\n", entry->u.bitmap.fileName, entry->name.name);
- }
- fclose (file);
-+ chmod (full_name, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
-
- /* Write out encodings directory */
-
-@@ -232,6 +233,7 @@
- fprintf(file, "%s %s%s\n",
- encoding->name, prefix, encoding->fileName);
- fclose(file);
-+ chmod (full_name, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
-
- return TRUE;
- }
+++ /dev/null
---- XFree86-4.0/xc/lib/X11/OpenDis.c.moresecurity Wed Jun 28 18:54:22 2000
-+++ XFree86-4.0/xc/lib/X11/OpenDis.c Wed Jun 28 18:54:58 2000
-@@ -397,6 +397,11 @@
- * now extract the vendor string... String must be null terminated,
- * padded to multiple of 4 bytes.
- */
-+ /* Check for a sane vendor string length */
-+ if (u.setup->nbytesVendor > 256) {
-+ OutOfMemory(dpy, setup);
-+ return (NULL);
-+ }
- dpy->vendor = (char *) Xmalloc((unsigned) (u.setup->nbytesVendor + 1));
- if (dpy->vendor == NULL) {
- OutOfMemory(dpy, setup);
+++ /dev/null
-diff -urN XFree86-3.3.6.orig/xc/config/cf/xf86site.def XFree86-3.3.6/xc/config/cf/xf86site.def
---- XFree86-3.3.6.orig/xc/config/cf/xf86site.def Sat Mar 11 04:34:04 2000
-+++ XFree86-3.3.6/xc/config/cf/xf86site.def Sat Mar 11 05:02:00 2000
-@@ -93,8 +93,8 @@
- * Some Linux releases don't have a libtermcap. In this case you may need
- * to uncomment the following
- *
--#define TermcapLibrary -lncurses
- */
-+#define TermcapLibrary -lncurses
-
- /*
- * If you have Tk (which is required to build XF86Setup), uncomment this
-diff -urN XFree86-3.3.6.orig/xc/programs/xterm/Imakefile XFree86-3.3.6/xc/programs/xterm/Imakefile
---- XFree86-3.3.6.orig/xc/programs/xterm/Imakefile Sat Mar 11 05:00:52 2000
-+++ XFree86-3.3.6/xc/programs/xterm/Imakefile Sat Mar 11 05:02:00 2000
-@@ -83,7 +83,7 @@
- -DOSMINORVERSION=$(OSMINORVERSION)
- MISC_DEFINES = /* -DALLOWLOGGING -DALLOWLOGFILEEXEC */
- XKB_DEFINES = XkbClientDefines
-- DEFINES = -I. $(XKB_DEFINES) $(TERMCAPDEFINES) $(FEATURE_DEFINES) $(SCROLLBAR_RIGHT)
-+ DEFINES = -I. -I/usr/include/ncurses $(XKB_DEFINES) $(TERMCAPDEFINES) $(FEATURE_DEFINES) $(SCROLLBAR_RIGHT)
-
- #ifdef OS2Architecture
- MAINSRC = os2main.c
+++ /dev/null
-diff -urN XFree86-3.3.5.orig/xc/programs/xterm/Imakefile XFree86-3.3.5/xc/programs/xterm/Imakefile
---- XFree86-3.3.5.orig/xc/programs/xterm/Imakefile Wed Jul 28 15:37:50 1999
-+++ XFree86-3.3.5/xc/programs/xterm/Imakefile Thu Sep 2 18:51:23 1999
-@@ -20,6 +20,10 @@
- #define XkbClientDefines /**/
- #endif
-
-+#if InstallXtermSetUID
-+#undef InstallXtermSetUID
-+#endif
-+
- #ifndef XkbClientDepLibs
- #define XkbClientDepLibs /**/
- #endif
-@@ -48,6 +52,8 @@
- PUCCPTYDDEF = -DPUCC_PTYD /* does not need to be setuid */
- PTYLIB = -lpucc
- #endif
-+
-+ PTYLIB = -lutil -lutempter
-
- #if ((LinuxCLibMajorVersion == 6) && (LinuxCLibMinorVersion < 1))
- PTYLIB = -lutil
-diff -urN XFree86-3.3.5.orig/xc/programs/xterm/main.c XFree86-3.3.5/xc/programs/xterm/main.c
---- XFree86-3.3.5.orig/xc/programs/xterm/main.c Thu Sep 2 16:49:51 1999
-+++ XFree86-3.3.5/xc/programs/xterm/main.c Thu Sep 2 18:52:41 1999
-@@ -1934,7 +1934,7 @@
- static int
- get_pty (int *pty)
- {
--#if defined(__osf__) || (defined(__GLIBC__) && !defined(USE_USG_PTYS))
-+#if defined(__osf__) || (defined(__GLIBC__) && !defined(USE_USG_PTYS)) || defined(__linux__)
- int tty;
- return (openpty(pty, &tty, ttydev, NULL, NULL));
- #elif (defined(SYSV) && defined(i386) && !defined(SVR4)) || defined(__QNXNTO__)
-@@ -2611,6 +2611,9 @@
- }
- #endif /* sun vs TIOCSWINSZ */
-
-+#undef UTMP
-+ addToUtmp(ttydev, NULL, screen->respond);
-+
- if (!am_slave) {
- #ifdef USE_HANDSHAKE
- if (pipe(pc_pipe) || pipe(cp_pipe))
-@@ -3230,6 +3233,7 @@
- if (pw && pw->pw_name)
- Setenv ("LOGNAME=", pw->pw_name); /* for POSIX */
- #ifdef USE_SYSV_UTMP
-+
- /* Set up our utmp entry now. We need to do it here
- ** for the following reasons:
- ** - It needs to have our correct process id (for
-@@ -3328,7 +3332,6 @@
- #endif
- /* close the file */
- (void) endutent();
--
- #else /* USE_SYSV_UTMP */
- /* We can now get our ttyslot! We can also set the initial
- * UTMP entry.
-@@ -4063,6 +4066,7 @@
- Exit(int n)
- {
- register TScreen *screen = &term->screen;
-+ removeFromUtmp();
- #ifdef UTMP
- #ifdef USE_SYSV_UTMP
- #if defined(SVR4) || defined(SCO325)
+++ /dev/null
---- XFree86-3.3.5/xc/config/cf/linux.cf~ Thu Sep 2 20:21:42 1999
-+++ XFree86-3.3.5/xc/config/cf/linux.cf Thu Sep 2 21:14:58 1999
-@@ -139,7 +139,7 @@
- #define HasMkstemp YES
- #endif
- #ifndef HasPam
--#define HasPam NO
-+#define HasPam YES
- #endif
-
- #define AvoidNullMakeCommand YES
+++ /dev/null
---- XFree86-3.3.3/xc/config/cf/xf86site.def.rh Sun Nov 8 06:19:11 1998
-+++ XFree86-3.3.3/xc/config/cf/xf86site.def Mon Nov 30 13:48:39 1998
-@@ -66,9 +66,9 @@
- *
- * This should automatically get set correctly by imake.
- *
--#define LinuxCLibMajorVersion 5
--#define LinuxClibMinorVersion 4
- */
-+#define LinuxCLibMajorVersion 6
-+#define LinuxClibMinorVersion 0
-
- /*
- * If you want to use the GNU malloc library, uncomment this
-@@ -101,8 +101,8 @@
- * Note: version 4.0 or 4.1 is required, and XF86Setup links it statically by
- * default.
- *
--#define HasTk YES
- */
-+#define HasTk YES
-
- /*
- * Set the paths and names for your Tk library if they don't match the
-@@ -115,25 +115,26 @@
- *
- * Some Linux releases need TkLibDir set to /usr/X11R6/lib
- *
--#define TkLibDir /usr/local/lib
--#define TkIncDir /usr/local/include
--#define TkLibName tk
- */
-+#define TkLibDir /usr/lib
-+#define TkIncDir /usr/include
-+#define TkLibName tk
-
- /*
- * By default, XF86Setup is linked with a static Tk library. To change
- * that, uncomment the following line.
- *
--#define XF86SetupUsesStaticTk NO
- */
-+#define XF86SetupUsesStaticTk NO
-+
-
- /*
- * If you have Tcl (which is required to build XF86Setup), uncomment this
- * Note: version 7.4 or 7.5 is required, and XF86Setup links it statically by
- * default.
- *
--#define HasTcl YES
- */
-+#define HasTcl YES
-
- /*
- * Set the paths and names for your Tcl library if they don't match the
-@@ -143,17 +144,17 @@
- *
- * Some Linux releases need TclIncDir set to /usr/include/tcl.
- *
--#define TclLibDir /usr/local/lib
--#define TclIncDir /usr/local/include
--#define TclLibName tcl
- */
-+#define TclLibDir /usr/lib
-+#define TclIncDir /usr/include
-+#define TclLibName tcl
-
- /*
- * By default, XF86Setup is linked with a static Tcl library. To change
- * that, uncomment the following line.
- *
--#define XF86SetupUsesStaticTcl NO
- */
-+#define XF86SetupUsesStaticTcl NO
-
- /*
- * Which servers do you wish to build, you can save a lot of disk space
-@@ -369,8 +370,8 @@
- /*
- * To not build/install the Cyrillic fonts, uncomment the following
- *
--#define BuildCyrillicFonts NO
- */
-+#define BuildCyrillicFonts YES
-
- /*
- * To not install the local font directory, uncomment the following
-@@ -400,7 +401,7 @@
- * will need to be built with the Joystick driver in order to be able to
- * use this.
- *
--#define JoystickSupport NO
-+#define JoystickSupport YES
- #define WacomSupport YES
- #define MicroTouchSupport YES
- #define ElographicsSupport YES
-@@ -536,8 +537,8 @@
- * To forceably build static libraries in addition to shared libraries,
- * uncomment this.
- *
--#define ForceNormalLib YES
- */
-+#define ForceNormalLib YES
-
- /*
- * Uncomment this if your default tools (eg, gcc, ld, as, etc) are
---- XFree86-3.3.3/xc/config/cf/site.def.rh Sun Jun 22 06:32:21 1997
-+++ XFree86-3.3.3/xc/config/cf/site.def Mon Nov 30 13:43:48 1998
-@@ -106,10 +111,11 @@
- */
-
- /*
--#undef DefaultUserPath
--#define DefaultUserPath /bin:/usr/bin:$(BINDIR):/usr/ucb:/usr/local/bin
- */
--
-+#undef DefaultUserPath
-+#define DefaultUserPath /usr/local/bin:/bin:/usr/bin
-+#undef DefaultSystemPath
-+#define DefaultSystemPath /sbin:/usr/sbin:/bin:/usr/bin
-
- /* You do NOT need SetUID if you only run the server under xdm */
- /* You MAY need SetUID if users run the server by hand or under xinit */
---- XFree86-3.3.3/xc/config/cf/linux.cf.rh Sun Nov 8 06:34:50 1998
-+++ XFree86-3.3.3/xc/config/cf/linux.cf Mon Nov 30 13:43:53 1998
-@@ -318,1 +318,5 @@
- #include <xfree86.cf>
-+
-+#ifndef XtermWithI18N
-+#define XtermWithI18N YES
-+#endif
---- XFree86-3.3.3/xc/programs/xinit/Imakefile.rh Thu Nov 5 14:28:39 1998
-+++ XFree86-3.3.3/xc/programs/xinit/Imakefile Mon Nov 30 13:43:47 1998
-@@ -35,9 +35,11 @@
- InstallNamedProg(startx,startx,$(BINDIR))
- InstallManPage(startx,$(MANDIR))
-
--#if InstallXinitConfig
--InstallNonExecFile($(SAMPLECONFIG),$(XINITDIR))
--#else
--InstallNonExecFileNoClobber($(SAMPLECONFIG),$(XINITDIR))
--#endif
-+XCOMM Red Hat gets this from a different package
-+XCOMM #if InstallXinitConfig
-+XCOMM InstallNonExecFile($(SAMPLECONFIG),$(XINITDIR))
-+XCOMM #else
-+XCOMM InstallNonExecFileNoClobber($(SAMPLECONFIG),$(XINITDIR))
-+XCOMM #endif
-+
- #endif
+++ /dev/null
---- XFree86-3.3.3.1/xc/programs/xdm/config/Xsession.rhxdm Wed Jan 3 02:36:27 1996
-+++ XFree86-3.3.3.1/xc/programs/xdm/config/Xsession Mon Apr 12 19:26:02 1999
-@@ -1,5 +1,23 @@
--#!/bin/sh
--# $XConsortium: Xsession /main/10 1995/12/18 18:21:28 gildea $
-+#!/bin/sh -l
-+# Xsession for Red Hat Linux 6.0
-+# Copyright (c) 1999 Red Hat Software, Inc.
-+
-+# clean up after xbanner
-+if [ -f /usr/X11R6/bin/freetemp ]; then
-+ freetemp
-+fi
-+
-+# clear screen to some sane color
-+/usr/X11R6/bin/xsetroot -solid "#356390"
-+
-+case $# in
-+1)
-+ case $1 in
-+ failsafe)
-+ exec xterm -geometry 80x24-0-0
-+ ;;
-+ esac
-+esac
-
- # redirect errors to a file in user's home directory if we can
- for errfile in "$HOME/.xsession-errors" "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER"
-@@ -12,20 +30,15 @@
- fi
- done
-
--case $# in
--1)
-- case $1 in
-- failsafe)
-- exec xterm -geometry 80x24-0-0
-- ;;
-- esac
--esac
--
- startup=$HOME/.xsession
- resources=$HOME/.Xresources
-
--if [ -f "$startup" ]; then
-+if [ -x "$startup" ]; then
- exec "$startup"
-+elif [ -x "$HOME/.Xclients" ]; then
-+ exec "$HOME/.Xclients"
-+elif [ -x /etc/X11/xinit/Xclients ]; then
-+ exec /etc/X11/xinit/Xclients
- else
- if [ -f "$resources" ]; then
- xrdb -load "$resources"
---- XFree86-3.3.3.1/xc/programs/xdm/config/Xsetup_0.rhxdm Wed Apr 27 03:20:03 1994
-+++ XFree86-3.3.3.1/xc/programs/xdm/config/Xsetup_0 Mon Apr 12 19:26:02 1999
-@@ -1,3 +1,6 @@
- #!/bin/sh
--# $XConsortium: Xsetup_0,v 1.3 93/09/28 14:30:31 gildea Exp $
--xconsole -geometry 480x130-0-0 -daemon -notify -verbose -fn fixed -exitOnFail
-+# Xsetup for Red Hat Linux 6.0
-+# Copyright (c) 1999 Red Hat Software, Inc.
-+/usr/X11R6/bin/xsetroot -solid "#356390"
-+/usr/bin/xsri -geometry +5+5 -avoid 300x250 -keep-aspect \
-+ /usr/share/pixmaps/redhat/redhat-transparent.png
---- XFree86-3.3.3.1/xc/programs/xdm/config/xdm-conf.cpp.rhxdm Sat Feb 10 00:46:54 1996
-+++ XFree86-3.3.3.1/xc/programs/xdm/config/xdm-conf.cpp Mon Apr 12 19:26:02 1999
-@@ -1,19 +1,19 @@
- ! $XConsortium: xdm-conf.cpp /main/3 1996/01/15 15:17:26 gildea $
--DisplayManager.errorLogFile: XDMDIR/xdm-errors
--DisplayManager.pidFile: XDMDIR/xdm-pid
--DisplayManager.keyFile: XDMDIR/xdm-keys
--DisplayManager.servers: XDMDIR/Xservers
--DisplayManager.accessFile: XDMDIR/Xaccess
-+DisplayManager.errorLogFile: /var/log/xdm-error.log
-+DisplayManager.pidFile: /var/run/xdm.pid
-+DisplayManager.keyFile: /etc/X11/xdm/xdm-keys
-+DisplayManager.servers: /etc/X11/xdm/Xservers
-+DisplayManager.accessFile: /etc/X11/xdm/Xaccess
- ! All displays should use authorization, but we cannot be sure
- ! X terminals will be configured that way, so by default
- ! use authorization only for local displays :0, :1, etc.
- DisplayManager._0.authorize: true
- DisplayManager._1.authorize: true
- ! The following three resources set up display :0 as the console.
--DisplayManager._0.setup: XDMDIR/Xsetup_0
--DisplayManager._0.startup: XDMDIR/GiveConsole
--DisplayManager._0.reset: XDMDIR/TakeConsole
-+DisplayManager._0.setup: /etc/X11/xdm/Xsetup_0
-+DisplayManager._0.startup: /etc/X11/xdm/GiveConsole
-+DisplayManager._0.reset: /etc/X11/xdm/TakeConsole
- !
--DisplayManager*resources: XDMDIR/Xresources
--DisplayManager*session: XDMDIR/Xsession
-+DisplayManager*resources: /etc/X11/xdm/Xresources
-+DisplayManager*session: /etc/X11/xdm/Xsession
- DisplayManager*authComplain: false
---- XFree86-3.3.3.1/xc/programs/xdm/config/GiveConsole.rhxdm Mon Apr 12 19:33:09 1999
-+++ XFree86-3.3.3.1/xc/programs/xdm/config/GiveConsole Mon Apr 12 19:34:11 1999
-@@ -8,3 +8,5 @@
- # causing serious grief.
- #
- chown $USER /dev/console
-+/usr/X11R6/bin/sessreg -a -w "/var/log/wtmp" -u "/var/run/utmp" \
-+ -x "/etc/X11/xdm/Xservers" -l $DISPLAY -h "" $USER
---- XFree86-3.3.3.1/xc/programs/xdm/config/TakeConsole.rhxdm Mon Apr 12 19:33:13 1999
-+++ XFree86-3.3.3.1/xc/programs/xdm/config/TakeConsole Mon Apr 12 19:34:45 1999
-@@ -5,3 +5,5 @@
- #
- chmod 622 /dev/console
- chown root /dev/console
-+/usr/X11R6/bin/sessreg -d -w "/var/log/wtmp" -u "/var/run/utmp" \
-+ -x "/etc/X11/xdm/Xservers" -l $DISPLAY -h "" $USER
+++ /dev/null
---- XFree86-4.0.2.orig/xc/programs/xkbcomp/symbols/ro Tue Aug 15 12:51:32 2000
-+++ XFree86-4.0.2/xc/programs/xkbcomp/symbols/ro Fri Jan 19 22:03:56 2001
-@@ -5,7 +5,6 @@
- //
- // Created by Cristian Gafton, <gafton@redhat.com> (C) 2000
- //
--// $XFree86: xc/programs/xkbcomp/symbols/ro,v 3.1 2000/08/15 16:51:32 dawes Exp $
-
- partial hidden alphanumeric_keys modifier_keys
- xkb_symbols "basic" {
-@@ -13,7 +12,7 @@
-
- key <TLDE> { [], [ acircumflex, acircumflex ] };
- key <AC01> { [], [ atilde, acircumflex ] };
-- key <AC02> { [], [ scedilla, Scedilla ] };
-+ key <AC02> { [], [ masculine, ordfeminine ] };
- key <AD05> { [], [ thorn, Thorn ] };
- key <AD08> { [], [ icircumflex, Icircumflex ] };
- };
+++ /dev/null
---- XFree86-3.3.4.orig/xc/nls/locale.alias Wed Jun 2 09:50:05 1999
-+++ XFree86-3.3.4/xc/nls/locale.alias Sun Aug 8 21:57:30 1999
-@@ -282,7 +282,7 @@
- ru_RU.iso88595 ru_RU.ISO8859-5
- #if defined(INCLUDE_ru_SU)
- XCOMM ru_SU is redundant now
--ru_SU ru_RU.ISO8859-5
-+ru_SU ru_RU.KOI8-R
- ru_SU.ISO8859-5 ru_RU.ISO8859-5
- ru_SU.KOI8-R ru_RU.KOI8-R
- #endif
+++ /dev/null
-diff -urN XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_accel.c XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c
---- XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_accel.c Fri Nov 8 19:03:32 2002
-+++ XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c Mon May 5 12:30:22 2003
-@@ -470,6 +470,7 @@
- | NO_TRANSPARENCY
- | HARDWARE_PATTERN_PROGRAMMED_BITS
- | HARDWARE_PATTERN_PROGRAMMED_ORIGIN
-+ | ROP_NEEDS_SOURCE
- ;
- }
- #endif
-@@ -496,6 +497,7 @@
- | SCANLINE_PAD_DWORD
- | BIT_ORDER_IN_BYTE_MSBFIRST
- | LEFT_EDGE_CLIPPING
-+ | ROP_NEEDS_SOURCE
- ;
- xaaptr->SetupForImageWrite = SavageSetupForImageWrite;
- xaaptr->SubsequentImageWriteRect = SavageSubsequentImageWriteRect;
-@@ -506,7 +508,7 @@
- /* WriteBitmap color expand */
-
- #if 0
-- xaaptr->WriteBitmapFlags = NO_PLANEMASK;
-+ xaaptr->WriteBitmapFlags = NO_PLANEMASK | ROP_NEEDS_SOURCE;
- xaaptr->WriteBitmap = SavageWriteBitmapCPUToScreenColorExpand;
- #endif
-
-diff -urN XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_driver.c XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c
---- XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_driver.c Tue Feb 25 05:08:21 2003
-+++ XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c Mon May 5 12:30:23 2003
-@@ -19,16 +19,12 @@
- #define DPMS_SERVER
- #include "extensions/dpms.h"
-
--#ifdef XvExtension
- #include "xf86xv.h"
--#endif
-
- #include "savage_driver.h"
- #include "savage_bci.h"
-
-
--
--
- /*
- * prototypes
- */
-@@ -82,10 +78,10 @@
- #define iabs(a) ((int)(a)>0?(a):(-(a)))
-
- #define DRIVER_NAME "savage"
--#define DRIVER_VERSION "1.1.26"
-+#define DRIVER_VERSION "1.1.27"
- #define VERSION_MAJOR 1
- #define VERSION_MINOR 1
--#define PATCHLEVEL 26
-+#define PATCHLEVEL 27
- #define SAVAGE_VERSION ((VERSION_MAJOR << 24) | \
- (VERSION_MINOR << 16) | \
- PATCHLEVEL)
-@@ -287,7 +283,6 @@
- "XAACopyROP_PM",
- "XAACreateInfoRec",
- "XAADestroyInfoRec",
-- "XAAFillSolidRects",
- "XAAHelpPatternROP",
- "XAAHelpSolidROP",
- "XAAInit",
-@@ -2363,10 +2358,8 @@
- if (xf86DPMSInit(pScreen, SavageDPMS, 0) == FALSE)
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DPMS initialization failed\n");
-
--#ifdef XvExtension
- if( !psav->NoAccel && !SavagePanningCheck(pScrn) )
- SavageInitVideo( pScreen );
--#endif
-
- if (serverGeneration == 1)
- xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
-diff -urN XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_driver.h XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h
---- XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_driver.h Sat Jan 18 16:22:30 2003
-+++ XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h Mon May 5 12:30:23 2003
-@@ -140,11 +140,9 @@
- int YFactor; /* overlay Y factor */
- int displayXoffset; /* overlay X offset */
- int displayYoffset; /* overlay Y offset */
-- int XExpansion; /* expansion factor in x */
-- int XExp1;
-+ int XExp1; /* expansion ratio in x */
- int XExp2;
-- int YExpansion; /* expansion factor in x */
-- int YExp1;
-+ int YExp1; /* expansion ratio in x */
- int YExp2;
- int cxScreen;
- int TVSizeX;
-diff -urN XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_regs.h XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h
---- XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_regs.h Wed Oct 2 22:39:55 2002
-+++ XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h Mon May 5 12:30:23 2003
-@@ -216,7 +216,15 @@
- VGAOUT8(psav->vgaIOBase + 5, a); \
- }
-
-+#define HZEXP_COMP_1 0x54
-+#define HZEXP_BORDER 0x58
- #define HZEXP_FACTOR_IGA1 0x59
-+
-+#define VTEXP_COMP_1 0x56
-+#define VTEXP_BORDER 0x5a
- #define VTEXP_FACTOR_IGA1 0x5b
-
-+#define EC1_CENTER_ON 0x10
-+#define EC1_EXPAND_ON 0x0c
-+
- #endif /* _SAVAGE_REGS_H */
-diff -urN XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_vbe.c XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c
---- XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_vbe.c Wed Oct 2 22:39:55 2002
-+++ XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c Mon May 5 12:30:23 2003
-@@ -72,7 +72,7 @@
- SavageClearVM86Regs( psav->pInt10 );
- psav->pInt10->ax = 0x4f14; /* S3 extensions */
- psav->pInt10->bx = 0x0001; /* Set default refresh rate */
-- psav->pInt10->cx = n;
-+ psav->pInt10->cx = n & 0x3fff;
- psav->pInt10->di = Refresh & 0xffff;
-
- xf86ExecX86int10( psav->pInt10 );
-diff -urN XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_video.c XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c
---- XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_video.c Sun Jan 12 04:55:49 2003
-+++ XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c Mon May 5 12:30:24 2003
-@@ -17,11 +17,6 @@
-
- #define TIMER_MASK (OFF_TIMER | FREE_TIMER)
-
--#ifndef XvExtension
--void SavageInitVideo(ScreenPtr pScreen) {}
--void SavageResetVideo(ScrnInfoPtr pScrn) {}
--#else
--
- void myOUTREG( SavagePtr psav, unsigned long offset, unsigned long value );
-
- static XF86VideoAdaptorPtr SavageSetupImageVideo(ScreenPtr);
-@@ -79,7 +74,7 @@
- ) = NULL;
-
- static void OverlayParamInit(ScrnInfoPtr pScrn);
--static void InitStreamsForExpansion(SavagePtr psav);
-+static void InitStreamsForExpansion(ScrnInfoPtr pScrn);
-
- /*static void SavageBlockHandler(int, pointer, pointer, pointer);*/
-
-@@ -421,7 +416,6 @@
-
- /* Sequence stolen from streams.c in M7 NT driver */
-
--
- xf86EnableIO();
-
- /* Unlock extended registers. */
-@@ -430,10 +424,20 @@
- VGAOUT16(vgaCRIndex, 0xa039);
- VGAOUT16(0x3c4, 0x0608);
-
-+ if(
-+ S3_SAVAGE_MOBILE_SERIES(psav->Chipset) &&
-+ !psav->CrtOnly &&
-+ !psav->TvOn
-+ ) {
-+ OverlayParamInit( pScrn );
-+ }
-+
- VGAOUT8( vgaCRIndex, EXT_MISC_CTRL2 );
-
- if( S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ||
-- (psav->Chipset == S3_SUPERSAVAGE) ||
-+#if 0 /* I don't think commenting this out is correct (EE) */
-+ (psav->Chipset == S3_SUPERSAVAGE) ||
-+#endif
- (psav->Chipset == S3_SAVAGE2000) )
- {
- jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAM1;
-@@ -878,36 +882,6 @@
- }
-
-
--static Bool
--RegionsEqual(RegionPtr A, RegionPtr B)
--{
-- int *dataA, *dataB;
-- int num;
--
-- num = REGION_NUM_RECTS(A);
-- if(num != REGION_NUM_RECTS(B))
-- return FALSE;
--
-- if((A->extents.x1 != B->extents.x1) ||
-- (A->extents.x2 != B->extents.x2) ||
-- (A->extents.y1 != B->extents.y1) ||
-- (A->extents.y2 != B->extents.y2))
-- return FALSE;
--
-- dataA = (int*)REGION_RECTS(A);
-- dataB = (int*)REGION_RECTS(B);
--
-- while(num--) {
-- if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1]))
-- return FALSE;
-- dataA += 2;
-- dataB += 2;
-- }
--
-- return TRUE;
--}
--
--
- /* SavageClipVideo -
-
- Takes the dst box in standard X BoxRec form (top and left
-@@ -992,9 +966,8 @@
-
- REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
-
-- SavageStreamsOff( pScrn );
--
- if(shutdown) {
-+ SavageStreamsOff( pScrn );
- if(pPriv->area) {
- xf86FreeOffscreenArea(pPriv->area);
- pPriv->area = NULL;
-@@ -1283,9 +1256,11 @@
- ssControl |= (1 << 24);
- OUTREG(SSTREAM_CONTROL_REG, ssControl);
-
-+#if 0
- /* Set color key on primary. */
-
- SavageSetColorKey( pScrn );
-+#endif
-
- /* Set FIFO L2 on second stream. */
-
-@@ -1358,10 +1333,10 @@
- !psav->CrtOnly &&
- !psav->TvOn
- ) {
-- drw_w = (float)(drw_w * psav->XExp1)/(float)psav->XExp2 + 1;
-- drw_h = (float)(drw_h * psav->YExp1)/(float)psav->YExp2 + 1;
-- dstBox->x1 = (float)(dstBox->x1 * psav->XExp1)/(float)psav->XExp2;
-- dstBox->y1 = (float)(dstBox->y1 * psav->YExp1)/(float)psav->YExp2;
-+ drw_w = (drw_w * psav->XExp1)/psav->XExp2 + 1;
-+ drw_h = (drw_h * psav->YExp1)/psav->YExp2 + 1;
-+ dstBox->x1 = (dstBox->x1 * psav->XExp1)/psav->XExp2;
-+ dstBox->y1 = (dstBox->y1 * psav->YExp1)/psav->YExp2;
- dstBox->x1 += psav->displayXoffset;
- dstBox->y1 += psav->displayYoffset;
- }
-@@ -1378,14 +1353,16 @@
- * are 2 bytes/pixel.
- */
-
-- OUTREG(SEC_STREAM_FBUF_ADDR0, (offset + (x1>>15)) & 0x3ffff0 );
-+ OUTREG(SEC_STREAM_FBUF_ADDR0, (offset + (x1>>15)) & 0x7ffff0 );
- OUTREG(SEC_STREAM_STRIDE, pitch & 0xfff );
- OUTREG(SEC_STREAM_WINDOW_START, ((dstBox->x1+1) << 16) | (dstBox->y1+1) );
- OUTREG(SEC_STREAM_WINDOW_SZ, ((drw_w) << 16) | drw_h );
-
-+#if 0
- /* Set color key on primary. */
-
- SavageSetColorKey( pScrn );
-+#endif
-
- /* Set FIFO L2 on second stream. */
-
-@@ -1424,6 +1401,20 @@
- int top, left, npixels, nlines;
- BoxRec dstBox;
- CARD32 tmp;
-+/* xf86ErrorFVerb(XVTRACE,"SavagePutImage\n"); */
-+
-+ if( psav->cxScreen != pScrn->currentMode->HDisplay )
-+ {
-+ /* The mode has changed. Recompute the offsets. */
-+
-+ if(
-+ S3_SAVAGE_MOBILE_SERIES(psav->Chipset) &&
-+ !psav->CrtOnly &&
-+ !psav->TvOn
-+ ) {
-+ OverlayParamInit( pScrn );
-+ }
-+ }
-
- if(drw_w > 16384) drw_w = 16384;
-
-@@ -1519,18 +1510,19 @@
- SavageCopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels);
- break;
- }
-+
-+ /* We need to enable the video before we draw the chroma color.
-+ Otherwise, we get blue flashes. */
-+
-+ SavageDisplayVideo(pScrn, id, offset, width, height, dstPitch,
-+ x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h);
-
- /* update cliplist */
-- if(!RegionsEqual(&pPriv->clip, clipBoxes)) {
-- REGION_COPY(pScreen, &pPriv->clip, clipBoxes);
-+ if(!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)) {
-+ REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes);
- /* draw these */
-- XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0,
-- REGION_NUM_RECTS(clipBoxes),
-- REGION_RECTS(clipBoxes));
-+ xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes);
- }
--
-- SavageDisplayVideo(pScrn, id, offset, width, height, dstPitch,
-- x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h);
-
- pPriv->videoStatus = CLIENT_VIDEO_ON;
-
-@@ -1692,6 +1684,7 @@
- XF86SurfacePtr surface
- ){
- OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr;
-+ xf86ErrorFVerb(XVTRACE,"SavageStopSurface\n");
-
- if(pPriv->isOn) {
- /*SavagePtr psav = SAVPTR(surface->pScrn);*/
-@@ -1754,6 +1747,7 @@
- SavagePortPrivPtr portPriv = GET_PORT_PRIVATE(pScrn);
- INT32 x1, y1, x2, y2;
- BoxRec dstBox;
-+ xf86ErrorFVerb(XVTRACE,"SavageDisplaySurface\n");
-
- x1 = src_x;
- x2 = src_x + src_w;
-@@ -1777,14 +1771,12 @@
- dstBox.y1 -= pScrn->frameY0;
- dstBox.y2 -= pScrn->frameY0;
-
-- XAAFillSolidRects(pScrn, portPriv->colorKey, GXcopy, ~0,
-- REGION_NUM_RECTS(clipBoxes),
-- REGION_RECTS(clipBoxes));
--
- SavageDisplayVideo(pScrn, surface->id, surface->offsets[0],
- surface->width, surface->height, surface->pitches[0],
- x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h);
-
-+ xf86XVFillKeyHelper(pScrn->pScreen, portPriv->colorKey, clipBoxes);
-+
- pPriv->isOn = TRUE;
- #if 0
- if(portPriv->videoStatus & CLIENT_VIDEO_ON) {
-@@ -1839,144 +1831,87 @@
- SavagePtr psav = SAVPTR(pScrn);
-
- psav = SAVPTR(pScrn);
-- psav->cxScreen = psav->iResX;
-- InitStreamsForExpansion(psav);
-+ psav->cxScreen = pScrn->currentMode->HDisplay;
-+ InitStreamsForExpansion(pScrn);
- }
-
--/* Function to calculate lcd expansion x,yfactor and offset for overlay
-+/* Function to calculate lcd expansion x,y factor and offset for overlay
- */
--static void InitStreamsForExpansion(SavagePtr psav)
-+static void InitStreamsForExpansion(ScrnInfoPtr pScrn)
- {
-+ SavagePtr psav = SAVPTR(pScrn);
- int PanelSizeX,PanelSizeY;
- int ViewPortWidth,ViewPortHeight;
-+ int XExpansion, YExpansion;
- int XFactor, YFactor;
-+ int Hstate, Vstate;
-+
-+ static CARD32 Xfactors[] = {
-+ 0x00010001,
-+ 0x00010001, /* 1 */
-+ 0,
-+ 0x00090008, /* 3 */
-+ 0x00050004, /* 4 */
-+ 0,
-+ 0x00030002, /* 6 */
-+ 0x00020001 /* 7 */
-+ };
-+
-+ static CARD32 Yfactors[] = {
-+ 0x00010001, 0x00010001,
-+ 0, 0x00060005,
-+ 0x00050004, 0x00040003,
-+ 0, 0x00030002,
-+ 0x00020001, 0x00050002,
-+ 0x000C0005, 0x00080003,
-+ 0x00090004, 0,
-+ 0x00030001, 0x00040001,
-+ };
-+
-+
-
- PanelSizeX = psav->PanelX;
- PanelSizeY = psav->PanelY;
-- ViewPortWidth = psav->iResX;
-- ViewPortHeight = psav->iResY;
-+ ViewPortWidth = pScrn->currentMode->HDisplay;
-+ ViewPortHeight = pScrn->currentMode->VDisplay;
-+
- if( PanelSizeX == 1408 )
- PanelSizeX = 1400;
-- psav->XExpansion = 0x00010001;
-- psav->YExpansion = 0x00010001;
-+
-+ XExpansion = 0x00010001;
-+ YExpansion = 0x00010001;
-+
- psav->displayXoffset = 0;
- psav->displayYoffset = 0;
-
-+ VGAOUT8(0x3C4, HZEXP_COMP_1);
-+ Hstate = VGAIN8(0x3C5);
-+ VGAOUT8(0x3C4, VTEXP_COMP_1);
-+ Vstate = VGAIN8(0x3C5);
- VGAOUT8(0x3C4, HZEXP_FACTOR_IGA1);
-- XFactor = VGAIN8(0x3C5) >> 4;
-+ XFactor = VGAIN8(0x3C5);
- VGAOUT8(0x3C4, VTEXP_FACTOR_IGA1);
-- YFactor = VGAIN8(0x3C5) >> 4;
-+ YFactor = VGAIN8(0x3C5);
-
-- switch( XFactor )
-+ if( Hstate & EC1_EXPAND_ON )
- {
-- case 1:
-- psav->XExpansion = 0x00010001;
-- psav->displayXoffset =
-- (((PanelSizeX - ViewPortWidth) / 2) + 0x7) & 0xFFF8;
-- break;
--
-- case 3:
-- psav->XExpansion = 0x00090008;
-- psav->displayXoffset =
-- (((PanelSizeX - ((9 * ViewPortWidth)/8)) / 2) + 0x7) & 0xFFF8;
-- break;
-+ XExpansion = Xfactors[XFactor>>4];
-+ }
-
-- case 4:
-- psav->XExpansion = 0x00050004;
-+ if( Vstate & EC1_EXPAND_ON )
-+ {
-+ YExpansion = Yfactors[YFactor>>4];
-+ }
-
-- if ((psav->cxScreen == 800) && (PanelSizeX !=1400))
-- {
-- psav->displayXoffset =
-- (((PanelSizeX - ((5 * ViewPortWidth)/4)) / 2) ) & 0xFFF8;
-- }
-- else
-- {
-- psav->displayXoffset =
-- (((PanelSizeX - ((5 * ViewPortWidth)/4)) / 2) +0x7) & 0xFFF8;
-- }
-- break;
-+ psav->XExp1 = XExpansion >> 16;
-+ psav->XExp2 = XExpansion & 0xFFFF;
-
-- case 6:
-- psav->XExpansion = 0x00030002;
-- psav->displayXoffset =
-- (((PanelSizeX - ((3 * ViewPortWidth)/2)) / 2) + 0x7) & 0xFFF8;
-- break;
-+ psav->YExp1 = YExpansion >> 16;
-+ psav->YExp2 = YExpansion & 0xFFFF;
-
-- case 7:
-- psav->XExpansion = 0x00020001;
-- psav->displayXoffset =
-- (((PanelSizeX - (2 * ViewPortWidth)) / 2) + 0x7) & 0xFFF8;
-- break;
-- }
--
-- switch( YFactor )
-- {
-- case 0:
-- psav->YExpansion = 0x00010001;
-- psav->displayYoffset = (PanelSizeY - ViewPortHeight) / 2;
-- break;
-- case 1:
-- psav->YExpansion = 0x00010001;
-- psav->displayYoffset = (PanelSizeY - ViewPortHeight) / 2;
-- break;
-- case 2:
-- psav->YExpansion = 0x00040003;
-- psav->displayYoffset = (PanelSizeY - ((4 * ViewPortHeight)/3)) / 2;
-- break;
-- case 4:
-- psav->YExpansion = 0x00050004;
-- psav->displayYoffset = (PanelSizeY - ((5 * ViewPortHeight)/4)) / 2;
-- break;
-- case 5:
-- psav->YExpansion = 0x00040003;
-+ psav->displayXoffset =
-+ ((PanelSizeX - (psav->XExp1 * ViewPortWidth) / psav->XExp2) / 2 + 7) & 0xfff8;
-+ psav->displayYoffset =
-+ ((PanelSizeY - (psav->YExp1 * ViewPortHeight) / psav->YExp2) / 2);
-
-- if((psav->cxScreen == 1024)&&(PanelSizeX ==1400))
-- {
-- psav->displayYoffset =
-- ((PanelSizeY - ((4 * ViewPortHeight)/3)) / 2) - 0x1 ;
-- }
-- else
-- {
-- psav->displayYoffset = (PanelSizeY - ((4 * ViewPortHeight)/3)) / 2;
-- }
-- break;
-- case 6:
-- psav->YExpansion = 0x00050004;
-- psav->displayYoffset = (PanelSizeY - ((5 * ViewPortHeight)/4)) / 2;
-- break;
-- case 7:
-- psav->YExpansion = 0x00030002;
-- psav->displayYoffset = (PanelSizeY - ((3 * ViewPortHeight)/2)) / 2;
-- break;
-- case 8:
-- psav->YExpansion = 0x00020001;
-- psav->displayYoffset = (PanelSizeY - (2 * ViewPortHeight)) /2;
-- break;
-- case 9:
-- psav->YExpansion = 0x00090004;
-- psav->displayYoffset = (PanelSizeY - ((9 * ViewPortHeight)/4)) /2;
-- break;
-- case 11:
-- psav->YExpansion = 0x00110005;
-- psav->displayYoffset = (PanelSizeY - ((11 * ViewPortHeight)/5)) /2;
-- break;
-- case 12:
-- psav->YExpansion = 0x00070003;
-- psav->displayYoffset = (PanelSizeY - ((7 * ViewPortHeight)/3)) /2;
-- break;
-- case 14:
-- psav->YExpansion = 0x00050002;
-- psav->displayYoffset = (PanelSizeY - ((5 * ViewPortHeight)/2)) /2;
-- break;
-- case 15:
-- psav->YExpansion = 0x00040001;
-- psav->displayYoffset = (PanelSizeY - (4 * ViewPortHeight)) /2;
-- break;
-- }
-- psav->XExp1 = psav->XExpansion >> 16;
-- psav->XExp2 = psav->XExpansion & 0xFFFF;
-- psav->YExp1 = psav->YExpansion >> 16;
-- psav->YExp2 = psav->YExpansion & 0xFFFF;
- } /* InitStreamsForExpansionPM */
--
--#endif /* XvExtension */
+++ /dev/null
---- XFree86-4.0/xc/config/cf/Imake.rules.shared Fri May 12 09:52:32 2000
-+++ XFree86-4.0/xc/config/cf/Imake.rules Fri May 12 09:57:14 2000
-@@ -3082,6 +3082,7 @@
- #ifndef LibraryModuleTarget
- #if MakeDllModules
- #define LibraryModuleTarget(module,objects) @@\
-+NormalLibraryTarget(module, objects) @@\
- DynamicModuleTarget(Concat3(lib,module,.so), objects)
- #else
- #define LibraryModuleTarget(module, objects) @@\
-@@ -3095,6 +3096,7 @@
- #ifndef DepLibraryModuleTarget
- #if MakeDllModules
- #define DepLibraryModuleTarget(module,deplist,objects) @@\
-+NormalDepLibraryTarget(module, deplist, objects) @@\
- DepDynamicModuleTarget(Concat3(lib,module,.so), deplist, objects)
- #else
- #define DepLibraryModuleTarget(module,deplist,objects) @@\
---- XFree86-4.0/xc/programs/Xserver/GL/Imakefile.shared Sat Feb 26 00:37:09 2000
-+++ XFree86-4.0/xc/programs/Xserver/GL/Imakefile Fri May 12 01:08:54 2000
-@@ -42,7 +42,7 @@
-
- ModuleObjectRule()
-
--NormalDepLibraryTarget(glx,$(SUBDIRS) $(DONES) $(MOBJS),$(OBJS))
-+DepLibraryModuleTarget(glx,$(SUBDIRS) $(DONES) $(MOBJS),$(OBJS))
-
- InstallLibraryModule(glx,$(MODULEDIR),extensions)
- ForceSubdirs($(SUBDIRS))
---- XFree86-4.0/xc/programs/Xserver/fb/Imakefile.shared Sat Feb 26 00:37:40 2000
-+++ XFree86-4.0/xc/programs/Xserver/fb/Imakefile Fri May 12 01:08:54 2000
-@@ -79,7 +79,7 @@
- ../mi/llib-lmi.ln
-
- NormalLibraryObjectRule()
--NormalLibraryTarget(fb,$(OBJS))
-+LibraryModuleTarget(fb,$(OBJS))
- LintLibraryTarget(fb,$(SRCS))
-
- NormalLintTarget($(SRCS))
---- XFree86-4.0/xc/programs/Xserver/Imakefile.shared Fri May 12 09:27:35 2000
-+++ XFree86-4.0/xc/programs/Xserver/Imakefile Fri May 12 09:30:32 2000
-@@ -527,13 +527,13 @@
- #if XF86Server
- XF86SERVER = XFree86
- #endif
--#if XnestServer && !MakeDllModules
-+#if XnestServer
- XNEST = Xnest
- #endif
--#if XVirtualFramebufferServer && !MakeDllModules
-+#if XVirtualFramebufferServer
- XVFB = Xvfb
- #endif
--#if defined(XF86Server) || (!MakeDllModules && (defined(XnestServer) || defined(XVirtualFramebufferServer)))
-+#if defined(XF86Server) || ((defined(XnestServer) || defined(XVirtualFramebufferServer)))
- MakeMutex($(XF86SERVER) $(XNEST) $(XVFB))
- #endif
- MakeMutex($(STDDIRS) mfb fb cfb cfb16 cfb24 cfb32)
-@@ -863,7 +863,7 @@
- KDRIVEDIRS=$(KDDIRS) $(FBDEVDIR) $(SAVAGEDIR) $(TRIDENTDIR) $(SIS530DIR) \
- $(TRIODIR) $(TS300DIR) $(ITSYDIR)
-
--#if XprtServer && !MakeDllModules
-+#if XprtServer
- XCOMM
- XCOMM Print Server
- XCOMM
-@@ -896,7 +896,7 @@
- ServerTarget(Xprt,$(XPSUBDIRS),$(XPOBJS),$(XPLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER),$(XPSYSLIBS))
- #endif /* XprtServer */
-
--#if XnestServer && !MakeDllModules
-+#if XnestServer
- XCOMM
- XCOMM Server with Xlib-based ddx
- XCOMM
-@@ -945,7 +945,7 @@
- #endif /* XnonServer */
-
-
--#if XVirtualFramebufferServer && !MakeDllModules
-+#if XVirtualFramebufferServer
- XCOMM
- XCOMM server with Virtual (malloced) framebuffer
- XCOMM
+++ /dev/null
-Index: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c
-===================================================================
-RCS file: /srv/cvs/cvsup/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v
-retrieving revision 1.3
-retrieving revision 1.4
-diff -u -I.*XFree86: -r1.3 -r1.4
---- XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c 2000/12/02 01:16:16 1.3
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c 2001/02/14 19:08:32 1.4
-@@ -1355,7 +1355,7 @@
- USHORT oldREFIndex,CRT1ModeNo,oldModeIDOffset;
- long int longtemp;
-
-- USHORT LatencyFactor[48]={ 88, 80, 78, 72, 70, 00, /* 64 bit BQ=2 */
-+ static USHORT LatencyFactor[48]={ 88, 80, 78, 72, 70, 00, /* 64 bit BQ=2 */
- 00, 79, 77, 71, 69, 49, /* 64 bit BQ=1 */
- 88, 80, 78, 72, 70, 00, /* 128 bit BQ=2 */
- 00, 72, 70, 64, 62, 44, /* 128 bit BQ=1 */
+++ /dev/null
---- XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/xf86config/Cards.sis Mon Sep 13 13:17:05 1999
-+++ XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/xf86config/Cards Mon Sep 13 13:17:27 1999
-@@ -2299,7 +2299,7 @@
- NAME SiS 6326
- CHIPSET SiS6326
- SERVER SVGA
--LINE # Option "no_accel" # Use this if acceleration is causing problems
-+LINE Option "no_accel" # Use this if acceleration is causing problems
- LINE # Option "fifo_moderate"
- LINE # Option "fifo_conserv"
- LINE # Option "fifo_aggresive"
+++ /dev/null
---- XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/xf86config/Cards.ssa50 Tue Aug 31 15:55:47 1999
-+++ XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/xf86config/Cards Tue Aug 31 15:57:44 1999
-@@ -2334,6 +2334,9 @@
-
- NAME Diamond SpeedStar A50
- SEE SiS 6326
-+LINE Option "sw_cursor"
-+LINE Option "no_imageblt"
-+LINE Option "no_bitblt"
-
- NAME AOpen PA50D
- SEE SiS 6326
+++ /dev/null
---- XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c.chmou Tue Sep 19 17:34:43 2000
-+++ XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c Tue Sep 19 18:30:25 2000
-@@ -127,9 +127,10 @@
- }
- }
- if (i!=numConfigs) {
-- ErrorF("Incorrect initialization of visuals\n");
-+ xf86DrvMsg(pScreen->myNum, X_ERROR,
-+ "Incorrect initialization of visuals\n");
- return FALSE;
-- } else ErrorF("Created %d visuals\n", numConfigs);
-+ }
- break; /* 16bpp */
-
- case 24:
-@@ -224,7 +225,7 @@
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "Incorrect initialization of visuals\n");
- return FALSE;
-- } else ErrorF("Created %d visuals\n", numConfigs);
-+ }
- break;
- }
- pTDFX->numVisualConfigs = numConfigs;
-@@ -263,12 +264,21 @@
-
- switch (pScrn->bitsPerPixel) {
- case 8:
-+ xf86DrvMsg(pScreen->myNum, X_ERROR,
-+ "DRI not supported in 8 bpp mode, disabling DRI.\n");
- return FALSE;
- case 16:
- break;
- case 24:
-+ xf86DrvMsg(pScreen->myNum, X_ERROR,
-+ "DRI not supported in 24 bpp mode, disabling DRI.\n");
-+ return FALSE;
- case 32:
-- if (pTDFX->ChipType<=PCI_CHIP_VOODOO3) return FALSE;
-+ if (pTDFX->ChipType<=PCI_CHIP_VOODOO3) {
-+ xf86DrvMsg(pScreen->myNum, X_ERROR,
-+ "DRI requires Voodoo3 or later, disabling DRI.\n");
-+ return FALSE;
-+ }
- }
-
- /* Check that the GLX, DRI, and DRM modules have been loaded by testing
-@@ -295,8 +305,12 @@
- }
-
- pDRIInfo = DRICreateInfoRec();
-- if (!pDRIInfo)
-- return FALSE;
-+ if (!pDRIInfo) {
-+ xf86DrvMsg(pScreen->myNum, X_ERROR,
-+ "DRICreatInfoRect() failed, disabling DRI.\n");
-+ return FALSE;
-+ }
-+
- pTDFX->pDRIInfo = pDRIInfo;
-
- pDRIInfo->drmDriverName = TDFXKernelDriverName;
-@@ -336,13 +350,14 @@
- * in the SAREA header
- */
- if (sizeof(XF86DRISAREARec)+sizeof(TDFXSAREAPriv)>SAREA_MAX) {
-- xf86DrvMsg(pScreen->myNum, X_ERROR, "Data does not fit in SAREA\n");
-+ xf86DrvMsg(pScreen->myNum, X_ERROR, "Data does not fit in SAREA\n");
- return FALSE;
- }
- pDRIInfo->SAREASize = SAREA_MAX;
- #endif
-
- if (!(pTDFXDRI = (TDFXDRIPtr)xnfcalloc(sizeof(TDFXDRIRec),1))) {
-+ xf86DrvMsg(pScreen->myNum, X_ERROR, "DRI memory allocation failed, disabling DRI.\n");
- DRIDestroyInfoRec(pTDFX->pDRIInfo);
- pTDFX->pDRIInfo=0;
- return FALSE;
-@@ -363,6 +378,8 @@
- pDRIInfo->devPrivate=0;
- DRIDestroyInfoRec(pTDFX->pDRIInfo);
- pTDFX->pDRIInfo=0;
-+ xf86DrvMsg(pScreen->myNum, X_ERROR, "DRIScreenInit failed, disabling DRI.\n");
-+
- return FALSE;
- }
-
-@@ -391,6 +408,7 @@
- if (drmAddMap(pTDFX->drmSubFD, (drmHandle)pTDFX->MMIOAddr[0],
- pTDFXDRI->regsSize, DRM_REGISTERS, 0, &pTDFXDRI->regs)<0) {
- TDFXDRICloseScreen(pScreen);
-+ xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap failed, disabling DRI.\n");
- return FALSE;
- }
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08lx\n",
-@@ -398,6 +416,7 @@
-
- if (!(TDFXInitVisualConfigs(pScreen))) {
- TDFXDRICloseScreen(pScreen);
-+ xf86DrvMsg(pScreen->myNum, X_ERROR, "TDFXInitVisualConfigs failed, disabling DRI.\n");
- return FALSE;
- }
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "visual configs initialized\n" );
---- XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c.chmou Tue Sep 19 17:34:43 2000
-+++ XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c Tue Sep 19 18:30:25 2000
-@@ -636,7 +636,6 @@
- ClockRangePtr clockRanges;
- int i;
- MessageType from;
-- char *mod=0, *reqSym=0;
- int flags24;
- rgb defaultWeight = {0, 0, 0};
- pciVideoPtr match;
-@@ -663,7 +662,7 @@
-
- if (flags & PROBE_DETECT) {
- TDFXProbeDDC(pScrn, pTDFX->pEnt->index);
-- return FALSE;
-+ return TRUE;
- }
-
- /* The vgahw module should be loaded here when needed */
-@@ -1195,7 +1194,10 @@
- maxm=24;
- } else {
- minm=1;
-- maxm=64;
-+ maxm=57; /* This used to be 64, alas it seems the last 8 (funny that ?)
-+ * values cause jittering at lower resolutions. I've not done
-+ * any calculations to what the adjustment affects clock ranges,
-+ * but I can still run at 1600x1200@75Hz */
- }
- for (n=1; n<256; n++) {
- f_cur=REFFREQ*(n+2);
-@@ -1604,15 +1606,6 @@
- pTDFX = TDFXPTR(pScrn);
- pTDFX->stride = pScrn->displayWidth*pTDFX->cpp;
-
-- /* Layout the memory. Start with all the ram */
-- memRemaining=pScrn->videoRam<<10;
-- /* Remove the cursor space */
-- memRemaining-=4096;
-- /* Remove the main screen and offscreen pixmaps */
-- memRemaining-=pTDFX->stride*(pScrn->virtualY+128);
-- /* Remove one scanline for page alignment */
-- memRemaining-=4095;
-- /* Remove the back and Z buffers */
- if (pTDFX->cpp!=3) {
- screenSizeInTiles=calcBufferSize(pScrn->virtualX, pScrn->virtualY,
- TRUE, pTDFX->cpp);
-@@ -1622,41 +1615,77 @@
- screenSizeInTiles=calcBufferSize(pScrn->virtualX, pScrn->virtualY,
- TRUE, 4);
- }
-- memRemaining-=screenSizeInTiles*2;
--
-- /* Give all the rest to textures, rounded down to a page */
-- texSize=memRemaining&~0xFFF;
--
-- /* Make sure fifo has CMDFIFO_PAGES<fifoSize<255 pages */
-- if (memRemaining-texSize<CMDFIFO_PAGES<<12)
-- texSize=(memRemaining-(CMDFIFO_PAGES<<12))&~0xFFF;
-- /* Fifo uses the remaining space up to 255 pages */
-- fifoSize = (memRemaining-texSize)&~0xFFF;
-- if (fifoSize>255<<12) fifoSize=255<<12;
--
-- /* Assign the variables */
-- /* Cursor */
-- pTDFX->cursorOffset=0; /* Size 1024 bytes */
--
-- /* Point the fifo at the first page */
-+ memRemaining=((pScrn->videoRam<<10) - 1) &~ 0xFFF;
-+ /* Note that a page is 4096 bytes, and a */
-+ /* tile is 32 x 128 = 4096 bytes. So, */
-+ /* page and tile boundaries are the same */
-+ /* Place the depth offset first, forcing */
-+ /* it to be on an *odd* page boundary. */
-+ pTDFX->depthOffset = (memRemaining - screenSizeInTiles) &~ 0xFFF;
-+ if ((pTDFX->depthOffset & (0x1 << 12)) == 0) {
-+#if 0
-+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-+ "Changing depth offset from 0x%08x to 0x%08x\n",
-+ pTDFX->depthOffset,
-+ pTDFX->depthOffset - (0x1 << 12));
-+#endif
-+ pTDFX->depthOffset -= (0x1 << 12);
-+ }
-+ /* Now, place the back buffer, forcing it */
-+ /* to be on an *even* page boundary. */
-+ pTDFX->backOffset = (pTDFX->depthOffset - screenSizeInTiles) &~ 0xFFF;
-+ if (pTDFX->backOffset & (0x1 << 12)) {
-+#if 0
-+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-+ "Changing back offset from 0x%08x to 0x%08x\n",
-+ pTDFX->backOffset,
-+ pTDFX->backOffset - (0x1 << 12));
-+#endif
-+ pTDFX->backOffset -= (0x1 << 12);
-+ }
-+ /* Now, place the front buffer, forcing */
-+ /* it to be on a page boundary too, just */
-+ /* for giggles. */
-+ pTDFX->fbOffset
-+ = (pTDFX->backOffset - (pScrn->virtualY+128)*pTDFX->stride) &~ 0xFFF;
-+ /* Give the cmd fifo at least */
-+ /* CMDFIFO_PAGES pages, but no more than */
-+ /* 255. */
-+ fifoSize = ((255 <= CMDFIFO_PAGES) ? 255 : CMDFIFO_PAGES) << 12;
-+ /* We give 4096 bytes to the cursor, fifoSize to the */
-+ /* FIFO, and everything to textures. */
-+ texSize = (pTDFX->fbOffset - fifoSize - 4096);
-+ pTDFX->texOffset = pTDFX->fbOffset - texSize;
-+ pTDFX->texSize = texSize;
- pTDFX->fifoOffset = 4096;
- pTDFX->fifoSize = fifoSize;
--
-- /* Textures */
-- pTDFX->texOffset = pTDFX->fifoOffset+fifoSize;
-- pTDFX->texSize = texSize;
--
-- /* Frame buffer */
-- pTDFX->fbOffset=pTDFX->texOffset+pTDFX->texSize;
--
-- /* Back buffer */
-- pTDFX->backOffset=pTDFX->fbOffset+(pScrn->virtualY+128)*pTDFX->stride;
-- /* Round off to a page */
-- pTDFX->backOffset=(pTDFX->backOffset+4095)&~0xFFF;
--
-- /* Depth buffer */
-- pTDFX->depthOffset=pTDFX->backOffset+screenSizeInTiles;
--
-+ pTDFX->cursorOffset = 0;
-+#if 0
-+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-+ "Cursor Offset: [0x%08X,0x%08X)\n",
-+ pTDFX->cursorOffset,
-+ pTDFX->cursorOffset+1024);
-+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-+ "Fifo Offset: [0x%08X, 0x%08X)\n",
-+ pTDFX->fifoOffset,
-+ pTDFX->fifoOffset+fifoSize);
-+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-+ "Texture Offset: [0x%08X, 0x%08X)\n",
-+ pTDFX->texOffset,
-+ pTDFX->texOffset + texSize);
-+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-+ "Front Buffer Offset: [0x%08X, 0x%08X)\n",
-+ pTDFX->fbOffset,
-+ pTDFX->fbOffset + (pScrn->virtualY+128)*pTDFX->stride);
-+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-+ "BackOffset: [0x%08X, 0x%08X)\n",
-+ pTDFX->backOffset,
-+ pTDFX->backOffset+screenSizeInTiles);
-+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-+ "DepthOffset: [0x%08X, 0x%08X)\n",
-+ pTDFX->depthOffset,
-+ pTDFX->depthOffset+screenSizeInTiles);
-+#endif /* 0/1 */
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Textures Memory %0.02f MB\n",
- (float)texSize/1024.0/1024.0);
- }
---- XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c.chmou Tue Sep 19 17:34:43 2000
-+++ XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c Tue Sep 19 18:30:25 2000
-@@ -163,12 +163,22 @@
- } else {
- int chip;
- int stride, bits;
-+ int TileAperturePitch, lg2TileAperturePitch;
- if (pTDFX->cpp==2) stride=pTDFX->stride;
- else stride=4*pTDFX->stride/pTDFX->cpp;
- bits=pTDFX->backOffset>>12;
-+ for (lg2TileAperturePitch = 0, TileAperturePitch = 1024;
-+ (lg2TileAperturePitch < 5) &&
-+ TileAperturePitch < stride;
-+ lg2TileAperturePitch += 1, TileAperturePitch <<= 1);
-+#if 0
-+ fprintf(stderr, "Using %d (== lg2(%d)-10) for tile aperture pitch\n",
-+ lg2TileAperturePitch, TileAperturePitch);
-+ fprintf(stderr, "stride == %d\n", stride);
-+#endif
- for (chip=0; chip<pTDFX->numChips; chip++) {
- TDFXWriteChipLongMMIO(pTDFX, chip, LFBMEMORYCONFIG, (bits&0x1FFF) |
-- SST_RAW_LFB_ADDR_STRIDE_4K |
-+ SST_RAW_LFB_ADDR_STRIDE(lg2TileAperturePitch) |
- ((bits&0x6000)<<10) |
- ((stride+127)/128)<<SST_RAW_LFB_TILE_STRIDE_SHIFT);
- }
---- XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c.chmou Tue Sep 19 17:34:43 2000
-+++ XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c Tue Sep 19 18:30:25 2000
-@@ -1,4 +1,3 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c,v 1.2 2000/06/17 18:23:23 dawes Exp $ */
-
- #include "xf86.h"
- #include "xf86_ansic.h"
---- XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h.chmou Tue Sep 19 17:34:43 2000
-+++ XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h Tue Sep 19 18:30:25 2000
-@@ -52,8 +52,26 @@
-
- #define MEM_TYPE_SGRAM 0
- #define MEM_TYPE_SDRAM 1
-+/*
-+ * SST_RAW_LFB_ADDR_STRIDE(Lg2SizeInK) takes the
-+ * lfbMemoryConfig value for SGRAMStrideInTiles. This
-+ * is given by this table:
-+ * SGRAMStrideInBytes lfbMemoryConfig Value
-+ * ================== =====================
-+ * 1k 0
-+ * 2k 1
-+ * 4k 2
-+ * 8k 3
-+ * 16k 4
-+ *
-+ * FWIW, the right hand column is log2(left hand column)-10
-+ */
- #define SST_RAW_LFB_ADDR_STRIDE_SHIFT 13
--#define SST_RAW_LFB_ADDR_STRIDE_4K 0x2<<SST_RAW_LFB_ADDR_STRIDE_SHIFT
-+#define SST_RAW_LFB_ADDR_STRIDE(Lg2SizeInK) \
-+ ((Lg2SizeInK)<<SST_RAW_LFB_ADDR_STRIDE_SHIFT)
-+#define SST_RAW_LFB_ADDR_STRIDE_4K SST_RAW_LFB_ADDR_STRIDE(2)
-+#define SST_RAW_LFB_ADDR_STRIDE_8K SST_RAW_LFB_ADDR_STRIDE(3)
-+#define SST_RAW_LFB_ADDR_STRIDE_16K SST_RAW_LFB_ADDR_STRIDE(4)
- #define SST_RAW_LFB_TILE_STRIDE_SHIFT 16
-
- #define BLIT_LEFT 1
+++ /dev/null
---- XFree86-4.0.2/xc/include/Xos.h.tm Wed Feb 14 19:43:19 2001
-+++ XFree86-4.0.2/xc/include/Xos.h Wed Feb 14 19:45:26 2001
-@@ -149,6 +149,14 @@ extern int sys_nerr;
- #endif /* CSRG_BASED */
-
- /*
-+ * Get struct tm
-+ */
-+
-+#if defined(__linux__)
-+#include <time.h>
-+#endif
-+
-+/*
- * Get struct timeval
- */
-
-
-
+++ /dev/null
-diff -c -N -r xc.old/config/cf/X11.tmpl xc/config/cf/X11.tmpl
-*** xc.old/config/cf/X11.tmpl Mon Mar 2 03:55:22 1998
---- xc/config/cf/X11.tmpl Sat Apr 11 13:56:54 1998
-***************
-*** 202,207 ****
---- 202,213 ----
- #ifndef BuildXF86DGALibrary
- #define BuildXF86DGALibrary BuildXF86DGA
- #endif
-+ #ifndef BuildXF86RushExt
-+ #define BuildXF86RushExt NO
-+ #endif
-+ #ifndef BuildXF86RushLibrary
-+ #define BuildXF86RushLibrary BuildXF86RushExt
-+ #endif
- #ifndef BuildDPMSExt
- #define BuildDPMSExt NO
- #endif
-***************
-*** 992,997 ****
---- 998,1019 ----
- #endif
- #endif
-
-+ #if BuildXF86RushLibrary
-+ #ifndef SharedLibXxf86rush
-+ #define SharedLibXxf86rush YES
-+ #endif
-+ #ifndef NormalLibXxf86rush
-+ #define NormalLibXxf86rush YES
-+ #endif
-+ #ifndef DebugLibXxf86rush
-+ #define DebugLibXxf86rush NO
-+ #endif
-+ #ifndef ProfileLibXxf86rush
-+ #define ProfileLibXxf86rush NO
-+ #endif
-+ #endif
-+
-+
- #if BuildDPMSLibrary
- #ifndef SharedLibXdpms
- #define SharedLibXdpms NO
-***************
-*** 1078,1083 ****
---- 1100,1117 ----
- SharedLibReferences(XXF86DGA,Xxf86dga,$(XXF86DGALIBSRC),SOXXF86DGAREV,SharedXxf86dgaRev)
- #else
- ProjectUnsharedLibReferences(XXF86DGA,Xxf86dga,$(XXF86DGALIBSRC),XBuildLibDir)
-+ #endif
-+ #endif
-+
-+ #if BuildXF86RushLibrary
-+ XXF86RUSHLIBSRC = $(LIBSRC)/Xxf86rush
-+ #if SharedLibXxf86rush
-+ #ifndef SharedXxf86RushRev
-+ #define SharedXxf86RushRev 1.0
-+ #endif
-+ SharedLibReferences(XXF86RUSH,Xxf86rush,$(XXF86RUSHLIBSRC),SOXXF86RUSHREV,SharedXxf86RushRev)
-+ #else
-+ ProjectUnsharedLibReferences(XXF86RUSH,Xxf86rush,$(XXF86RUSHLIBSRC),XBuildLibDir)
- #endif
- #endif
-
-diff -c -N -r xc.old/config/cf/xfree86.cf xc/config/cf/xfree86.cf
-*** xc.old/config/cf/xfree86.cf Mon Mar 2 03:55:22 1998
---- xc/config/cf/xfree86.cf Sat Apr 11 15:34:02 1998
-***************
-*** 619,624 ****
---- 619,627 ----
- #ifndef BuildDPMSLibrary
- #define BuildDPMSLibrary YES
- #endif
-+ #ifndef BuildXF86RushLibrary
-+ #define BuildXF86RushLibrary YES
-+ #endif
-
- /*
- * Build the XFree86-VidMode extension
-***************
-*** 673,678 ****
---- 676,688 ----
- #define BuildDPMSExt YES
- #endif
-
-+ /*
-+ * Build the Rush extension support
-+ */
-+ #ifndef BuildXF86RushExt
-+ #define BuildXF86RushExt YES
-+ #endif
-+
- #if Malloc0ReturnsNull
- #ifndef XtMalloc0ReturnsNullDefines
- #define XtMalloc0ReturnsNullDefines Malloc0ReturnsNullDefines -DXTMALLOC_BC
-***************
-*** 764,769 ****
---- 774,785 ----
- #define XFree86DGADefines /**/
- #endif
-
-+ #if BuildXF86RushExt
-+ #define XFree86RushDefines -DXFreeXRUSH
-+ #else
-+ #define XFree86RushDefines /**/
-+ #endif
-+
- #ifndef MakeHasPosixVariableSubstitutions
- #if !HasBsdMake
- #define MakeHasPosixVariableSubstitutions NO
-***************
-*** 774,780 ****
-
- /* Server defines required for all OSs */
- #ifndef XFree86ServerDefines
-! #define XFree86ServerDefines -DSTATIC_COLOR -DAVOID_GLYPHBLT -DPIXPRIV LinkKitDefines XFree86DGADefines
- #endif
-
- #ifndef XFree86ServerOSDefines
---- 790,796 ----
-
- /* Server defines required for all OSs */
- #ifndef XFree86ServerDefines
-! #define XFree86ServerDefines -DSTATIC_COLOR -DAVOID_GLYPHBLT -DPIXPRIV LinkKitDefines XFree86DGADefines XFree86RushDefines
- #endif
-
- #ifndef XFree86ServerOSDefines
-*** xc.old/include/extensions/Imakefile Sun Jan 12 02:39:14 1997
---- xc/include/extensions/Imakefile Sun Apr 5 17:34:16 1998
-***************
-*** 14,19 ****
---- 14,22 ----
- #if BuildXF86DGALibrary
- XF86DGAHEADERS = xf86dga.h xf86dgastr.h
- #endif
-+ #if BuildXF86RushLibrary
-+ XF86RUSHHEADERS = xf86rush.h xf86rushstr.h
-+ #endif
- #if BuildLBX
- LBXHEADERS = lbxbuf.h lbxbufstr.h lbxdeltastr.h lbximage.h lbxopts.h lbxstr.h lbxzlib.h
- #endif
-***************
-*** 21,27 ****
- DPMSHEADERS = dpms.h dpmsstr.h
- #endif
-
-! EXTRAHEADERS = $(SCREENSAVERHEADERS) $(XF86VIDMODEHEADERS) $(XF86DGAHEADERS) $(XF86MISCHEADERS) $(LBXHEADERS) $(DPMSHEADERS)
-
-
-
---- 24,30 ----
- DPMSHEADERS = dpms.h dpmsstr.h
- #endif
-
-! EXTRAHEADERS = $(SCREENSAVERHEADERS) $(XF86VIDMODEHEADERS) $(XF86DGAHEADERS) $(XF86RUSHHEADERS) $(XF86MISCHEADERS) $(LBXHEADERS) $(DPMSHEADERS)
-
-
-
-diff -c -N -r xc.old/include/extensions/xf86rush.h xc/include/extensions/xf86rush.h
-*** xc.old/include/extensions/xf86rush.h Wed Dec 31 16:00:00 1969
---- xc/include/extensions/xf86rush.h Sun Apr 19 15:56:23 1998
-***************
-*** 0 ****
---- 1,70 ----
-+ /* $$ */
-+ /*
-+
-+ Copyright (c) 1998 Daryll Strauss
-+
-+ */
-+
-+ #ifndef _XF86RUSH_H_
-+ #define _XF86RUSH_H_
-+
-+ #include <X11/Xfuncproto.h>
-+
-+ #define X_XF86RushQueryVersion 0
-+ #define X_XF86RushLockPixmap 1
-+ #define X_XF86RushUnlockPixmap 2
-+ #define X_XF86RushUnlockAllPixmaps 3
-+
-+ #define XF86RushNumberEvents 0
-+
-+ #define XF86RushClientNotLocal 0
-+ #define XF86RushNumberErrors (XF86RushClientNotLocal + 1)
-+
-+ #ifndef _XF86RUSH_SERVER_
-+
-+ _XFUNCPROTOBEGIN
-+
-+ Bool XF86RushQueryVersion(
-+ #if NeedFunctionPrototypes
-+ Display* /* dpy */,
-+ int* /* majorVersion */,
-+ int* /* minorVersion */
-+ #endif
-+ );
-+
-+ Bool XF86RushQueryExtension(
-+ #if NeedFunctionPrototypes
-+ Display* /* dpy */,
-+ int* /* event_base */,
-+ int* /* error_base */
-+ #endif
-+ );
-+
-+ Bool XF86RushLockPixmap(
-+ #if NeedFunctionPrototypes
-+ Display * /* dpy */,
-+ int /* screen */,
-+ Pixmap /* Pixmap */,
-+ void ** /* Return address */
-+ #endif
-+ );
-+
-+ Bool XF86RushUnlockPixmap(
-+ #if NeedFunctionPrototypes
-+ Display * /* dpy */,
-+ int /* screen */,
-+ Pixmap /* Pixmap */
-+ #endif
-+ );
-+
-+ Bool XF86RushUnlockAllPixmaps(
-+ #if NeedFunctionPrototypes
-+ Display * /* dpy */
-+ #endif
-+ );
-+
-+ _XFUNCPROTOEND
-+
-+ #endif /* _XF86RUSH_SERVER_ */
-+
-+ #endif /* _XF86RUSH_H_ */
-diff -c -N -r xc.old/include/extensions/xf86rushstr.h xc/include/extensions/xf86rushstr.h
-*** xc.old/include/extensions/xf86rushstr.h Wed Dec 31 16:00:00 1969
---- xc/include/extensions/xf86rushstr.h Sun Apr 5 21:44:32 1998
-***************
-*** 0 ****
---- 1,82 ----
-+ /* $$ */
-+ /*
-+
-+ Copyright (c) 1998 Daryll Strauss
-+
-+ */
-+
-+ #ifndef _XF86RUSHSTR_H_
-+ #define _XF86RUSHSTR_H_
-+
-+ #include "xf86rush.h"
-+
-+ #define XF86RUSHNAME "XFree86-Rush"
-+
-+ #define XF86RUSH_MAJOR_VERSION 1 /* current version numbers */
-+ #define XF86RUSH_MINOR_VERSION 0
-+
-+ typedef struct _XF86RushQueryVersion {
-+ CARD8 reqType; /* always RushReqCode */
-+ CARD8 rushReqType; /* always X_RushQueryVersion */
-+ CARD16 length B16;
-+ } xXF86RushQueryVersionReq;
-+ #define sz_xXF86RushQueryVersionReq 4
-+
-+ typedef struct {
-+ BYTE type; /* X_Reply */
-+ BOOL pad1;
-+ CARD16 sequenceNumber B16;
-+ CARD32 length B32;
-+ CARD16 majorVersion B16; /* major version of Rush protocol */
-+ CARD16 minorVersion B16; /* minor version of Rush protocol */
-+ CARD32 pad2 B32;
-+ CARD32 pad3 B32;
-+ CARD32 pad4 B32;
-+ CARD32 pad5 B32;
-+ CARD32 pad6 B32;
-+ } xXF86RushQueryVersionReply;
-+ #define sz_xXF86RushQueryVersionReply 32
-+
-+ typedef struct _XF86RushLockPixmap {
-+ CARD8 reqType; /* always RushReqCode */
-+ CARD8 rushReqType; /* always X_RushLockPixmap */
-+ CARD16 length B16;
-+ CARD16 screen B16;
-+ CARD16 pad B16;
-+ CARD32 pixmap B32;
-+ } xXF86RushLockPixmapReq;
-+ #define sz_xXF86RushLockPixmapReq 12
-+
-+ typedef struct {
-+ BYTE type;
-+ BOOL pad1;
-+ CARD16 sequenceNumber B16;
-+ CARD32 length B32;
-+ CARD32 addr B32;
-+ CARD32 pad2 B32;
-+ CARD32 pad3 B32;
-+ CARD32 pad4 B32;
-+ CARD32 pad5 B32;
-+ CARD32 pad6 B32;
-+ } xXF86RushLockPixmapReply;
-+ #define sz_xXF86RushLockPixmapReply 32
-+
-+ typedef struct _XF86RushUnlockPixmap {
-+ CARD8 reqType; /* always RushReqCode */
-+ CARD8 rushReqType; /* always X_RushUnlockPixmap */
-+ CARD16 length B16;
-+ CARD16 screen B16;
-+ CARD16 pad B16;
-+ CARD32 pixmap B32;
-+ } xXF86RushUnlockPixmapReq;
-+ #define sz_xXF86RushUnlockPixmapReq 12
-+
-+ typedef struct _XF86RushUnlockAllPixmaps {
-+ CARD8 reqType; /* always RushReqCode */
-+ CARD8 rushReqType; /* always X_RushUnlockAllPixmaps */
-+ CARD16 length B16;
-+ } xXF86RushUnlockAllPixmapsReq;
-+ #define sz_xXF86RushUnlockAllPixmapsReq 4
-+
-+ #endif /* _XF86RUSHSTR_H_ */
-+
-diff -c -N -r xc.old/lib/Imakefile xc/lib/Imakefile
-*** xc.old/lib/Imakefile Sat Jul 5 08:55:33 1997
---- xc/lib/Imakefile Sat Apr 11 13:24:59 1998
-***************
-*** 39,45 ****
- XF86DGALIB = Xxf86dga
- #endif
-
-! XF86EXTLIBS = $(XF86MISCLIB) $(XF86VMLIB) $(XF86DGALIB)
-
- #if BuildDPMSLibrary
- XDPMSLIBDIR = Xdpms
---- 39,49 ----
- XF86DGALIB = Xxf86dga
- #endif
-
-! #if BuildXF86RushLibrary
-! XF86RUSHLIB = Xxf86rush
-! #endif
-!
-! XF86EXTLIBS = $(XF86MISCLIB) $(XF86VMLIB) $(XF86DGALIB) $(XF86RUSHLIB)
-
- #if BuildDPMSLibrary
- XDPMSLIBDIR = Xdpms
-***************
-*** 61,67 ****
-
- #if !BuildServersOnly
- LINTSUBDIRS = Xau Xdmcp $(THRSTUBLIB) X11 oldX ICE SM Xext Xt \
-! $(SSLIB) $(XF86MISCLIB) $(XF86VMLIB) $(XF86DGALIB) \
- Xmu Xaw XIE Xi Xtst FS \
- PEX5 $(XKBLIBDIR) $(XKBUILIBDIR) $(LBXUTILDIR) $(XALIBDIR) \
- $(XDPMSLIBDIR) \
---- 65,71 ----
-
- #if !BuildServersOnly
- LINTSUBDIRS = Xau Xdmcp $(THRSTUBLIB) X11 oldX ICE SM Xext Xt \
-! $(SSLIB) $(XF86MISCLIB) $(XF86VMLIB) $(XF86DGALIB) $(XF86RUSHLIB) \
- Xmu Xaw XIE Xi Xtst FS \
- PEX5 $(XKBLIBDIR) $(XKBUILIBDIR) $(LBXUTILDIR) $(XALIBDIR) \
- $(XDPMSLIBDIR) \
-diff -c -N -r xc.old/lib/Xext/XF86Rush.c xc/lib/Xext/XF86Rush.c
-*** xc.old/lib/Xext/XF86Rush.c Wed Dec 31 16:00:00 1969
---- xc/lib/Xext/XF86Rush.c Sun Apr 5 18:01:55 1998
-***************
-*** 0 ****
---- 1,163 ----
-+ /* $$ */
-+ /*
-+
-+ Copyright (c) 1998 Daryll Strauss
-+
-+ */
-+
-+ /* THIS IS NOT AN X CONSORTIUM STANDARD */
-+
-+ #define NEED_EVENTS
-+ #define NEED_REPLIES
-+ #include "Xlibint.h"
-+ #include "xf86rushstr.h"
-+ #include "Xext.h"
-+ #include "extutil.h"
-+
-+ static XExtensionInfo _xf86rush_info_data;
-+ static XExtensionInfo *xf86rush_info = &_xf86rush_info_data;
-+ static char *xf86rush_extension_name = XF86RUSHNAME;
-+
-+ #define XF86RushCheckExtension(dpy,i,val) \
-+ XextCheckExtension (dpy, i, xf86rush_extension_name, val)
-+
-+ /*****************************************************************************
-+ * *
-+ * private utility routines *
-+ * *
-+ *****************************************************************************/
-+
-+ static int close_display();
-+ static /* const */ XExtensionHooks xf86rush_extension_hooks = {
-+ NULL, /* create_gc */
-+ NULL, /* copy_gc */
-+ NULL, /* flush_gc */
-+ NULL, /* free_gc */
-+ NULL, /* create_font */
-+ NULL, /* free_font */
-+ close_display, /* close_display */
-+ NULL, /* wire_to_event */
-+ NULL, /* event_to_wire */
-+ NULL, /* error */
-+ NULL, /* error_string */
-+ };
-+
-+ static XEXT_GENERATE_FIND_DISPLAY (find_display, xf86rush_info,
-+ xf86rush_extension_name,
-+ &xf86rush_extension_hooks,
-+ 0, NULL)
-+
-+ static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xf86rush_info)
-+
-+
-+ /*****************************************************************************
-+ * *
-+ * public XFree86-DGA Extension routines *
-+ * *
-+ *****************************************************************************/
-+
-+ Bool XF86RushQueryExtension (dpy, event_basep, error_basep)
-+ Display *dpy;
-+ int *event_basep, *error_basep;
-+ {
-+ XExtDisplayInfo *info = find_display (dpy);
-+
-+ if (XextHasExtension(info)) {
-+ *event_basep = info->codes->first_event;
-+ *error_basep = info->codes->first_error;
-+ return True;
-+ } else {
-+ return False;
-+ }
-+ }
-+
-+ Bool XF86RushQueryVersion(dpy, majorVersion, minorVersion)
-+ Display* dpy;
-+ int* majorVersion;
-+ int* minorVersion;
-+ {
-+ XExtDisplayInfo *info = find_display (dpy);
-+ xXF86RushQueryVersionReply rep;
-+ xXF86RushQueryVersionReq *req;
-+
-+ XF86RushCheckExtension (dpy, info, False);
-+
-+ LockDisplay(dpy);
-+ GetReq(XF86RushQueryVersion, req);
-+ req->reqType = info->codes->major_opcode;
-+ req->dgaReqType = X_XF86RushQueryVersion;
-+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
-+ UnlockDisplay(dpy);
-+ SyncHandle();
-+ return False;
-+ }
-+ *majorVersion = rep.majorVersion;
-+ *minorVersion = rep.minorVersion;
-+ UnlockDisplay(dpy);
-+ SyncHandle();
-+ return True;
-+ }
-+
-+ Bool XF86RushLockPixmap(dpy, screen, pixmap, addr)
-+ Display *dpy;
-+ int screen;
-+ Pixmap pixmap;
-+ void **addr;
-+ {
-+ XExtDisplayInfo *info = find_display (dpy);
-+ xXF86RushLockPixmapReply rep;
-+ xXF86RushLockPixmapReq *req;
-+
-+ XF86RushCheckExtension (dpy, info, False);
-+ LockDisplay(dpy);
-+ GetReq(XF86RushLockPixmap, req);
-+ req->reqType = info->codes->major_opcode;
-+ req->dgaReqType = X_XF86RushLockPixmap;
-+ req->screen=screen;
-+ req->pixmap=pixmap;
-+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
-+ UnlockDisplay(dpy);
-+ SyncHandle();
-+ return False;
-+ }
-+ *addr=(void*)rep.addr;
-+ UnlockDisplay(dpy);
-+ SyncHandle();
-+ return True;
-+ }
-+
-+ Bool XF86RushUnlockPixmap(dpy, screen, pixmap)
-+ Display *dpy;
-+ int screen;
-+ Pixmap pixmap;
-+ {
-+ XExtDisplayInfo *info = find_display(dpy);
-+ xXF86RushUnlockPixmapReq *req;
-+
-+ XF86RushCheckExtension (dpy, info, False);
-+ LockDisplay(dpy);
-+ GetReq(XF86RushUnlockPixmap, req);
-+ req->reqType = info->codes->major_opcode;
-+ req->dgaReqType = X_XF86RushUnlockPixmap;
-+ req->screen=screen;
-+ req->pixmap=pixmap;
-+ UnlockDisplay(dpy);
-+ SyncHandle();
-+ return True;
-+ }
-+
-+ Bool XF86RushUnlockAllPixmaps(dpy)
-+ Display *dpy;
-+ {
-+ XExtDisplayInfo *info = find_display(dpy);
-+ xXF86RushUnlockAllPixmapsReq *req;
-+
-+ XF86RushCheckExtension (dpy, info, False);
-+ LockDisplay(dpy);
-+ GetReq(XF86RushUnlockAllPixmaps, req);
-+ req->reqType = info->codes->major_opcode;
-+ req->dgaReqType = X_XF86RushUnlockAllPixmaps;
-+ UnlockDisplay(dpy);
-+ SyncHandle();
-+ return True;
-+ }
-diff -c -N -r xc.old/lib/Xxf86rush/Imakefile xc/lib/Xxf86rush/Imakefile
-*** xc.old/lib/Xxf86rush/Imakefile Wed Dec 31 16:00:00 1969
---- xc/lib/Xxf86rush/Imakefile Sat Apr 11 13:29:38 1998
-***************
-*** 0 ****
---- 1,33 ----
-+ XCOMM $$
-+ #define DoNormalLib NormalLibXxf86rush
-+ #define DoSharedLib SharedLibXxf86rush
-+ #define DoDebugLib DebugLibXxf86rush
-+ #define DoProfileLib ProfileLibXxf86rush
-+ #define LibName Xxf86rush
-+ #define SoRev SOXXF86RUSHREV
-+ #define LibHeaders NO
-+
-+ #include <Threads.tmpl>
-+
-+ #ifdef SharedXxf86rushReqs
-+ REQUIREDLIBS = SharedXxf86rushReqs
-+ #endif
-+
-+ XF86RUSHSRCS = XF86Rush.c
-+ XF86RUSHOBJS = XF86Rush.o
-+
-+ #if Malloc0ReturnsNull
-+ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-+ #endif
-+
-+ DEFINES = $(ALLOC_DEFINES)
-+ INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC)
-+ SRCS = $(XF86RUSHSRCS)
-+ OBJS = $(XF86RUSHOBJS)
-+ LINTLIBS = $(LINTXLIB)
-+
-+ #include <Library.tmpl>
-+
-+ DependTarget()
-+
-+
-diff -c -N -r xc.old/lib/Xxf86rush/XF86Rush.c xc/lib/Xxf86rush/XF86Rush.c
-*** xc.old/lib/Xxf86rush/XF86Rush.c Wed Dec 31 16:00:00 1969
---- xc/lib/Xxf86rush/XF86Rush.c Sat Apr 11 13:55:40 1998
-***************
-*** 0 ****
---- 1,163 ----
-+ /* $$ */
-+ /*
-+
-+ Copyright (c) 1998 Daryll Strauss
-+
-+ */
-+
-+ /* THIS IS NOT AN X CONSORTIUM STANDARD */
-+
-+ #define NEED_EVENTS
-+ #define NEED_REPLIES
-+ #include "Xlibint.h"
-+ #include "xf86rushstr.h"
-+ #include "Xext.h"
-+ #include "extutil.h"
-+
-+ static XExtensionInfo _xf86rush_info_data;
-+ static XExtensionInfo *xf86rush_info = &_xf86rush_info_data;
-+ static char *xf86rush_extension_name = XF86RUSHNAME;
-+
-+ #define XF86RushCheckExtension(dpy,i,val) \
-+ XextCheckExtension (dpy, i, xf86rush_extension_name, val)
-+
-+ /*****************************************************************************
-+ * *
-+ * private utility routines *
-+ * *
-+ *****************************************************************************/
-+
-+ static int close_display();
-+ static /* const */ XExtensionHooks xf86rush_extension_hooks = {
-+ NULL, /* create_gc */
-+ NULL, /* copy_gc */
-+ NULL, /* flush_gc */
-+ NULL, /* free_gc */
-+ NULL, /* create_font */
-+ NULL, /* free_font */
-+ close_display, /* close_display */
-+ NULL, /* wire_to_event */
-+ NULL, /* event_to_wire */
-+ NULL, /* error */
-+ NULL, /* error_string */
-+ };
-+
-+ static XEXT_GENERATE_FIND_DISPLAY (find_display, xf86rush_info,
-+ xf86rush_extension_name,
-+ &xf86rush_extension_hooks,
-+ 0, NULL)
-+
-+ static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xf86rush_info)
-+
-+
-+ /*****************************************************************************
-+ * *
-+ * public XFree86-DGA Extension routines *
-+ * *
-+ *****************************************************************************/
-+
-+ Bool XF86RushQueryExtension (dpy, event_basep, error_basep)
-+ Display *dpy;
-+ int *event_basep, *error_basep;
-+ {
-+ XExtDisplayInfo *info = find_display (dpy);
-+
-+ if (XextHasExtension(info)) {
-+ *event_basep = info->codes->first_event;
-+ *error_basep = info->codes->first_error;
-+ return True;
-+ } else {
-+ return False;
-+ }
-+ }
-+
-+ Bool XF86RushQueryVersion(dpy, majorVersion, minorVersion)
-+ Display* dpy;
-+ int* majorVersion;
-+ int* minorVersion;
-+ {
-+ XExtDisplayInfo *info = find_display (dpy);
-+ xXF86RushQueryVersionReply rep;
-+ xXF86RushQueryVersionReq *req;
-+
-+ XF86RushCheckExtension (dpy, info, False);
-+
-+ LockDisplay(dpy);
-+ GetReq(XF86RushQueryVersion, req);
-+ req->reqType = info->codes->major_opcode;
-+ req->rushReqType = X_XF86RushQueryVersion;
-+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
-+ UnlockDisplay(dpy);
-+ SyncHandle();
-+ return False;
-+ }
-+ *majorVersion = rep.majorVersion;
-+ *minorVersion = rep.minorVersion;
-+ UnlockDisplay(dpy);
-+ SyncHandle();
-+ return True;
-+ }
-+
-+ Bool XF86RushLockPixmap(dpy, screen, pixmap, addr)
-+ Display *dpy;
-+ int screen;
-+ Pixmap pixmap;
-+ void **addr;
-+ {
-+ XExtDisplayInfo *info = find_display (dpy);
-+ xXF86RushLockPixmapReply rep;
-+ xXF86RushLockPixmapReq *req;
-+
-+ XF86RushCheckExtension (dpy, info, False);
-+ LockDisplay(dpy);
-+ GetReq(XF86RushLockPixmap, req);
-+ req->reqType = info->codes->major_opcode;
-+ req->rushReqType = X_XF86RushLockPixmap;
-+ req->screen=screen;
-+ req->pixmap=pixmap;
-+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
-+ UnlockDisplay(dpy);
-+ SyncHandle();
-+ return False;
-+ }
-+ *addr=(void*)rep.addr;
-+ UnlockDisplay(dpy);
-+ SyncHandle();
-+ return True;
-+ }
-+
-+ Bool XF86RushUnlockPixmap(dpy, screen, pixmap)
-+ Display *dpy;
-+ int screen;
-+ Pixmap pixmap;
-+ {
-+ XExtDisplayInfo *info = find_display(dpy);
-+ xXF86RushUnlockPixmapReq *req;
-+
-+ XF86RushCheckExtension (dpy, info, False);
-+ LockDisplay(dpy);
-+ GetReq(XF86RushUnlockPixmap, req);
-+ req->reqType = info->codes->major_opcode;
-+ req->rushReqType = X_XF86RushUnlockPixmap;
-+ req->screen=screen;
-+ req->pixmap=pixmap;
-+ UnlockDisplay(dpy);
-+ SyncHandle();
-+ return True;
-+ }
-+
-+ Bool XF86RushUnlockAllPixmaps(dpy)
-+ Display *dpy;
-+ {
-+ XExtDisplayInfo *info = find_display(dpy);
-+ xXF86RushUnlockAllPixmapsReq *req;
-+
-+ XF86RushCheckExtension (dpy, info, False);
-+ LockDisplay(dpy);
-+ GetReq(XF86RushUnlockAllPixmaps, req);
-+ req->reqType = info->codes->major_opcode;
-+ req->rushReqType = X_XF86RushUnlockAllPixmaps;
-+ UnlockDisplay(dpy);
-+ SyncHandle();
-+ return True;
-+ }
-diff -c -N -r xc.old/programs/Xserver/Xext/Imakefile ./Xext/Imakefile
-*** xc.old/programs/Xserver/Xext/Imakefile Fri Jan 23 04:35:11 1998
---- xc/programs/Xserver/Xext/Imakefile Sun Apr 4 18:13:41 1999
-***************
-*** 32,37 ****
---- 32,42 ----
- DPMSOBJS = dpms.o
- #endif
-
-+ #if BuildXF86RushExt
-+ XF86RRUSHSRCS = xf86Rush.c
-+ XF86RUSHOBJS = xf86Rush.o
-+ #endif
-+
- #if BuildAppgroup
- APPGROUPSRCS = appgroup.c
- APPGROUPOBJS = appgroup.o
-***************
-*** 47,59 ****
- mitmisc.c xtest.c xtest1di.c xtest1dd.c sleepuntil.c \
- bigreq.c sync.c $(SCRNSAVSRC) xcmisc.c $(VIDMODESRCS) \
- $(XF86MISCSRCS) $(XF86DGASRCS) $(SECURITYSRCS) \
-! $(DPMSSRCS) \
- $(APPGROUPSRCS) xprint.c
- OBJS = shape.o $(SHMOBJS) mbuf.o \
- mitmisc.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o \
- bigreq.o sync.o $(SCRNSAVOBJ) xcmisc.o $(VIDMODEOBJS) \
- $(XF86MISCOBJS) $(XF86DGAOBJS) $(SECURITYOBJS) \
-! $(DPMSOBJS) \
- $(APPGROUPOBJS) xprint.o
-
- XF86INCLUDES = -I../hw/xfree86/common -I../hw/xfree86/os-support
---- 52,64 ----
- mitmisc.c xtest.c xtest1di.c xtest1dd.c sleepuntil.c \
- bigreq.c sync.c $(SCRNSAVSRC) xcmisc.c $(VIDMODESRCS) \
- $(XF86MISCSRCS) $(XF86DGASRCS) $(SECURITYSRCS) \
-! $(DPMSSRCS) $(XF86RUSHSRCS) \
- $(APPGROUPSRCS) xprint.c
- OBJS = shape.o $(SHMOBJS) mbuf.o \
- mitmisc.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o \
- bigreq.o sync.o $(SCRNSAVOBJ) xcmisc.o $(VIDMODEOBJS) \
- $(XF86MISCOBJS) $(XF86DGAOBJS) $(SECURITYOBJS) \
-! $(DPMSOBJS) $(XF86RUSHOBJS) \
- $(APPGROUPOBJS) xprint.o
-
- XF86INCLUDES = -I../hw/xfree86/common -I../hw/xfree86/os-support
-diff -c -N -r xc.old/programs/Xserver/Xext/xf86Rush.c ./Xext/xf86Rush.c
-*** xc.old/programs/Xserver/Xext/xf86Rush.c Wed Dec 31 16:00:00 1969
---- xc/programs/Xserver/Xext/xf86Rush.c Sun Apr 4 18:13:41 1999
-***************
-*** 0 ****
---- 1,213 ----
-+ /* $XFree86: $ */
-+
-+ /*
-+
-+ Copyright (c) 1998 Daryll Strauss
-+
-+ */
-+
-+ #define NEED_REPLIES
-+ #define NEED_EVENTS
-+ #include "X.h"
-+ #include "Xproto.h"
-+ #include "misc.h"
-+ #include "dixstruct.h"
-+ #include "extnsionst.h"
-+ #include "colormapst.h"
-+ #include "cursorstr.h"
-+ #include "scrnintstr.h"
-+ #include "servermd.h"
-+ #define _XF86RUSH_SERVER_
-+ #include "xf86rushstr.h"
-+ #include "swaprep.h"
-+ #include "../hw/xfree86/common/xf86.h"
-+ #include <dlfcn.h>
-+
-+ #include <X11/Xtrans.h>
-+ #include "../os/osdep.h"
-+ #include <X11/Xauth.h>
-+ #ifndef ESIX
-+ #ifndef Lynx
-+ #include <sys/socket.h>
-+ #else
-+ #include <socket.h>
-+ #endif
-+ #else
-+ #include <lan/socket.h>
-+ #endif
-+
-+ extern int xf86ScreenIndex;
-+ static unsigned char RushReqCode = 0;
-+ static int RushErrorBase;
-+
-+ static DISPATCH_PROC(ProcXF86RushDispatch);
-+ static DISPATCH_PROC(ProcRushQueryVersion);
-+ static DISPATCH_PROC(ProcRushLockPixmap);
-+ static DISPATCH_PROC(ProcRushUnlockPixmap);
-+ static DISPATCH_PROC(ProcRushUnlockAllPixmaps);
-+
-+ static DISPATCH_PROC(SProcXF86RushDispatch);
-+
-+ static void XF86RushResetProc(
-+ #if NeedFunctionPrototypes
-+ ExtensionEntry* /* extEntry */
-+ #endif
-+ );
-+
-+ void
-+ XFree86RushExtensionInit()
-+ {
-+ ExtensionEntry* extEntry;
-+
-+ if (
-+ (extEntry = AddExtension(XF86RUSHNAME,
-+ XF86RushNumberEvents,
-+ XF86RushNumberErrors,
-+ ProcXF86RushDispatch,
-+ SProcXF86RushDispatch,
-+ XF86RushResetProc,
-+ StandardMinorOpcode))) {
-+ RushReqCode = (unsigned char)extEntry->base;
-+ RushErrorBase = extEntry->errorBase;
-+ }
-+ }
-+
-+ /*ARGSUSED*/
-+ static void
-+ XF86RushResetProc (extEntry)
-+ ExtensionEntry* extEntry;
-+ {
-+ }
-+
-+ static int
-+ ProcRushQueryVersion(client)
-+ register ClientPtr client;
-+ {
-+ xXF86RushQueryVersionReply rep;
-+ register int n;
-+
-+ REQUEST_SIZE_MATCH(xXF86RushQueryVersionReq);
-+ rep.type = X_Reply;
-+ rep.length = 0;
-+ rep.sequenceNumber = client->sequence;
-+ rep.majorVersion = XF86RUSH_MAJOR_VERSION;
-+ rep.minorVersion = XF86RUSH_MINOR_VERSION;
-+ if (client->swapped) {
-+ swaps(&rep.sequenceNumber, n);
-+ swapl(&rep.length, n);
-+ }
-+ WriteToClient(client, sizeof(xXF86RushQueryVersionReply), (char *)&rep);
-+ return (client->noClientException);
-+ }
-+
-+ static int
-+ ProcXF86RushLockPixmap(client)
-+ register ClientPtr client;
-+ {
-+ REQUEST(xXF86RushLockPixmapReq);
-+ xXF86RushLockPixmapReply rep;
-+ ScrnInfoPtr vptr;
-+ PixmapPtr pix;
-+ void *handle;
-+ void *(*func)();
-+
-+ if (stuff->screen > screenInfo.numScreens)
-+ return BadValue;
-+
-+ vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
-+
-+ REQUEST_SIZE_MATCH(xXF86RushLockPixmapReq);
-+ rep.type = X_Reply;
-+ rep.length = 0;
-+ rep.sequenceNumber = client->sequence;
-+ pix = (PixmapPtr)SecurityLookupIDByType(client,
-+ stuff->pixmap, RT_PIXMAP,
-+ SecurityReadAccess);
-+ handle=dlopen(0, 0);
-+ if (handle) {
-+ func=(void*(*)())dlsym(handle, "xf86LockPixmap");
-+ dlclose(handle);
-+ }
-+ if (handle && func) rep.addr=(int)func(pix);
-+ else rep.addr = 0;
-+
-+ WriteToClient(client, SIZEOF(xXF86RushLockPixmapReply), (char*)&rep);
-+ return client->noClientException;
-+ }
-+
-+ static int
-+ ProcXF86RushUnlockPixmap(client)
-+ register ClientPtr client;
-+ {
-+ REQUEST(xXF86RushUnlockPixmapReq);
-+ ScrnInfoPtr vptr;
-+ PixmapPtr pix;
-+ void *handle;
-+ void (*func)();
-+
-+ if (stuff->screen > screenInfo.numScreens)
-+ return BadValue;
-+
-+ vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
-+ REQUEST_SIZE_MATCH(xXF86RushUnlockPixmapReq);
-+ pix = (PixmapPtr)SecurityLookupIDByType(client,
-+ stuff->pixmap, RT_PIXMAP,
-+ SecurityReadAccess);
-+ handle=dlopen(0, 0);
-+ if (handle) {
-+ func=(void(*)())dlsym(handle, "xf86UnlockPixmap");
-+ dlclose(handle);
-+ }
-+ if (handle && func) func(pix);
-+ return client->noClientException;
-+ }
-+
-+ static int
-+ ProcXF86RushUnlockAllPixmaps(client)
-+ register ClientPtr client;
-+ {
-+ void *handle;
-+ void (*func)();
-+
-+ REQUEST(xXF86RushUnlockAllPixmapsReq);
-+ REQUEST_SIZE_MATCH(xXF86RushUnlockAllPixmapsReq);
-+ handle=dlopen(0, 0);
-+ if (handle) {
-+ func=(void(*)())dlsym(handle, "xf86UnlockAllPixmaps");
-+ dlclose(handle);
-+ }
-+ if (handle && func) func();
-+ return client->noClientException;
-+ }
-+
-+ ProcXF86RushDispatch (client)
-+ register ClientPtr client;
-+ {
-+ REQUEST(xReq);
-+
-+ if (!LocalClient(client))
-+ return RushErrorBase + XF86RushClientNotLocal;
-+
-+ switch (stuff->data)
-+ {
-+ case X_XF86RushQueryVersion:
-+ return ProcRushQueryVersion(client);
-+ case X_XF86RushLockPixmap:
-+ return ProcXF86RushLockPixmap(client);
-+ case X_XF86RushUnlockPixmap:
-+ return ProcXF86RushUnlockPixmap(client);
-+ case X_XF86RushUnlockAllPixmaps:
-+ return ProcXF86RushUnlockAllPixmaps(client);
-+ default:
-+ return BadRequest;
-+ }
-+ }
-+
-+ SProcXF86RushDispatch (client)
-+ register ClientPtr client;
-+ {
-+ REQUEST(xReq);
-+
-+ return RushErrorBase + XF86RushClientNotLocal;
-+ }
-+
-diff -c -N -r xc.old/programs/Xserver/hw/xfree86/LinkKit/Imakefile ./hw/xfree86/LinkKit/Imakefile
-*** xc.old/programs/Xserver/hw/xfree86/LinkKit/Imakefile Sun Jan 12 02:41:28 1997
---- xc/programs/Xserver/hw/xfree86/LinkKit/Imakefile Sun Apr 4 18:13:41 1999
-***************
-*** 73,78 ****
---- 73,79 ----
- LimitBoolean("BuildXF86VidModeExt", NO, BuildXF86VidModeExt) >> $@
- LimitBoolean("BuildXF86MiscExt", NO, BuildXF86MiscExt) >> $@
- LimitBoolean("BuildXF86DGA", NO, BuildXF86DGA) >> $@
-+ LimitBoolean("BuildXF86RushExt", NO, BuildXF86RushExt) >> $@
- LimitBoolean("BuildDPMSExt", BuildDPMSExt, BuildDPMSExt) >> $@
-
- clean::
-diff -c -N -r xc.old/programs/Xserver/hw/xfree86/common/xf86Cursor.c ./hw/xfree86/common/xf86Cursor.c
-*** xc.old/programs/Xserver/hw/xfree86/common/xf86Cursor.c Sat Oct 31 12:13:18 1998
---- xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c Sun Apr 4 18:13:41 1999
-***************
-*** 138,143 ****
---- 138,150 ----
- Bool frameChanged = FALSE;
- ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
-
-+ #ifdef XFreeXDGA
-+ /*
-+ * Since we're in DGA mode we need to trash this scroll request
-+ */
-+ if (pScr->directMode&XF86DGADirectGraphics)
-+ return;
-+ #endif
- /*
- * check wether (x,y) belongs to the visual part of the screen
- * if not, change the base of the displayed frame accoring
-diff -c -N -r xc.old/programs/Xserver/hw/xfree86/vga256/drivers/apm/apm_cursor.c ./hw/xfree86/vga256/drivers/apm/apm_cursor.c
-*** xc.old/programs/Xserver/hw/xfree86/vga256/drivers/apm/apm_cursor.c Sun Jan 18 02:35:30 1998
---- xc/programs/Xserver/hw/xfree86/vga256/drivers/apm/apm_cursor.c Sun Apr 4 18:13:42 1999
-***************
-*** 23,29 ****
- #include "apm.h"
-
- static void ApmShowCursor(void);
-! static void ApmHideCursor(void);
- static Bool ApmRealizeCursor(ScreenPtr pScr, CursorPtr pCurs);
- static Bool ApmUnrealizeCursor(ScreenPtr pScr, CursorPtr pCurs);
- static void ApmLoadCursorToCard(ScreenPtr pScr, CursorPtr pCurs, int x, int y);
---- 23,29 ----
- #include "apm.h"
-
- static void ApmShowCursor(void);
-! void ApmHideCursor(void);
- static Bool ApmRealizeCursor(ScreenPtr pScr, CursorPtr pCurs);
- static Bool ApmUnrealizeCursor(ScreenPtr pScr, CursorPtr pCurs);
- static void ApmLoadCursorToCard(ScreenPtr pScr, CursorPtr pCurs, int x, int y);
-***************
-*** 108,114 ****
- * This is also a local function, it's not called from outside.
- */
-
-! static void
- ApmHideCursor(void)
- {
- ApmCheckMMIO_Init();
---- 108,114 ----
- * This is also a local function, it's not called from outside.
- */
-
-! void
- ApmHideCursor(void)
- {
- ApmCheckMMIO_Init();
-diff -c -N -r xc.old/programs/Xserver/hw/xfree86/vga256/drivers/apm/apm_driver.c ./hw/xfree86/vga256/drivers/apm/apm_driver.c
-*** xc.old/programs/Xserver/hw/xfree86/vga256/drivers/apm/apm_driver.c Sun Feb 15 16:42:15 1998
---- xc/programs/Xserver/hw/xfree86/vga256/drivers/apm/apm_driver.c Sun Apr 4 18:13:42 1999
-***************
-*** 610,616 ****
---- 610,624 ----
-
- #ifdef XFreeXDGA
- if (vga256InfoRec.directMode&XF86DGADirectGraphics && !enter)
-+ {
-+ if (vgaHWCursor.Initialized == TRUE)
-+ {
-+ extern void ApmHideCursor(void);
-+ ApmHideCursor();
-+ }
- return;
-+ }
-+
- #endif
-
- if (enter)
-***************
-*** 965,970 ****
---- 973,985 ----
- */
- modinx(vgaIOBase + 4, 0x1c, 0x0f, (Base & 0x0f0000) >> 16);
-
-+ #ifdef XFreeXDGA
-+ if (vga256InfoRec.directMode & XF86DGADirectGraphics) {
-+ /* Wait until vertical retrace is in progress. */
-+ while (inb(vgaIOBase + 0xA) & 0x08);
-+ while (!(inb(vgaIOBase + 0xA) & 0x08));
-+ }
-+ #endif
- }
-
- /*
-diff -c -N -r xc.old/programs/Xserver/hw/xfree86/xaa/xf86cparea.c ./hw/xfree86/xaa/xf86cparea.c
-*** xc.old/programs/Xserver/hw/xfree86/xaa/xf86cparea.c Mon Nov 18 05:22:11 1996
---- xc/programs/Xserver/hw/xfree86/xaa/xf86cparea.c Tue Apr 6 23:51:36 1999
-***************
-*** 85,90 ****
---- 85,92 ----
- #include "xf86xaa.h"
- #include "xf86local.h"
-
-+ #include "xf86Priv.h"
-+ #include "xf86pcache.h"
-
- RegionPtr
- xf86CopyArea(pSrcDrawable, pDstDrawable,
-***************
-*** 96,105 ****
- int width, height;
- int dstx, dsty;
- {
-! if (pSrcDrawable->type == DRAWABLE_WINDOW
-! && pDstDrawable->type == DRAWABLE_WINDOW) {
- return (*xf86GCInfoRec.cfbBitBltDispatch)(
-! pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty,
- xf86DoBitBlt, 0L);
- }
---- 98,110 ----
- int width, height;
- int dstx, dsty;
- {
-! if ((pDstDrawable->type == DRAWABLE_WINDOW) &&
-! ((pSrcDrawable->type == DRAWABLE_WINDOW) ||
-! ((xf86AccelInfoRec.Flags & PIXMAP_CACHE) &&
-! (pSrcDrawable->type == DRAWABLE_PIXMAP) &&
-! xf86CacheIsLocked((PixmapPtr)pSrcDrawable)))) {
- return (*xf86GCInfoRec.cfbBitBltDispatch)(
-! pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty,
- xf86DoBitBlt, 0L);
- }
-***************
-*** 132,137 ****
---- 137,154 ----
- int xdir; /* 1 = left right, -1 = right left/ */
- int ydir; /* 1 = top down, -1 = bottom up */
- int careful;
-+ extern CacheInfoPtr xf86CacheInfo;
-+ int i, slot;
-+
-+ /* Handle locked pixmaps just like screen to screen blits */
-+ if (pSrc->type==DRAWABLE_PIXMAP) {
-+ slot=((xf86PixPrivPtr)((PixmapPtr)pSrc)->devPrivates[xf86PixmapIndex].ptr)->slot;
-+ pptTmp=pptSrc;
-+ for (i=0; i<REGION_NUM_RECTS(prgnDst); i++, pptTmp++) {
-+ pptTmp->x+=xf86CacheInfo[slot].x;
-+ pptTmp->y+=xf86CacheInfo[slot].y;
-+ }
-+ }
-
- /* XXX we have to err on the side of safety when both are windows,
- * because we don't know if IncludeInferiors is being used.
-diff -c -N -r xc.old/programs/Xserver/hw/xfree86/xaa/xf86pcache.c ./hw/xfree86/xaa/xf86pcache.c
-*** xc.old/programs/Xserver/hw/xfree86/xaa/xf86pcache.c Sun Feb 8 07:36:25 1998
---- xc/programs/Xserver/hw/xfree86/xaa/xf86pcache.c Tue Apr 13 12:21:33 1999
-***************
-*** 127,144 ****
-
- CacheInfoPtr xf86CacheInfo = NULL;
- static int MaxSlot;
- static int MaxWidth;
- static int MaxHeight;
- static unsigned int pixmap_cache_clock = 1;
- static int FirstWideSlot;
- static int MaxWideSlotHeight;
-
- void xf86InitPixmapCacheSlots()
- {
- ScrnInfoPtr infoRec;
- int memoryStart, memoryEnd;
-! int width_in_bytes, cache_start_y, i;
-! int height_left, standard_slots, wide_slots, wide_slot_width;
-
- infoRec = xf86AccelInfoRec.ServerInfoRec;
- memoryStart = xf86AccelInfoRec.PixmapCacheMemoryStart;
---- 127,147 ----
-
- CacheInfoPtr xf86CacheInfo = NULL;
- static int MaxSlot;
-+ static int MaxBigSlot;
- static int MaxWidth;
- static int MaxHeight;
- static unsigned int pixmap_cache_clock = 1;
- static int FirstWideSlot;
-+ static int FirstBigSlot;
- static int MaxWideSlotHeight;
-+ static int cache_start_y;
-
- void xf86InitPixmapCacheSlots()
- {
- ScrnInfoPtr infoRec;
- int memoryStart, memoryEnd;
-! int width_in_bytes, i;
-! int height_left, standard_slots, wide_slots, wide_slot_width, big_slots;
-
- infoRec = xf86AccelInfoRec.ServerInfoRec;
- memoryStart = xf86AccelInfoRec.PixmapCacheMemoryStart;
-***************
-*** 228,236 ****
- }
- }
-
- MaxSlot = standard_slots + wide_slots - 1;
-! xf86CacheInfo = (CacheInfoPtr)xcalloc(MaxSlot + 1, sizeof(CacheInfo));
- FirstWideSlot = standard_slots;
-
- ErrorF("%s %s: XAA: Using %d %dx%d ",
- XCONFIG_PROBED, infoRec->name, standard_slots, MaxWidth, MaxHeight);
---- 231,243 ----
- }
- }
-
-+ /* Arbitrarily say you can have 10 big slots */
-+ big_slots = 10;
- MaxSlot = standard_slots + wide_slots - 1;
-! MaxBigSlot = MaxSlot + big_slots;
-! xf86CacheInfo = (CacheInfoPtr)xcalloc(MaxBigSlot + 1, sizeof(CacheInfo));
- FirstWideSlot = standard_slots;
-+ FirstBigSlot = standard_slots + wide_slots;
-
- ErrorF("%s %s: XAA: Using %d %dx%d ",
- XCONFIG_PROBED, infoRec->name, standard_slots, MaxWidth, MaxHeight);
-***************
-*** 255,261 ****
- xf86CacheInfo[i + standard_slots].cache_height = min(32, height_left);
- }
-
-! for (i = 0; i <= MaxSlot; i++) {
- xf86CacheInfo[i].id = -1;
- xf86CacheInfo[i].lru = pixmap_cache_clock;
- xf86CacheInfo[i].fg_color = 0;
---- 262,268 ----
- xf86CacheInfo[i + standard_slots].cache_height = min(32, height_left);
- }
-
-! for (i = 0; i <= MaxBigSlot; i++) {
- xf86CacheInfo[i].id = -1;
- xf86CacheInfo[i].lru = pixmap_cache_clock;
- xf86CacheInfo[i].fg_color = 0;
-***************
-*** 315,321 ****
- #ifdef PIXPRIV
- devPriv = (xf86PixPrivPtr)(pix->devPrivates[xf86PixmapIndex].ptr);
-
-! if (devPriv->slot == MaxSlot + 1)
- /*
- * Special value indicates that this pattern was found to be
- * non-cachable.
---- 322,328 ----
- #ifdef PIXPRIV
- devPriv = (xf86PixPrivPtr)(pix->devPrivates[xf86PixmapIndex].ptr);
-
-! if (devPriv->slot == MaxBigSlot + 1)
- /*
- * Special value indicates that this pattern was found to be
- * non-cachable.
-***************
-*** 344,350 ****
- * pattern, but can't, and ScreenToScreencopy doesn't have
- * the required support for transparency.
- */
-! devPriv->slot = MaxSlot + 1;
- return 0;
- }
- devPriv->slot = slot;
---- 351,357 ----
- * pattern, but can't, and ScreenToScreencopy doesn't have
- * the required support for transparency.
- */
-! devPriv->slot = MaxBigSlot + 1;
- return 0;
- }
- devPriv->slot = slot;
-***************
-*** 893,898 ****
---- 900,906 ----
- pci->flags = 0;
- pci->lru = pixmap_cache_clock;
- pci->id = pix->drawable.serialNumber;
-+ pci->locked = FALSE;
-
- reducible_status = TILE_UNKNOWN;
-
-***************
-*** 1303,1305 ****
---- 1311,1483 ----
- return (pix->drawable.width <= MaxWidth &&
- pix->drawable.height <= MaxHeight);
- }
-+
-+ /* Rush extension support */
-+
-+ int testOverlap(pcipix)
-+ CacheInfoPtr pcipix;
-+ {
-+ int slot;
-+ CacheInfoPtr pcitest;
-+
-+ for (slot=FirstBigSlot; slot<=MaxBigSlot; slot++) {
-+ if (xf86CacheInfo[slot].id>0) {
-+ pcitest=&xf86CacheInfo[slot];
-+ if (!((pcipix->x+pcipix->w<pcitest->x ||
-+ pcipix->x>pcitest->x+pcitest->w) &&
-+ (pcipix->y+pcipix->h<pcitest->y ||
-+ pcipix->y>pcitest->y+pcitest->w)))
-+ return 1;
-+ }
-+ }
-+ return 0;
-+ }
-+
-+
-+ /*
-+ Dividing up the extra memory among X and Glide is difficult.
-+ We'll take what we're given and then try to stick up to big_slots
-+ pixmaps within it. big_slots should be small to keep this efficient.
-+ To fit the pixmap we'll try to put it next to and below each
-+ existing pixmap. Then we'll check if it overlaps anything.
-+ */
-+ static int
-+ findPosition(pci, pix)
-+ CacheInfoPtr pci;
-+ PixmapPtr pix;
-+ {
-+ int slot, bestx, besty;
-+
-+ bestx=-2;
-+ for (slot=FirstBigSlot; slot<=MaxBigSlot; slot++) {
-+ if (xf86CacheInfo[slot].id>0) {
-+ if (bestx==-2) bestx==-1;
-+ /* Check for fit to right */
-+ pci->x=xf86CacheInfo[slot].x+xf86CacheInfo[slot].w;
-+ pci->y=xf86CacheInfo[slot].y;
-+ if (bestx<0 || (bestx+besty>pci->x+pci->y)) {
-+ if (!testOverlap(pci, &xf86CacheInfo[slot])) {
-+ bestx=pci->x;
-+ besty=pci->y;
-+ }
-+ }
-+ /* Check for fit below */
-+ pci->x=xf86CacheInfo[slot].x;
-+ pci->y=xf86CacheInfo[slot].y+xf86CacheInfo[slot].h;
-+ if (bestx<0 || (bestx+besty>pci->x+pci->y)) {
-+ if (!testOverlap(pci, &xf86CacheInfo[slot])) {
-+ bestx=pci->x;
-+ besty=pci->y;
-+ }
-+ }
-+ }
-+ }
-+ if (bestx==-2) { /* Nothing in the list yet */
-+ bestx=0;
-+ besty=cache_start_y+MaxHeight;
-+ }
-+ if (bestx==-1) { /* Doesn't fit */
-+ return 0;
-+ }
-+ pci->x=bestx;
-+ pci->y=besty;
-+ }
-+
-+ void *
-+ xf86LockPixmap(pix)
-+ PixmapPtr pix;
-+ {
-+ xf86PixPrivPtr devPriv =
-+ (xf86PixPrivPtr)(pix->devPrivates[xf86PixmapIndex].ptr);
-+ int slot, size;
-+ ScrnInfoPtr infoRec;
-+ CacheInfoPtr pci;
-+
-+ switch (xf86AccelInfoRec.BitsPerPixel) {
-+ case 8:
-+ size=1;
-+ break;
-+ case 16:
-+ size=2;
-+ break;
-+ case 24:
-+ size=3;
-+ break;
-+ case 32:
-+ size=4;
-+ break;
-+ case 1:
-+ case 4:
-+ default:
-+ return 0;
-+ }
-+ for (slot=FirstBigSlot; slot<MaxBigSlot ; slot++) {
-+ if (slot==-1) break;
-+ }
-+ if (slot==MaxBigSlot) return 0;
-+ /* Assign the slot */
-+ IncrementCacheLRU(slot);
-+ devPriv->slot = slot;
-+ /* Fill in the cache entry */
-+ pci = &xf86CacheInfo[devPriv->slot];
-+ pci->pix_w = pix->drawable.width;
-+ pci->pix_h = pix->drawable.height;
-+ pci->nx = 1;
-+ pci->ny = 1;
-+ pci->w = pci->pix_w;
-+ pci->h = pci->pix_h;
-+ pci->fg_color = 0;
-+ pci->bg_color = 0;
-+ pci->flags = 0;
-+ pci->lru = pixmap_cache_clock;
-+ pci->locked = TRUE;
-+ /* Assign X & Y position */
-+ if (!findPosition(pci, pix)) return 0;
-+ pci->id = pix->drawable.serialNumber;
-+ xf86AccelInfoRec.ImageWrite(pci->x, pci->y, pci->pix_w, pci->pix_h,
-+ pix->devPrivate.ptr, pix->devKind, GXcopy,
-+ 0xFFFFFFFF);
-+ infoRec=xf86AccelInfoRec.ServerInfoRec;
-+ return (void*)(infoRec->physBase +
-+ (xf86CacheInfo[slot].x +
-+ xf86CacheInfo[slot].y*infoRec->displayWidth) * size);
-+ }
-+
-+ void
-+ xf86UnlockPixmap(pix)
-+ PixmapPtr pix;
-+ {
-+ xf86PixPrivPtr devPriv =
-+ (xf86PixPrivPtr)(pix->devPrivates[xf86PixmapIndex].ptr);
-+ if (devPriv->slot<0) return;
-+ xf86CacheInfo[devPriv->slot].locked = FALSE;
-+ xf86CacheInfo[devPriv->slot].id = -1;
-+ devPriv->slot = 0;
-+ }
-+
-+ void
-+ xf86UnlockAllPixmaps()
-+ {
-+ int i;
-+
-+ for (i=FirstBigSlot; i<=MaxBigSlot; i++) {
-+ if (xf86CacheInfo[i].id>0 && xf86CacheInfo[i].locked) {
-+ xf86CacheInfo[i].locked = FALSE;
-+ xf86CacheInfo[i].id = -1;
-+ }
-+ }
-+ }
-+
-+ int
-+ xf86CacheIsLocked(pix)
-+ PixmapPtr pix;
-+ {
-+ xf86PixPrivPtr devPriv =
-+ (xf86PixPrivPtr)(pix->devPrivates[xf86PixmapIndex].ptr);
-+ int slot;
-+
-+ slot=devPriv->slot;
-+ if (slot<FirstBigSlot || slot>MaxBigSlot) return 0;
-+ return xf86CacheInfo[slot].locked;
-+ }
-+
-diff -c -N -r xc.old/programs/Xserver/hw/xfree86/xaa/xf86pcache.h ./hw/xfree86/xaa/xf86pcache.h
-*** xc.old/programs/Xserver/hw/xfree86/xaa/xf86pcache.h Fri Jan 17 22:57:28 1997
---- xc/programs/Xserver/hw/xfree86/xaa/xf86pcache.h Sun Apr 4 18:13:42 1999
-***************
-*** 19,24 ****
---- 19,25 ----
- int pattern0; /* if fixed pattern, pattern 0 register contents */
- int pattern1; /* if fixed pattern, pattern 1 register contents */
- unsigned int lru; /* lru counter */
-+ Bool locked;
- } CacheInfo, *CacheInfoPtr;
-
- #ifdef PIXPRIV
-***************
-*** 43,45 ****
---- 44,47 ----
- void xf86InitPixmapCacheSlots();
-
- void xf86InvalidatePixmapCache();
-+
-diff -c -N -r xc.old/programs/Xserver/mi/Imakefile ./mi/Imakefile
-*** xc.old/programs/Xserver/mi/Imakefile Sat May 3 02:50:45 1997
---- xc/programs/Xserver/mi/Imakefile Sun Apr 4 18:13:42 1999
-***************
-*** 32,38 ****
- * Make sure XINPUT, XF86VidTune, etc aren't defined for the miinitext.o
- * used by Xnest, Xvfb
- */
-! EXT_DEFINES = ExtensionDefines -UXINPUT -UXF86VIDMODE -UXFreeXDGA -UXF86MISC
- #else
- EXT_DEFINES = ExtensionDefines
- #endif
---- 32,39 ----
- * Make sure XINPUT, XF86VidTune, etc aren't defined for the miinitext.o
- * used by Xnest, Xvfb
- */
-! EXT_DEFINES = ExtensionDefines -UXINPUT -UXF86VIDMODE -UXFreeXDGA -UXF86MISC \
-! -UXFreeXRUSH
- #else
- EXT_DEFINES = ExtensionDefines
- #endif
-diff -c -N -r xc.old/programs/Xserver/mi/miinitext.c ./mi/miinitext.c
-*** xc.old/programs/Xserver/mi/miinitext.c Thu May 22 07:00:46 1997
---- xc/programs/Xserver/mi/miinitext.c Sun Apr 4 18:13:42 1999
-***************
-*** 155,160 ****
---- 155,163 ----
- #ifdef XFreeXDGA
- extern void XFree86DGAExtensionInit(INITARGS);
- #endif
-+ #ifdef XFreeXRUSH
-+ extern void XFree86RushExtensionInit(INITARGS);
-+ #endif
- #ifdef DPMSExtension
- extern void DPMSExtensionInit(INITARGS);
- #endif
-***************
-*** 264,269 ****
---- 267,275 ----
- #endif
- #if defined(XFreeXDGA) && !defined(PRINT_ONLY_SERVER)
- XFree86DGAExtensionInit();
-+ #endif
-+ #if defined(XFreeXRUSH) && !defined(PRINT_ONLY_SERVER)
-+ XFree86RushExtensionInit();
- #endif
- #if defined(DPMSExtension) && !defined(PRINT_ONLY_SERVER)
- DPMSExtensionInit();
+++ /dev/null
---- XFree86-3.3.3.1/xc/programs/xdm/session.c~ Sat Jun 19 02:25:32 1999
-+++ XFree86-3.3.3.1/xc/programs/xdm/session.c Sat Jun 19 04:30:43 1999
-@@ -699,6 +699,32 @@
- #endif /* K5AUTH */
- bzero(passwd, strlen(passwd));
- SetUserAuthorization (d, verify);
-+#ifdef USE_PAM
-+{
-+ int i, j;
-+ const char *const *pam_env;
-+ char *tmp_pam_env;
-+
-+ pam_env = (const char *const *) pam_getenvlist((pam_handle_t *) pamh);
-+
-+ if (pam_env != NULL) {
-+ tmp_pam_env = malloc(4096);
-+ if (tmp_pam_env != NULL) {
-+ for (i = 0; pam_env[i]; i++) {
-+ Debug("env[%d] = %s\n", i, pam_env[i]);
-+ strncpy(tmp_pam_env, pam_env[i], 4095);
-+ tmp_pam_env[4095] = 0;
-+ j = 0;
-+ while (tmp_pam_env[j] != '=')
-+ j++;
-+ tmp_pam_env[j] = 0;
-+ verify->userEnviron = setEnv(verify->userEnviron, tmp_pam_env, &tmp_pam_env[j + 1]);
-+ }
-+ }
-+ free(tmp_pam_env);
-+ }
-+}
-+#endif
- home = getEnv (verify->userEnviron, "HOME");
- if (home)
- if (chdir (home) == -1) {
+++ /dev/null
-diff -Nur XFree86-4.0.2.org/xc/programs/xdm/greeter/verify.c XFree86-4.0.2/xc/programs/xdm/greeter/verify.c
---- XFree86-4.0.2.org/xc/programs/xdm/greeter/verify.c Wed Nov 29 17:46:09 2000
-+++ XFree86-4.0.2/xc/programs/xdm/greeter/verify.c Thu Dec 21 12:02:33 2000
-@@ -114,6 +114,7 @@
-
- #ifdef USE_PAM
- static char *PAM_password;
-+extern pam_handle_t *pamh;
- static int pam_error;
-
- static int PAM_conv (int num_msg,
-@@ -162,12 +163,8 @@
- Verify (struct display *d, struct greet_info *greet, struct verify_info *verify)
- {
- struct passwd *p;
--#ifdef USE_PAM
-- pam_handle_t **pamhp = thepamhp();
--#else
- #ifdef USESHADOW
- struct spwd *sp;
--#endif
- #endif
- #ifdef __OpenBSD__
- char *s;
-diff -Nur XFree86-4.0.2.org/xc/programs/xdm/session.c XFree86-4.0.2/xc/programs/xdm/session.c
---- XFree86-4.0.2.org/xc/programs/xdm/session.c Tue Dec 5 01:59:35 2000
-+++ XFree86-4.0.2/xc/programs/xdm/session.c Thu Dec 21 12:06:41 2000
-@@ -97,9 +97,9 @@
- extern char *crypt(CRYPT_ARGS);
- #endif
- #ifdef USE_PAM
-+pam_handle_t *pamh;
- pam_handle_t **thepamhp()
- {
-- static pam_handle_t *pamh = NULL;
- return &pamh;
- }
-
-@@ -472,9 +472,6 @@
- SessionExit (struct display *d, int status, int removeAuth)
- {
- #ifdef USE_PAM
-- pam_handle_t *pamh = thepamh();
--#endif
--#ifdef USE_PAM
- if (pamh) {
- /* shutdown PAM session */
- pam_close_session(pamh, 0);
-@@ -535,9 +532,6 @@
- int pid;
- #ifdef HAS_SETUSERCONTEXT
- struct passwd* pwd;
--#endif
--#ifdef USE_PAM
-- pam_handle_t *pamh = thepamh();
- #endif
-
- if (verify->argv) {
+++ /dev/null
-diff -Naur -x CVS xc.orig/config/cf/FreeBSD.cf xc/config/cf/FreeBSD.cf
---- XFree86-4.0.2.orig/xc/config/cf/FreeBSD.cf Mon Dec 4 13:49:09 2000
-+++ XFree86-4.0.2/xc/config/cf/FreeBSD.cf Mon Jan 22 14:49:12 2001
-@@ -59,6 +59,12 @@
- #define HasNCurses YES
- #define HasVarRun YES
- #define HasVarDb YES
-+
-+#if (OSMajorVersion > 1)
-+#define InstallXloadSetGID NO
-+#else
-+#define InstallXloadSetGID YES
-+#endif
-
- #define AvoidNullMakeCommand YES
- #define StripInstalledPrograms YES
-diff -Naur -x CVS xc.orig/config/cf/Imake.rules xc/config/cf/Imake.rules
---- XFree86-4.0.2.orig/xc/config/cf/Imake.rules Sat Dec 16 12:32:59 2000
-+++ XFree86-4.0.2/xc/config/cf/Imake.rules Sat Jan 27 15:08:17 2001
-@@ -1217,7 +1217,7 @@
- InstallHtmlManPageAliases(file,aliases,$(MANSUFFIX)) @@\
- @@\
- install.man:: @@\
-- @(TMP=/tmp/tmp.$$$$; \ @@\
-+ @(TMP=#tmp.$$$$; \ @@\
- RemoveFile($${TMP}); \ @@\
- echo .so `basename destdir`/file.$(MANSUFFIX) > $${TMP}; \ @@\
- for i in aliases; do (set -x; \ @@\
-@@ -1258,7 +1258,7 @@
- InstallHtmlManPageAliases(file,aliases,suffix) @@\
- @@\
- install.man:: @@\
-- @(TMP=/tmp/tmp.$$$$; \ @@\
-+ @(TMP=#tmp.$$$$; \ @@\
- RemoveFile($${TMP}); \ @@\
- echo .so `basename destdir`/file.suffix > $${TMP}; \ @@\
- for i in aliases; do (set -x; \ @@\
-diff -Naur -x CVS xc.orig/config/cf/NetBSD.cf xc/config/cf/NetBSD.cf
---- XFree86-4.0.2.orig/xc/config/cf/NetBSD.cf Sun Dec 3 11:14:08 2000
-+++ XFree86-4.0.2/xc/config/cf/NetBSD.cf Mon Jan 22 14:49:14 2001
-@@ -71,6 +71,8 @@
-
- #define HasVarRun YES
- #define HasVarDb YES
-+
-+#define InstallXloadSetGID NO
-
- /* Defines for using the GNU pth thread library -- experimental */
-
-diff -Naur -x CVS xc.orig/config/cf/OpenBSD.cf xc/config/cf/OpenBSD.cf
---- XFree86-4.0.2.orig/xc/config/cf/OpenBSD.cf Sat Dec 2 15:15:03 2000
-+++ XFree86-4.0.2/xc/config/cf/OpenBSD.cf Mon Jan 22 14:49:15 2001
-@@ -71,6 +71,8 @@
-
- #define HasVarRun YES
- #define HasVarDb YES
-+
-+#define InstallXloadSetGID NO
-
- #ifndef HasLibPthread
- #define HasLibPthread NO
-diff -Naur -x CVS xc.orig/config/cf/X11.tmpl xc/config/cf/X11.tmpl
---- XFree86-4.0.2.orig/xc/config/cf/X11.tmpl Sat Dec 16 12:33:01 2000
-+++ XFree86-4.0.2/xc/config/cf/X11.tmpl Mon Jan 22 14:49:17 2001
-@@ -339,6 +339,9 @@
- #ifndef InstallXtermSetUID
- #define InstallXtermSetUID YES /* xterm needs to be set uid */
- #endif
-+#ifndef InstallXloadSetGID
-+#define InstallXloadSetGID YES /* xload often needs set gid kmem */
-+#endif
- #ifndef InstallXinitConfig
- #define InstallXinitConfig NO /* install sample xinit config */
- #endif
-@@ -358,6 +361,12 @@
- #ifndef InstallAppDefFiles
- #define InstallAppDefFiles YES /* install application defaults */
- #endif
-+#ifndef UseConfDirForAppDefaults
-+#define UseConfDirForAppDefaults YES
-+#endif
-+#ifndef UseConfDirForXkb
-+#define UseConfDirForXkb YES
-+#endif
- #ifndef CompressAllFonts
- #define CompressAllFonts NO
- #endif
-@@ -2347,6 +2356,7 @@
- * if the InstallAppDefFiles configuration parameter is set.
- */
- #ifndef InstallAppDefaultsLong
-+#if UseConfDirForAppDefaults
- #if InstallAppDefFiles
- #define InstallAppDefaultsLong(file,class) @@\
- LinkConfDirectory(app-defaults,.,app-defaults,.) @@\
-@@ -2356,6 +2366,15 @@
- LinkConfDirectory(app-defaults,.,app-defaults,.) @@\
- InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class)
- #endif /* InstallAppDefFiles */
-+#else /* UseConfDirForAppDefaults */
-+#if InstallAppDefFiles
-+#define InstallAppDefaultsLong(file,class) @@\
-+InstallNamedTarget(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class)
-+#else
-+#define InstallAppDefaultsLong(file,class) @@\
-+InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class)
-+#endif /* InstallAppDefFiles */
-+#endif /* UseConfDirForAppDefaults */
- #endif /* InstallAppDefaultsLong */
-
- /*
-diff -Naur -x CVS xc.orig/config/cf/linux.cf xc/config/cf/linux.cf
---- XFree86-4.0.2.orig/xc/config/cf/linux.cf Sat Dec 16 12:33:00 2000
-+++ XFree86-4.0.2/xc/config/cf/linux.cf Mon Jan 22 14:49:19 2001
-@@ -215,6 +215,10 @@
- # ifndef HasLibCrypt
- # define HasLibCrypt NO
- # endif
-+#endif
-+
-+#ifndef InstallXloadSetGID
-+#define InstallXloadSetGID NO
- #endif
-
- /* <linux/input.h> support mainly for USB support */
-diff -Naur -x CVS xc.orig/config/cf/osf1.cf xc/config/cf/osf1.cf
---- XFree86-4.0.2.orig/xc/config/cf/osf1.cf Wed Jun 11 08:24:18 1997
-+++ XFree86-4.0.2/xc/config/cf/osf1.cf Mon Jan 22 14:49:23 2001
-@@ -35,6 +35,9 @@
- #define ShLibDir /usr/shlib
- #define SharedLibPex NO /* losing, no shared -lm */
- #endif
-+
-+#define InstallXloadSetGID NO
-+
- #define ThreadedX ModernOSF1
-
- #if ThreadedX
-diff -Naur -x CVS xc.orig/config/util/gccmdep.cpp xc/config/util/gccmdep.cpp
---- XFree86-4.0.2.orig/xc/config/util/gccmdep.cpp Tue Nov 14 16:59:21 2000
-+++ XFree86-4.0.2/xc/config/util/gccmdep.cpp Sat Jan 27 15:07:33 2001
-@@ -14,6 +14,18 @@
- LN=LNCMD
- MV=MVCMD
-
-+XCOMM Security: if $tmp exists exit immediately
-+rm -f ${TMP}
-+if [ -e ${TMP} ] ; then
-+ echo "$0: ${TMP} exists already, exit." 1>&2
-+ exit 1;
-+fi
-+#if defined(HAS_MKTEMP)
-+if [ -n "`type -p mktemp`" ] ; then
-+ TMP="`mktemp ${TMP}.XXXXXX`" || exit 1
-+fi
-+#endif
-+
- trap "$RM ${TMP}*; exit 1" 1 2 15
- trap "$RM ${TMP}*; exit 0" 1 2 13
-
-@@ -33,7 +45,7 @@
- -D*|-I*)
- args="$args '$1'"
- ;;
-- -g|-O*)
-+ -g|-O)
- ;;
- *)
- if [ "$endmarker"x = x ]; then
-diff -Naur -x CVS xc.orig/extras/rman/rman.c xc/extras/rman/rman.c
---- XFree86-4.0.2.orig/xc/extras/rman/rman.c Fri Dec 1 13:48:08 2000
-+++ XFree86-4.0.2/xc/extras/rman/rman.c Thu Dec 21 14:01:07 2000
-@@ -474,12 +474,14 @@
- {
- char *p0;
- static char *nonhref = "\">'";
-+ static char *punct = ".,:;)]}?!";
-
- while (*p==' ') p++;
- if (strincmp(p,"http",4)==0) {
- href="%s"; manrefname = p;
- p+=4;
- while (*p && !isspace(*p) && !strchr(nonhref,*p)) p++;
-+ while (strchr(punct, *(p - 1))) p--;
- } else {
- href = manRef;
-
-diff -Naur -x CVS xc.orig/lib/Xaw/AsciiSrc.c xc/lib/Xaw/AsciiSrc.c
---- XFree86-4.0.2.orig/xc/lib/Xaw/AsciiSrc.c Tue Nov 28 12:25:09 2000
-+++ XFree86-4.0.2/xc/lib/Xaw/AsciiSrc.c Sat Jan 27 15:06:11 2001
-@@ -1456,7 +1456,7 @@
- open_mode = O_WRONLY | O_CREAT | O_EXCL;
- fdopen_mode = "w";
- }
-- else
-+ else {
- /* O_NOFOLLOW is a FreeBSD & Linux extension */
- #ifdef O_NOFOLLOW
- open_mode = O_RDWR | O_NOFOLLOW;
-@@ -1464,6 +1464,7 @@
- open_mode = O_RDWR; /* unsafe; subject to race conditions */
- #endif /* O_NOFOLLOW */
- fdopen_mode = "r+";
-+ }
- break;
- default:
- XtErrorMsg("badMode", "asciiSourceCreate", "XawError",
-diff -Naur -x CVS xc.orig/lib/Xaw/Form.c xc/lib/Xaw/Form.c
---- XFree86-4.0.2.orig/xc/lib/Xaw/Form.c Thu Oct 26 13:57:49 2000
-+++ XFree86-4.0.2/xc/lib/Xaw/Form.c Fri Feb 9 21:33:13 2001
-@@ -582,6 +582,11 @@
- always_resize_children =
- ChangeFormGeometry((Widget)fw, False, maxx, maxy, NULL, NULL);
-
-+#ifdef OLDXAW
-+ fw->form.old_width = fw->core.width;
-+ fw->form.old_height = fw->core.height;
-+#endif
-+
- if (force_relayout)
- ret_val = True;
- else
-@@ -656,7 +661,6 @@
- static void
- LayoutChild(Widget w)
- {
-- FormWidget fw = (FormWidget)XtParent(w);
- FormConstraints form = (FormConstraints)w->core.constraints;
- Widget ref;
-
-@@ -684,22 +688,16 @@
- form->form.new_y = form->form.dy;
- if ((ref = form->form.horiz_base) != NULL) {
- FormConstraints ref_form = (FormConstraints)ref->core.constraints;
-- Dimension width;
-
- LayoutChild(ref);
-- width = fw->form.old_width ?
-- ref_form->form.virtual_width : XtWidth(ref);
-- form->form.new_x += ref_form->form.new_x + width +
-+ form->form.new_x += ref_form->form.new_x + XtWidth(ref) +
- (XtBorderWidth(ref) << 1);
- }
- if ((ref = form->form.vert_base) != NULL) {
- FormConstraints ref_form = (FormConstraints)ref->core.constraints;
-- Dimension height;
-
- LayoutChild(ref);
-- height = fw->form.old_height ?
-- ref_form->form.virtual_height : XtHeight(ref);
-- form->form.new_y += ref_form->form.new_y + height +
-+ form->form.new_y += ref_form->form.new_y + XtHeight(ref) +
- (XtBorderWidth(ref) << 1);
- }
-
-@@ -891,8 +889,6 @@
- * The window will be updated when no_refigure is set back
- * to False
- */
-- form->form.virtual_width = XtWidth(w);
-- form->form.virtual_height = XtHeight(w);
- form->form.deferred_resize = True;
- ret_val = XtGeometryDone;
- }
-@@ -902,6 +898,8 @@
- /*
- * Resets everything.
- */
-+ fw->form.old_width = XtWidth(fw);
-+ fw->form.old_height = XtHeight(fw);
- for (childP = children; childP - children < num_children; childP++) {
- Widget nw = *childP;
-
-@@ -916,8 +914,6 @@
- nform->form.virtual_height = XtHeight(nw);
- }
- }
-- fw->form.old_width = XtWidth(fw);
-- fw->form.old_height = XtHeight(fw);
- }
- else {
- XtWidth(w) = old_width;
-@@ -1022,23 +1018,21 @@
- (*((FormWidgetClass)w->core.widget_class)->form_class.layout)
- (fw, XtWidth(w), XtHeight(w), True);
-
-- if (!fw->form.old_width || !fw->form.old_height) {
-- fw->form.old_width = XtWidth(w);
-- fw->form.old_height = XtHeight(w);
-- for (children = childP = fw->composite.children;
-- childP - children < num_children;
-- childP++) {
-- child = *childP;
-- if (!XtIsManaged(child))
-- continue;
-- form = (FormConstraints)child->core.constraints;
-+ fw->form.old_width = XtWidth(w);
-+ fw->form.old_height = XtHeight(w);
-+ for (children = childP = fw->composite.children;
-+ childP - children < num_children;
-+ childP++) {
-+ child = *childP;
-+ if (!XtIsManaged(child))
-+ continue;
-+ form = (FormConstraints)child->core.constraints;
- #ifndef OLDXAW
-- form->form.virtual_x = XtX(child);
-- form->form.virtual_y = XtY(child);
-+ form->form.virtual_x = XtX(child);
-+ form->form.virtual_y = XtY(child);
- #endif
-- form->form.virtual_width = XtWidth(child);
-- form->form.virtual_height = XtHeight(child);
-- }
-+ form->form.virtual_width = XtWidth(child);
-+ form->form.virtual_height = XtHeight(child);
- }
- }
-
-diff -Naur -x CVS xc.orig/lib/Xaw/MultiSrc.c xc/lib/Xaw/MultiSrc.c
---- XFree86-4.0.2.orig/xc/lib/Xaw/MultiSrc.c Mon Jul 19 09:36:02 1999
-+++ XFree86-4.0.2/xc/lib/Xaw/MultiSrc.c Sat Jan 27 15:06:56 2001
-@@ -67,6 +67,10 @@
- #include "XawI18n.h"
- #include "Private.h"
-
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <fcntl.h>
-+
- #define MAGIC_VALUE ((XawTextPosition)-1)
- #define streq(a, b) (strcmp((a), (b)) == 0)
-
-@@ -1158,7 +1162,9 @@
- static FILE *
- InitStringOrFile(MultiSrcObject src, Bool newString)
- {
-- char *open_mode = NULL;
-+ mode_t open_mode;
-+ const char *fdopen_mode = NULL;
-+ int fd;
- FILE *file;
- char fileName[TMPSIZ];
- Display *d = XtDisplayOfObject((Widget)src);
-@@ -1208,7 +1214,8 @@
- XtErrorMsg("NoFile", "multiSourceCreate", "XawError",
- "Creating a read only disk widget and no file specified.",
- NULL, 0);
-- open_mode = "r";
-+ open_mode = O_RDONLY;
-+ fdopen_mode = "r";
- break;
- case XawtextAppend:
- case XawtextEdit:
-@@ -1218,10 +1225,18 @@
-
- (void)tmpnam((char *)src->multi_src.string);
- src->multi_src.is_tempfile = True;
-- open_mode = "w";
-+ open_mode = O_WRONLY | O_CREAT | O_EXCL;
-+ fdopen_mode = "w";
-+ }
-+ else {
-+/* O_NOFOLLOW is a BSD & Linux extension */
-+#ifdef O_NOFOLLOW
-+ open_mode = O_RDWR | O_NOFOLLOW;
-+#else
-+ open_mode = O_RDWR; /* unsafe; subject to race conditions */
-+#endif
-+ fdopen_mode = "r+";
- }
-- else
-- open_mode = "r+";
- break;
- default:
- XtErrorMsg("badMode", "multiSourceCreate", "XawError",
-@@ -1243,12 +1258,14 @@
- }
-
- if (!src->multi_src.is_tempfile) {
-- if ((file = fopen((char *)src->multi_src.string, open_mode)) != NULL) {
-- (void)fseek(file, 0, 2);
-- src->multi_src.length = ftell(file);
-- return file;
-+ if ((fd = open((char *)src->multi_src.string, open_mode, 0666)) != 0) {
-+ if ((file = fdopen(fd, fdopen_mode)) != NULL) {
-+ (void)fseek(file, 0, SEEK_END);
-+ src->multi_src.length = (XawTextPosition)ftell(file);
-+ return(file);
-+ }
- }
-- else {
-+ {
- String params[2];
- Cardinal num_params = 2;
-
-@@ -1258,7 +1275,7 @@
- "openError", "multiSourceCreate", "XawWarning",
- "Cannot open file %s; %s", params, &num_params);
- }
-- }
-+ }
- src->multi_src.length = 0;
- return (NULL);
- }
-diff -Naur -x CVS xc.orig/lib/Xaw/Pixmap.c xc/lib/Xaw/Pixmap.c
---- XFree86-4.0.2.orig/xc/lib/Xaw/Pixmap.c Tue Sep 26 11:56:54 2000
-+++ XFree86-4.0.2/xc/lib/Xaw/Pixmap.c Fri Feb 9 21:33:13 2001
-@@ -437,7 +437,7 @@
- cache = (XawCache **)bsearch(screen, xaw->elems,
- xaw->num_elems, sizeof(XtPointer),
- bcmp_long);
-- if (!cache)
-+ if (!cache || !(*cache)->num_elems)
- return (NULL);
- if (flags == FIND_SCREEN)
- return (*cache);
-@@ -446,7 +446,7 @@
- cache = (XawCache **)bsearch((void *)colormap, (*cache)->elems,
- (*cache)->num_elems, sizeof(XtPointer),
- bcmp_long);
-- if (!cache)
-+ if (!cache || !(*cache)->num_elems)
- return (NULL);
- if (flags == FIND_COLORMAP)
- return (*cache);
-@@ -456,7 +456,7 @@
- (*cache)->num_elems, sizeof(XtPointer),
- bcmp_long);
-
-- if (!cache)
-+ if (!cache || !(*cache)->num_elems)
- return (NULL);
- return (*cache);
- }
-diff -Naur -x CVS xc.orig/lib/Xaw/Text.c xc/lib/Xaw/Text.c
---- XFree86-4.0.2.orig/xc/lib/Xaw/Text.c Thu Dec 7 15:26:12 2000
-+++ XFree86-4.0.2/xc/lib/Xaw/Text.c Fri Feb 9 21:33:13 2001
-@@ -805,6 +805,7 @@
- XtRealizeWidget(vbar);
- XtMapWidget(vbar);
- }
-+ XtSetKeyboardFocus(vbar, (Widget)ctx);
- }
-
- /*
-@@ -863,6 +864,7 @@
- XtRealizeWidget(hbar);
- XtMapWidget(hbar);
- }
-+ XtSetKeyboardFocus(hbar, (Widget)ctx);
- }
-
- /*
-diff -Naur -x CVS xc.orig/lib/Xaw/TextAction.c xc/lib/Xaw/TextAction.c
---- XFree86-4.0.2.orig/xc/lib/Xaw/TextAction.c Thu Dec 7 15:26:12 2000
-+++ XFree86-4.0.2/xc/lib/Xaw/TextAction.c Fri Feb 9 21:33:13 2001
-@@ -2835,12 +2835,23 @@
- EndAction((TextWidget)w);
- }
-
-+/* This is kind of a hack, but, only one text widget can have focus at
-+ * a time on one display. There is a problem in the implementation of the
-+ * text widget, the scrollbars can not be adressed via editres, since they
-+ * are not children of a subclass of composite.
-+ * The focus variable is required to make sure only one text window will
-+ * show a block cursor at one time.
-+ */
-+struct _focus { Display *display; Widget widget; };
-+static struct _focus *focus;
-+static Cardinal num_focus;
- /*ARGSUSED*/
- static void
- TextFocusIn(Widget w, XEvent *event, String *p, Cardinal *n)
- {
- TextWidget ctx = (TextWidget)w;
- Bool display_caret = ctx->text.display_caret;
-+ int i;
-
- if (event->xfocus.detail == NotifyPointer)
- return;
-@@ -2853,6 +2864,25 @@
- ctx->text.hasfocus = TRUE;
- if (display_caret)
- EndAction(ctx);
-+
-+ for (i = 0; i < num_focus; i++)
-+ if (focus[i].display == XtDisplay(w))
-+ break;
-+ if (i >= num_focus) {
-+ focus = (struct _focus*)
-+ XtRealloc((XtPointer)focus, sizeof(struct _focus) * (num_focus + 1));
-+ i = num_focus;
-+ focus[i].widget = w;
-+ focus[i].display = XtDisplay(w);
-+ num_focus++;
-+ }
-+ if (focus[i].widget != w) {
-+ Widget old = focus[i].widget;
-+
-+ focus[i].widget = w;
-+ if (old != NULL)
-+ TextFocusOut(old, event, p, n);
-+ }
- }
-
- /*ARGSUSED*/
-@@ -2861,8 +2891,24 @@
- {
- TextWidget ctx = (TextWidget)w;
- Bool display_caret = ctx->text.display_caret;
-+ Widget shell;
-+ Window window;
-+ int i, revert;
-+
-+ shell = w;
-+ while (shell) {
-+ if (XtIsShell(shell))
-+ break;
-+ shell = XtParent(shell);
-+ }
-
-- if (event->xfocus.detail == NotifyPointer)
-+ for (i = 0; i < num_focus; i++)
-+ if (focus[i].display == XtDisplay(w))
-+ break;
-+ XGetInputFocus(XtDisplay(w), &window, &revert);
-+ if ((XtWindow(shell) == window &&
-+ (i < num_focus && focus[i].widget == w))
-+ || event->xfocus.detail == NotifyPointer)
- return;
-
- /* Let the input method know focus has left.*/
-@@ -3110,6 +3156,8 @@
- FD_ZERO(&fds);
- FD_SET(ConnectionNumber(XtDisplay(w)), &fds);
- (void)select(FD_SETSIZE, &fds, NULL, NULL, &tmval);
-+ if (tmval.tv_usec != 500000)
-+ usleep(40000);
-
- StartAction(ctx, NULL);
- #ifndef OLDXAW
-@@ -3342,8 +3390,9 @@
- return;
- }
- else {
-- mult = mult * 10 + params[0][0] - '0';
-- ctx->text.mult = ctx->text.mult * 10 + params[0][0] - '0';
-+ mult = mult * 10 + (params[0][0] - '0') * (mult < 0 ? -1 : 1);
-+ ctx->text.mult = ctx->text.mult * 10 + (params[0][0] - '0') *
-+ (mult < 0 ? -1 : 1);
- }
- if (mult != ctx->text.mult || mult >= 32767) { /* checks for overflow */
- XBell(XtDisplay(w), 0);
-diff -Naur -x CVS xc.orig/lib/Xaw/TextPop.c xc/lib/Xaw/TextPop.c
---- XFree86-4.0.2.orig/xc/lib/Xaw/TextPop.c Thu May 18 12:29:52 2000
-+++ XFree86-4.0.2/xc/lib/Xaw/TextPop.c Fri Feb 9 21:33:13 2001
-@@ -837,7 +837,7 @@
- static Bool
- DoSearch(struct SearchAndReplace *search)
- {
-- char msg[BUFSIZ];
-+ char msg[37];
- Widget tw = XtParent(search->search_popup);
- XawTextPosition pos;
- XawTextScanDirection dir;
-@@ -875,11 +875,27 @@
- GetString to get a tame version */
-
- if (pos == XawTextSearchError) {
-- (void)XmuSnprintf(msg, sizeof(msg),
-- "Could not find string ``%s''.",
-- GetString(search->search_text));
-+ char *ptr;
-+ int len;
-+
-+ ptr = GetString(search->search_text);
-+ len = strlen(ptr);
-+ (void)XmuSnprintf(msg, sizeof(msg), "%s", ptr);
-+
-+ ptr = strchr(msg, '\n');
-+ if (ptr != NULL || sizeof(msg) - 1 < len) {
-+ if (ptr != NULL)
-+ len = ptr - msg + 4;
-+ else
-+ len = strlen(msg);
-+
-+ if (len < 4)
-+ strcpy(msg, "...");
-+ else
-+ strcpy(msg + len - 4, "...");
-+ }
- XawTextUnsetSelection(tw);
-- SetSearchLabels(search, msg, "", True);
-+ SetSearchLabels(search, "Could not find string", msg, True);
-
- return (False);
- }
-@@ -1019,15 +1035,26 @@
-
- if (new_pos == XawTextSearchError) {
- if (count == 0) {
-- char msg[BUFSIZ];
--
-- /* The Raw string in find.ptr may be WC I can't use here,
-- so I call GetString to get a tame version */
--
-- (void)XmuSnprintf(msg, sizeof(msg),
-- "Error: Could not find string ``%s''",
-- GetString(search->search_text));
-- SetSearchLabels(search, msg, "", True);
-+ char msg[37];
-+ char *ptr;
-+ int len;
-+
-+ ptr = GetString(search->search_text);
-+ len = strlen(ptr);
-+ (void)XmuSnprintf(msg, sizeof(msg), "%s", ptr);
-+ ptr = strchr(msg, '\n');
-+ if (ptr != NULL || sizeof(msg) - 1 < len) {
-+ if (ptr != NULL)
-+ len = ptr - msg + 4;
-+ else
-+ len = strlen(msg);
-+
-+ if (len < 4)
-+ strcpy(msg, "...");
-+ else
-+ strcpy(msg + len - 4, "...");
-+ }
-+ SetSearchLabels(search, "Could not find string", msg, True);
-
- if (redisplay) {
- XawTextSetInsertionPoint(tw, ipos);
-@@ -1047,7 +1074,7 @@
- XawTextGetSelectionPos(tw, &pos, &end_pos);
-
- if (search->selection_changed) {
-- SetSearchLabels(search, "Selection has been modified, aborting.",
-+ SetSearchLabels(search, "Selection modified, aborting.",
- "", True);
- if (redisplay) {
- XawTextSetInsertionPoint(tw, ipos);
-@@ -1067,11 +1094,7 @@
- }
-
- if (XawTextReplace(tw, pos, end_pos, &replace) != XawEditDone) {
-- char msg[BUFSIZ];
--
-- (void)XmuSnprintf(msg, sizeof(msg),
-- "'%s' with '%s'", find.ptr, replace.ptr);
-- SetSearchLabels(search, "Error while replacing", msg, True);
-+ SetSearchLabels(search, "Error while replacing.", "", True);
- if (redisplay) {
- XawTextSetInsertionPoint(tw, ipos);
- XawTextEnableRedisplay(tw);
-diff -Naur -x CVS xc.orig/lib/Xaw/TextSrc.c xc/lib/Xaw/TextSrc.c
---- XFree86-4.0.2.orig/xc/lib/Xaw/TextSrc.c Tue Sep 26 11:56:55 2000
-+++ XFree86-4.0.2/xc/lib/Xaw/TextSrc.c Fri Feb 9 21:33:13 2001
-@@ -1022,9 +1022,9 @@
- XtFree((XtPointer)entity);
- if (entity == anchor->entities) {
- if ((anchor->entities = enext) == NULL) {
-+ eprev = NULL;
- anchor = XawTextSourceRemoveAnchor(w, anchor);
- entity = anchor ? anchor->entities : NULL;
-- eprev = NULL;
- }
- else
- eprev = entity = enext;
-@@ -1053,6 +1053,7 @@
- XtFree((XtPointer)entity);
- anchor->cache = NULL;
- if (entity == anchor->entities) {
-+ eprev = NULL;
- if ((anchor->entities = enext) == NULL) {
- if (i == 0)
- ++i;
-@@ -1069,7 +1070,6 @@
- break;
- }
- anchor = src->textSrc.anchors[i];
-- eprev = NULL;
- entity = anchor->entities;
- continue;
- }
-diff -Naur -x CVS xc.orig/programs/Xserver/dix/events.c xc/programs/Xserver/dix/events.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/dix/events.c Sun Oct 22 17:12:09 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/dix/events.c Fri Feb 9 21:33:13 2001
-@@ -2783,6 +2783,44 @@
- if (deactivateGrab)
- (*keybd->DeactivateGrab)(keybd);
- }
-+
-+#ifdef XKB
-+/* This function is used to set the key pressed or key released state -
-+ this is only used when the pressing of keys does not cause
-+ CoreProcessKeyEvent to be called, as in for example Mouse Keys.
-+*/
-+void
-+FixKeyState (xE, keybd)
-+ register xEvent *xE;
-+ register DeviceIntPtr keybd;
-+{
-+ int key, bit;
-+ register BYTE *kptr;
-+ register KeyClassPtr keyc = keybd->key;
-+
-+ key = xE->u.u.detail;
-+ kptr = &keyc->down[key >> 3];
-+ bit = 1 << (key & 7);
-+#ifdef DEBUG
-+ if ((xkbDebugFlags&0x4)&&
-+ ((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) {
-+ ErrorF("FixKeyState: Key %d %s\n",key,
-+ (xE->u.u.type==KeyPress?"down":"up"));
-+ }
-+#endif
-+ switch (xE->u.u.type)
-+ {
-+ case KeyPress:
-+ *kptr |= bit;
-+ break;
-+ case KeyRelease:
-+ *kptr &= ~bit;
-+ break;
-+ default:
-+ FatalError("Impossible keyboard event");
-+ }
-+}
-+#endif
-
- void
- #ifdef XKB
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/CHANGELOG xc/programs/Xserver/hw/xfree86/CHANGELOG
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/CHANGELOG Tue Dec 19 08:12:29 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/CHANGELOG Sat Feb 10 09:37:49 2001
-@@ -1,3 +1,40 @@
-+XFree86 4.0.2a (?? February 2001)
-+1224. Make acceleration work on the Trident Cyber9388 (Alan Hourihane).
-+1223. Make some changes to the clock selection for trident driver
-+ (Alan Hourihane).
-+1222. Ensure Video is unavailable when no acceleration available in the
-+ trident driver (Alan Hourihane).
-+1221. Allow xf86ClaimPciSlot to be called with a NULL GDevPtr, as it was
-+ previously (Alan Hourihane).
-+1220. Correct some problems with xedit c-mode. Fix geometry management
-+ incompatibilites with Xaw 6 in the Form widget.
-+ Fix problem in libxf86config when comparing float and double and
-+ small fix to xf86cfg when converting a HorizSync or VertRefresh
-+ specification string to format used internally by libxf86config.
-+ Adds dvorak keyboard and fixes Ukranian in rules/xfree86.lst.
-+ Fix problems in the xkb interface of xf86cfg and fix autorepeat with
-+ MouseKeys, based on patches and suggestion of Stephen Montgomery-Smith
-+ (Paulo César Pereira de Andrade).
-+1219. Undo s3virge changes in 4.0.2 for Xv support on ViRGE chipsets since
-+ they caused problems with plain ViRGE cards. Xv is still supported
-+ for the ViRGE DX (#4414, 4430, Kevin Brosius).
-+1218. Fix incorrect driverName fields in the cyrix, i810 and sis drivers.
-+ This was causing 'XFree86 -configure' to get the driver name wrong.
-+ Also fix the documentation of this field in the DESIGN doc (David Dawes).
-+1217. [SECURITY] Fix temp files vulnerabilites in xman on systems with
-+ mkstemp(). (Matthieu Herrb).
-+1216. [SECURITY] Fix temp vulnerabilities in Xaw/MultiSrc.c using the technique
-+ in patch #4279 (Branden Robinson). Fix temp file vulnerability in
-+ gccmakedep based on report from Alan Cox. Fix temp file vulnerability
-+ in Imake.rules, InstallManPageAliases (Matthieu Herrb).
-+1215. Fix Neomagic 2200 screen corruption (Egbert Eich).
-+1214. Add an imake control for determining when xload should be installed
-+ set-gid (David Dawes).
-+1213. Add some imake controls for installing Xkb and app-defaults files
-+ in the traditional location rather than under /etc/X11 (Red Hat does
-+ that) (David Dawes).
-+1212. Misc bindist updates.
-+
- XFree86 4.0.2 (18 December 2000)
- 1211. Fix a problem introduced recently when using the "ps/2" protocol for
- mice on FreeBSD (David Dawes).
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/common/xf86Bus.c xc/programs/Xserver/hw/xfree86/common/xf86Bus.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c Wed Dec 6 10:35:07 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c Sat Feb 10 09:37:49 2001
-@@ -1,4 +1,4 @@
--/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.56 2000/12/06 15:35:07 eich Exp $ */
-+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.56.2.1 2001/02/10 10:23:53 alanh Exp $ */
- /*
- * Copyright (c) 1997-1999 by The XFree86 Project, Inc.
- */
-@@ -443,7 +443,8 @@
- pEnt->chipset = xf86Entities[entityIndex]->chipset;
- pEnt->resources = xf86Entities[entityIndex]->resources;
- pEnt->driver = xf86Entities[entityIndex]->driver;
-- if (xf86Entities[entityIndex]->devices[0]) {
-+ if ( (xf86Entities[entityIndex]->devices) &&
-+ (xf86Entities[entityIndex]->devices[0]) ) {
- for (i = 0; i < xf86Entities[entityIndex]->numInstances; i++)
- if (xf86Entities[entityIndex]->devices[i]->screen == 0)
- break;
-@@ -469,7 +470,8 @@
- int i;
-
- /* We might not use AddDevtoEntity */
-- if (!xf86Entities[entityIndex]->devices[0])
-+ if ( (!xf86Entities[entityIndex]->devices) ||
-+ (!xf86Entities[entityIndex]->devices[0]) )
- return NULL;
-
- if (entityIndex >= xf86NumEntities ||
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/common/xf86pciBus.c xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c Fri Dec 8 15:13:35 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c Sat Feb 10 09:37:49 2001
-@@ -2343,7 +2343,8 @@
- p->pciBusId.func = func;
- p->active = active;
- p->inUse = FALSE;
-- xf86AddDevToEntity(num, dev);
-+ if (dev)
-+ xf86AddDevToEntity(num, dev);
- /* Here we initialize the access structure */
- p->access = xnfcalloc(1,sizeof(EntityAccessRec));
- while (ppaccp && *ppaccp) {
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/doc/BugReport xc/programs/Xserver/hw/xfree86/doc/BugReport
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/doc/BugReport Thu Aug 3 08:24:02 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/doc/BugReport Tue Dec 19 13:13:35 2000
-@@ -5,7 +5,7 @@
-
- VERSION:
-
--4.0.1a
-+4.0.2
-
- VIDEO DRIVER:
-
-@@ -54,4 +54,4 @@
-
-
-
--$XFree86: xc/programs/Xserver/hw/xfree86/doc/BugReport,v 1.3 2000/08/03 12:24:02 dawes Exp $
-+$XFree86: xc/programs/Xserver/hw/xfree86/doc/BugReport,v 1.3.2.1 2000/12/19 18:13:35 dawes Exp $
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/doc/DESIGN xc/programs/Xserver/hw/xfree86/doc/DESIGN
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/doc/DESIGN Mon Dec 4 14:47:21 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/doc/DESIGN Fri Feb 9 21:33:14 2001
-@@ -408,12 +408,12 @@
- points required during the early phase of InitOutput(). xf86AddDriver() adds
- it to the global xf86DriverList[] array.
-
--The DriverRec contains the driver's version, a short descriptive message, the
--Identify(), Probe() and AvailableOptions() function entry points as well as a
--pointer to the driver's module (as returned from the loader when the driver
--was loaded) and a reference count which keeps track of how many screens are
--using the driver. The entry driver entry points are those required prior to
--the driver allocating and filling in its ScrnInfoRec.
-+The DriverRec contains the driver canonical name, the Identify(), Probe() and
-+AvailableOptions() function entry points as well as a pointer to the driver's
-+module (as returned from the loader when the driver was loaded) and a refer-
-+ence count which keeps track of how many screens are using the driver. The
-+entry driver entry points are those required prior to the driver allocating
-+and filling in its ScrnInfoRec.
-
- For a static server, the xf86DriverList[] array is initialised at build time,
- and the loading of modules is not done.
-@@ -5368,7 +5368,7 @@
-
- DriverRec ZZZ = {
- VERSION,
-- "unaccelerated driver for ZZZ Zzzzzy cards",
-+ ZZZ_DRIVER_NAME,
- ZZZIdentify,
- ZZZProbe,
- ZZZAvailableOptions,
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml Mon Dec 4 13:49:54 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml Fri Feb 9 21:33:14 2001
-@@ -517,8 +517,8 @@
- &s.code;InitOutput()&e.code;. &s.code;xf86AddDriver()&e.code; adds
- it to the global &s.code;xf86DriverList[]&e.code; array.
-
-- The &s.code;DriverRec&e.code; contains the driver's version, a short
-- descriptive message, the &s.code;Identify()&e.code;,
-+ The &s.code;DriverRec&e.code; contains the driver canonical name,
-+ the &s.code;Identify()&e.code;,
- &s.code;Probe()&e.code; and &s.code;AvailableOptions()&e.code;
- function entry points as well as a pointer
- to the driver's module (as returned from the loader when the driver
-@@ -6336,7 +6336,7 @@
- <code>
- DriverRec ZZZ = {
- VERSION,
-- "unaccelerated driver for ZZZ Zzzzzy cards",
-+ ZZZ_DRIVER_NAME,
- ZZZIdentify,
- ZZZProbe,
- ZZZAvailableOptions,
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/doc/sgml/README.sgml xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml Sat Dec 16 12:33:01 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml Fri Feb 9 21:33:14 2001
-@@ -31,8 +31,22 @@
- <sect>What is XFree86 &relvers;?
- <p>
-
--XFree86 &relvers; is the third full release in the <![ %earlyrel; [new]]>
--XFree86 4 series.
-+<![ %updaterel [
-+XFree86 &relvers; is the &whichupdaterel; update to &fullrelvers;,
-+the &whichfullrel; full release in the <![ %earlyrel; [new]]> XFree86
-+4 series.
-+
-+Update releases are taken from a stable/maintenance branch. They are
-+designed to be installed on top of the full release that they are
-+updating. They contain fixes for serious problems, most commonly
-+fixes for security issues, fixes for driver bugs, and fixes that improve
-+stability.
-+]]>
-+
-+<![ %fullrel [
-+XFree86 &relvers; is the &whichfullrel; full release in the <![ %earlyrel;
-+[new]]> XFree86 4 series.
-+]]>
-
- <p>
- XFree86 release 4 is a major re-design of the basic architectural
-@@ -47,9 +61,10 @@
- The road to XFree86 release 4 began as an architectural concept in mid
- 1997, with the serious framework being implemented in code the beginning
- of 1998. There were several snapshots on the road to 4.0 which are now
--part of the 4.0 base release. The &relvers; version is an upgrade to
-+part of the 4.0 base release.
-+<![ %fullrel [The &relvers; version is an upgrade to
- &prevrelvers;, which include more hardware ports, code enhancements and
--bug fixes.
-+bug fixes.]]>
-
- Release 4 also included the long-awaited integration of the DRI (Direct
- Rendering Infrastructure). This upgrade into the code base gives
-@@ -195,113 +210,134 @@
- obtaining the release in source form is given below.
- ]]>
-
--The source for version &relvers; is split into three tarballs:
--<tt>X&srcvers;src-1.tgz</tt>, <tt>X&srcvers;src-2.tgz</tt>,
--<tt>X&srcvers;src-3.tgz</tt>. The first contains everything except the
-+<![ %updaterel; [
-+The source for version &relvers; is available as a patch relative to
-+&prevrelvers;.
-+The patch file is <tt>&prevrelvers;-&relvers;.diff.gz</tt>.
-+
-+The patch
-+should be applied to a clean &prevrelvers; source tree, working from
-+the directory containing the <tt>xc/</tt> directory. The patch should
-+be applied by running:
-+
-+<tscreen><verb>
-+gzip -d < &prevrelvers;-&relvers;.diff.gz | patch -p0 -E
-+</verb></tscreen>
-+
-+Information about getting the source for &prevrelvers can be found in the
-+README file for that version, which can be found on the
-+<url name="XFree86 web site" url="http://www.xfree86.org/pub/XFree86/&prevrelvers;/README.html">.
-+.
-+]]>
-+
-+<![ %fullrel [
-+The source for version &fullrelvers; is split into three tarballs:
-+<tt>X&fullsrcvers;src-1.tgz</tt>, <tt>X&fullsrcvers;src-2.tgz</tt>,
-+<tt>X&fullsrcvers;src-3.tgz</tt>. The first contains everything except the
- fonts and general X11 documentation. It is sufficient for building
- XFree86 is you already have a set of fonts. The second contains the
- fonts and the source for the general X11 documentation. The third
- contains the general X11 documentation in hardcopy format.
-
- <![ %onediff; [
--A source patch relative to version &prevrelvers; is also available.
--The patch file is <tt>&prevrelvers;-&relvers;.diff.gz</tt>.
-+A source patch relative to version &prevfullrelvers; is also available.
-+The patch file is <tt>&prevfullrelvers;-&fullrelvers;.diff.gz</tt>.
- <![ %difftar; [
- There is also a tarball that contains some files that have components that
--can't be included in a diff. It is <tt>&relvers;.tgz</tt>.
-+can't be included in a diff. It is <tt>&fullrelvers;.tgz</tt>.
- ]]>
- The patch
--should be applied to a clean &prevrelvers; source tree, working from
-+should be applied to a clean &prevfullrelvers; source tree, working from
- the directory containing the <tt>xc/</tt> directory. The patch should
- be applied by running:
-
- <tscreen><verb>
--gzip -d < &prevrelvers;-&relvers;.diff.gz | patch -p0 -E
-+gzip -d < &prevfullrelvers;-&fullrelvers;.diff.gz | patch -p0 -E
- </verb></tscreen>
- <![ %difftar; [
- <tscreen><verb>
--gzip -d < &relvers;.tgz | tar vxf -
-+gzip -d < &fullrelvers;.tgz | tar vxf -
- </verb></tscreen>
- ]]>
- ]]>
-
- <![ %twodiffs; [
--A source patch relative to version &prevrelvers; is also available.
-+A source patch relative to version &prevfullrelvers; is also available.
- Because of its size, it is split into two parts.
--The patch files are <tt>&prevrelvers;-&relvers;.diff1.gz</tt> and
--<tt>&prevrelvers;-&relvers;.diff2.gz</tt>.
-+The patch files are <tt>&prevfullrelvers;-&fullrelvers;.diff1.gz</tt> and
-+<tt>&prevfullrelvers;-&fullrelvers;.diff2.gz</tt>.
- <![ %difftar; [
- There is also a tarball that contains some files that have components that
--can't be included in a diff. It is <tt>&relvers;.tgz</tt>.
-+can't be included in a diff. It is <tt>&fullrelvers;.tgz</tt>.
- ]]>
- These patches should
--be applied to a clean &prevrelvers; source tree, working from the directory
-+be applied to a clean &prevfullrelvers; source tree, working from the directory
- containing the <tt>xc/</tt> directory. The patches should be applied by
- running:
-
- <tscreen><verb>
--gzip -d < &prevrelvers;-&relvers;.diff1.gz | patch -p0 -E
--gzip -d < &prevrelvers;-&relvers;.diff2.gz | patch -p0 -E
-+gzip -d < &prevfullrelvers;-&fullrelvers;.diff1.gz | patch -p0 -E
-+gzip -d < &prevfullrelvers;-&fullrelvers;.diff2.gz | patch -p0 -E
- </verb></tscreen>
- <![ %difftar; [
- <tscreen><verb>
--gzip -d < &relvers;.tgz | tar vxf -
-+gzip -d < &fullrelvers;.tgz | tar vxf -
- </verb></tscreen>
- ]]>
- ]]>
-
- <![ %threediffs; [
--A source patch relative to version &prevrelvers; is also available.
-+A source patch relative to version &prevfullrelvers; is also available.
- Because of its size, it is split into three parts.
--The patch files are <tt>&prevrelvers;-&relvers;.diff1.gz</tt>,
--<tt>&prevrelvers;-&relvers;.diff2.gz</tt> and
--<tt>&prevrelvers;-&relvers;.diff3.gz</tt>.
-+The patch files are <tt>&prevfullrelvers;-&fullrelvers;.diff1.gz</tt>,
-+<tt>&prevfullrelvers;-&fullrelvers;.diff2.gz</tt> and
-+<tt>&prevfullrelvers;-&fullrelvers;.diff3.gz</tt>.
- <![ %difftar; [
- There is also a tarball that contains some files that have components that
--can't be included in a diff. It is <tt>&relvers;.tgz</tt>.
-+can't be included in a diff. It is <tt>&fullrelvers;.tgz</tt>.
- ]]>
- These patches should
--be applied to a clean &prevrelvers; source tree, working from the directory
-+be applied to a clean &prevfullrelvers; source tree, working from the directory
- containing the <tt>xc/</tt> directory. The patches should be applied by
- running:
-
- <tscreen><verb>
--gzip -d < &prevrelvers;-&relvers;.diff1.gz | patch -p0 -E
--gzip -d < &prevrelvers;-&relvers;.diff2.gz | patch -p0 -E
--gzip -d < &prevrelvers;-&relvers;.diff3.gz | patch -p0 -E
-+gzip -d < &prevfullrelvers;-&fullrelvers;.diff1.gz | patch -p0 -E
-+gzip -d < &prevfullrelvers;-&fullrelvers;.diff2.gz | patch -p0 -E
-+gzip -d < &prevfullrelvers;-&fullrelvers;.diff3.gz | patch -p0 -E
- </verb></tscreen>
- <![ %difftar; [
- <tscreen><verb>
--gzip -d < &relvers;.tgz | tar vxf -
-+gzip -d < &fullrelvers;.tgz | tar vxf -
- </verb></tscreen>
- ]]>
- ]]>
-
- <![ %fourdiffs; [
--A source patch relative to version &prevrelvers; is also available.
-+A source patch relative to version &prevfullrelvers; is also available.
- Because of its size, it is split into four parts.
--The patch files are <tt>&prevrelvers;-&relvers;.diff1.gz</tt>,
--<tt>&prevrelvers;-&relvers;.diff2.gz</tt>,
--<tt>&prevrelvers;-&relvers;.diff3.gz</tt> and
--<tt>&prevrelvers;-&relvers;.diff4.gz</tt>.
-+The patch files are <tt>&prevfullrelvers;-&fullrelvers;.diff1.gz</tt>,
-+<tt>&prevfullrelvers;-&fullrelvers;.diff2.gz</tt>,
-+<tt>&prevfullrelvers;-&fullrelvers;.diff3.gz</tt> and
-+<tt>&prevfullrelvers;-&fullrelvers;.diff4.gz</tt>.
- <![ %difftar; [
- There is also a tarball that contains some files that have components that
--can't be included in a diff. It is <tt>&relvers;.tgz</tt>.
-+can't be included in a diff. It is <tt>&fullrelvers;.tgz</tt>.
- ]]>
- These patches should
--be applied to a clean &prevrelvers; source tree, working from the directory
-+be applied to a clean &prevfullrelvers; source tree, working from the directory
- containing the <tt>xc/</tt> directory. The patches should be applied by
- running:
-
- <tscreen><verb>
--gzip -d < &prevrelvers;-&relvers;.diff1.gz | patch -p0 -E
--gzip -d < &prevrelvers;-&relvers;.diff2.gz | patch -p0 -E
--gzip -d < &prevrelvers;-&relvers;.diff3.gz | patch -p0 -E
--gzip -d < &prevrelvers;-&relvers;.diff4.gz | patch -p0 -E
-+gzip -d < &prevfullrelvers;-&fullrelvers;.diff1.gz | patch -p0 -E
-+gzip -d < &prevfullrelvers;-&fullrelvers;.diff2.gz | patch -p0 -E
-+gzip -d < &prevfullrelvers;-&fullrelvers;.diff3.gz | patch -p0 -E
-+gzip -d < &prevfullrelvers;-&fullrelvers;.diff4.gz | patch -p0 -E
- </verb></tscreen>
- <![ %difftar; [
- <tscreen><verb>
--gzip -d < &relvers;.tgz | tar vxf -
-+gzip -d < &fullrelvers;.tgz | tar vxf -
- </verb></tscreen>
- ]]>
- ]]>
-@@ -311,6 +347,7 @@
-
- To format the XFree86 documentation use the latest version of our doctools
- package available as <tt>doctools-&doctoolsvers;.tgz</tt>.
-+]]> <!-- fullrel -->
-
- <sect>Reporting Bugs
- <p>
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c Sat Dec 2 10:30:37 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c Fri Feb 9 21:33:14 2001
-@@ -112,7 +112,7 @@
-
- DriverRec CYRIX = {
- VERSION,
-- "accelerated driver for Cyrix integrated processors",
-+ CYRIX_DRIVER_NAME,
- CYRIXIdentify,
- CYRIXProbe,
- CYRIXAvailableOptions,
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c Sat Dec 2 10:30:42 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c Fri Feb 9 21:33:14 2001
-@@ -92,7 +92,7 @@
-
- DriverRec I810 = {
- I810_VERSION,
-- "Accelerated driver for Intel i810 cards",
-+ I810_DRIVER_NAME,
- I810Identify,
- I810Probe,
- I810AvailableOptions,
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c Tue Oct 17 17:36:15 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c Mon Jan 22 14:59:11 2001
-@@ -337,8 +337,8 @@
- NEOACLPtr nAcl = NEOACLPTR(pScrn);
-
- if ((dstY < srcY) || ((dstY == srcY) && (dstX < srcX))) {
-- if (((dstX < 64) && ((srcX + w) == pScrn->displayWidth)) ||
-- ((dstX == 0) && (w > (pScrn->displayWidth - 64)))) {
-+ if ((((dstX < 64) && ((srcX + w) == pScrn->displayWidth)) ||
-+ ((dstX == 0) && (w > (pScrn->displayWidth - 64)))) && (w > 64)) {
-
- int srcX1 = srcX + 64;
- int dstX1 = dstX + 64;
-@@ -368,9 +368,9 @@
- OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff));
- }
- } else {
-- if ((((dstX + w) > (pScrn->displayWidth - 64)) && (srcX == 0))
-+ if (((((dstX + w) > (pScrn->displayWidth - 64)) && (srcX == 0))
- || (((dstX + w) == pScrn->displayWidth)
-- && (w > (pScrn->displayWidth - 64)))) {
-+ && (w > (pScrn->displayWidth - 64)))) && (w > 64)) {
- int srcX1, dstX1;
-
- w -= 64;
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES Tue Nov 28 15:59:17 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES Fri Feb 9 21:33:14 2001
-@@ -1,7 +1,7 @@
- S3 ViRGE 4.0 devel notes
-
- rev:
--27 Nov 2000 KJB
-+3 Jan 2001 KJB
-
-
- Function Implemented
-@@ -23,6 +23,11 @@
-
- Status
- ------
-+1/03/01 KJB
-+Ver 1.6.0
-+Revert ViRGE to pre-Xv changes. ViRGE DX still supports Xv, but changes
-+added for Xv and ViRGE caused problems with normal display.
-+
- 11/27/00 KJB
- Ver 1.5.0
- Clean up, bump version for 4.0.2 submission.
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c Sat Dec 16 12:33:00 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c Fri Feb 9 21:33:14 2001
-@@ -116,9 +116,9 @@
-
- #define S3VIRGE_NAME "S3VIRGE"
- #define S3VIRGE_DRIVER_NAME "s3virge"
--#define S3VIRGE_VERSION_NAME "1.5.0"
-+#define S3VIRGE_VERSION_NAME "1.6.0"
- #define S3VIRGE_VERSION_MAJOR 1
--#define S3VIRGE_VERSION_MINOR 5
-+#define S3VIRGE_VERSION_MINOR 6
- #define S3VIRGE_PATCHLEVEL 0
- #define S3VIRGE_DRIVER_VERSION ((S3VIRGE_VERSION_MAJOR << 24) | \
- (S3VIRGE_VERSION_MINOR << 16) | \
-@@ -3073,7 +3073,7 @@
- S3VCommonCalcClock(dclk, 1, 1, 31, 0, 4,
- 230000, 460000, &new->SR13, &new->SR12);
- } /* end TRIO_3D if() */
-- else { /* Is this correct for DX/GX as well? */
-+ else if(ps3v->Chipset == S3_ViRGE_DXGX) {
- if (pScrn->bitsPerPixel == 8) {
- if(dclk > 80000) { /* We need pixmux */
- new->CR67 = 0x10;
-@@ -3110,7 +3110,39 @@
- }
- S3VCommonCalcClock(dclk, 1, 1, 31, 0, 3,
- 135000, 270000, &new->SR13, &new->SR12);
-- }
-+ } /* end DXGX if() */
-+ else { /* Everything else ... (only ViRGE) */
-+ if (pScrn->bitsPerPixel == 8) {
-+ if(dclk > 80000) { /* We need pixmux */
-+ new->CR67 = 0x10;
-+ new->SR15 |= 0x10; /* Set DCLK/2 bit */
-+ new->SR18 = 0x80; /* Enable pixmux */
-+ }
-+ }
-+ else if ((pScrn->bitsPerPixel == 16) && (pScrn->weight.green == 5)) {
-+ new->CR67 = 0x30; /* 15bpp */
-+ }
-+ else if (pScrn->bitsPerPixel == 16) {
-+ new->CR67 = 0x50;
-+ }
-+ else if (pScrn->bitsPerPixel == 24) {
-+ new->CR67 = 0xd0 | 0x0c;
-+ /* Flag STREAMS proc. required */
-+ ps3v->NeedSTREAMS = TRUE;
-+ S3VInitSTREAMS(pScrn, new->STREAMS, mode);
-+ new->MMPR0 = 0xc000; /* Adjust FIFO slots */
-+ }
-+ else if (pScrn->bitsPerPixel == 32) {
-+ new->CR67 = 0xd0 | 0x0c;
-+ /* Flag STREAMS proc. required */
-+ ps3v->NeedSTREAMS = TRUE;
-+ S3VInitSTREAMS(pScrn, new->STREAMS, mode);
-+ new->MMPR0 = 0x10000; /* Still more FIFO slots */
-+ }
-+ S3VCommonCalcClock(dclk, 1, 1, 31, 0, 3,
-+ 135000, 270000, &new->SR13, &new->SR12);
-+ } /* end great big if()... */
-+
-
- /* Now adjust the value of the FIFO based upon options specified */
- if( ps3v->fifo_moderate ) {
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c Tue Nov 28 15:59:18 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c Fri Feb 9 21:33:14 2001
-@@ -106,9 +106,9 @@
- (pScrn->bitsPerPixel == 16)
- )
- &&
-- ((ps3v->Chipset == S3_ViRGE_DXGX) ||
-+ ((ps3v->Chipset == S3_ViRGE_DXGX) /* || */
- /* S3_ViRGE_GX2_SERIES(ps3v->Chipset) || */
-- (ps3v->Chipset == S3_ViRGE)
-+ /* (ps3v->Chipset == S3_ViRGE) */
- )
- && !ps3v->NoAccel
- )
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c Sat Dec 2 10:30:51 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c Fri Feb 9 21:33:14 2001
-@@ -117,7 +117,7 @@
-
- DriverRec SIS = {
- SIS_CURRENT_VERSION,
-- "accelerated driver for SiS chipsets",
-+ SIS_DRIVER_NAME,
- SISIdentify,
- SISProbe,
- SISAvailableOptions,
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/drivers/trident/trident.h xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h Fri Dec 8 04:05:16 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h Sat Feb 10 09:37:50 2001
-@@ -266,8 +266,7 @@
- #define HAS_DST_TRANS ((pTrident->Chipset == PROVIDIA9682) || \
- (pTrident->Chipset == PROVIDIA9685))
-
--#define Is3Dchip ((pTrident->Chipset == CYBER9388) || \
-- (pTrident->Chipset == CYBER9397) || \
-+#define Is3Dchip ((pTrident->Chipset == CYBER9397) || \
- (pTrident->Chipset == CYBER9397DVD) || \
- (pTrident->Chipset == CYBER9520) || \
- (pTrident->Chipset == CYBER9525DVD) || \
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c Thu Dec 7 11:48:04 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c Sat Feb 10 09:37:50 2001
-@@ -158,7 +158,8 @@
- infoPtr->SubsequentScreenToScreenCopy =
- TridentSubsequentScreenToScreenCopy;
-
-- if (!(pTrident->Chipset == PROVIDIA9685 && pScrn->bitsPerPixel > 8)) {
-+ if (!((pTrident->Chipset == PROVIDIA9685 ||
-+ pTrident->Chipset == CYBER9388) && pScrn->bitsPerPixel > 8)) {
- infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK |
- HARDWARE_PATTERN_SCREEN_ORIGIN |
- BIT_ORDER_IN_BYTE_MSBFIRST;
-@@ -282,7 +283,8 @@
-
- REPLICATE(transparency_color);
- if (transparency_color != -1) {
-- if (pTrident->Chipset == PROVIDIA9685) {
-+ if (pTrident->Chipset == PROVIDIA9685 ||
-+ pTrident->Chipset == CYBER9388) {
- dst |= 1<<16;
- } else {
- TGUI_OPERMODE(pTrident->EngineOperation | DST_ENABLE);
-@@ -294,7 +296,8 @@
- if ((pTrident->Chipset == PROVIDIA9682) ||
- (pTrident->Chipset == TGUI9680))
- dst |= FASTMODE;
-- if (pTrident->Chipset == PROVIDIA9685)
-+ if (pTrident->Chipset == PROVIDIA9685 ||
-+ pTrident->Chipset == CYBER9388)
- dst |= 1<<21;
- }
-
-@@ -332,7 +335,8 @@
- pTrident->BltScanDirection = 0;
- REPLICATE(color);
- TGUI_FMIX(XAAPatternROP[rop]);
-- if (pTrident->Chipset == PROVIDIA9685) {
-+ if (pTrident->Chipset == PROVIDIA9685 ||
-+ pTrident->Chipset == CYBER9388) {
- TGUI_FPATCOL(color);
- if (rop == GXcopy)
- pTrident->BltScanDirection |= 1<<21;
-@@ -404,10 +408,12 @@
- if ((pTrident->Chipset == PROVIDIA9682 ||
- pTrident->Chipset == TGUI9680) && rop == GXcopy)
- pTrident->BltScanDirection |= FASTMODE;
-- if (pTrident->Chipset == PROVIDIA9685 && rop == GXcopy)
-+ if ((pTrident->Chipset == PROVIDIA9685 ||
-+ pTrident->Chipset == CYBER9388) && rop == GXcopy)
- pTrident->BltScanDirection |= 1<<21;
- REPLICATE(fg);
-- if (pTrident->Chipset == PROVIDIA9685) {
-+ if (pTrident->Chipset == PROVIDIA9685 ||
-+ pTrident->Chipset == CYBER9388) {
- TGUI_FPATCOL(fg);
- if (bg == -1) {
- pTrident->BltScanDirection |= 1<<12;
-@@ -463,7 +469,8 @@
- TGUI_FMIX(XAAPatternROP[rop]);
- if ((pTrident->Chipset == PROVIDIA9682 ||
- pTrident->Chipset == TGUI9680) && rop == GXcopy) drawflag = FASTMODE;
-- if (pTrident->Chipset == PROVIDIA9685) {
-+ if (pTrident->Chipset == PROVIDIA9685 ||
-+ pTrident->Chipset == CYBER9388) {
- if (rop == GXcopy) drawflag |= 1<<21;
- TGUI_FPATCOL(color);
- } else {
-@@ -522,26 +529,30 @@
- int drawflag = 0;
-
- REPLICATE(fg);
-- if (pTrident->Chipset == PROVIDIA9685)
-+ if (pTrident->Chipset == PROVIDIA9685 ||
-+ pTrident->Chipset == CYBER9388)
- TGUI_FPATCOL(fg);
- else
- TGUI_FCOLOUR(fg);
-
- if (bg == -1) {
- drawflag |= 1<<12;
-- if (pTrident->Chipset == PROVIDIA9685)
-+ if (pTrident->Chipset == PROVIDIA9685 ||
-+ pTrident->Chipset == CYBER9388)
- TGUI_BPATCOL(~fg);
- else
- TGUI_BCOLOUR(~fg);
- } else {
- REPLICATE(bg);
-- if (pTrident->Chipset == PROVIDIA9685)
-+ if (pTrident->Chipset == PROVIDIA9685 ||
-+ pTrident->Chipset == CYBER9388)
- TGUI_BPATCOL(bg);
- else
- TGUI_BCOLOUR(bg);
- }
-
-- if (pTrident->Chipset == PROVIDIA9685) {
-+ if (pTrident->Chipset == PROVIDIA9685 ||
-+ pTrident->Chipset == CYBER9388) {
- drawflag |= 7<<18;
- if (rop == GXcopy) drawflag |= 1<<21;
- }
-@@ -584,7 +595,8 @@
-
- REPLICATE(transparency_color);
- if (transparency_color != -1) {
-- if (pTrident->Chipset == PROVIDIA9685) {
-+ if (pTrident->Chipset == PROVIDIA9685 ||
-+ pTrident->Chipset == CYBER9388) {
- drawflag |= 1<<16;
- } else {
- TGUI_OPERMODE(pTrident->EngineOperation | DST_ENABLE);
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c Sat Dec 16 12:33:00 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c Sat Feb 10 09:37:50 2001
-@@ -333,7 +333,6 @@
- case CYBER9525DVD:
- case CYBER9397DVD:
- case CYBER9397:
-- case CYBER9388:
- case IMAGE975:
- case IMAGE985:
- if (pScrn->bitsPerPixel >= 8)
-@@ -344,9 +343,12 @@
- pReg->tridentRegs3x4[PreEndFetch] = 0xFF;
- /* Fall Through */
- case PROVIDIA9685:
-+ case CYBER9388:
-+ case CYBER9385:
- pReg->tridentRegs3x4[Enhancement0] = 0x40;
- /* Fall Through */
- case PROVIDIA9682:
-+ case CYBER9382:
- if (pTrident->UsePCIRetry)
- pReg->tridentRegs3x4[PCIRetry] = 0xDF;
- else
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c Fri Dec 8 04:05:16 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c Sat Feb 10 09:37:50 2001
-@@ -418,6 +418,7 @@
- "XAACreateInfoRec",
- "XAAHelpPatternROP",
- "XAAHelpSolidROP",
-+ "XAAFillSolidRects",
- "XAACopyROP",
- "XAAPatternROP",
- "XAAInit",
-@@ -1635,9 +1636,9 @@
- case CYBERBLADEI7:
- pTrident->ddc1Read = Tridentddc1Read;
- ramtype = "SDRAM";
-- pTrident->IsCyber = TRUE;
-+ /* pTrident->IsCyber = TRUE; VIA MVP4 integrated Desktop version */
- Support24bpp = TRUE;
-- chipset = "CyberBlade/i7";
-+ chipset = "CyberBlade/i7/VIA MVP4";
- pTrident->NewClockCode = TRUE;
- pTrident->frequency = NTSC;
- break;
-@@ -2579,13 +2580,10 @@
- pScrn->fbOffset = 0;
-
- #ifdef XvExtension
-- if (pTrident->Chipset >= CYBER9397)
-+ if ((pTrident->Chipset >= CYBER9397) && (!pTrident->NoAccel))
- TRIDENTInitVideo(pScreen);
- #endif
-
-- if(pTrident->BlockHandler)
-- pScreen->BlockHandler = pTrident->BlockHandler;
--
- pTrident->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = TRIDENTCloseScreen;
- pScreen->SaveScreen = TRIDENTSaveScreen;
-@@ -2744,6 +2742,9 @@
- if (pTrident->DGAModes)
- xfree(pTrident->DGAModes);
- pScrn->vtSema = FALSE;
-+
-+ if(pTrident->BlockHandler)
-+ pScreen->BlockHandler = pTrident->BlockHandler;
-
- pScreen->CloseScreen = pTrident->CloseScreen;
- return (*pScreen->CloseScreen)(scrnIndex, pScreen);
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c Sat Dec 16 12:33:00 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c Sat Feb 10 09:37:50 2001
-@@ -46,8 +46,7 @@
- int freq, ffreq;
- int m, n, k;
- int p, q, r, s;
-- int startn, endn;
-- int endm, endk;
-+ int endn, endm, endk, startk;
-
- p = q = r = s = 0;
-
-@@ -55,23 +54,25 @@
-
- if (pTrident->NewClockCode)
- {
-- startn = 64;
- endn = 255;
- endm = 63;
-- endk = 3;
-+ endk = 2;
-+ if (clock >= 100000) startk = 0;
-+ if (clock < 100000) startk = 1;
-+ if (clock < 50000) startk = 2;
- }
- else
- {
-- startn = 0;
- endn = 121;
- endm = 31;
- endk = 1;
-+ startk = 0;
- }
-
- freq = clock;
-
-- for (k=endk;k>=0;k--)
-- for (n=startn;n<=endn;n++)
-+ for (k=startk;k<=endk;k++)
-+ for (n=0;n<=endn;n++)
- for (m=1;m<=endm;m++)
- {
- ffreq = ( ( ((n + 8) * pTrident->frequency) / ((m + 2) * powerup[k]) ) * 1000);
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c Mon Jun 12 22:28:34 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c Fri Feb 9 21:33:14 2001
-@@ -37,7 +37,7 @@
-
- DriverRec V4L = {
- 40000,
-- "Xv driver for video4linux",
-+ "v4l",
- V4LIdentify, /* Identify*/
- V4LProbe, /* Probe */
- V4LAvailableOptions,
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/etc/bindist/common/host.def xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def Sat Dec 16 12:36:43 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def Tue Dec 19 13:13:36 2000
-@@ -21,5 +21,6 @@
-
- #define InstallHardcopyDocs YES
- #define HardcopyDocDirs RX XIE XKB XPRINT
-+#define InstallMiscManPages YES
-
-
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/parser/Monitor.c xc/programs/Xserver/hw/xfree86/parser/Monitor.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/parser/Monitor.c Tue Dec 5 14:06:53 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/parser/Monitor.c Fri Feb 9 21:33:15 2001
-@@ -434,7 +434,7 @@
- break;
- case DASH:
- if (xf86getToken (NULL) != NUMBER ||
-- val.realnum < ptr->mon_hsync[ptr->mon_n_hsync].lo)
-+ (float)val.realnum < ptr->mon_hsync[ptr->mon_n_hsync].lo)
- Error (HORIZSYNC_MSG, NULL);
- ptr->mon_hsync[ptr->mon_n_hsync].hi = val.realnum;
- break;
-@@ -468,7 +468,7 @@
- break;
- case DASH:
- if (xf86getToken (NULL) != NUMBER ||
-- val.realnum < ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo)
-+ (float)val.realnum < ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo)
- Error (VERTREFRESH_MSG, NULL);
- ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = val.realnum;
- break;
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/xf86cfg/Imakefile xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile Sat Dec 16 12:33:00 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile Fri Feb 9 21:33:15 2001
-@@ -96,7 +96,7 @@
- #endif
-
- DEFINES = -DXF86CONFIG=\"XConfigFile\" $(MODULEDEFINES) \
-- $(CURSESDEFINES)
-+ $(CURSESDEFINES) -DPROJECT_ROOT=\"ProjectRoot\"
-
- #if HasDlopen
- DLLIB = DlLibrary
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad Thu Nov 30 15:55:16 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad Fri Feb 9 21:39:41 2001
-@@ -1338,7 +1338,7 @@
- <tt><b>Apply changes</b></tt> button there is no way to undo your changes.</font>
-
-
--*Expert.geometry: 800x600
-+*Expert.geometry: 640x460
- *Expert*vpane.min: 64
- *Expert*vpane.max: 64
- *Expert*vpane.showGrip: False
-@@ -1767,3 +1767,4 @@
- *expert*tree*buffers.flagsL.fromVert: size
- *expert*tree*buffers.flags.fromVert: size
- *expert*tree*buffers.flags.fromHoriz: flagsL
-+*Expert*close.label: Close
-\ No newline at end of file
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/xf86cfg/accessx.c xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c Fri Oct 20 10:59:05 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c Fri Feb 9 21:39:41 2001
-@@ -179,15 +179,12 @@
- XtNstate,
- (xkb_info->xkb->ctrls->enabled_ctrls &
- (XkbAccessXKeysMask | XkbStickyKeysMask |
-- XkbMouseKeysMask | XkbMouseKeysAccelMask |
-- XkbRepeatKeysMask | XkbSlowKeysMask |
-- XkbBounceKeysMask)) != 0, NULL, 0);
-+ XkbSlowKeysMask | XkbBounceKeysMask)) != 0, NULL, 0);
-
- apply = XtCreateManagedWidget("apply", commandWidgetClass, accessx, NULL, 0);
- XtAddCallback(apply, XtNcallback, ApplyCallback, NULL);
-
- form = XtCreateManagedWidget("Accessx", formWidgetClass, accessx, NULL, 0);
-- XtAddCallback(enable, XtNcallback, EnableCallback, (XtPointer)form);
- timeoutToggle = XtVaCreateManagedWidget("timeoutToggle", toggleWidgetClass,
- form, XtNstate,
- xkb_info->xkb->ctrls->ax_timeout > 60
-@@ -450,7 +447,6 @@
-
- XtSetArg(args[0], XtNstate, &state);
- XtGetValues(enable, args, 1);
-- EnableCallback(enable, (XtPointer)form, (XtPointer)(long)state);
- }
-
- void
-@@ -471,7 +467,7 @@
- static void
- EnableCallback(Widget w, XtPointer user_data, XtPointer call_data)
- {
-- XtSetSensitive(user_data, (long)call_data);
-+ XtSetSensitive((Widget)user_data, (long)call_data);
- }
-
- /*ARGSUSED*/
-@@ -534,162 +530,148 @@
- XtSetArg(args[0], XtNstate, &state);
- XtGetValues(enable, args, 1);
- if (state) {
-- xkb_info->xkb->ctrls->enabled_ctrls |= XkbAccessXKeysMask;
- xkb_info->config.initial_ctrls |= XkbAccessXKeysMask;
-+ xkb_info->xkb->ctrls->enabled_ctrls |= XkbAccessXKeysMask;
-+ }
-+ else {
-+ xkb_info->config.initial_ctrls &= ~XkbAccessXKeysMask;
-+ xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbAccessXKeysMask;
-+ }
-+
-+ /* Timeout */
-+ XtSetArg(args[0], XtNstate, &state);
-+ XtGetValues(timeoutToggle, args, 1);
-+ if (state)
-+ xkb_info->config.ax_timeout =
-+ xkb_info->xkb->ctrls->ax_timeout = timeout->value * 60;
-+ else
-+ xkb_info->config.ax_timeout =
-+ xkb_info->xkb->ctrls->ax_timeout = 65535;
-+
-+ /* Enable StickyKeys */
-+ XtSetArg(args[0], XtNstate, &state);
-+ XtGetValues(sticky, args, 1);
-+ if (state) {
-+ xkb_info->config.initial_ctrls |= XkbStickyKeysMask;
-+ xkb_info->xkb->ctrls->enabled_ctrls |= XkbStickyKeysMask;
-+ }
-+ else {
-+ xkb_info->config.initial_ctrls &= ~XkbStickyKeysMask;
-+ xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbStickyKeysMask;
-+ }
-+ XtSetArg(args[0], XtNstate, &state);
-+ XtGetValues(stickyAuto, args, 1);
-+ if (state) {
-+ xkb_info->config.initial_opts &= ~XkbAX_TwoKeysMask;
-+ xkb_info->config.initial_opts &= ~XkbAX_LatchToLockMask;
-+ xkb_info->xkb->ctrls->ax_options &= ~XkbAX_TwoKeysMask;
-+ xkb_info->xkb->ctrls->ax_options &= ~XkbAX_LatchToLockMask;
-+ }
-+ else {
-+ xkb_info->config.initial_opts &= ~XkbAX_TwoKeysMask;
-+ xkb_info->config.initial_opts |= XkbAX_LatchToLockMask;
-+ xkb_info->xkb->ctrls->ax_options &= ~XkbAX_TwoKeysMask;
-+ xkb_info->xkb->ctrls->ax_options |= XkbAX_LatchToLockMask;
-+ }
-+ XtSetArg(args[0], XtNstate, &state);
-+ XtGetValues(stickyBeep, args, 1);
-+ if (state) {
-+ xkb_info->config.initial_opts |= XkbAX_StickyKeysFBMask;
-+ xkb_info->xkb->ctrls->ax_options |= XkbAX_StickyKeysFBMask;
-+ }
-+ else {
-+ xkb_info->config.initial_opts &= ~XkbAX_StickyKeysFBMask;
-+ xkb_info->xkb->ctrls->ax_options &= ~XkbAX_StickyKeysFBMask;
-+ }
-+
-+ /* Enable MouseKeys */
-+ XtSetArg(args[0], XtNstate, &state);
-+ XtGetValues(mouse, args, 1);
-+ if (state) {
-+ xkb_info->config.initial_ctrls |= XkbMouseKeysAccelMask;
-+ xkb_info->xkb->ctrls->enabled_ctrls |= XkbMouseKeysMask |
-+ XkbMouseKeysAccelMask;
-+ xkb_info->config.mk_delay =
-+ xkb_info->xkb->ctrls->mk_delay = mouseDelay->value * 100;
-+ xkb_info->config.mk_interval =
-+ xkb_info->xkb->ctrls->mk_interval = 40;
-+ xkb_info->config.mk_time_to_max =
-+ xkb_info->xkb->ctrls->mk_time_to_max =
-+ (mouseTime->value * 1000) / xkb_info->xkb->ctrls->mk_interval;
-+ xkb_info->config.mk_max_speed =
-+ xkb_info->xkb->ctrls->mk_max_speed =
-+ mouseSpeed->value * mouseTime->value;
-+ xkb_info->config.mk_curve = xkb_info->xkb->ctrls->mk_curve = 0;
-+ }
-+ else {
-+ xkb_info->config.initial_ctrls &= ~(XkbMouseKeysMask |
-+ XkbMouseKeysAccelMask);
-+ xkb_info->xkb->ctrls->enabled_ctrls &= ~(XkbMouseKeysMask |
-+ XkbMouseKeysAccelMask);
-+ }
-+
-+ /* Enable RepeatKeys */
-+ XtSetArg(args[0], XtNstate, &state);
-+ XtGetValues(repeat, args, 1);
-+ if (state) {
-+ xkb_info->config.initial_ctrls |= XkbRepeatKeysMask;
-+ xkb_info->xkb->ctrls->enabled_ctrls |= XkbRepeatKeysMask;
-+ xkb_info->config.repeat_interval =
-+ xkb_info->xkb->ctrls->repeat_interval = repeatRate->value * 1000;
-+ xkb_info->config.repeat_delay =
-+ xkb_info->xkb->ctrls->repeat_delay = repeatDelay->value * 1000;
-+ }
-+ else {
-+ xkb_info->config.initial_ctrls &= ~XkbRepeatKeysMask;
-+ xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbRepeatKeysMask;
-+ }
-
-- /* Timeout */
-- XtSetArg(args[0], XtNstate, &state);
-- XtGetValues(timeoutToggle, args, 1);
-- if (state)
-- xkb_info->config.ax_timeout =
-- xkb_info->xkb->ctrls->ax_timeout = timeout->value * 60;
-- else
-- xkb_info->config.ax_timeout =
-- xkb_info->xkb->ctrls->ax_timeout = 65535;
--
-- /* Enable StickyKeys */
-- XtSetArg(args[0], XtNstate, &state);
-- XtGetValues(sticky, args, 1);
-- if (state) {
-- xkb_info->config.initial_ctrls |= XkbStickyKeysMask;
-- xkb_info->xkb->ctrls->enabled_ctrls |= XkbStickyKeysMask;
-- }
-- else {
-- xkb_info->config.initial_ctrls &= ~XkbStickyKeysMask;
-- xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbStickyKeysMask;
-- }
-- XtSetArg(args[0], XtNstate, &state);
-- XtGetValues(stickyAuto, args, 1);
-- if (state) {
-- xkb_info->config.initial_opts &= ~XkbAX_TwoKeysMask;
-- xkb_info->config.initial_opts &= ~XkbAX_LatchToLockMask;
-- xkb_info->xkb->ctrls->ax_options &= ~XkbAX_TwoKeysMask;
-- xkb_info->xkb->ctrls->ax_options &= ~XkbAX_LatchToLockMask;
-- }
-- else {
-- xkb_info->config.initial_opts &= ~XkbAX_TwoKeysMask;
-- xkb_info->config.initial_opts |= XkbAX_LatchToLockMask;
-- xkb_info->xkb->ctrls->ax_options &= ~XkbAX_TwoKeysMask;
-- xkb_info->xkb->ctrls->ax_options |= XkbAX_LatchToLockMask;
-- }
-- XtSetArg(args[0], XtNstate, &state);
-- XtGetValues(stickyBeep, args, 1);
-- if (state) {
-- xkb_info->config.initial_opts |= XkbAX_StickyKeysFBMask;
-- xkb_info->xkb->ctrls->ax_options |= XkbAX_StickyKeysFBMask;
-- }
-- else {
-- xkb_info->config.initial_opts &= ~XkbAX_StickyKeysFBMask;
-- xkb_info->xkb->ctrls->ax_options &= ~XkbAX_StickyKeysFBMask;
-- }
--
-- /* Enable MouseKeys */
-- XtSetArg(args[0], XtNstate, &state);
-- XtGetValues(mouse, args, 1);
-- if (state) {
-- xkb_info->config.initial_ctrls |= XkbMouseKeysMask |
-- XkbMouseKeysAccelMask;
-- xkb_info->xkb->ctrls->enabled_ctrls |= XkbMouseKeysMask |
-- XkbMouseKeysAccelMask;
-- xkb_info->config.mk_delay =
-- xkb_info->xkb->ctrls->mk_delay = mouseDelay->value * 100;
-- xkb_info->config.mk_interval =
-- xkb_info->xkb->ctrls->mk_interval = 40;
-- xkb_info->config.mk_time_to_max =
-- xkb_info->xkb->ctrls->mk_time_to_max =
-- (mouseTime->value * 1000) / xkb_info->xkb->ctrls->mk_interval;
-- xkb_info->config.mk_max_speed =
-- xkb_info->xkb->ctrls->mk_max_speed =
-- mouseSpeed->value * mouseTime->value;
-- xkb_info->config.mk_curve = xkb_info->xkb->ctrls->mk_curve = 0;
-- }
-- else {
-- xkb_info->config.initial_ctrls &= ~(XkbMouseKeysMask |
-- XkbMouseKeysAccelMask);
-- xkb_info->xkb->ctrls->enabled_ctrls &= ~(XkbMouseKeysMask |
-- XkbMouseKeysAccelMask);
-- }
--
-- /* Enable RepeatKeys */
-- XtSetArg(args[0], XtNstate, &state);
-- XtGetValues(repeat, args, 1);
-- if (state) {
-- xkb_info->config.initial_ctrls |= XkbRepeatKeysMask;
-- xkb_info->xkb->ctrls->enabled_ctrls |= XkbRepeatKeysMask;
-- xkb_info->config.repeat_interval =
-- xkb_info->xkb->ctrls->repeat_interval = repeatRate->value * 1000;
-- xkb_info->config.repeat_delay =
-- xkb_info->xkb->ctrls->repeat_delay = repeatDelay->value * 1000;
-- }
-- else {
-- xkb_info->config.initial_ctrls &= ~XkbRepeatKeysMask;
-- xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbRepeatKeysMask;
-- }
--
-- /* Enable SlowKeys */
-- XtSetArg(args[0], XtNstate, &state);
-- XtGetValues(slowToggle, args, 1);
-- if (state) {
-- xkb_info->config.initial_ctrls |= XkbSlowKeysMask;
-- xkb_info->xkb->ctrls->enabled_ctrls |= XkbSlowKeysMask;
-- xkb_info->config.slow_keys_delay =
-- xkb_info->xkb->ctrls->slow_keys_delay = slow->value * 1000;
-- }
-- else {
-- xkb_info->config.initial_ctrls &= ~XkbSlowKeysMask;
-- xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbSlowKeysMask;
-- }
-- XtSetArg(args[0], XtNstate, &state);
-- XtGetValues(slowPressed, args, 1);
-- if (state) {
-- xkb_info->config.initial_opts |= XkbAX_SKPressFBMask;
-- xkb_info->xkb->ctrls->ax_options |= XkbAX_SKPressFBMask;
-- }
-- else {
-- xkb_info->config.initial_opts &= ~XkbAX_SKPressFBMask;
-- xkb_info->xkb->ctrls->ax_options &= ~XkbAX_SKPressFBMask;
-- }
-- XtSetArg(args[0], XtNstate, &state);
-- XtGetValues(slowAccepted, args, 1);
-- if (state) {
-- xkb_info->config.initial_opts |= XkbAX_SKAcceptFBMask;
-- xkb_info->xkb->ctrls->ax_options |= XkbAX_SKAcceptFBMask;
-- }
-- else {
-- xkb_info->config.initial_opts &= ~XkbAX_SKAcceptFBMask;
-- xkb_info->xkb->ctrls->ax_options &= ~XkbAX_SKAcceptFBMask;
-- }
--
-- /* Enable BounceKeys */
-- XtSetArg(args[0], XtNstate, &state);
-- XtGetValues(bounceToggle, args, 1);
-- if (state) {
-- xkb_info->config.initial_ctrls |= XkbBounceKeysMask;
-- xkb_info->xkb->ctrls->enabled_ctrls |= XkbBounceKeysMask;
-- xkb_info->config.debounce_delay =
-- xkb_info->xkb->ctrls->debounce_delay = bounce->value * 1000;
-- }
-- else {
-- xkb_info->config.initial_ctrls &= ~XkbBounceKeysMask;
-- xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbBounceKeysMask;
-- }
-- }
-- else {
-- xkb_info->config.initial_ctrls &=
-- ~(XkbAccessXKeysMask | XkbStickyKeysMask | XkbMouseKeysMask |
-- XkbMouseKeysAccelMask | XkbRepeatKeysMask | XkbSlowKeysMask |
-- XkbBounceKeysMask);
-- xkb_info->config.initial_opts &=
-- ~(XkbAX_TwoKeysMask | XkbAX_LatchToLockMask | XkbAX_StickyKeysFBMask |
-- XkbAX_SKPressFBMask | XkbAX_SKAcceptFBMask);
--
-- xkb_info->xkb->ctrls->enabled_ctrls &=
-- ~(XkbAccessXKeysMask | XkbStickyKeysMask | XkbMouseKeysMask |
-- XkbMouseKeysAccelMask | XkbRepeatKeysMask | XkbSlowKeysMask |
-- XkbBounceKeysMask);
-- xkb_info->xkb->ctrls->ax_options &=
-- ~(XkbAX_TwoKeysMask | XkbAX_LatchToLockMask | XkbAX_StickyKeysFBMask |
-- XkbAX_SKPressFBMask | XkbAX_SKAcceptFBMask);
-+ /* Enable SlowKeys */
-+ XtSetArg(args[0], XtNstate, &state);
-+ XtGetValues(slowToggle, args, 1);
-+ if (state) {
-+ xkb_info->config.initial_ctrls |= XkbSlowKeysMask;
-+ xkb_info->xkb->ctrls->enabled_ctrls |= XkbSlowKeysMask;
-+ xkb_info->config.slow_keys_delay =
-+ xkb_info->xkb->ctrls->slow_keys_delay = slow->value * 1000;
-+ }
-+ else {
-+ xkb_info->config.initial_ctrls &= ~XkbSlowKeysMask;
-+ xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbSlowKeysMask;
-+ }
-+ XtSetArg(args[0], XtNstate, &state);
-+ XtGetValues(slowPressed, args, 1);
-+ if (state) {
-+ xkb_info->config.initial_opts |= XkbAX_SKPressFBMask;
-+ xkb_info->xkb->ctrls->ax_options |= XkbAX_SKPressFBMask;
-+ }
-+ else {
-+ xkb_info->config.initial_opts &= ~XkbAX_SKPressFBMask;
-+ xkb_info->xkb->ctrls->ax_options &= ~XkbAX_SKPressFBMask;
-+ }
-+ XtSetArg(args[0], XtNstate, &state);
-+ XtGetValues(slowAccepted, args, 1);
-+ if (state) {
-+ xkb_info->config.initial_opts |= XkbAX_SKAcceptFBMask;
-+ xkb_info->xkb->ctrls->ax_options |= XkbAX_SKAcceptFBMask;
-+ }
-+ else {
-+ xkb_info->config.initial_opts &= ~XkbAX_SKAcceptFBMask;
-+ xkb_info->xkb->ctrls->ax_options &= ~XkbAX_SKAcceptFBMask;
-+ }
-+
-+ /* Enable BounceKeys */
-+ XtSetArg(args[0], XtNstate, &state);
-+ XtGetValues(bounceToggle, args, 1);
-+ if (state) {
-+ xkb_info->config.initial_ctrls |= XkbBounceKeysMask;
-+ xkb_info->xkb->ctrls->enabled_ctrls |= XkbBounceKeysMask;
-+ xkb_info->config.debounce_delay =
-+ xkb_info->xkb->ctrls->debounce_delay = bounce->value * 1000;
-+ }
-+ else {
-+ xkb_info->config.initial_ctrls &= ~XkbBounceKeysMask;
-+ xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbBounceKeysMask;
- }
-
- XkbSetControls(DPY, XkbAllControlsMask, xkb_info->xkb);
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/xf86cfg/expert.c xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c Sat Dec 2 10:31:02 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c Fri Feb 9 21:39:42 2001
-@@ -4615,6 +4615,9 @@
- XtNtreeParent, config, NULL, 0);
- node->next = NewNode(mainNode, flags, NULL, config, NULL);
- node = node->next;
-+ if (XF86Config->conf_flags == NULL)
-+ XF86Config->conf_flags = (XF86ConfFlagsPtr)
-+ XtCalloc(1, sizeof(XF86ConfFlagsRec));
- XtAddCallback(flags, XtNcallback, OptionsCallback,
- (XtPointer)&(XF86Config->conf_flags->flg_option_lst));
-
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/xf86cfg/interface.c xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c Fri Dec 8 21:23:26 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c Fri Feb 9 21:39:42 2001
-@@ -61,7 +61,11 @@
- #include "stubs.h"
-
- #define randomize() srand((unsigned)time((time_t*)NULL))
-+#ifdef PROJECT_ROOT
-+#define DefaultXFree86Dir PROJECT_ROOT
-+#else
- #define DefaultXFree86Dir "/usr/X11R6"
-+#endif
-
- /*
- * Prototypes
-diff -Naur -x CVS xc.orig/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c Thu Nov 30 15:55:18 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c Fri Feb 9 21:39:42 2001
-@@ -275,6 +275,7 @@
- range[i].lo = range[i].hi = val;
- if (++i >= nrange || *str == '\0')
- break;
-+ continue;
- }
- else if (*str != '-')
- return (0);
-diff -Naur -x CVS xc.orig/programs/Xserver/xkb/Imakefile xc/programs/Xserver/xkb/Imakefile
---- XFree86-4.0.2.orig/xc/programs/Xserver/xkb/Imakefile Fri Oct 20 10:59:09 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/xkb/Imakefile Mon Jan 22 14:49:33 2001
-@@ -67,6 +67,8 @@
- LinkSourceFile(XKBAlloc.c,$(XLIBSRC))
- LinkSourceFile(XKBGAlloc.c,$(XLIBSRC))
-
-+#if UseConfDirForXkb
- LinkConfDirectory(xkb,.,xkb,.)
-+#endif
-
- DependTarget()
-diff -Naur -x CVS xc.orig/programs/Xserver/xkb/xkbActions.c xc/programs/Xserver/xkb/xkbActions.c
---- XFree86-4.0.2.orig/xc/programs/Xserver/xkb/xkbActions.c Tue Apr 4 15:25:23 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/xkb/xkbActions.c Fri Feb 9 21:39:42 2001
-@@ -1318,6 +1318,9 @@
- }
- else CoreProcessPointerEvent(xE,dev,count);
- }
-+ else if (keyEvent)
-+ FixKeyState(xE,dev);
-+
- xkbi->prev_state= oldState;
- XkbComputeDerivedState(xkbi);
- keyc->prev_state= keyc->state;
-diff -Naur -x CVS xc.orig/programs/xedit/c-mode.c xc/programs/xedit/c-mode.c
---- XFree86-4.0.2.orig/xc/programs/xedit/c-mode.c Mon Sep 27 02:30:08 1999
-+++ XFree86-4.0.2/xc/programs/xedit/c-mode.c Fri Feb 9 21:39:43 2001
-@@ -383,7 +383,7 @@
- rtmp = MAX(rtmp, pright);
- }
- right = anchor->position + entity->offset;
-- while (entity && ++count < 3) {
-+ while (entity && count++ < 3) {
- if (entity->property == Qerror) {
- right = anchor->position + entity->offset + entity->length;
- count = 0;
-diff -Naur -x CVS xc.orig/programs/xedit/ispell.c xc/programs/xedit/ispell.c
---- XFree86-4.0.2.orig/xc/programs/xedit/ispell.c Tue Sep 26 11:57:24 2000
-+++ XFree86-4.0.2/xc/programs/xedit/ispell.c Fri Feb 9 21:39:43 2001
-@@ -339,14 +339,31 @@
- static void
- IspellSetRepeated(Bool state)
- {
-+ static char *mispelled, *repeated;
-+ Arg args[1];
-+
-+ if (mispelled == NULL) {
-+ XtSetArg(args[0], XtNlabel, &mispelled);
-+ XtGetValues(ispell.mispelled, args, 1);
-+ mispelled = XtNewString(mispelled);
-+ }
-+ if (repeated == NULL) {
-+ XtSetArg(args[0], XtNlabel, &repeated);
-+ XtGetValues(ispell.repeated, args, 1);
-+ repeated = XtNewString(repeated);
-+ }
- XtSetSensitive(ispell.replaceAll, !state);
- XtSetSensitive(ispell.ignoreAll, !state);
- XtSetSensitive(ispell.add, !state);
- XtSetSensitive(ispell.addUncap, !state);
-- if (state && XtIsManaged(ispell.mispelled))
-- XtChangeManagedSet(&ispell.mispelled, 1, NULL, NULL, &ispell.repeated, 1);
-- else if (!state && XtIsManaged(ispell.repeated))
-- XtChangeManagedSet(&ispell.repeated, 1, NULL, NULL, &ispell.mispelled, 1);
-+ if (!state) {
-+ XtSetArg(args[0], XtNlabel, mispelled);
-+ XtSetValues(ispell.mispelled, args, 1);
-+ }
-+ else {
-+ XtSetArg(args[0], XtNlabel, repeated);
-+ XtSetValues(ispell.mispelled, args, 1);
-+ }
- }
-
- static void
-diff -Naur -x CVS xc.orig/programs/xkbcomp/rules/xfree86.lst xc/programs/xkbcomp/rules/xfree86.lst
---- XFree86-4.0.2.orig/xc/programs/xkbcomp/rules/xfree86.lst Wed Dec 6 15:18:08 2000
-+++ XFree86-4.0.2/xc/programs/xkbcomp/rules/xfree86.lst Fri Feb 9 21:39:43 2001
-@@ -38,6 +38,7 @@
- ca Canadian
- cs Czechoslovakian
- dk Danish
-+ dvorak Dvorak
- ee Estonian
- fi Finnish
- fr French
-@@ -64,7 +65,7 @@
- es Spanish
- se Swedish
- th Thai
-- uk Ukrainian
-+ ua Ukrainian
- gb United Kingdom
- vn Vietnamese
- nec/jp PC-98xx Series
-diff -Naur -x CVS xc.orig/programs/xload/Imakefile xc/programs/xload/Imakefile
---- XFree86-4.0.2.orig/xc/programs/xload/Imakefile Tue Nov 14 13:20:39 2000
-+++ XFree86-4.0.2/xc/programs/xload/Imakefile Mon Jan 22 14:49:35 2001
-@@ -27,7 +27,7 @@
- AllTarget(ProgramTargetName(xload))
- NormalProgramTarget(xload,$(OBJS),$(DEPLIBS),$(LOCAL_LIBRARIES),NullParameter)
-
--#if defined(OSF1Architecture) || defined(NetBSDArchitecture) || (defined(FreeBSDArchitecture) && OSMajorVersion > 1) || defined(OpenBSDArchitecture)
-+#if !InstallXloadSetGID
- InstallProgram(xload,$(BINDIR))
- #else
- InstallProgramWithFlags(xload,$(BINDIR),$(INSTKMEMFLAGS))
-diff -Naur -x CVS xc.orig/programs/xman/Imakefile xc/programs/xman/Imakefile
---- XFree86-4.0.2.orig/xc/programs/xman/Imakefile Fri Feb 11 22:55:14 2000
-+++ XFree86-4.0.2/xc/programs/xman/Imakefile Sat Jan 27 15:09:05 2001
-@@ -11,10 +11,13 @@
- #endif
- MANPATHS = $(SYSMANPATH) $(LOCALMANPATH)
- HELPFILE = -DHELPFILE=\"$(LIBDIR)$(PATHSEP)xman.help\"
-+#if HasMkstemp
-+MKSTEMP = -DHAS_MKSTEMP
-+#endif
-
- OSMAJORVERSION = OSMajorVersion
- OSMINORVERSION = OSMinorVersion
-- DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) -DOSMINORVERSION=$(OSMINORVERSION) $(HELPFILE) $(MANPATHS)
-+ DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) -DOSMINORVERSION=$(OSMINORVERSION) $(HELPFILE) $(MANPATHS) $(MKSTEMP)
- DEPLIBS = XawClientDepLibs
- LOCAL_LIBRARIES = XawClientLibs
- SRCS = ScrollByL.c handler.c man.c buttons.c help.c \
-diff -Naur -x CVS xc.orig/programs/xman/misc.c xc/programs/xman/misc.c
---- XFree86-4.0.2.orig/xc/programs/xman/misc.c Tue Jun 13 19:15:53 2000
-+++ XFree86-4.0.2/xc/programs/xman/misc.c Sat Jan 27 15:09:06 2001
-@@ -45,8 +45,18 @@
- #include <X11/Shell.h>
-
- static FILE * Uncompress(ManpageGlobals * man_globals, char * filename);
--static Boolean UncompressNamed(ManpageGlobals * man_globals, char * filename, char * output);
--static Boolean UncompressUnformatted(ManpageGlobals * man_globals, char * entry, char * filename);
-+#ifndef HAS_MKSTEMP
-+static Boolean UncompressNamed(ManpageGlobals * man_globals, char * filename,
-+ char * output);
-+static Boolean UncompressUnformatted(ManpageGlobals * man_globals,
-+ char * entry, char * filename);
-+#else
-+static Boolean UncompressNamed(ManpageGlobals * man_globals, char * filename,
-+ char * output, FILE ** output_fd);
-+static Boolean UncompressUnformatted(ManpageGlobals * man_globals,
-+ char * entry, char * filename,
-+ FILE **file);
-+#endif
-
- #if defined(ISC) || defined(SCO)
- static char *uncompress_format = NULL;
-@@ -279,14 +289,23 @@
- char tmp_file[BUFSIZ], error_buf[BUFSIZ];
- FILE * file;
-
-+#ifndef HAS_MKSTEMP
- if ( !UncompressNamed(man_globals, filename, tmp_file) )
- return(NULL);
-
- else if ((file = fopen(tmp_file, "r")) == NULL) {
-- sprintf(error_buf, "Something went wrong in retrieving the %s",
-- "uncompressed manual page try cleaning up /tmp.");
-- PopupWarning(man_globals, error_buf);
-+ sprintf(error_buf, "Something went wrong in retrieving the %s",
-+ "uncompressed manual page try cleaning up /tmp.");
-+ PopupWarning(man_globals, error_buf);
- }
-+#else
-+ if (!UncompressNamed(man_globals, filename, tmp_file, &file)) {
-+ sprintf(error_buf, "Something went wrong in retrieving the %s",
-+ "uncompressed manual page try cleaning up /tmp.");
-+ PopupWarning(man_globals, error_buf);
-+ return(NULL);
-+ }
-+#endif
-
- unlink(tmp_file); /* remove name in tree, it will remain
- until we close the fd, however. */
-@@ -302,11 +321,20 @@
- * Returns:; TRUE if the file was found.
- */
-
-+#ifndef HAS_MKSTEMP
- static Boolean
- UncompressNamed(ManpageGlobals * man_globals, char * filename, char * output)
-+#else
-+static Boolean
-+UncompressNamed(ManpageGlobals * man_globals, char * filename, char * output,
-+ FILE ** output_fd)
-+#endif
- {
- char tmp[BUFSIZ], cmdbuf[BUFSIZ], error_buf[BUFSIZ];
- struct stat junk;
-+#ifdef HAS_MKSTEMP
-+ int fd;
-+#endif
-
- if (stat(filename, &junk) != 0) { /* Check for existance of the file. */
- if (errno != ENOENT) {
-@@ -323,7 +351,16 @@
- */
-
- strcpy(tmp, MANTEMP); /* get a temp file. */
-+#ifndef HAS_MKSTEMP
- (void) mktemp(tmp);
-+#else
-+ fd = mkstemp(tmp);
-+ if (fd < 0) {
-+ PopupWarning(man_globals, "Error creating a temp file");
-+ return FALSE;
-+ }
-+ *output_fd = fdopen(fd, "r");
-+#endif
- strcpy(output, tmp);
-
- #ifdef GZIP_EXTENSION
-@@ -357,6 +394,9 @@
- Format(ManpageGlobals * man_globals, char * entry)
- {
- FILE * file;
-+#ifdef HAS_MKSTEMP
-+ int fd;
-+#endif
- Widget manpage = man_globals->manpagewidgets.manpage;
- char cmdbuf[BUFSIZ], tmp[BUFSIZ], filename[BUFSIZ], error_buf[BUFSIZ];
- char path[BUFSIZ];
-@@ -364,7 +404,11 @@
- Position x,y; /* location to pop up the
- "would you like to save" widget. */
-
-+#ifndef HAS_MKSTEMP
- if ( !UncompressUnformatted(man_globals, entry, filename) ) {
-+#else
-+ if ( !UncompressUnformatted(man_globals, entry, filename, &file) ) {
-+#endif
- /* We Really could not find it, this should never happen, yea right. */
- sprintf(error_buf, "Could not open manual page, %s", entry);
- PopupWarning(man_globals, error_buf);
-@@ -372,7 +416,11 @@
- return(NULL);
- }
-
-+#ifndef HAS_MKSTEMP
- if ((file = fopen(filename, "r")) != NULL) {
-+#else
-+ if (file != NULL) {
-+#endif
- char line[BUFSIZ];
-
- if (fgets(line, sizeof(line), file) != NULL) {
-@@ -408,13 +456,23 @@
- XFlush(XtDisplay(man_globals->standby));
-
- strcpy(tmp,MANTEMP); /* Get a temp file. */
-+#ifndef HAS_MKSTEMP
- (void) mktemp(tmp);
-+#else
-+ fd = mkstemp(tmp);
-+ file = fdopen(fd, "r");
-+#endif
- strcpy(man_globals->tempfile, tmp);
-
- ParseEntry(entry, path, NULL, NULL);
-
-+#ifndef HAS_MKSTEMP
- sprintf(cmdbuf,"cd %s ; %s %s %s > %s %s", path, TBL,
- filename, FORMAT, man_globals->tempfile, "2> /dev/null");
-+#else
-+ sprintf(cmdbuf,"cd %s ; %s %s %s >> %s %s", path, TBL,
-+ filename, FORMAT, man_globals->tempfile, "2> /dev/null");
-+#endif
-
- if(system(cmdbuf) != 0) { /* execute search. */
- sprintf(error_buf,
-@@ -423,12 +481,14 @@
- file = NULL;
- }
- else {
-+#ifndef HAS_MKSTEMP
- if ((file = fopen(man_globals->tempfile,"r")) == NULL) {
- sprintf(error_buf, "Something went wrong in retrieving the %s",
- "temp file, try cleaning up /tmp");
- PopupWarning(man_globals, error_buf);
- }
- else {
-+#endif
-
- XtPopdown( XtParent(man_globals->standby) );
-
-@@ -460,7 +520,9 @@
- else
- unlink(man_globals->tempfile);
- }
-+#ifndef HAS_MKSTEMP
- }
-+#endif
- }
-
- if (man_globals->compress || man_globals->gzip) /* If the original
-@@ -481,7 +543,13 @@
- */
-
- static Boolean
--UncompressUnformatted(ManpageGlobals * man_globals, char * entry, char * filename)
-+#ifndef HAS_MKSTEMP
-+UncompressUnformatted(ManpageGlobals * man_globals, char * entry,
-+ char * filename)
-+#else
-+UncompressUnformatted(ManpageGlobals * man_globals, char * entry,
-+ char * filename, FILE **file)
-+#endif
- {
- char path[BUFSIZ], page[BUFSIZ], section[BUFSIZ], input[BUFSIZ];
- int len_cat = strlen(CAT), len_man = strlen(MAN);
-@@ -505,7 +573,11 @@
- * Then for compressed files in an uncompressed directory.
- */
- sprintf(input, "%s.%s", filename, COMPRESSION_EXTENSION);
-+#ifndef HAS_MKSTEMP
- if ( UncompressNamed(man_globals, input, filename) ) {
-+#else
-+ if ( UncompressNamed(man_globals, input, filename, file) ) {
-+#endif
- man_globals->compress = TRUE;
- sprintf(man_globals->save_file, "%s/%s%s/%s.%s", path,
- CAT, section + len_cat, page, COMPRESSION_EXTENSION);
-@@ -514,7 +586,11 @@
- #ifdef GZIP_EXTENSION
- else {
- sprintf(input, "%s.%s", filename, GZIP_EXTENSION);
-+#ifndef HAS_MKSTEMP
- if ( UncompressNamed(man_globals, input, filename) ) {
-+#else
-+ if ( UncompressNamed(man_globals, input, filename, file) ) {
-+#endif
- man_globals->compress = TRUE;
- man_globals->gzip = TRUE;
- sprintf(man_globals->save_file, "%s/%s%s/%s.%s", path,
-@@ -542,7 +618,11 @@
- */
-
- sprintf(input, "%s.%s", filename, COMPRESSION_EXTENSION);
-+#ifndef HAS_MKSTEMP
- if ( UncompressNamed(man_globals, input, filename) ) {
-+#else
-+ if ( UncompressNamed(man_globals, input, filename, file) ) {
-+#endif
- man_globals->compress = TRUE;
- sprintf(man_globals->save_file, "%s/%s%s/%s.%s", path,
- CAT, section + len_cat, page, COMPRESSION_EXTENSION);
-@@ -551,7 +631,11 @@
- #ifdef GZIP_EXTENSION
- else {
- sprintf(input, "%s.%s", filename, GZIP_EXTENSION);
-+#ifndef HAS_MKSTEMP
- if ( UncompressNamed(man_globals, input, filename) ) {
-+#else
-+ if ( UncompressNamed(man_globals, input, filename, file) ) {
-+#endif
- man_globals->compress = TRUE;
- man_globals->gzip = TRUE;
- sprintf(man_globals->save_file, "%s/%s%s/%s.%s", path,
-@@ -566,7 +650,11 @@
-
- sprintf(input, "%s/%s%s.%s/%s", path,
- MAN, section + len_man, COMPRESSION_EXTENSION, page);
-+#ifndef HAS_MKSTEMP
- if ( UncompressNamed(man_globals, input, filename) ) {
-+#else
-+ if ( UncompressNamed(man_globals, input, filename, file) ) {
-+#endif
- man_globals->compress = TRUE;
- sprintf(man_globals->save_file, "%s/%s%s.%s/%s", path,
- CAT, section + len_cat, COMPRESSION_EXTENSION, page);
-diff -Naur -x CVS xc.orig/programs/xman/search.c xc/programs/xman/search.c
---- XFree86-4.0.2.orig/xc/programs/xman/search.c Tue Jun 13 19:15:53 2000
-+++ XFree86-4.0.2/xc/programs/xman/search.c Sat Jan 27 15:09:06 2001
-@@ -149,11 +149,14 @@
- FILE *
- DoSearch(ManpageGlobals * man_globals, int type)
- {
-- char cmdbuf[BUFSIZ],*mantmp;
-+ char cmdbuf[BUFSIZ],*mantmp, *manpath;
- char tmp[BUFSIZ],path[BUFSIZ];
- char string_buf[BUFSIZ], cmp_str[BUFSIZ], error_buf[BUFSIZ];
- char * search_string = SearchString(man_globals);
- FILE * file;
-+#ifdef HAS_MKSTEMP
-+ int fd;
-+#endif
- int count;
- Boolean flag;
-
-@@ -171,13 +174,37 @@
- return(NULL);
- }
-
-- strcpy(tmp, MANTEMP); /* get a temp file. */
-- (void) mktemp(tmp);
-- mantmp = tmp;
--
- if (type == APROPOS) {
- char label[BUFSIZ];
-
-+ strcpy(tmp, MANTEMP); /* get a temp file. */
-+#ifdef HAS_MKSTEMP
-+ fd = mkstemp(tmp);
-+ if (fd < 0) {
-+ PopupWarning(man_globals, "Cant create temp file");
-+ return NULL;
-+ }
-+#else
-+ (void)mktemp(tmp);
-+#endif
-+ mantmp = tmp;
-+
-+ manpath=getenv("MANPATH");
-+ if (manpath == NULL || streq(manpath,"") ) {
-+#ifdef MANCONF
-+ if (!ReadManConfig(path))
-+#endif
-+ {
-+ strcpy(path,SYSMANPATH);
-+#ifdef LOCALMANPATH
-+ strcat(path,":");
-+ strcat(path,LOCALMANPATH);
-+#endif
-+ }
-+ } else {
-+ strcpy(path,manpath);
-+ }
-+
- sprintf(label,"Results of apropos search on: %s", search_string);
-
- #ifdef NO_MANPATH_SUPPORT /* not quite correct, but the best I can do. */
-@@ -191,7 +218,11 @@
- PopupWarning(man_globals, error_buf);
- }
-
-+#ifdef HAS_MKSTEMP
-+ if ((file = fdopen(fd, "r")) == NULL)
-+#else
- if((file = fopen(mantmp,"r")) == NULL)
-+#endif
- PrintError("lost temp file? out of temp space?");
-
- /*
-diff -Naur -x CVS xc.orig/programs/xman/vendor.h xc/programs/xman/vendor.h
---- XFree86-4.0.2.orig/xc/programs/xman/vendor.h Tue Aug 1 14:53:07 2000
-+++ XFree86-4.0.2/xc/programs/xman/vendor.h Sat Jan 27 15:09:07 2001
-@@ -135,10 +135,18 @@
- # define NO_COMPRESS
- # else
- # define COMPRESSION_EXTENSION "Z"
--# define UNCOMPRESS_FORMAT "zcat < %s > %s"
-+# ifndef HAS_MKSTEMP
-+# define UNCOMPRESS_FORMAT "zcat < %s > %s"
-+# else
-+# define UNCOMPRESS_FORMAT "zcat < %s >> %s"
-+# endif
- # define COMPRESS "compress"
- # define GZIP_EXTENSION "gz"
--# define GUNZIP_FORMAT "gzip -c -d < %s > %s"
-+# ifndef HAS_MKSTEMP
-+# define GUNZIP_FORMAT "gzip -c -d < %s > %s"
-+# else
-+# define GUNZIP_FORMAT "gzip -c -d < %s >> %s"
-+# endif
- # define GZIP_COMPRESS "gzip"
- # endif /* ISC */
- # endif /* UTEK */
-@@ -154,10 +162,19 @@
- # define NO_MANPATH_SUPPORT
- #endif
-
--#ifdef NO_MANPATH_SUPPORT
--# define APROPOS_FORMAT ("man -k %s | pr -h Apropos >> %s")
-+#ifndef HAS_MKSTEMP
-+# ifdef NO_MANPATH_SUPPORT
-+# define APROPOS_FORMAT ("man -k %s | pr -h Apropos > %s")
-+# else
-+# define APROPOS_FORMAT ("man -M %s -k %s | pr -h Apropos > %s")
-+# endif
- #else
--# define APROPOS_FORMAT ("man -M %s -k %s | pr -h Apropos > %s")
-+/* with mkstemp the temp output file is already created */
-+# ifdef NO_MANPATH_SUPPORT
-+# define APROPOS_FORMAT ("man -k %s | pr -h Apropos >> %s")
-+# else
-+# define APROPOS_FORMAT ("man -M %s -k %s | pr -h Apropos >> %s")
-+# endif
- #endif
-
- #ifdef ultrix
+++ /dev/null
---- XFree86-3.3.5/xc/programs/mkfontdir/mkfontdir.c.xfsftfontdir Fri Nov 13 09:17:34 1998
-+++ XFree86-3.3.5/xc/programs/mkfontdir/mkfontdir.c Thu Aug 19 10:01:45 1999
-@@ -111,6 +111,7 @@
- #include <X11/X.h>
- #include <X11/Xproto.h>
- #include "fntfilst.h"
-+#include "fontenc.h"
-
- #include <errno.h>
- #ifdef X_NOT_STDC_ENV
-@@ -122,16 +123,67 @@
- #include <X11/keysymdef.h>
-
- char *progName;
-+char *prefix = "";
-+Bool relative = FALSE;
-+
-+/* The possible extensions for encoding files, in decreasing priority */
-+#ifdef X_GZIP_FONT_COMPRESSION
-+#define NUMENCODINGEXTENSIONS 2
-+char *encodingExtensions[]={".gz", ".Z"};
-+#else
-+#define NUMENCODINGEXTENSIONS 1
-+char *encodingExtensions[]={".Z"};
-+#endif
-+
-+typedef struct _nameBucket {
-+ struct _nameBucket *next;
-+ char *name;
-+ FontRendererPtr renderer;
-+} NameBucketRec, *NameBucketPtr;
-+
-+typedef struct _encodingBucket {
-+ struct _encodingBucket *next;
-+ char *name;
-+ char *fileName;
-+ int priority;
-+} EncodingBucketRec, *EncodingBucketPtr;
-+
-+#define HASH_SIZE 1024
-+/* should be a divisor of HASH_SIZE */
-+#define ENCODING_HASH_SIZE 256
-+
-+
-+static Bool WriteFontTable ( char *dirName, FontTablePtr table,
-+ EncodingBucketPtr *encodings, int count);
-+static char * NameForAtomOrNone ( Atom a );
-+static Bool GetFontName ( char *file_name, char *font_name );
-+static char * FontNameExists ( FontTablePtr table, char *font_name );
-+int AddEntry ( FontTablePtr table, char *fontName, char *fileName );
-+static Bool ProcessFile ( char *dirName, char *fileName, FontTablePtr table );
-+static void Estrip ( char *ext, char *name );
-+char * MakeName ( char *name );
-+int Hash ( char *name );
-+Bool LoadEncodings(EncodingBucketPtr *encodings, char *dirName, int priority);
-+static Bool LoadDirectory ( char *dirName, FontTablePtr table );
-+int LoadScalable ( char *dirName, FontTablePtr table );
-+static Bool DoDirectory(char *dirName,
-+ EncodingBucketPtr *encodings, int count);
-+int GetDefaultPointSize ( void );
-+void RegisterFPEFunctions ( void );
-+void ErrorF ( void );
-
- static Bool
--WriteFontTable(dirName, table)
-+WriteFontTable(dirName, table, encodings, count)
- char *dirName;
- FontTablePtr table;
-+ EncodingBucketPtr *encodings;
-+ int count;
- {
- int i;
- FILE *file;
- char full_name[PATH_MAX];
- FontEntryPtr entry;
-+ EncodingBucketPtr encoding;
-
- sprintf (full_name, "%s/%s", dirName, FontDirFile);
-
-@@ -155,6 +207,30 @@
- fprintf (file, "%s %s\n", entry->u.bitmap.fileName, entry->name.name);
- }
- fclose (file);
-+
-+
-+ /* Write out encodings directory */
-+
-+ sprintf (full_name, "%s/%s", dirName, "encodings.dir");
-+ if (unlink(full_name) < 0 && errno != ENOENT)
-+ {
-+ fprintf(stderr, "%s: warning: cannot unlink %s\n", progName, full_name);
-+ return TRUE; /* non fatal error */
-+ }
-+ if(!count) return TRUE;
-+ file = fopen (full_name, "w");
-+ if (!file)
-+ {
-+ fprintf (stderr, "%s: can't create directory %s\n", progName, full_name);
-+ return TRUE;
-+ }
-+ fprintf(file, "%d\n", count);
-+ for(i=0; i<ENCODING_HASH_SIZE; i++)
-+ for(encoding=encodings[i]; encoding; encoding=encoding->next)
-+ fprintf(file, "%s %s%s\n",
-+ encoding->name, prefix, encoding->fileName);
-+ fclose(file);
-+
- return TRUE;
- }
-
-@@ -215,6 +291,7 @@
- return 0;
- }
-
-+int
- AddEntry (table, fontName, fileName)
- FontTablePtr table;
- char *fontName, *fileName;
-@@ -249,7 +326,7 @@
-
- CopyISOLatin1Lowered (font_name, font_name, strlen(font_name));
-
-- if (existing = FontNameExists (table, font_name))
-+ if ((existing = FontNameExists (table, font_name)) != 0)
- {
- fprintf (stderr, "%s: Duplicate font names %s\n", progName, font_name);
- fprintf (stderr, "\t%s %s\n", existing, fileName);
-@@ -259,6 +336,7 @@
- }
-
- static
-+void
- Estrip(ext,name)
- char *ext;
- char *name;
-@@ -268,16 +346,8 @@
-
- /***====================================================================***/
-
--typedef struct _nameBucket {
-- struct _nameBucket *next;
-- char *name;
-- FontRendererPtr renderer;
--} NameBucketRec, *NameBucketPtr;
--
- #define New(type,count) ((type *) malloc (count * sizeof (type)))
-
--#define HASH_SIZE 1024
--
- char *
- MakeName(name)
- char *name;
-@@ -297,7 +367,7 @@
- char c;
-
- i = 0;
-- while (c = *name++)
-+ while ((c = *name++) != 0)
- i = (i << 1) ^ c;
- return i & (HASH_SIZE - 1);
- }
-@@ -319,7 +389,6 @@
- int hash;
- char *extension;
- NameBucketPtr *hashTable, bucket, *prev, next;
-- Bool status;
-
- #ifdef WIN32
- if ((dirh = FindFirstFile("*.*", &file)) == INVALID_HANDLE_VALUE)
-@@ -435,8 +504,141 @@
- }
-
- static Bool
--DoDirectory(dirName)
-+CompareEncodingFiles(char *name1, char *name2)
-+{
-+ int len, len1, len2, p1, p2, i;
-+ char *extension;
-+
-+ len1=strlen(name1);
-+ len2=strlen(name2);
-+ p1=p2=-1;
-+
-+ for(extension=encodingExtensions[0], i=0;
-+ i<NUMENCODINGEXTENSIONS;
-+ extension++, i++) {
-+ len=strlen(extension);
-+ if(p1<0 && len1>=len && !strcmp(name1+len1-len, extension))
-+ p1=i;
-+ if(p2<0 && len2>=len && !strcmp(name2+len2-len, extension))
-+ p2=i;
-+ }
-+
-+ if(p1<0)
-+ return FALSE;
-+ else if(p2<0)
-+ return TRUE;
-+ else
-+ return(p1<p2);
-+}
-+
-+static Bool
-+InsertEncoding(EncodingBucketPtr *encodings,
-+ char *name, char *fileName, int priority)
-+{
-+ int bucket;
-+ EncodingBucketPtr encoding;
-+
-+ bucket=Hash(name)%ENCODING_HASH_SIZE;
-+
-+ for(encoding=encodings[bucket]; encoding; encoding=encoding->next) {
-+ if(!strcmp(name, encoding->name)) {
-+ if(encoding->priority<priority)
-+ return TRUE;
-+ else if(encoding->priority>priority)
-+ break;
-+ else if(CompareEncodingFiles(fileName, encoding->fileName))
-+ break;
-+ else
-+ return TRUE;
-+
-+ }
-+ }
-+
-+ if(!encoding) {
-+ /* Need to insert new bucket */
-+ if((encoding=New(EncodingBucketRec, 1))==NULL)
-+ return FALSE;
-+ encoding->next=encodings[bucket];
-+ encodings[bucket]=encoding;
-+ }
-+
-+ /* Now encoding points to a bucket to fill in */
-+ encoding->name=name;
-+ encoding->fileName=fileName;
-+ encoding->priority=priority;
-+ return TRUE;
-+}
-+
-+Bool
-+LoadEncodings(EncodingBucketPtr *encodings, char *dirName, int priority)
-+{
-+ EncodingBucketPtr new;
-+ char *filename;
-+ char **names;
-+ char **name;
-+ char fullname[MAXFONTFILENAMELEN];
-+ int len;
-+#ifdef WIN32
-+ HANDLE dirh;
-+ WIN32_FIND_DATA file;
-+#else
-+ DIR *dirp;
-+ struct dirent *file;
-+#endif
-+
-+ if (strcmp(dirName, ".") == 0) {
-+ len=0;
-+ } else {
-+ len=strlen(dirName);
-+ strcpy(fullname, dirName);
-+ if(fullname[len-1]!='/')
-+ fullname[len++]='/';
-+ }
-+
-+
-+#ifdef WIN32
-+ if ((dirh = FindFirstFile("*.*", &file)) == INVALID_HANDLE_VALUE)
-+ return FALSE;
-+#else
-+ if ((dirp = opendir (dirName)) == NULL)
-+ return FALSE;
-+#endif
-+#ifdef WIN32
-+ do {
-+#else
-+ while ((file = readdir (dirp)) != NULL) {
-+#endif
-+ if(len+strlen(FileName(file))>=MAXFONTFILENAMELEN) {
-+ fprintf(stderr, "%s: warning: filename `%s/%s' too long, ignored\n",
-+ progName, dirName, FileName(file));
-+ continue;
-+ }
-+ strcpy(fullname+len, FileName(file));
-+ names=identifyEncodingFile(fullname);
-+ if(names) {
-+ if((filename=New(char, strlen(fullname)+1))==NULL) {
-+ fprintf(stderr, "%s: warning: out of memory.\n", progName);
-+ break;
-+ }
-+ strcpy(filename, fullname);
-+ for(name=names; *name; name++)
-+ if(!InsertEncoding(encodings, *name, filename, priority))
-+ fprintf(stderr, "%s: warning: failed to insert encoding %s\n", *name);
-+ /* Only free the spine -- the names themselves may be used */
-+ free(names);
-+ }
-+ }
-+#ifdef WIN32
-+ while (FindNextFile(dirh, &file));
-+#endif
-+ return TRUE;
-+}
-+
-+static Bool
-+DoDirectory(dirName, encodings, count)
- char *dirName;
-+ EncodingBucketPtr *encodings;
-+ int count;
- {
- FontTableRec table;
- Bool status;
-@@ -455,42 +657,113 @@
- }
- status = TRUE;
- if (table.used >= 0)
-- status = WriteFontTable (dirName, &table);
-+ status = WriteFontTable (dirName, &table, encodings, count);
- FontFileFreeTable (&table);
- return status;
- }
-
--GetDefaultPointSize ()
-+int
-+GetDefaultPointSize (void)
- {
- return 120;
- }
-
--FontResolutionPtr GetClientResolutions ()
-+FontResolutionPtr GetClientResolutions (num)
-+ int *num;
- {
- return 0;
- }
-
--RegisterFPEFunctions ()
-+void
-+RegisterFPEFunctions (void)
- {
- }
-
--ErrorF ()
-+void
-+ErrorF (void)
- {
- }
-
- /***====================================================================***/
-
-+int
- main (argc, argv)
- int argc;
- char **argv;
- {
-- int i;
-+ int argn, i, count;
-+ char *dirname, fulldirname[MAXFONTFILENAMELEN];
-+ EncodingBucketPtr *encodings, encoding;
-+ char **name;
-
- BitmapRegisterFontFileFunctions ();
- progName = argv[0];
-- if (argc == 1)
-+ if((encodings=New(EncodingBucketPtr, ENCODING_HASH_SIZE))==NULL) {
-+ fprintf(stderr, "%s: out of memory\n", progName);
-+ exit(2);
-+ }
-+ for(i=0; i<ENCODING_HASH_SIZE; i++)
-+ encodings[i]=NULL;
-+
-+ for(argn=1; argn<argc; argn++) {
-+ if(argv[argn][0]=='\0' || argv[argn][0]!='-')
-+ break;
-+ if(argv[argn][1]=='-') {
-+ argn++;
-+ break;
-+ } else if(argv[argn][1]=='e') {
-+ if(argv[argn][2]=='\0') {
-+ argn++;
-+ if (argn < argc)
-+ dirname=argv[argn];
-+ else {
-+ fprintf(stderr, "%s: -e requires an argument\n", progName);
-+ break;
-+ }
-+ } else
-+ dirname=argv[argn]+2;
-+ if(dirname[0]=='/' || relative)
-+ LoadEncodings(encodings, dirname, argn);
-+ else {
-+ if(getcwd(fulldirname, MAXFONTFILENAMELEN)==NULL) {
-+ fprintf(stderr, "%s: failed to get cwd\n", progName);
-+ break;
-+ }
-+ i=strlen(fulldirname);
-+ if(i+1+strlen(dirname)>=MAXFONTFILENAMELEN-1) {
-+ fprintf(stderr, "%s: directory name `%s' too long\n", progName,
-+ dirname);
-+ break;
-+ }
-+ fulldirname[i++]='/';
-+ strcpy(fulldirname+i, dirname);
-+ LoadEncodings(encodings, fulldirname, argn);
-+ }
-+ } else if(argv[argn][1]=='p') {
-+ if(argv[argn][2]=='\0') {
-+ argn++;
-+ prefix=argv[argn];
-+ } else
-+ prefix=argv[argn]+2;
-+ } else if(argv[argn][1]=='r') {
-+ if(argv[argn][2]=='\0')
-+ relative=TRUE;
-+ else {
-+ fprintf(stderr, "%s: unknown option `%s'\n", progName, argv[argn]);
-+ continue;
-+ }
-+ } else
-+ fprintf(stderr, "%s: unknown option `%s'\n", progName, argv[argn]);
-+ }
-+
-+ count=0;
-+ for(i=0; i<ENCODING_HASH_SIZE; i++)
-+ for(encoding=encodings[i]; encoding; encoding=encoding->next)
-+ count++;
-+
-+ if (argc == argc)
- {
-- if (!DoDirectory("."))
-+ if (!DoDirectory(".", encodings, count))
- {
- fprintf (stderr, "%s: failed to create directory in %s\n",
- progName, ".");
-@@ -498,11 +771,11 @@
- }
- }
- else
-- for (i = 1; i < argc; i++) {
-- if (!DoDirectory(argv[i]))
-+ for (; argn < argc; argn++) {
-+ if (!DoDirectory(argv[argn], encodings, count))
- {
- fprintf (stderr, "%s: failed to create directory in %s\n",
-- progName, argv[i]);
-+ progName, argv[argn]);
- exit (1);
- }
- }
---- XFree86-3.3.5/xc/programs/mkfontdir/mkfontdir.man.xfsftfontdir Sat Dec 21 23:11:23 1996
-+++ XFree86-3.3.5/xc/programs/mkfontdir/mkfontdir.man Wed Aug 18 17:23:04 1999
-@@ -26,12 +26,22 @@
- .\" from the X Consortium.
- .TH MKFONTDIR 1 "Release 6.3" "X Version 11"
- .SH NAME
--mkfontdir, fonts.dir, fonts.scale, fonts.alias \- create an index of X font files in a directory
-+mkfontdir, fonts.dir, fonts.scale, fonts.alias, encodings.dir \- create an index of X font files in a directory
- .SH SYNOPSIS
- .B "mkfontdir"
--[\fIdirectory-name\fP .\|.\|. ]
-+.RB [ \-r ]
-+.RB [ \-p
-+.IR prefix ]
-+.RB [ \-e
-+.IR encoding-directory-name ]
-+\|.\|.\|.
-+.RB [ \-\- ]
-+.RI [ directory-name
-+\|.\|.\|. ]
- .SH DESCRIPTION
--For each directory argument, \fImkfontdir\fP reads all of the font files in the
-+For each directory argument,
-+.Imkfontdir
-+reads all of the font files in the
- directory searching for properties named "FONT", or (failing that) the name
- of the file stripped of its suffix. These are converted to lower case and
- used as font names, and,
-@@ -39,7 +49,9 @@
- written out to the file "fonts.dir" in the directory.
- The X server and font server use "fonts.dir" to find font files.
- .PP
--The kinds of font files read by \fImkfontdir\fP depend on configuration
-+The kinds of font files read by
-+.Imkfontdir
-+depend on configuration
- parameters, but typically include PCF (suffix ".pcf"), SNF (suffix ".snf")
- and BDF (suffix ".bdf"). If a font exists in multiple formats,
- .I mkfontdir
-@@ -53,7 +65,8 @@
- Because scalable font files do not usually include the X font name, the
- file "fonts.scale" can be used to name the scalable fonts in the
- directory.
--The fonts listed in it are copied to fonts.dir by \fImkfontdir\fP.
-+The fonts listed in it are copied to fonts.dir by
-+.Imkfontdir .
- "fonts.scale" has the same format as the "fonts.dir" file.
- .SH "FONT NAME ALIASES"
- The file "fonts.alias", which can be put in any directory of the font-path, is
-@@ -83,6 +96,48 @@
- If the string "FILE_NAMES_ALIASES" stands alone on a line, each file-name
- in the directory (stripped of its suffix) will be used as an alias for
- that font.
-+.SH ENCODING FILES
-+The option
-+.B -e
-+can be used to specify a directory with encoding files. Every such
-+directory is scanned for encoding files, the list of which is then
-+written to an "encodings.dir" file in every font directory. The
-+"encodings.dir" file is used by the server to find encoding
-+information.
-+.PP
-+The "encodings.dir" file has the same format as "fonts.dir".
-+It maps encoding names (strings of the form
-+.BI CHARSET_REGISTRY \- CHARSET_ENCODING
-+) to encoding file names.
-+.SH OPTIONS
-+The following options are supported:
-+.TP
-+.B \-e
-+Specify a directory containing encoding files. The
-+.B \-e
-+option may be specified multiple times, and all the specified
-+directories will be read. The order of the entries is significant, as
-+encodings found in earlier directories override those in later ones;
-+encoding files in the same directory are discriminated by preferring
-+compressed versions.
-+.TP
-+.B \-p
-+Specify a prefix that is prepended to the encoding file path names
-+when the are written to the "encodings.dir" file. The prefix is
-+prepended as-is. If a `/' is required between the prefix and the path
-+names, it must be supplied explicitly as part of the prefix.
-+.TP
-+.B \-r
-+Keep non-absolute encoding directories in their relative form when
-+writing the "encodings.dir" file. The default is to convert relative
-+encoding directories to absolute directories by prepending the current
-+directory. The positioning of this options is significant, as this
-+option only applies to subsequent
-+.B \-e
-+options.
-+.TP
-+.B \-\-
-+End options.
- .SH FILES
- .TP 15
- .B fonts.dir
-@@ -98,5 +153,10 @@
- List of font name aliases.
- Read by the X server and font server each
- time the font path is set (see xset(1)).
-+.TP 15
-+.B encodings.dir
-+List of known encodings and the files they are stored in.
-+Created by \fImkfontdir\fP. Read by the X server and font server each
-+time a font with an unknown charset is opened.
- .SH "SEE ALSO"
- X(1), Xserver(1), xfs(1), xset(1)
+++ /dev/null
---- XFree86-3.3.4.orig/xc/programs/xinit/xinit.c Sun Jun 27 12:32:26 1999
-+++ XFree86-3.3.4/xc/programs/xinit/xinit.c Sun Aug 8 22:28:20 1999
-@@ -596,30 +596,40 @@
- serverpid = -1;
- break;
- }
-- /*
-- * kludge to avoid race with TCP, giving server time to
-- * set his socket options before we try to open it,
-- * either use the 15 second timeout, or await SIGUSR1.
-+
-+ /*
-+ * before we try the below kludge, see if we are already
-+ * ready to connect. Fast CPUs with cached filesystems
-+ * shouldn't have to wait 15 seconds.
- *
-- * If your machine is substantially slower than 15 seconds,
-- * you can easily adjust this value.
-+ * pbrown@redhat.com - 06/08/1999
- */
-- alarm (15);
-+ if (waitforserver() == 0) {
-+ /*
-+ * kludge to avoid race with TCP, giving server time to
-+ * set his socket options before we try to open it,
-+ * either use the 15 second timeout, or await SIGUSR1.
-+ *
-+ * If your machine is substantially slower than 15 seconds,
-+ * you can easily adjust this value.
-+ */
-+ alarm (15);
-
- #ifndef X_NOT_POSIX
-- sigsuspend(&old);
-- alarm (0);
-- sigprocmask(SIG_SETMASK, &old, NULL);
-+ sigsuspend(&old);
-+ alarm (0);
-+ sigprocmask(SIG_SETMASK, &old, NULL);
- #else
-- sigpause (old);
-- alarm (0);
-- sigsetmask (old);
-+ sigpause (old);
-+ alarm (0);
-+ sigsetmask (old);
- #endif
-
-- if (waitforserver() == 0) {
-- Error("unable to connect to X server\r\n");
-- shutdown();
-- serverpid = -1;
-+ if (waitforserver() == 0) {
-+ Error("unable to connect to X server\r\n");
-+ shutdown();
-+ serverpid = -1;
-+ }
- }
- break;
- }
+++ /dev/null
---- XFree86-4.2.0/xc/programs/xkbcomp/symbols/us_intl.xkb-us_intl-missing-commas Sat Feb 9 14:37:36 2002
-+++ XFree86-4.2.0/xc/programs/xkbcomp/symbols/us_intl Sat Feb 9 14:39:35 2002
-@@ -40,22 +40,21 @@
- [ asciicircum, asciicircum ] };
- key <AC11> { [ dead_acute, dead_diaeresis ],
- [ apostrophe, quotedbl ] };
--
-- key <AE09> { [ 9, parenleft ]
-+ key <AE09> { [ 9, parenleft ],
- [ dead_breve, dead_breve ] };
-- key <AE10> { [ 0, parenright ]
-+ key <AE10> { [ 0, parenright ],
- [ dead_abovering, dead_abovering ] };
- key <AE11> { [ minus, underscore ],
- [ dead_macron, dead_belowdot ] };
- key <AE12> { [ equal, plus ],
- [ dead_doubleacute, dead_horn ] };
-- key <AC10> { [ semicolon, colon ]
-+ key <AC10> { [ semicolon, colon ],
- [ dead_ogonek, dead_diaeresis ] };
-- key <AB08> { [ comma, less ]
-+ key <AB08> { [ comma, less ],
- [ dead_cedilla, dead_caron ] };
-- key <AB09> { [ period, greater ]
-+ key <AB09> { [ period, greater ],
- [ dead_abovedot, dead_circumflex ] };
-- key <AB10> { [ slash, question ]
-+ key <AB10> { [ slash, question ],
- [ dead_hook, dead_hook ] };
-
-
+++ /dev/null
-
-The following patch fixes a problem in _XomGenericTextEscapement().
-The problem is that the font used when
-
-To reproduce the bug, load the following fontset:
-
- "-*-helvetica-bold-r-normal--10-*-*-*-p-*-*-*," \
- "-*-*-bold-r-normal-*-10-*-*-*-*-*-*-*,*"
-
-And then (in a Latin-1 locale) compare the results of measuring the
-string with actually drawing the font on the screen. Though helvetica
-is drawn on the screen, the width will not be the width from the
-helvetica font, but from a different font from matching on the '*'.
-
-The patch below fixes selecting the font for measuring the text
-escapement to work the same way as selecting the font for drawing.
-
-I've added another comment in a different portion of code that appears
-somewhat dubious to me; the entries in font_set->font_data are getting
-filled in with bogus fonts. Loading these fonts is unecessary
-overhead, and having them there is likely to produce odd bugs like
-this one.
-
-(I have to say that reading this code makes me more and more happy
-that I decided to ignore and bypass it for Pango.)
-
-Regards,
- Owen
-
---- xc/lib/X11/omGeneric.c.ots Wed Jul 12 12:02:04 2000
-+++ xc/lib/X11/omGeneric.c Wed Jul 12 12:09:15 2000
-@@ -1031,6 +1031,15 @@
-
- found_num++;
- is_found = True;
-+ /* We almost certainly should have 'break' here and should ignore
-+ * the rest of the patterns. The problem is that we'll overwrite
-+ * font_data->font and font_data->xlfd_name with later matches.
-+ * But the general expectation would be that font_data->xlfd_name
-+ * would correspond to to the returned value. (It's not clear
-+ * why this routine modifies font_data and has a font_data_return...)
-+ *
-+ * Owen Taylor <otaylor@redhat.com> 12 Jul 2000
-+ */
- }
-
- switch(class) {
---- xc/lib/X11/omTextEsc.c.ots Wed Jul 12 11:57:58 2000
-+++ xc/lib/X11/omTextEsc.c Wed Jul 12 12:07:41 2000
-@@ -151,10 +151,27 @@
- is_xchar2b, FONTSCOPE);
- if(ptr_len <= 0)
- break;
-+
-+ /* First, see if the "Best Match" font for the FontSet was set.
-+ * If it was, use that font. If it was not set, then use the
-+ * font defined by font_set->font_data[0] (which is what
-+ * _XomGetFontDataFromFontSet() always seems to return for
-+ * non-VW text). Note that given the new algorithm in
-+ * parse_fontname() and parse_fontdata(), fs->font will
-+ * *always* contain good data. We should probably remove
-+ * the check for "fd->font", but we won't :-) -- jjw/pma (HP)
-+ *
-+ * Above comment and way this is done propagated from omText.c
-+ * Note that fd->font is junk so using the result of the
-+ * above call /needs/ to be ignored.
-+ *
-+ * Owen Taylor <otaylor@redhat.com> 12 Jul 2000
-+ *
-+ */
- if(fd == (FontData) NULL ||
-- (font = fd->font) == (XFontStruct *) NULL) {
-+ (font = font_set->font) == (XFontStruct *) NULL) {
-
-- if((font = font_set->font) == (XFontStruct *) NULL)
-+ if((font = fd->font) == (XFontStruct *) NULL)
- break;
- }
-
+++ /dev/null
---- XFree86-4.3.0/xc/programs/xterm/charproc.c.xterm-can-2003-0063 2003-02-06 18:09:42.000000000 -0500
-+++ XFree86-4.3.0/xc/programs/xterm/charproc.c 2003-02-25 05:10:42.000000000 -0500
-@@ -3867,11 +3867,16 @@
- break;
-
- case 21: /* Report the window's title */
-+/* This code block is disabled to fix a security issue reported
-+ * in CAN-2003-0063
-+ */
-+#if 0
- report_win_label(screen, 'l', &text,
- XGetWMName(
- screen->display,
- VShellWindow,
- &text));
-+#endif
- break;
-
- default: /* DECSLPP (24, 25, 36, 48, 72, 144) */
+++ /dev/null
-diff -crN -x Makefile xc/lib/font/FreeType/ft.h xc.new/lib/font/FreeType/ft.h
-*** xc/lib/font/FreeType/ft.h Sun Apr 25 18:32:21 1999
---- xc.new/lib/font/FreeType/ft.h Sun Oct 10 01:48:10 1999
-***************
-*** 64,69 ****
---- 64,70 ----
- {
- int has_cmap;
- TT_CharMap cmap;
-+ int base;
- struct font_encoding *encoding;
- struct font_encoding_mapping *mapping;
- };
-***************
-*** 78,83 ****
---- 79,85 ----
-
- int ttf_pick_cmap(char*, int, char*, TT_Face, struct ttf_mapping *);
- int ftstrcasecmp(const char *s1, const char *s2);
-+ unsigned ttf_remap(unsigned code, struct ttf_mapping *tm);
-
- /* ftutil.c */
-
-***************
-*** 85,90 ****
- int ttf_u2a(int, char*, char*, int);
- int FTtoXReturnCode(int);
- int ttf_GetEnglishName(TT_Face, char *, int);
-!
-!
-
---- 87,91 ----
- int ttf_u2a(int, char*, char*, int);
- int FTtoXReturnCode(int);
- int ttf_GetEnglishName(TT_Face, char *, int);
-! int ttf_checkForTTCName(char*, char**, int*);
-
-diff -crN -x Makefile xc/lib/font/FreeType/ftenc.c xc.new/lib/font/FreeType/ftenc.c
-*** xc/lib/font/FreeType/ftenc.c Sun Apr 25 18:32:21 1999
---- xc.new/lib/font/FreeType/ftenc.c Sun Oct 10 02:51:55 1999
-***************
-*** 23,28 ****
---- 23,29 ----
- */
-
- /* TrueType-dependent encoding code */
-+ #include <string.h>
-
- #include "fontmisc.h" /* defines xalloc and friends */
- #include "fontenc.h"
-***************
-*** 41,46 ****
---- 42,48 ----
- struct font_encoding *encoding;
- struct font_encoding_mapping *mapping;
- TT_CharMap cmap;
-+
-
- char *encoding_name=0;
-
-***************
-*** 51,56 ****
---- 53,59 ----
-
- if(!strcasecmp(encoding_name, "truetype-raw")) {
- tm->has_cmap=0;
-+ tm->base=0;
- tm->encoding=0;
- tm->mapping=0;
- return 0;
-***************
-*** 61,66 ****
---- 64,79 ----
- &cmap)) {
- tm->has_cmap=1;
- tm->cmap=cmap;
-+ if(!strcasecmp(encoding_name, "microsoft-symbol")) {
-+ /* deal with undocumented lossage */
-+ TT_Face_Properties properties;
-+ if(!TT_Get_Face_Properties(face, &properties) &&
-+ properties.os2!=0)
-+ tm->base=properties.os2->usFirstCharIndex-0x20;
-+ else
-+ tm->base=0;
-+ } else
-+ tm->base=0;
- tm->encoding=encoding;
- tm->mapping=mapping;
- return 0;
-***************
-*** 82,87 ****
---- 95,101 ----
- if(!find_cmap(FONT_ENCODING_UNICODE, 0, 0, face, &cmap)) {
- tm->has_cmap=1;
- tm->cmap=cmap;
-+ tm->base=0;
- tm->encoding=0;
- tm->mapping=0;
- return 0;
-***************
-*** 91,96 ****
---- 105,111 ----
- if(!TT_Get_CharMap(face, 0, &cmap)) {
- tm->has_cmap=1;
- tm->cmap=cmap;
-+ tm->base=0;
- tm->encoding=0;
- tm->mapping=0;
- return 0;
-***************
-*** 98,103 ****
---- 113,119 ----
-
- /* Tough. */
- tm->has_cmap=0;
-+ tm->base=0;
- tm->encoding=0;
- tm->mapping=0;
- return 0;
-***************
-*** 170,175 ****
---- 186,192 ----
- else
- return 0;
- }
-+ index += tm->base;
- if(tm->has_cmap)
- return TT_Char_Index(tm->cmap, index);
- else
-diff -crN -x Makefile xc/lib/font/FreeType/ftfuncs.c xc.new/lib/font/FreeType/ftfuncs.c
-*** xc/lib/font/FreeType/ftfuncs.c Sun Jun 13 19:06:17 1999
---- xc.new/lib/font/FreeType/ftfuncs.c Sun Oct 10 01:49:04 1999
-***************
-*** 23,28 ****
---- 23,30 ----
-
- /* $XFree86: xc/lib/font/FreeType/ftfuncs.c,v 1.11 1999/06/13 13:47:29 dawes Exp $ */
-
-+ #include <string.h>
-+
- #include "fontmisc.h"
- #include "fntfilst.h"
- #include "fontutil.h"
-***************
-*** 134,140 ****
-
- face->instances=0;
-
-! if(ttc_checkForTTCName(fileName, &realFileName, &faceNumber)) {
- ftrc=TT_Open_Collection(ftypeEngine, realFileName, faceNumber,
- &face->face);
- } else {
---- 136,142 ----
-
- face->instances=0;
-
-! if(ttf_checkForTTCName(fileName, &realFileName, &faceNumber)) {
- ftrc=TT_Open_Collection(ftypeEngine, realFileName, faceNumber,
- &face->face);
- } else {
-***************
-*** 775,781 ****
- static void
- FreeTypeFreeXFont(FontPtr pFont, int freeProps)
- {
-- int i;
- TTFFont *tf;
-
- if(pFont) {
---- 777,782 ----
-***************
-*** 812,818 ****
- int rawAverageWidth)
- {
- int i, j, maxprops;
-- unsigned long code;
- char *sp, *ep, val[256];
- TT_Instance_Metrics imetrics;
- int upm; /* units per em */
---- 813,818 ----
-***************
-*** 1573,1579 ****
- FontEncoding charEncoding, unsigned long *glyphCount,
- CharInfoPtr *glyphs, int nlevels)
- {
-- int idx;
- unsigned code;
- TTFFont *tf;
- CharInfoPtr *gp;
---- 1573,1578 ----
-diff -crN -x Makefile xc/lib/font/FreeType/ftfuncs.h xc.new/lib/font/FreeType/ftfuncs.h
-*** xc/lib/font/FreeType/ftfuncs.h Sun Apr 25 18:32:22 1999
---- xc.new/lib/font/FreeType/ftfuncs.h Sun Oct 10 01:45:15 1999
-***************
-*** 6,14 ****
- /* Glyphs are held in segments of this size */
- #define FONTSEGMENTSIZE 16
-
-- /* defined in atom.c */
-- Atom MakeAtom(char *, unsigned, int);
--
- /* A structure that holds bitmap order and padding info. */
-
- typedef struct {
---- 6,11 ----
-diff -crN -x Makefile xc/lib/font/FreeType/ftutil.c xc.new/lib/font/FreeType/ftutil.c
-*** xc/lib/font/FreeType/ftutil.c Sun Apr 25 18:32:22 1999
---- xc.new/lib/font/FreeType/ftutil.c Sun Oct 10 01:50:22 1999
-***************
-*** 161,167 ****
- int
- ttf_GetEnglishName(TT_Face face, char *name, int nameID)
- {
-! int i, j, nrec;
- unsigned short slen;
- unsigned short nrPlatformID, nrEncodingID, nrLanguageID, nrNameID;
- char *s;
---- 161,167 ----
- int
- ttf_GetEnglishName(TT_Face face, char *name, int nameID)
- {
-! int i, nrec;
- unsigned short slen;
- unsigned short nrPlatformID, nrEncodingID, nrLanguageID, nrNameID;
- char *s;
-***************
-*** 179,185 ****
- nrLanguageID==0x0c09 || nrLanguageID==0x1009 ||
- nrLanguageID==0x1409 || nrLanguageID==0x1809)) ||
- /* or for Apple, Unicode, English */
-! ((nrPlatformID==0 && nrNameID==nameID &
- nrLanguageID==0))) {
- if(!TT_Get_Name_String(face, i, &s, &slen))
- return ttf_u2a(slen, s, name, MSBFirst);
---- 179,185 ----
- nrLanguageID==0x0c09 || nrLanguageID==0x1009 ||
- nrLanguageID==0x1409 || nrLanguageID==0x1809)) ||
- /* or for Apple, Unicode, English */
-! ((nrPlatformID==0 && nrNameID==nameID &&
- nrLanguageID==0))) {
- if(!TT_Get_Name_String(face, i, &s, &slen))
- return ttf_u2a(slen, s, name, MSBFirst);
-***************
-*** 206,212 ****
- }
-
- int
-! ttc_checkForTTCName(char *fileName, char **realFileName, int *faceNumber)
- {
- int length;
- int fn;
---- 206,212 ----
- }
-
- int
-! ttf_checkForTTCName(char *fileName, char **realFileName, int *faceNumber)
- {
- int length;
- int fn;
-diff -crN -x Makefile xc/lib/font/fontfile/fontenc.c xc.new/lib/font/fontfile/fontenc.c
-*** xc/lib/font/fontfile/fontenc.c Sun Oct 10 03:03:10 1999
---- xc.new/lib/font/fontfile/fontenc.c Sun Oct 10 02:24:00 1999
-***************
-*** 518,537 ****
- {0,0,0,0,0,0,0}
- };
-
-! /* Apparently, Microsoft Symbol aims at being compatible with Unicode
-! * by using the 16 columns of the Private Use Area starting at code
-! * 0xF000. */
-!
-! static unsigned
-! eight_bit_to_microsoft_symbol(unsigned code, void *client_data)
-! {
-! return code+0xF000;
-! }
-
- static struct font_encoding_mapping microsoft_symbol[]=
-! {{FONT_ENCODING_TRUETYPE,3,0,eight_bit_to_microsoft_symbol,0,0,0},
- /* You never know */
-! {FONT_ENCODING_TRUETYPE,3,1,eight_bit_to_microsoft_symbol,0,0,0},
- {0,0,0,0,0,0,0}};
-
- static struct font_encoding_mapping apple_roman[]=
---- 518,531 ----
- {0,0,0,0,0,0,0}
- };
-
-! /* Microsoft Symbol is treated specially in ftenc.c, where we add
-! * usFirstCharIndex-0x20 to the glyph index before applying the
-! * cmap. */
-
- static struct font_encoding_mapping microsoft_symbol[]=
-! {{FONT_ENCODING_TRUETYPE,3,0,0,0,0,0},
- /* You never know */
-! {FONT_ENCODING_TRUETYPE,3,1,0,0,0,0},
- {0,0,0,0,0,0,0}};
-
- static struct font_encoding_mapping apple_roman[]=