diff options
author | kaleb <empty> | 1995-01-06 20:56:32 +0000 |
---|---|---|
committer | kaleb <empty> | 1995-01-06 20:56:32 +0000 |
commit | 2c541601676d14ab9b2d9c371ebc7d97c0226f39 (patch) | |
tree | b2ca7eac0fd2c80eb798bebe961498e72a99980f /xc/programs/Xserver/hw/xfree86 | |
parent | 5c4d93a1f56bfc908a69f0281effe5db1f830e1d (diff) |
3.1.0B
Diffstat (limited to 'xc/programs/Xserver/hw/xfree86')
73 files changed, 3048 insertions, 1556 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c index a308cdb1a..412af2463 100644 --- a/xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c +++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c @@ -25,14 +25,16 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c,v 3.0 1994/12/03 10:08:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c,v 3.2 1994/12/25 12:18:05 dawes Exp $ */ #include "Probe.h" -static Word Ports[] = {0xCF8, 0xCFA, 0x0000, 0x0000 }; +static Word Ports[] = {0xCF8, 0xCFA, 0xCFC, 0x000 }; #define NUMPORTS (sizeof(Ports)/sizeof(Word)) +#define PCI_EN 0x80000000 + static int MemProbe_I128 __STDCARGS((int)); static int I128Mem = 0; @@ -52,17 +54,88 @@ int *Chipset; { Bool result = FALSE; Word ioaddr, vendor, device, iobase; - Long id, vendordevice; + Long id, vendordevice, tmplong1, tmplong2, pcibus, cardnum; + Byte tmp1, tmp2, configtype = 0; - EnableIOPorts(NUMPORTS, Ports); + EnableIOPorts(2, Ports); - outp(0xCF8, 0x80); + outp(0xCF8, 0x00); outp(0xCFA, 0x00); + tmp1 = inp(0xCF8); + tmp2 = inp(0xCFA); + if ((tmp1 == 0x00) && (tmp2 == 0x00)) + configtype = 2; + else { + tmplong1 = inpl(0xCF8); + outpl(0xCF8, PCI_EN); + tmplong2 = inpl(0xCF8); + if (tmplong2 == PCI_EN); + configtype = 1; + outpl(0xCF8, tmplong1); + } - DisableIOPorts(NUMPORTS, Ports); + DisableIOPorts(2, Ports); + + if (configtype == 0) + return(FALSE); + else if (configtype == 1) { + EnableIOPorts(3, Ports); + for (pcibus = 0x000000; pcibus < 0x100000; pcibus += 0x10000) { + for (cardnum = 0x00000; cardnum < 0x10000; cardnum += 0x0800) { + outpl(0xCF8, PCI_EN | pcibus | cardnum); + tmplong1 = inpl(0xCFC); + vendor = (unsigned short )(tmplong1 & 0xFFFF); + device = (unsigned short )((tmplong1 >> 16) & 0xFFFF); +#ifdef DEBUG + printf("pci bus/card 0x%08x, vendor 0x%04x device 0x%04x\n", + pcibus | cardnum, vendor, device); +#endif + if ((vendor == 0x105D) && (device == 0x2309)) { + outpl(0xCF8, PCI_EN | pcibus | cardnum | 0x24); + iobase = inpl(0xCFC) & 0xFFFFFF00; + + DisableIOPorts(3, Ports); + Ports[3] = iobase + 0x18; + EnableIOPorts(4, Ports); + + id = inpl(iobase + 0x18); + DisableIOPorts(4, Ports); + + switch (id & 0xC0) { + case 0x00: + I128Mem = 4096; + break; + case 0x40: + I128Mem = 8192; + break; + case 0x80: + I128Mem = 16384; + break; + case 0xC0: + I128Mem = 32768; + break; + } + + *Chipset = CHIP_I128; + return(TRUE); + } + } + } + /* not found */ + DisableIOPorts(3, Ports); + return(FALSE); + } + + /* else configtype == 2 */ + + EnableIOPorts(2, Ports); + outp(0xCF8, 0x80); + outp(0xCFA, 0x00); + DisableIOPorts(2, Ports); for (ioaddr = 0xC000; ioaddr < 0xD000; ioaddr += 0x0100) { Ports[2] = ioaddr; + Ports[3] = ioaddr + 0x24; EnableIOPorts(NUMPORTS, Ports); vendordevice = inpl(ioaddr); @@ -70,8 +143,8 @@ int *Chipset; device = (unsigned short )((vendordevice >> 16) & 0xFFFF); #ifdef DEBUG - printf("pci slot at 0x%04x, vendor 0x%04x board 0x%04x\n", - ioaddr, vendor, board); + printf("pci slot at 0x%04x, vendor 0x%04x device 0x%04x\n", + ioaddr, vendor, device); #endif if ((vendor != 0x105D) || (device != 0x2309)) { @@ -82,7 +155,8 @@ int *Chipset; iobase = inpl(ioaddr + 0x24) & 0xFFFFFF00; DisableIOPorts(NUMPORTS, Ports); - Ports[3] = iobase; + Ports[2] = iobase + 0x18; + Ports[3] = 0x000; EnableIOPorts(NUMPORTS, Ports); id = inpl(iobase + 0x18) & 0x7FFFFFFF; diff --git a/xc/programs/Xserver/hw/xfree86/XF86_Acc.man b/xc/programs/Xserver/hw/xfree86/XF86_Acc.man index 1c838c756..0ffd334c2 100644 --- a/xc/programs/Xserver/hw/xfree86/XF86_Acc.man +++ b/xc/programs/Xserver/hw/xfree86/XF86_Acc.man @@ -1,5 +1,5 @@ -.\" $XConsortium: XF86_Acc.man,v 1.4 94/10/12 19:34:26 kaleb Exp kaleb $ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86_Acc.man,v 3.17 1994/11/05 23:38:20 dawes Exp $ +.\" $XConsortium: XF86_Acc.man,v 1.5 95/01/05 20:53:30 kaleb Exp kaleb $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86_Acc.man,v 3.19 1994/12/17 09:48:21 dawes Exp $ .TH XF86_Accel 1 "Version 3.1.1" "XFree86" .SH NAME XF86_Accel - accelerated X Window System servers for diff --git a/xc/programs/Xserver/hw/xfree86/accel/agx/agxDLine.c b/xc/programs/Xserver/hw/xfree86/accel/agx/agxDLine.c index 1426ff4c7..95bca095f 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/agx/agxDLine.c +++ b/xc/programs/Xserver/hw/xfree86/accel/agx/agxDLine.c @@ -1,5 +1,5 @@ -/* $XConsortium: s3dline.c,v 1.2 94/04/17 20:31:06 dpw Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/agx/agxDLine.c,v 3.0 1994/11/19 07:49:57 dawes Exp $ */ +/* $XConsortium: agxDLine.c,v 1.1 94/12/27 10:49:51 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/agx/agxDLine.c,v 3.1 1994/12/25 12:19:12 dawes Exp $ */ /* Copyright (c) 1987 X Consortium @@ -131,11 +131,12 @@ agxDLine(pDrawable, pGC, mode, npt, pptInit) int axis; /* major axis */ int cmd2; unsigned char *pDash; - int dashOffset; int numInDashList; - int dashIndex; + int dashOffset = 0; + int dashIndex = 0; + int dashIndexTmp = 0; int isDoubleDash; - int dashIndexTmp, dashOffsetTmp, thisDash, dashRemaining; + int dashOffsetTmp, thisDash, dashRemaining; int unclippedlen; unsigned int dashPat; /* a bunch of temporaries */ @@ -157,6 +158,19 @@ agxDLine(pDrawable, pGC, mode, npt, pptInit) pboxInit = REGION_RECTS(cclip); nboxInit = REGION_NUM_RECTS(cclip); + pDash = (unsigned char *) pGC->dash; + numInDashList = pGC->numInDashList; + miStepDash ((int)pGC->dashOffset, &dashIndex, pDash, + numInDashList, &dashOffset); + dashRemaining = pDash[dashIndex] - dashOffset; + thisDash = dashRemaining ; + + xorg = pDrawable->x; + yorg = pDrawable->y; + ppt = pptInit; + x2 = ppt->x + xorg; + y2 = ppt->y + yorg; + MAP_INIT( GE_MS_MAP_B, GE_MF_1BPP | GE_MF_MOTO_FORMAT, agxMemBase + agxScratchOffset, @@ -190,21 +204,6 @@ agxDLine(pDrawable, pGC, mode, npt, pptInit) | GE_OP_INC_X | GE_OP_INC_Y ); - pDash = (unsigned char *) pGC->dash; - numInDashList = pGC->numInDashList; - dashIndex = 0; - dashOffset = 0; - miStepDash ((int)pGC->dashOffset, &dashIndex, pDash, - numInDashList, &dashOffset); - dashRemaining = pDash[dashIndex] - dashOffset; - thisDash = dashRemaining ; - - - xorg = pDrawable->x; - yorg = pDrawable->y; - ppt = pptInit; - x2 = ppt->x + xorg; - y2 = ppt->y + yorg; while (--npt) { nbox = nboxInit; pbox = pboxInit; diff --git a/xc/programs/Xserver/hw/xfree86/accel/agx/agxDSeg.c b/xc/programs/Xserver/hw/xfree86/accel/agx/agxDSeg.c index af9b1127c..71b3cd775 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/agx/agxDSeg.c +++ b/xc/programs/Xserver/hw/xfree86/accel/agx/agxDSeg.c @@ -1,5 +1,5 @@ -/* $XConsortium: s3dline.c,v 1.2 94/04/17 20:31:06 dpw Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/agx/agxDSeg.c,v 3.0 1994/11/19 07:49:58 dawes Exp $ */ +/* $XConsortium: agxDSeg.c,v 1.1 94/12/27 10:50:35 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/agx/agxDSeg.c,v 3.1 1994/12/25 12:19:14 dawes Exp $ */ /* Copyright (c) 1987 X Consortium @@ -129,10 +129,11 @@ agxDSegment(pDrawable, pGC, nseg, pSeg) int axis; /* major axis */ int cmd2; unsigned char *pDash; - int dashOffset; int numInDashList; - int dashIndex; - int dashIndexTmp, dashOffsetTmp, thisDash, dashRemaining; + int dashOffset = 0; + int dashIndex = 0; + int dashIndexTmp = 0; + int dashOffsetTmp, thisDash, dashRemaining; unsigned int dashPat; /* a bunch of temporaries */ int tmp; @@ -153,6 +154,17 @@ agxDSegment(pDrawable, pGC, nseg, pSeg) pboxInit = REGION_RECTS(cclip); nboxInit = REGION_NUM_RECTS(cclip); + pDash = (unsigned char *) pGC->dash; + numInDashList = pGC->numInDashList; + dashIndex = 0; + dashIndexTmp = 0; + dashOffset = 0; + miStepDash ((int)pGC->dashOffset, &dashIndex, pDash, + numInDashList, &dashOffset); + + xorg = pDrawable->x; + yorg = pDrawable->y; + MAP_INIT( GE_MS_MAP_B, GE_MF_1BPP | GE_MF_INTEL_FORMAT, agxMemBase + agxScratchOffset, @@ -185,15 +197,6 @@ agxDSegment(pDrawable, pGC, nseg, pSeg) | GE_OP_INC_X | GE_OP_INC_Y ); - pDash = (unsigned char *) pGC->dash; - numInDashList = pGC->numInDashList; - dashIndex = 0; - dashOffset = 0; - miStepDash ((int)pGC->dashOffset, &dashIndex, pDash, - numInDashList, &dashOffset); - - xorg = pDrawable->x; - yorg = pDrawable->y; while (nseg--) { nbox = nboxInit; pbox = pboxInit; diff --git a/xc/programs/Xserver/hw/xfree86/accel/ibm8514/ibm8514.c b/xc/programs/Xserver/hw/xfree86/accel/ibm8514/ibm8514.c index cc2156c6d..da5655f56 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/ibm8514/ibm8514.c +++ b/xc/programs/Xserver/hw/xfree86/accel/ibm8514/ibm8514.c @@ -1,5 +1,5 @@ -/* $XConsortium: ibm8514.c,v 1.2 94/10/12 19:52:10 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/ibm8514/ibm8514.c,v 3.8 1994/10/23 12:57:17 dawes Exp $ */ +/* $XConsortium: ibm8514.c,v 1.3 95/01/05 20:25:39 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/ibm8514/ibm8514.c,v 3.9 1994/12/29 09:45:10 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -105,6 +105,7 @@ ScrnInfoRec ibm8514InfoRec = { 0, /* int instance */ 0, /* int s3Madjust */ 0, /* int s3Nadjust */ + 0, /* int s3MClk */ }; short ibm8514alu[16] = { diff --git a/xc/programs/Xserver/hw/xfree86/accel/mach32/Imakefile b/xc/programs/Xserver/hw/xfree86/accel/mach32/Imakefile index 7663d7b64..7bc25e97c 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/mach32/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/accel/mach32/Imakefile @@ -1,5 +1,5 @@ -XCOMM $XConsortium: Imakefile,v 1.1 94/10/05 13:31:19 kaleb Exp $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach32/Imakefile,v 3.5 1994/08/31 04:21:34 dawes Exp $ +XCOMM $XConsortium: Imakefile,v 1.2 94/10/12 19:59:09 kaleb Exp kaleb $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach32/Imakefile,v 3.6 1994/12/17 10:05:00 dawes Exp $ #include <Server.tmpl> SRCS = mach32.c mach32cmap.c mach32gc.c mach32fs.c mach32ss.c \ @@ -37,5 +37,6 @@ ObjectFromSpecialSource(mach32line1r,mach32line,-DONE_RECT) InstallLinkKitLibrary(mach32,$(LINKKITDIR)/drivers) +#ifndef OS2Architecture DependTarget() - +#endif diff --git a/xc/programs/Xserver/hw/xfree86/accel/mach32/mach32.c b/xc/programs/Xserver/hw/xfree86/accel/mach32/mach32.c index 2516e83d5..6ddc8379f 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/mach32/mach32.c +++ b/xc/programs/Xserver/hw/xfree86/accel/mach32/mach32.c @@ -1,5 +1,5 @@ -/* $XConsortium: mach32.c,v 1.2 94/10/12 19:59:09 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach32/mach32.c,v 3.24 1994/11/19 13:18:10 dawes Exp $ */ +/* $XConsortium: mach32.c,v 1.3 95/01/05 20:27:25 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach32/mach32.c,v 3.26 1994/12/29 09:47:18 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * Copyright 1993 by Kevin E. Martin, Chapel Hill, North Carolina. @@ -117,6 +117,7 @@ ScrnInfoRec mach32InfoRec = { 0, /* int instance */ 0, /* int s3Madjust */ 0, /* int s3Nadjust */ + 0, /* int s3MClk */ }; short mach32alu[16] = { @@ -271,6 +272,10 @@ static ATIInformationBlock *GetATIInformationBlock() /* Test for ATI accelerator product */ info.ATI_Accelerator_Present = 1; + /* Reset the 8514/A, and disable all interrupts. */ + outw(SUBSYS_CNTL, GPCTRL_RESET | CHPTEST_NORMAL); + outw(SUBSYS_CNTL, GPCTRL_ENAB | CHPTEST_NORMAL); + tmp = inw( ROM_ADDR_1 ); outw( ROM_ADDR_1, 0x5555 ); ProbeWaitIdleEmpty(); diff --git a/xc/programs/Xserver/hw/xfree86/accel/mach32/mach32init.c b/xc/programs/Xserver/hw/xfree86/accel/mach32/mach32init.c index c06670795..8f2b9d675 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/mach32/mach32init.c +++ b/xc/programs/Xserver/hw/xfree86/accel/mach32/mach32init.c @@ -1,5 +1,5 @@ -/* $XConsortium: mach32init.c,v 1.2 94/10/12 19:59:09 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach32/mach32init.c,v 3.3 1994/11/19 13:18:17 dawes Exp $ */ +/* $XConsortium: mach32init.c,v 1.3 95/01/05 20:27:25 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach32/mach32init.c,v 3.6 1994/12/25 12:23:21 dawes Exp $ */ /* * Written by Jake Richter * Copyright (c) 1989, 1990 Panacea Inc., Londonderry, NH - All Rights Reserved @@ -72,10 +72,10 @@ void mach32CalcCRTCRegs(crtcRegs, mode) mach32CRTCRegPtr crtcRegs; DisplayModePtr mode; { - crtcRegs->h_total = (mode->HTotal >> 3) - 1; - crtcRegs->h_disp = (mode->HDisplay >> 3) - 1; - crtcRegs->h_sync_strt = (mode->HSyncStart >> 3) - 1; - crtcRegs->h_sync_wid = (mode->HSyncEnd - mode->HSyncStart) >> 3; + crtcRegs->h_total = (mode->CrtcHTotal >> 3) - 1; + crtcRegs->h_disp = (mode->CrtcHDisplay >> 3) - 1; + crtcRegs->h_sync_strt = (mode->CrtcHSyncStart >> 3) - 1; + crtcRegs->h_sync_wid = (mode->CrtcHSyncEnd - mode->CrtcHSyncStart) >> 3; if (crtcRegs->h_sync_wid > 0x1f) { ErrorF("%s %s: Horizontal Sync width (%d) in mode \"%s\"\n", @@ -87,10 +87,10 @@ void mach32CalcCRTCRegs(crtcRegs, mode) if (mode->Flags & V_NHSYNC) crtcRegs->h_sync_wid |= H_POLARITY_NEG; - crtcRegs->v_total = SKIP_2(mode->VTotal - 1); - crtcRegs->v_disp = SKIP_2(mode->VDisplay - 1); - crtcRegs->v_sync_strt = SKIP_2(mode->VSyncStart - 1); - crtcRegs->v_sync_wid = mode->VSyncEnd - mode->VSyncStart; + crtcRegs->v_total = SKIP_2(mode->CrtcVTotal - 1); + crtcRegs->v_disp = SKIP_2(mode->CrtcVDisplay - 1); + crtcRegs->v_sync_strt = SKIP_2(mode->CrtcVSyncStart - 1); + crtcRegs->v_sync_wid = mode->CrtcVSyncEnd - mode->CrtcVSyncStart; if (crtcRegs->v_sync_wid > 0x1f) { ErrorF("%s %s: Vertical Sync width (%d) in mode \"%s\"\n", @@ -384,7 +384,7 @@ void mach32SetRamdac(clock) old_EXT_GE_CONFIG |= PIXEL_WIDTH_8 | (mach32DAC8Bit ? DAC_8_BIT_EN : 0); - if (mach32InfoRec.clock[(*clock >> 2) & 0xf] > 80000) { + if (mach32InfoRec.clock[(*clock >> 2) & 0x1f] > 80000) { /* pixel clock is SCLK/2 and VCLK/2 */ outb(OUTPUT_CLK_SEL, 0x09); @@ -419,7 +419,7 @@ void mach32SetRamdac(clock) MaskOn = 0; switch (mach32Ramdac) { case DAC_TLC34075: - if (mach32InfoRec.clock[(*clock >> 2) & 0xf] > 80000) { + if (mach32InfoRec.clock[(*clock >> 2) & 0x1f] > 80000) { ErrorF("Pixel multiplexing not supported at this depth\n"); break; } diff --git a/xc/programs/Xserver/hw/xfree86/accel/mach32/mach32scrin.c b/xc/programs/Xserver/hw/xfree86/accel/mach32/mach32scrin.c index 0e8f36bb4..e74fdacdd 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/mach32/mach32scrin.c +++ b/xc/programs/Xserver/hw/xfree86/accel/mach32/mach32scrin.c @@ -1,5 +1,5 @@ -/* $XConsortium: mach32scrin.c,v 1.1 94/10/05 13:31:19 kaleb Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach32/mach32scrin.c,v 3.4 1994/09/24 15:12:23 dawes Exp $ */ +/* $XConsortium: mach32scrin.c,v 1.3 94/10/12 19:59:09 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach32/mach32scrin.c,v 3.5 1994/12/10 02:07:52 dawes Exp $ */ /************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. Copyright 1993 by Kevin E. Martin, Chapel Hill, North Carolina. @@ -87,12 +87,10 @@ extern RegionPtr miCopyPlane(); static VisualRec visuals[] = { /* vid class bpRGB cmpE nplan rMask gMask bMask oRed oGreen oBlue */ -#ifndef STATIC_COLOR 0, PseudoColor, _BP, 1<<PSZ, PSZ, 0, 0, 0, 0, 0, 0, 0, DirectColor, _BP, _CE, PSZ, _RM, _GM, _BM, _RS, _GS, _BS, 0, GrayScale, _BP, 1<<PSZ, PSZ, 0, 0, 0, 0, 0, 0, 0, StaticGray, _BP, 1<<PSZ, PSZ, 0, 0, 0, 0, 0, 0, -#endif 0, StaticColor, _BP, 1<<PSZ, PSZ, _RM, _GM, _BM, _RS, _GS, _BS, 0, TrueColor, _BP, _CE, PSZ, _RM, _GM, _BM, _RS, _GS, _BS }; diff --git a/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64.c b/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64.c index ef03eefa3..85705f062 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64.c +++ b/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64.c @@ -1,5 +1,5 @@ -/* $XConsortium: $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach64/mach64.c,v 3.2 1994/12/05 03:45:36 dawes Exp $ */ +/* $XConsortium: mach64.c,v 1.1 94/12/14 15:04:34 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach64/mach64.c,v 3.3 1994/12/29 10:02:27 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * Copyright 1993,1994 by Kevin E. Martin, Chapel Hill, North Carolina. @@ -124,6 +124,9 @@ ScrnInfoRec mach64InfoRec = { 0, /* int COPbase */ 0, /* int POSbase */ 0, /* int instance */ + 0, /* int s3Madjust */ + 0, /* int s3Nadjust */ + 0, /* int s3MClk */ }; int mach64alu[16] = { diff --git a/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64init.c b/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64init.c index 82b85ae26..2ffd113fd 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64init.c +++ b/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64init.c @@ -1,5 +1,5 @@ -/* $XConsortium: $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach64/mach64init.c,v 3.0 1994/11/26 12:42:53 dawes Exp $ */ +/* $XConsortium: mach64init.c,v 1.1 94/12/14 15:04:34 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach64/mach64init.c,v 3.1 1994/12/11 10:52:36 dawes Exp $ */ /* * Written by Jake Richter * Copyright (c) 1989, 1990 Panacea Inc., Londonderry, NH - All Rights Reserved @@ -78,11 +78,11 @@ void mach64CalcCRTCRegs(crtcRegs, mode) int i; crtcRegs->h_total_disp = - (((mode->HDisplay >> 3) - 1) << 16) | - ((mode->HTotal >> 3) - 1); + (((mode->CrtcHDisplay >> 3) - 1) << 16) | + ((mode->CrtcHTotal >> 3) - 1); crtcRegs->h_sync_strt_wid = - (((mode->HSyncEnd - mode->HSyncStart) >> 3) << 16) | - ((mode->HSyncStart >> 3) - 1); + (((mode->CrtcHSyncEnd - mode->CrtcHSyncStart) >> 3) << 16) | + ((mode->CrtcHSyncStart >> 3) - 1); if ((crtcRegs->h_sync_strt_wid >> 16) > 0x1f) { ErrorF("%s %s: Horizontal Sync width (%d) in mode \"%s\"\n", @@ -97,11 +97,11 @@ void mach64CalcCRTCRegs(crtcRegs, mode) crtcRegs->h_sync_strt_wid |= CRTC_H_SYNC_NEG; crtcRegs->v_total_disp = - ((mode->VDisplay - 1) << 16) | - (mode->VTotal - 1); + ((mode->CrtcVDisplay - 1) << 16) | + (mode->CrtcVTotal - 1); crtcRegs->v_sync_strt_wid = - ((mode->VSyncEnd - mode->VSyncStart) << 16) | - (mode->VSyncStart - 1); + ((mode->CrtcVSyncEnd - mode->CrtcVSyncStart) << 16) | + (mode->CrtcVSyncStart - 1); if ((crtcRegs->v_sync_strt_wid >> 16) > 0x1f) { ErrorF("%s %s: Vertical Sync width (%d) in mode \"%s\"\n", diff --git a/xc/programs/Xserver/hw/xfree86/accel/mach8/mach8.c b/xc/programs/Xserver/hw/xfree86/accel/mach8/mach8.c index d6c8ed985..7349de781 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/mach8/mach8.c +++ b/xc/programs/Xserver/hw/xfree86/accel/mach8/mach8.c @@ -1,5 +1,5 @@ -/* $XConsortium: mach8.c,v 1.4 94/10/14 19:01:31 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach8/mach8.c,v 3.12 1994/11/26 12:43:21 dawes Exp $ */ +/* $XConsortium: mach8.c,v 1.5 95/01/05 20:28:29 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach8/mach8.c,v 3.13 1994/12/29 10:03:20 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -113,6 +113,7 @@ ScrnInfoRec mach8InfoRec = { 0, /* int instance */ 0, /* int s3Madjust */ 0, /* int s3Nadjust */ + 0, /* int s3MClk */ }; short mach8alu[16] = { diff --git a/xc/programs/Xserver/hw/xfree86/accel/mach8/mach8im.c b/xc/programs/Xserver/hw/xfree86/accel/mach8/mach8im.c index 183983e2a..5f9683aa0 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/mach8/mach8im.c +++ b/xc/programs/Xserver/hw/xfree86/accel/mach8/mach8im.c @@ -1,5 +1,5 @@ -/* $XConsortium: mach8im.c,v 1.4 94/10/14 19:01:31 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach8/mach8im.c,v 3.3 1994/11/26 12:43:32 dawes Exp $ */ +/* $XConsortium: mach8im.c,v 1.5 95/01/05 20:28:29 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach8/mach8im.c,v 3.4 1994/12/10 02:08:11 dawes Exp $ */ /* * Copyright 1992 by Kevin E. Martin, Chapel Hill, North Carolina. * @@ -347,11 +347,11 @@ mach8ImageStipple( int w, int h, char *psrc, + int pwidth, int pw, int ph, int pox, int poy, - int pwidth, Pixel fgPixel, Pixel bgPixel, short alu, @@ -365,8 +365,8 @@ mach8ImageStipple(x, y, w, h, psrc, pwidth, pw, ph, pox, poy, int w; int h; char *psrc; - int pw, ph, pox, poy; int pwidth; + int pw, ph, pox, poy; Pixel fgPixel; Pixel bgPixel; short alu; diff --git a/xc/programs/Xserver/hw/xfree86/accel/mach8/mach8init.c b/xc/programs/Xserver/hw/xfree86/accel/mach8/mach8init.c index 8330dbd98..90b5c476e 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/mach8/mach8init.c +++ b/xc/programs/Xserver/hw/xfree86/accel/mach8/mach8init.c @@ -1,5 +1,5 @@ -/* $XConsortium: mach8init.c,v 1.1 94/10/05 13:31:46 kaleb Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach8/mach8init.c,v 3.1 1994/09/23 10:09:16 dawes Exp $ */ +/* $XConsortium: mach8init.c,v 1.2 94/10/12 20:01:59 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach8/mach8init.c,v 3.2 1994/12/11 10:52:47 dawes Exp $ */ /* * Written by Jake Richter * Copyright (c) 1989, 1990 Panacea Inc., Londonderry, NH - All Rights Reserved @@ -55,11 +55,11 @@ mach8calcvmode(vmdef, pMode) vmdef->clk = pMode->Clock; - vmdef->hd = (pMode->HDisplay >> 3) - 1; - vmdef->ht = (pMode->HTotal >> 3) - 1; - /*vmdef->hss = (pMode->HSyncStart >> 3) - 1;*/ - vmdef->hss = (pMode->HSyncStart - 1) >> 3; - vmdef->hsw = (pMode->HSyncEnd - pMode->HSyncStart) >> 3; + vmdef->hd = (pMode->CrtcHDisplay >> 3) - 1; + vmdef->ht = (pMode->CrtcHTotal >> 3) - 1; + /*vmdef->hss = (pMode->CrtcHSyncStart >> 3) - 1;*/ + vmdef->hss = (pMode->CrtcHSyncStart - 1) >> 3; + vmdef->hsw = (pMode->CrtcHSyncEnd - pMode->CrtcHSyncStart) >> 3; if(vmdef->hsw > 0x1f) { ErrorF("%s %s: Horizontal Sync width (%d) in mode \"%s\"\n", @@ -68,19 +68,19 @@ mach8calcvmode(vmdef, pMode) } vmdef->hsw &= 0x1F; - vmdef->vd = ((((pMode->VDisplay-1)<<1)&0xFFF8) | - (((pMode->VDisplay-1))&0x3)) | - ((((pMode->VDisplay-1)&0x80)>>5)); + vmdef->vd = ((((pMode->CrtcVDisplay-1)<<1)&0xFFF8) | + (((pMode->CrtcVDisplay-1))&0x3)) | + ((((pMode->CrtcVDisplay-1)&0x80)>>5)); - vmdef->vt = ((((pMode->VTotal-1)<<1)&0xFFF8) | - (((pMode->VTotal-1)&0x3)) | - (((pMode->VTotal-1)&0x80)>>5)); + vmdef->vt = ((((pMode->CrtcVTotal-1)<<1)&0xFFF8) | + (((pMode->CrtcVTotal-1)&0x3)) | + (((pMode->CrtcVTotal-1)&0x80)>>5)); - vmdef->vss = ((((pMode->VSyncStart-1)<<1)&0xFFF8) | - (((pMode->VSyncStart-1)&0x3)) | - (((pMode->VSyncStart-1)&0x80)>>5)); + vmdef->vss = ((((pMode->CrtcVSyncStart-1)<<1)&0xFFF8) | + (((pMode->CrtcVSyncStart-1)&0x3)) | + (((pMode->CrtcVSyncStart-1)&0x80)>>5)); - vmdef->vsw = pMode->VSyncEnd - pMode->VSyncStart; + vmdef->vsw = pMode->CrtcVSyncEnd - pMode->CrtcVSyncStart; if(vmdef->vsw > 0x1f) { ErrorF("%s %s: Vertical Sync width (%d) in mode \"%s\"\n", diff --git a/xc/programs/Xserver/hw/xfree86/accel/mach8/mach8scrin.c b/xc/programs/Xserver/hw/xfree86/accel/mach8/mach8scrin.c index 838927b76..23f8d78c6 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/mach8/mach8scrin.c +++ b/xc/programs/Xserver/hw/xfree86/accel/mach8/mach8scrin.c @@ -1,4 +1,5 @@ -/* $XConsortium: mach8scrin.c,v 1.1 94/03/28 21:12:42 dpw Exp $ */ +/* $XConsortium: mach8scrin.c,v 1.2 94/04/17 20:31:01 dpw Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach8/mach8scrin.c,v 3.1 1994/12/10 03:00:30 dawes Exp $ */ /************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. @@ -41,7 +42,7 @@ Modified for the Mach-8 by Rickard E. Faith (faith@cs.unc.edu) ********************************************************/ -/* $XConsortium: mach8scrin.c,v 1.1 94/03/28 21:12:42 dpw Exp $ */ +/* $XConsortium: mach8scrin.c,v 1.2 94/04/17 20:31:01 dpw Exp kaleb $ */ #include "X.h" #include "Xmd.h" @@ -80,12 +81,10 @@ extern int defaultColorVisualClass; static VisualRec visuals[] = { /* vid class bpRGB cmpE nplan rMask gMask bMask oRed oGreen oBlue */ -#ifndef STATIC_COLOR 0, PseudoColor, _BP, 1<<PSZ, PSZ, 0, 0, 0, 0, 0, 0, 0, DirectColor, _BP, _CE, PSZ, _RM, _GM, _BM, _RS, _GS, _BS, 0, GrayScale, _BP, 1<<PSZ, PSZ, 0, 0, 0, 0, 0, 0, 0, StaticGray, _BP, 1<<PSZ, PSZ, 0, 0, 0, 0, 0, 0, -#endif 0, StaticColor, _BP, 1<<PSZ, PSZ, _RM, _GM, _BM, _RS, _GS, _BS, 0, TrueColor, _BP, _CE, PSZ, _RM, _GM, _BM, _RS, _GS, _BS }; @@ -175,17 +174,10 @@ mach8ScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width) pScreen->CreateGC = mach8CreateGC; pScreen->CreateColormap = cfbInitializeColormap; pScreen->DestroyColormap = (void (*)())NoopDDA; -#ifdef STATIC_COLOR - pScreen->InstallColormap = cfbInstallColormap; - pScreen->UninstallColormap = cfbUninstallColormap; - pScreen->ListInstalledColormaps = cfbListInstalledColormaps; - pScreen->StoreColors = (void (*)())NoopDDA; -#else pScreen->InstallColormap = mach8InstallColormap; pScreen->UninstallColormap = mach8UninstallColormap; pScreen->ListInstalledColormaps = mach8ListInstalledColormaps; pScreen->StoreColors = mach8StoreColors; -#endif pScreen->ResolveColor = cfbResolveColor; pScreen->BitmapToRegion = mfbPixmapToRegion; mfbRegisterCopyPlaneProc (pScreen, miCopyPlane); diff --git a/xc/programs/Xserver/hw/xfree86/accel/s3/Imakefile b/xc/programs/Xserver/hw/xfree86/accel/s3/Imakefile index 6f8bfdb0f..cd607e5fb 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/s3/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/accel/s3/Imakefile @@ -1,5 +1,5 @@ -XCOMM $XConsortium: Imakefile,v 1.1 94/10/05 13:32:36 kaleb Exp $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/accel/s3/Imakefile,v 3.6 1994/08/31 04:29:38 dawes Exp $ +XCOMM $XConsortium: Imakefile,v 1.2 94/10/12 20:07:37 kaleb Exp kaleb $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/accel/s3/Imakefile,v 3.7 1994/12/17 10:05:29 dawes Exp $ #include <Server.tmpl> #define IHaveSubdirs @@ -47,6 +47,8 @@ InstallLinkKitNonExecFile(confS3.sh,$(LINKKITDIR)) InstallLinkKitNonExecFile(s3.h,$(LINKKITDIR)/drivers) InstallLinkKitNonExecFile(regs3.h,$(LINKKITDIR)/drivers) +#ifndef OS2Architecture DependTarget() +#endif DependSubdirs($(SUBDIRS)) diff --git a/xc/programs/Xserver/hw/xfree86/accel/s3/drivers/Imakefile b/xc/programs/Xserver/hw/xfree86/accel/s3/drivers/Imakefile index f999650e7..c42b7e183 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/s3/drivers/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/accel/s3/drivers/Imakefile @@ -1,4 +1,5 @@ -XCOMM $XConsortium$ +XCOMM $XConsortium: Imakefile,v 1.1 94/03/28 21:17:24 dpw Exp kaleb $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/accel/s3/drivers/Imakefile,v 3.0 1994/12/25 12:25:21 dawes Exp $ #include <Server.tmpl> #define IHaveSubdirs @@ -9,6 +10,3 @@ DependSubdirs($(SUBDIRS)) InstallLinkKitNonExecFile(Imakefile,$(LINKKITDIR)/drivers/s3) -#if XF86LinkKit -#include <LinkKit.tmpl> -#endif diff --git a/xc/programs/Xserver/hw/xfree86/accel/s3/s3.c b/xc/programs/Xserver/hw/xfree86/accel/s3/s3.c index fb169409c..5a9634338 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/s3/s3.c +++ b/xc/programs/Xserver/hw/xfree86/accel/s3/s3.c @@ -1,5 +1,5 @@ -/* $XConsortium: s3.c,v 1.3 94/11/01 10:27:10 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/s3/s3.c,v 3.51 1994/12/05 04:06:22 dawes Exp $ */ +/* $XConsortium: s3.c,v 1.4 94/12/27 11:29:42 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/s3/s3.c,v 3.56 1994/12/29 10:06:54 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -112,6 +112,7 @@ ScrnInfoRec s3InfoRec = 0, /* int instance */ 0, /* int s3Madjust */ 0, /* int s3Nadjust */ + 0, /* int s3MClk */ }; short s3alu[16] = @@ -148,16 +149,20 @@ static int Num_S3_IOPorts = (sizeof(S3_IOPorts)/sizeof(S3_IOPorts[0])); static SymTabRec s3DacTable[] = { { NORMAL_DAC, "normal" }, { BT485_DAC, "bt485" }, + { BT485_DAC, "bt9485" }, { ATT20C505_DAC, "att20c505" }, { TI3020_DAC, "ti3020" }, { ATT20C498_DAC, "att20c498" }, + { ATT20C498_DAC, "att21c498" }, { ATT22C498_DAC, "att22c498" }, { TI3025_DAC, "ti3025" }, { ATT20C490_DAC, "att20c490" }, { SC15025_DAC, "sc15025" }, { STG1700_DAC, "stg1700" }, { S3_SDAC_DAC, "s3_sdac" }, + { S3_SDAC_DAC, "ics5342" }, /* XXXX should be checked if true */ { S3_GENDAC_DAC, "s3gendac" }, + { S3_GENDAC_DAC, "ics5300" }, { -1, "" }, }; @@ -172,6 +177,7 @@ ScreenPtr s3savepScreen; Bool s3Localbus = FALSE; Bool s3LinearAperture = FALSE; Bool s3Mmio928 = FALSE; +Bool s3PixelMultiplexing = FALSE; Bool s3DAC8Bit = FALSE; Bool s3DACSyncOnGreen = FALSE; Bool s3PCIHack = FALSE; @@ -181,6 +187,8 @@ unsigned char s3SAM256 = 0x00; int s3BankSize; int s3DisplayWidth; pointer vgaBase = NULL; +pointer vgaBaseLow = NULL; +pointer vgaBaseHigh = NULL; pointer s3VideoMem = NULL; extern Bool xf86Exiting, xf86Resetting, xf86ProbeFailed, xf86Verbose; @@ -255,6 +263,114 @@ s3PrintIdent() ErrorF("\n"); } + +static int s3DetectMIRO_20SV_Rev(int BIOSbase) +{ +#define BIOS_BSIZE 1024 +#define BIOS_BASE 0xc0000 + + long addr = BIOSbase>0 ? BIOSbase : BIOS_BASE; + + unsigned char bios[BIOS_BSIZE]; + char *match1 = "miroCRYSTAL\37720SV", *match2 = "Rev."; + int i,j,l1,l2; + + if (xf86ReadBIOS(BIOSbase, 0, bios, BIOS_BSIZE) != BIOS_BSIZE) + return -1; + + if ((bios[0] != 0x55) || (bios[1] != 0xaa)) + return -2; + + l1 = strlen(match1); + l2 = strlen(match2); + for (i=0; i<BIOS_BSIZE-l1; i++) + if (bios[i] == match1[0] && !memcmp(&bios[i],match1,l1)) { + for(j=i+l1; (j<BIOS_BSIZE-l2-2) && bios[j]; j++) + if (bios[j] == match2[0] && !memcmp(&bios[j],match2,l2)) { + if (bios[j+l2] >= '0' && bios[j+l2] <= '9') + return bios[j+l2] - '0'; + else { + return -3; + } + } + } + return -4; +} + + +static Bool s3ProbeSDAC() +{ + /* probe for S3 GENDAC or SDAC */ + /* + * S3 GENDAC and SDAC have two fixed read only PLL clocks + * CLK0 f0: 25.255MHz M-byte 0x28 N-byte 0x61 + * CLK0 f1: 28.311MHz M-byte 0x3d N-byte 0x62 + * which can be used to detect GENDAC and SDAC since there is no chip-id + * for the GENDAC. + * + * NOTE: for the GENDAC on a MIRO 10SD (805+GENDAC) reading PLL values + * for CLK0 f0 and f1 always returns 0x7f (but is documented "read only") + */ + + unsigned char saveCR55, savelut[6]; + int i; + long clock01, clock23; + Bool found = FALSE; + + outb(vgaCRIndex, 0x55); + saveCR55 = inb(vgaCRReg); + outb(vgaCRReg, saveCR55 & ~1); + + outb(0x3c7,0); + for(i=0; i<2*3; i++) /* save first two LUT entries */ + savelut[i] = inb(0x3c9); + outb(0x3c8,0); + for(i=0; i<2*3; i++) /* set first two LUT entries to zero */ + outb(0x3c9,0); + + outb(vgaCRIndex, 0x55); + outb(vgaCRReg, saveCR55 | 1); + + outb(0x3c7,0); + for(i=clock01=0; i<4; i++) + clock01 = (clock01 << 8) | (inb(0x3c9) & 0xff); + for(i=clock23=0; i<4; i++) + clock23 = (clock23 << 8) | (inb(0x3c9) & 0xff); + + outb(vgaCRIndex, 0x55); + outb(vgaCRReg, saveCR55 & ~1); + + outb(0x3c8,0); + for(i=0; i<2*3; i++) /* restore first two LUT entries */ + outb(0x3c9,savelut[i]); + + outb(vgaCRIndex, 0x55); + outb(vgaCRReg, saveCR55); + + if ( clock01 == 0x28613d62 || + (clock01 == 0x7f7f7f7f && clock23 != 0x7f7f7f7f)) { + found = TRUE; + + xf86dactopel(); + inb(0x3c6); + inb(0x3c6); + inb(0x3c6); + + /* the forth read will show the SDAC chip ID and revision */ + if (((i=inb(0x3c6)) & 0xf0) == 0x70) { + ErrorF("%s %s: Detected an S3 SDAC 86C716 RAMDAC and programmable clock\n", + XCONFIG_PROBED, s3InfoRec.name); + s3RamdacType = S3_SDAC_DAC; + } + else { + ErrorF("%s %s: Detected an S3 GENDAC 86C708 RAMDAC and programmable clock\n", + XCONFIG_PROBED, s3InfoRec.name); + s3RamdacType = S3_GENDAC_DAC; + } + xf86dactopel(); + } +} + /* * s3Probe -- probe and initialize the hardware driver */ @@ -269,6 +385,7 @@ s3Probe() OFlagSet validOptions; char *card, *serno; int card_id, max_pix_clock, max_mem_clock; + char *clockchip_probed = XCONFIG_GIVEN; /* * These characterise a RAMDACs pixel multiplexing capabilities and @@ -409,7 +526,6 @@ s3Probe() #if 0 /* These aren't needed any more */ OFLG_SET(OPTION_STEALTH64, &validOptions); - OFLG_SET(OPTION_MIRO_CRYSTAL20SV, &validOptions); #endif if (S3_928_P(s3ChipId)) OFLG_SET(OPTION_PCI_HACK, &validOptions); @@ -447,6 +563,14 @@ s3Probe() } } + card_id = s3DetectMIRO_20SV_Rev(s3InfoRec.BIOSbase); + if (card_id > 1) { + ErrorF("%s %s: MIRO 20SV Rev.2 or newer detected.\n", + XCONFIG_PROBED, s3InfoRec.name); + if (!OFLG_ISSET(OPTION_S3_964_BT485_VCLK, &s3InfoRec.options)) + ErrorF("\tplease use Option \"s3_964_bt485_vclk\"\n"); + } + card_id = s3DetectELSA(s3InfoRec.BIOSbase, &card, &serno, &max_pix_clock, &max_mem_clock); if (card_id > 0) { @@ -475,16 +599,15 @@ s3Probe() default: continue; /* unknown card_id, don't set ICD2061A flags */ } - /* a known ELSA card_id was returned, set ICD 2061A clock support */ + /* a known ELSA card_id was returned, set ICD 2061A clock support + if there is no ClockChip specified in XF86Config */ - if (!OFLG_ISSET(CLOCK_OPTION_ICD2061A, &s3InfoRec.clockOptions)) { + if (!OFLG_ISSET(CLOCK_OPTION_PROGRAMABLE, &s3InfoRec.clockOptions)) { OFLG_SET(CLOCK_OPTION_ICD2061A, &s3InfoRec.clockOptions); OFLG_SET(CLOCK_OPTION_PROGRAMABLE, &s3InfoRec.clockOptions); s3ClockSelectFunc = icd2061ClockSelect; - if (xf86Verbose) - ErrorF("%s %s: Using ICD2061A programmable clock\n", - XCONFIG_PROBED, s3InfoRec.name); numClocks = 3; + clockchip_probed = XCONFIG_PROBED; } } while (0); } @@ -689,8 +812,6 @@ s3Probe() * type possible. Only probe for 928, 805i and 864/964. */ - /* XXXX The "Detected an ....." messages should probably go */ - if (S3_928_SERIES(s3ChipId) || S3_x64_SERIES(s3ChipId) || S3_805_I_SERIES(s3ChipId)) { /* First probe for Ti3020 and Ti3025 */ @@ -769,6 +890,26 @@ s3Probe() s3RamdacType = BT485_DAC; ErrorF("%s %s: Detected a BrookTree Bt485 RAMDAC\n", XCONFIG_PROBED, s3InfoRec.name); + + /* If it is a Bt485 and no clockchip is specified in the + XF86Config, set clockchips for SPEA Mercury / Mercury P64 */ + + if (!OFLG_ISSET(CLOCK_OPTION_PROGRAMABLE, &s3InfoRec.clockOptions)) + if (OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options)) { + if (S3_964_SERIES(s3ChipId)) { + OFLG_SET(CLOCK_OPTION_ICD2061A, &s3InfoRec.clockOptions); + OFLG_SET(CLOCK_OPTION_PROGRAMABLE, &s3InfoRec.clockOptions); + s3ClockSelectFunc = icd2061ClockSelect; + numClocks = 3; + clockchip_probed = XCONFIG_PROBED; + } else if (S3_928_ONLY(s3ChipId)) { + OFLG_SET(CLOCK_OPTION_SC11412, &s3InfoRec.clockOptions); + OFLG_SET(CLOCK_OPTION_PROGRAMABLE, &s3InfoRec.clockOptions); + s3ClockSelectFunc = icd2061ClockSelect; + numClocks = 3; + clockchip_probed = XCONFIG_PROBED; + } + } } } outb(0x3C6, tmp); @@ -853,205 +994,20 @@ s3Probe() } xf86setdaccomm(daccomm); } + } + + /* probe for S3 GENDAC or SDAC */ - /* probe for S3 GENDAC or SDAC */ - /* - * S3 GENDAC and SDAC have two fixed read only PLL clocks - * CLK0 f0: 25.255MHz M-byte 0x28 N-byte 0x61 - * CLK0 f1: 28.311MHz M-byte 0x3d N-byte 0x62 - * which can be used to detect GENDAC and SDAC since there is no chip-id - * for the GENDAC. - */ - - if (s3RamdacType == UNKNOWN_DAC) - { - unsigned char saveCR55, savelut[6]; - int i; - long clock01; - - outb(vgaCRIndex, 0x55); - saveCR55 = inb(vgaCRReg); - outb(vgaCRReg, saveCR55 & ~1); - - outb(0x3c7,0); - for(i=0; i<2*3; i++) /* save first two LUT entries */ - savelut[i] = inb(0x3c9); - outb(0x3c8,0); - for(i=0; i<2*3; i++) /* set first two LUT entries to zero */ - outb(0x3c9,0); - - outb(vgaCRIndex, 0x55); - outb(vgaCRReg, saveCR55 | 1); - - outb(0x3c7,0); - for(i=clock01=0; i<4; i++) - clock01 = (clock01 << 8) | (inb(0x3c9) & 0xff); - - outb(vgaCRIndex, 0x55); - outb(vgaCRReg, saveCR55 & ~1); - - outb(0x3c8,0); - for(i=0; i<2*3; i++) /* restore first two LUT entries */ - outb(0x3c9,savelut[i]); - - outb(vgaCRIndex, 0x55); - outb(vgaCRReg, saveCR55); - - if (clock01 == 0x28613d62) { - ErrorF("%s %s: Detected an S3 Gendac/SDAC programmable clock\n", - XCONFIG_PROBED, s3InfoRec.name); - - xf86dactopel(); - inb(0x3c6); - inb(0x3c6); - inb(0x3c6); - - /* the forth read will show the SDAC chip ID and revision */ - if (((i=inb(0x3c6)) & 0xf0) == 0x70) { - ErrorF("%s %s: Detected an S3 SDAC 86C716 RAMDAC\n", - XCONFIG_PROBED, s3InfoRec.name); - s3RamdacType = S3_SDAC_DAC; - - OFLG_SET(CLOCK_OPTION_S3GENDAC, &s3InfoRec.clockOptions); - OFLG_SET(CLOCK_OPTION_PROGRAMABLE, &s3InfoRec.clockOptions); - s3ClockSelectFunc = s3GendacClockSelect; - if (xf86Verbose) - ErrorF("%s %s: Using S3 Gendac/SDAC programmable clock\n", - XCONFIG_PROBED, s3InfoRec.name); - numClocks = 3; - } - else { - ErrorF("%s %s: Detected an S3 GENDAC 86C708 RAMDAC\n", - XCONFIG_PROBED, s3InfoRec.name); - s3RamdacType = S3_GENDAC_DAC; - - OFLG_SET(CLOCK_OPTION_S3GENDAC, &s3InfoRec.clockOptions); - OFLG_SET(CLOCK_OPTION_PROGRAMABLE, &s3InfoRec.clockOptions); - s3ClockSelectFunc = s3GendacClockSelect; - if (xf86Verbose) - ErrorF("%s %s: Using S3 Gendac/SDAC programmable clock\n", - XCONFIG_PROBED, s3InfoRec.name); - numClocks = 3; - } - xf86dactopel(); - } - } - - /* probe for S3 SDAC again; might be discarded?! */ - if (s3RamdacType == UNKNOWN_DAC) - { - xf86dactopel(); - inb(0x3c6); - inb(0x3c6); - inb(0x3c6); - - /* the forth read will show the chip ID and revision */ - if ((inb(0x3c6) & 0xf0) == 0x70) - { - ErrorF("%s %s: Detected an S3 SDAC 86C716 RAMDAC\n", - XCONFIG_PROBED, s3InfoRec.name); - s3RamdacType = S3_SDAC_DAC; - + if (S3_864_SERIES(s3ChipId) || S3_805_I_SERIES(s3ChipId) + || S3_801_SERIES(s3ChipId)) { + if (s3RamdacType == UNKNOWN_DAC) { + if (s3ProbeSDAC()) { OFLG_SET(CLOCK_OPTION_S3GENDAC, &s3InfoRec.clockOptions); OFLG_SET(CLOCK_OPTION_PROGRAMABLE, &s3InfoRec.clockOptions); s3ClockSelectFunc = s3GendacClockSelect; - if (xf86Verbose) - ErrorF("%s %s: Using S3 Gendac/SDAC programmable clock\n", - XCONFIG_PROBED, s3InfoRec.name); numClocks = 3; - } - xf86dactopel(); - } - } - - if (S3_801_SERIES(s3ChipId)) { - /* probe for S3 GENDAC or SDAC */ - /* - * S3 GENDAC and SDAC have two fixed read only PLL clocks - * CLK0 f0: 25.255MHz M-byte 0x28 N-byte 0x61 - * CLK0 f1: 28.311MHz M-byte 0x3d N-byte 0x62 - * which can be used to detect GENDAC and SDAC since there is no chip-id - * for the GENDAC. - * - * NOTE: for the GENDAC on a MIRO 10SD (805+GENDAC) reading PLL values - * for CLK0 f0 and f1 always returns 0x7f (but is documented "read only) - */ - - if (s3RamdacType == UNKNOWN_DAC) - { - unsigned char saveCR55, savelut[6]; - int i; - long clock01, clock23; - - outb(vgaCRIndex, 0x55); - saveCR55 = inb(vgaCRReg); - outb(vgaCRReg, saveCR55 & ~1); - - outb(0x3c7,0); - for(i=0; i<2*3; i++) /* save first two LUT entries */ - savelut[i] = inb(0x3c9); - outb(0x3c8,0); - for(i=0; i<2*3; i++) /* set first two LUT entries to zero */ - outb(0x3c9,0); - - outb(vgaCRIndex, 0x55); - outb(vgaCRReg, saveCR55 | 1); - - outb(0x3c7,0); - for(i=clock01=0; i<4; i++) - clock01 = (clock01 << 8) | (inb(0x3c9) & 0xff); - for(i=clock23=0; i<4; i++) - clock23 = (clock23 << 8) | (inb(0x3c9) & 0xff); - - outb(vgaCRIndex, 0x55); - outb(vgaCRReg, saveCR55 & ~1); - - outb(0x3c8,0); - for(i=0; i<2*3; i++) /* restore first two LUT entries */ - outb(0x3c9,savelut[i]); - - outb(vgaCRIndex, 0x55); - outb(vgaCRReg, saveCR55); - - if ( clock01 == 0x28613d62 || - (clock01 == 0x7f7f7f7f && clock23 != 0x7f7f7f7f)) { - ErrorF("%s %s: Detected an S3 Gendac/SDAC programmable clock\n", - XCONFIG_PROBED, s3InfoRec.name); - - xf86dactopel(); - inb(0x3c6); - inb(0x3c6); - inb(0x3c6); - - /* the forth read will show the SDAC chip ID and revision */ - if (((i=inb(0x3c6)) & 0xf0) == 0x70) { - ErrorF("%s %s: Detected an S3 SDAC 86C716 RAMDAC\n", - XCONFIG_PROBED, s3InfoRec.name); - s3RamdacType = S3_SDAC_DAC; - - OFLG_SET(CLOCK_OPTION_S3GENDAC, &s3InfoRec.clockOptions); - OFLG_SET(CLOCK_OPTION_PROGRAMABLE, &s3InfoRec.clockOptions); - s3ClockSelectFunc = s3GendacClockSelect; - if (xf86Verbose) - ErrorF("%s %s: Using S3 Gendac/SDAC programmable clock\n", - XCONFIG_PROBED, s3InfoRec.name); - numClocks = 3; - } - else { - ErrorF("%s %s: Detected an S3 GENDAC 86C708 RAMDAC\n", - XCONFIG_PROBED, s3InfoRec.name); - s3RamdacType = S3_GENDAC_DAC; - - OFLG_SET(CLOCK_OPTION_S3GENDAC, &s3InfoRec.clockOptions); - OFLG_SET(CLOCK_OPTION_PROGRAMABLE, &s3InfoRec.clockOptions); - s3ClockSelectFunc = s3GendacClockSelect; - if (xf86Verbose) - ErrorF("%s %s: Using S3 Gendac/SDAC programmable clock\n", - XCONFIG_PROBED, s3InfoRec.name); - numClocks = 3; - } - xf86dactopel(); - } + clockchip_probed = XCONFIG_PROBED; + } } } @@ -1284,7 +1240,8 @@ s3Probe() pixMuxPossible = TRUE; allowPixMuxInterlace = FALSE; /* It doesn't work right (yet) */ allowPixMuxSwitching = FALSE; /* XXXX Is this right? */ - if (OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options)) { + if (OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options) && + S3_928_ONLY(s3ChipId)) { nonMuxMaxClock = 67500; /* Doubling only works in mux mode */ nonMuxMaxMemory = 1024; /* Can't access more without mux */ allowPixMuxSwitching = FALSE; @@ -1303,10 +1260,17 @@ s3Probe() pixMuxLimitedWidths = TRUE; pixMuxMinWidth = 800; } else if (OFLG_ISSET(OPTION_STB_PEGASUS, &s3InfoRec.options)) { - nonMuxMaxClock = 67500; - allowPixMuxSwitching = TRUE; - pixMuxLimitedWidths = FALSE; - pixMuxMinWidth = 1024; + allowPixMuxSwitching = TRUE; + pixMuxLimitedWidths = TRUE; + /* For 8bpp mode, allow PIXMUX selection based on Clock and Width. */ + if (s3Bpp == 1) { + nonMuxMaxClock = 85000; + pixMuxMinWidth = 1024; + } else { + /* For 16bpp and 32bpp modes, require PIXMUX. */ + nonMuxMaxClock = 0; + pixMuxMinWidth = 0; + } } else if (S3_964_SERIES(s3ChipId)) { nonMuxMaxClock = 0; /* 964 can only be in pixmux mode when */ pixMuxMinWidth = 0; /* working in enhanced mode */ @@ -1336,19 +1300,46 @@ s3Probe() s3ClockSelectFunc = icd2061ClockSelect; if (xf86Verbose) ErrorF("%s %s: Using ICD2061A programmable clock\n", - XCONFIG_GIVEN, s3InfoRec.name); + clockchip_probed, s3InfoRec.name); numClocks = 3; } else if (OFLG_ISSET(CLOCK_OPTION_SC11412, &s3InfoRec.clockOptions)) { s3ClockSelectFunc = icd2061ClockSelect; if (xf86Verbose) ErrorF("%s %s: Using Sierra SC11412 programmable clock\n", - XCONFIG_GIVEN, s3InfoRec.name); + clockchip_probed, s3InfoRec.name); numClocks = 3; } else if (OFLG_ISSET(CLOCK_OPTION_S3GENDAC, &s3InfoRec.clockOptions)) { s3ClockSelectFunc = s3GendacClockSelect; - if (xf86Verbose) - ErrorF("%s %s: Using S3 Gendac/SDAC programmable clock\n", - XCONFIG_GIVEN, s3InfoRec.name); + if (xf86Verbose) { + unsigned char saveCR55; + int i,m,n,n1,n2, mclk; + + outb(vgaCRIndex, 0x55); + saveCR55 = inb(vgaCRReg); + outb(vgaCRReg, saveCR55 | 1); + + outb(0x3C7, 10); /* read MCLK */ + m = inb(0x3C9); + n = inb(0x3C9); + + outb(vgaCRIndex, 0x55); + outb(vgaCRReg, saveCR55); + + m &= 0x7f; + n1 = n & 0x1f; + n2 = (n>>5) & 0x03; + mclk = ((1431818 * (m+2.0)) / (n1+2.0) / (1 << n2) + 50) / 100; + ErrorF("%s %s: Using S3 Gendac/SDAC programmable clock (MCLK %1.3f MHz)\n", + clockchip_probed, s3InfoRec.name + ,mclk / 1000.0); + if (s3InfoRec.s3MClk > 0) { + ErrorF("%s %s: using specified MCLK value of %1.3f MHz for DRAM timings\n", + XCONFIG_GIVEN, s3InfoRec.s3MClk / 1000.0); + } + else { + s3InfoRec.s3MClk = mclk; + } + } numClocks = 3; } else if (OFLG_ISSET(CLOCK_OPTION_ICS2595, &s3InfoRec.clockOptions)) { #ifdef ICS2595 @@ -1524,9 +1515,16 @@ s3Probe() s3InfoRec.maxClock = maxRawClock; /* check DCLK limit of 95MHz for 864 */ - if (S3_864_SERIES(s3ChipId) && ((s3Bpp==1 && !pixMuxPossible) || s3Bpp>1) - && s3InfoRec.maxClock > 95000) - s3InfoRec.maxClock = 95000; + if (S3_864_SERIES(s3ChipId)) { + if (((s3Bpp==1 && !pixMuxPossible) || s3Bpp==2) + && s3InfoRec.maxClock > 95000) + s3InfoRec.maxClock = 95000; + + /* for 24bpp the limit should be 95/2 == 47.5MHz + but I set the limit to 50MHz to allow VESA 800x600@72Hz */ + else if (s3Bpp>2 && s3InfoRec.maxClock > 50000) + s3InfoRec.maxClock = 50000; + } if (xf86Verbose) { if (! OFLG_ISSET(CLOCK_OPTION_PROGRAMABLE, &s3InfoRec.clockOptions)) { @@ -1642,6 +1640,12 @@ s3Probe() if (S3_911_SERIES(s3ChipId)) { maxDisplayWidth = 1024; maxDisplayHeight = 1024 - 1; /* Cursor takes exactly 1 line for 911 */ + } else if ((OFLG_ISSET(OPTION_BT485_CURS, &s3InfoRec.options) && + DAC_IS_BT485_SERIES) || + (OFLG_ISSET(OPTION_TI3020_CURS, &s3InfoRec.options) && + DAC_IS_TI3020_SERIES)) { + maxDisplayWidth = 2048; + maxDisplayHeight = 4096; } else { maxDisplayWidth = 2048; maxDisplayHeight = 4096 - 3; /* Cursor can take up to 3 lines */ @@ -1723,6 +1727,13 @@ s3Probe() } if (s3InfoRec.videoRam > nonMuxMaxMemory) pMode->Flags |= V_PIXMUX; + /* XXXX this needs some changes */ + if (OFLG_ISSET(OPTION_STB_PEGASUS, &s3InfoRec.options) && + s3InfoRec.virtualX * s3InfoRec.virtualY > 2*1024*1024) { + /* PIXMUX must be used to access more than 2mb memory. */ + pMode->Flags |= V_PIXMUX; + pixMuxNeeded = TRUE; + } /* * Check if pixmux can't be used. There are two cases: @@ -1804,7 +1815,8 @@ s3Probe() } /* pixmux on Bt485 requires use of Bt's cursor */ - if (s3Bt485PixMux && s3UsingPixMux && + if (((s3Bt485PixMux && s3UsingPixMux) || + OFLG_ISSET(OPTION_STB_PEGASUS, &s3InfoRec.options)) && !OFLG_ISSET(OPTION_BT485_CURS, &s3InfoRec.options)) { OFLG_SET(OPTION_BT485_CURS, &s3InfoRec.options); ErrorF("%s %s: Using hardware cursor from Bt485/20C505 RAMDAC\n", @@ -1840,9 +1852,11 @@ s3Probe() /* only suports 8bpp -- nothing to do */ break; case BT485_DAC: - if (pMode->SynthClock > 67500) { - pMode->SynthClock /= 2; - pMode->Flags |= V_DBLCLK; + if (pMode->SynthClock > + (OFLG_ISSET(OPTION_STB_PEGASUS, &s3InfoRec.options) + ? 85000 : 67500)) { + pMode->SynthClock /= 2; + pMode->Flags |= V_DBLCLK; } /* XXXX What happens here for 16bpp/32bpp ? */ break; @@ -1909,7 +1923,8 @@ s3Probe() } while (pMode != pEnd); } if (DAC_IS_BT485_SERIES || DAC_IS_TI3020_SERIES) { - if (OFLG_ISSET(OPTION_DAC_8_BIT, &s3InfoRec.options) || s3Bpp > 1) + if (OFLG_ISSET(OPTION_DAC_8_BIT, &s3InfoRec.options) || s3Bpp > 1 || + OFLG_ISSET(OPTION_STB_PEGASUS, &s3InfoRec.options)) s3DAC8Bit = TRUE; if (OFLG_ISSET(OPTION_SYNC_ON_GREEN, &s3InfoRec.options)) { s3DACSyncOnGreen = TRUE; @@ -2177,7 +2192,10 @@ icd2061ClockSelect(freq) } if (!OFLG_ISSET(CLOCK_OPTION_ICS2595, &s3InfoRec.clockOptions)) { outb(vgaCRIndex, 0x42);/* select the clock */ - outb(vgaCRReg, 0x02); + if (OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options) && + S3_964_SERIES(s3ChipId)) /* for the SPEA Mercury P64 */ + outb(vgaCRReg, 0x0a); /* for some unknown reason */ + else outb(vgaCRReg, 0x02); } usleep(150000); /* Do the clock doubler selection in s3Init() */ diff --git a/xc/programs/Xserver/hw/xfree86/accel/s3/s3BtCursor.c b/xc/programs/Xserver/hw/xfree86/accel/s3/s3BtCursor.c index 8f09e4065..13061af15 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/s3/s3BtCursor.c +++ b/xc/programs/Xserver/hw/xfree86/accel/s3/s3BtCursor.c @@ -1,5 +1,5 @@ -/* $XConsortium: s3BtCursor.c,v 1.1 94/10/05 13:32:36 kaleb Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/s3/s3BtCursor.c,v 3.3 1994/09/04 10:46:59 dawes Exp $ */ +/* $XConsortium: s3BtCursor.c,v 1.2 94/10/12 20:07:37 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/s3/s3BtCursor.c,v 3.4 1994/12/17 10:05:36 dawes Exp $ */ /* * Copyright 1993 by David Wexelblat <dwex@goblin.org> * @@ -312,6 +312,7 @@ s3BtMoveCursor(pScr, x, y) int x, y; { extern int s3hotX, s3hotY; + extern Bool s3PixelMultiplexing; if (s3BlockCursor) return; @@ -319,6 +320,11 @@ s3BtMoveCursor(pScr, x, y) x -= s3InfoRec.frameX0; x += 64; x -= s3hotX; + /* Compensate for using Bt485 Cursor without pixel multiplexing. */ + if (OFLG_ISSET(OPTION_STB_PEGASUS, &s3InfoRec.options) && + !s3PixelMultiplexing) + x -= 2; + if (x < 0) return; diff --git a/xc/programs/Xserver/hw/xfree86/accel/s3/s3fcach.c b/xc/programs/Xserver/hw/xfree86/accel/s3/s3fcach.c index a2512e163..e2e2b273d 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/s3/s3fcach.c +++ b/xc/programs/Xserver/hw/xfree86/accel/s3/s3fcach.c @@ -1,5 +1,5 @@ -/* $XConsortium: s3fcach.c,v 1.1 94/10/05 13:32:36 kaleb Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/s3/s3fcach.c,v 3.9 1994/09/23 13:38:10 dawes Exp $ */ +/* $XConsortium: s3fcach.c,v 1.2 94/10/12 20:07:37 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/s3/s3fcach.c,v 3.10 1994/12/25 12:23:45 dawes Exp $ */ /* * Copyright 1992 by Kevin E. Martin, Chapel Hill, North Carolina. * @@ -71,6 +71,17 @@ s3FontCache8Init() x = 0; y = s3CursorStartY + s3CursorLines; h = s3ScissB + 1 - y; + w = s3DisplayWidth; + /* + If the area to the right of the virtual screen is larger than the + area below it, then use the area to the right. + */ + if (h*w < y*(s3DisplayWidth-s3InfoRec.virtualX)) { + h = y; + w = s3DisplayWidth - s3InfoRec.virtualX; + x = s3InfoRec.virtualX; + y = 0; + } /* * No pixmap expansion if s3DisplayWidth < 1024 and less than 100 scanlines @@ -79,7 +90,6 @@ s3FontCache8Init() if ((h < MIN_PIXMAP_WIDTH) || ((s3DisplayWidth < 1024) && (h < MIN_PIXMAP_WIDTH + 100))) { - w = s3DisplayWidth; ErrorF("%s %s: No pixmap expanding area available\n", XCONFIG_PROBED, s3InfoRec.name); } else { @@ -88,18 +98,16 @@ s3FontCache8Init() else pmwidth = h; - if (s3DisplayWidth < 1024) { - w = s3DisplayWidth; + if (s3DisplayWidth < 1024 || x > 0) { if (first) { - s3InitFrect(0, y, pmwidth); + s3InitFrect(x, y, pmwidth); } y += pmwidth; + h -= pmwidth; } else { - w = s3DisplayWidth - pmwidth; - if (h >= pmwidth) { /* XXXX This test should now be redundant */ - if (first) { - s3InitFrect(w, y, pmwidth); - } + w -= pmwidth; + if (first) { + s3InitFrect(w, y, pmwidth); } } if (first) { diff --git a/xc/programs/Xserver/hw/xfree86/accel/s3/s3im.c b/xc/programs/Xserver/hw/xfree86/accel/s3/s3im.c index 765314d61..18e4865ea 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/s3/s3im.c +++ b/xc/programs/Xserver/hw/xfree86/accel/s3/s3im.c @@ -1,5 +1,5 @@ -/* $XConsortium: s3im.c,v 1.4 94/12/27 11:29:42 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/s3/s3im.c,v 3.10 1994/11/26 12:44:56 dawes Exp $ */ +/* $XConsortium: s3im.c,v 1.5 94/12/29 18:17:29 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/s3/s3im.c,v 3.12 1995/01/02 04:52:11 dawes Exp $ */ /* * Copyright 1992 by Kevin E. Martin, Chapel Hill, North Carolina. * diff --git a/xc/programs/Xserver/hw/xfree86/accel/s3/s3init.c b/xc/programs/Xserver/hw/xfree86/accel/s3/s3init.c index 1dc6a646b..f121b8bc8 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/s3/s3init.c +++ b/xc/programs/Xserver/hw/xfree86/accel/s3/s3init.c @@ -1,5 +1,5 @@ -/* $XConsortium: s3init.c,v 1.1 94/03/28 21:15:52 dpw Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/s3/s3init.c,v 3.37 1994/11/19 07:54:16 dawes Exp $ */ +/* $XConsortium: s3init.c,v 1.3 94/12/27 11:29:42 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/s3/s3init.c,v 3.42 1994/12/29 10:06:58 dawes Exp $ */ /* * Written by Jake Richter Copyright (c) 1989, 1990 Panacea Inc., * Londonderry, NH - All Rights Reserved @@ -81,6 +81,10 @@ extern Bool (*s3ClockSelectFunc) (); extern int s3DisplayWidth; extern Bool s3Localbus; extern Bool s3Mmio928; +extern Bool s3PixelMultiplexing; +extern pointer vgaBase; +extern pointer vgaBaseLow; +extern pointer vgaBaseHigh; #define new ((vgaHWPtr)vgaNewVideoState) @@ -118,6 +122,20 @@ s3CleanUp(void) vgaProtect(TRUE); + if (OFLG_ISSET(OPTION_STB_PEGASUS, &s3InfoRec.options) && + !OFLG_ISSET(OPTION_NOLINEAR_MODE, &s3InfoRec.options) && + s3Mmio928) { + /* + Clear bit 7 of CRTC register 5C to map video memory normally. + */ + int CR5C; + outb(vgaCRIndex, 0x5C); + CR5C = inb(vgaCRReg); + outb(vgaCRIndex, 0x5C); + outb(vgaCRReg, CR5C & ~0x80); + vgaBase = vgaBaseLow; + } + WaitQueue(8); outb(vgaCRIndex, 0x35); tmp = inb(vgaCRReg); @@ -209,7 +227,8 @@ s3CleanUp(void) /* Turn off parallel mode explicitly here */ if (s3Bt485PixMux) { - if (OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options)) + if (OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options) && + S3_928_ONLY(s3ChipId)) { outb(vgaCRIndex, 0x5C); outb(vgaCRReg, 0x20); @@ -338,7 +357,6 @@ s3Init(mode) { short i, m; int interlacedived = mode->Flags & V_INTERLACE ? 2 : 1; - int pixel_multiplexing; unsigned char tmp, tmp1, tmp2, CR5C; unsigned int itmp; extern Bool s3DAC8Bit, s3DACSyncOnGreen; @@ -376,7 +394,9 @@ s3Init(mode) */ if (S3_964_SERIES(s3ChipId) && !DAC_IS_TI3025) s3SAM256 = 0x40; - else if (OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options)) + else if ((OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options) && + S3_928_ONLY(s3ChipId)) || + OFLG_ISSET(OPTION_STB_PEGASUS, &s3InfoRec.options)) s3SAM256 = 0x80; /* set 6 MCLK cycles for R/W time on Mercury */ else s3SAM256 = 0x00; @@ -578,9 +598,9 @@ s3Init(mode) } if (s3UsingPixMux && (mode->Flags & V_PIXMUX)) - pixel_multiplexing = TRUE; + s3PixelMultiplexing = TRUE; else - pixel_multiplexing = FALSE; + s3PixelMultiplexing = FALSE; if (OFLG_ISSET(OPTION_ELSA_W2000PRO, &s3InfoRec.options)) pixMuxShift = s3InfoRec.clock[mode->Clock] > 120000 ? 2 : @@ -599,48 +619,74 @@ s3Init(mode) pixMuxShift = 0; else if ((S3_928_SERIES(s3ChipId) && (DAC_IS_TI3020 || DAC_IS_BT485_SERIES)) && - pixel_multiplexing) { + s3PixelMultiplexing) { if (s3Bpp == 4) pixMuxShift = 0; /* 32 bit */ else if (s3Bpp == 2) pixMuxShift = 1; /* 16 bit */ else pixMuxShift = 2; /* 8 bit */ - } else if (pixel_multiplexing) - pixMuxShift = 2; /* old default for if (pixel_multiplexing) shifting */ + } else if (s3PixelMultiplexing) + pixMuxShift = 2; /* old default for if (s3PixelMultiplexing) shifting */ else pixMuxShift = 0; - if (pixMuxShift > 0) { - /* now divide the horizontal timing parameters as required */ - mode->HTotal >>= pixMuxShift; - mode->HDisplay >>= pixMuxShift; - mode->HSyncStart >>= pixMuxShift; - mode->HSyncEnd >>= pixMuxShift; - } - else if (pixMuxShift < 0) { - /* now multiply the horizontal timing parameters as required */ - mode->HTotal <<= -pixMuxShift; - mode->HDisplay <<= -pixMuxShift; - mode->HSyncStart <<= -pixMuxShift; - mode->HSyncEnd <<= -pixMuxShift; + if (!mode->CrtcHAdjusted) { + if (pixMuxShift > 0) { + /* now divide the horizontal timing parameters as required */ + mode->CrtcHTotal >>= pixMuxShift; + mode->CrtcHDisplay >>= pixMuxShift; + mode->CrtcHSyncStart >>= pixMuxShift; + mode->CrtcHSyncEnd >>= pixMuxShift; + } + else if (pixMuxShift < 0) { + /* now multiply the horizontal timing parameters as required */ + mode->CrtcHTotal <<= -pixMuxShift; + mode->CrtcHDisplay <<= -pixMuxShift; + mode->CrtcHSyncStart <<= -pixMuxShift; + mode->CrtcHSyncEnd <<= -pixMuxShift; + } + mode->CrtcHAdjusted = TRUE; } + /* + * do some sanity checks on the horizontal timing parameters + */ + { + Bool changed=FALSE; + int oldCrtcHSyncStart, oldCrtcHSyncEnd, oldCrtcHTotal; + + oldCrtcHSyncStart = mode->CrtcHSyncStart; + oldCrtcHSyncEnd = mode->CrtcHSyncEnd; + oldCrtcHTotal = mode->CrtcHTotal; + if (mode->CrtcHTotal > 4096) { /* CrtcHTotal/8 is a 9 bit value */ + mode->CrtcHTotal = 4096; + changed = TRUE; + } + if (mode->CrtcHSyncEnd >= mode->CrtcHTotal) { + mode->CrtcHSyncEnd = mode->CrtcHTotal - 1; + changed = TRUE; + } + if (mode->CrtcHSyncStart >= mode->CrtcHSyncEnd) { + mode->CrtcHSyncStart = mode->CrtcHSyncEnd - 1; + changed = TRUE; + } + if (changed) { + ErrorF("%s %s: mode line has to be modified ...\n", + XCONFIG_PROBED, s3InfoRec.name); + ErrorF("\t\tfrom %4d %4d %4d %4d %4d %4d %4d %4d\n" + ,mode->HDisplay, mode->HSyncStart, mode->HSyncEnd, mode->HTotal + ,mode->VDisplay, mode->VSyncStart, mode->VSyncEnd, mode->VTotal + ); + ErrorF("\t\tto %4d %4d %4d %4d %4d %4d %4d %4d\n" + ,(mode->CrtcHDisplay << 8) >> (8-pixMuxShift) + ,(mode->CrtcHSyncStart << 8) >> (8-pixMuxShift) + ,(mode->CrtcHSyncEnd << 8) >> (8-pixMuxShift) + ,(mode->CrtcHTotal << 8) >> (8-pixMuxShift) + ,mode->VDisplay, mode->VSyncStart, mode->VSyncEnd, mode->VTotal + ); + } + } if (!vgaHWInit(mode, sizeof(vgaS3Rec))) return(FALSE); - if (pixMuxShift > 0) { - /* put back the horizontal timing parameters */ - mode->HTotal <<= pixMuxShift; - mode->HDisplay <<= pixMuxShift; - mode->HSyncStart <<= pixMuxShift; - mode->HSyncEnd <<= pixMuxShift; - } - else if (pixMuxShift < 0) { - /* put back the horizontal timing parameters */ - mode->HTotal >>= -pixMuxShift; - mode->HDisplay >>= -pixMuxShift; - mode->HSyncStart >>= -pixMuxShift; - mode->HSyncEnd >>= -pixMuxShift; - } - new->MiscOutReg |= 0x0C; /* enable CR42 clock selection */ new->Sequencer[0] = 0x03; /* XXXX shouldn't need this */ new->CRTC[19] = s3BppDisplayWidth >> 3; @@ -655,13 +701,14 @@ s3Init(mode) else new->MiscOutReg |= 0x01; - if (OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options)) { + if (OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options) && + S3_928_ONLY(s3ChipId)) { /* * Make sure that parallel option is already set correctly before * changing the clock doubler state. - * XXXX maybe the !pixel_multiplexing bit is not required? + * XXXX maybe the !s3PixelMultiplexing bit is not required? */ - if (pixel_multiplexing) { + if (s3PixelMultiplexing) { outb(vgaCRIndex, 0x5C); outb(vgaCRReg, 0x20); outb(0x3C7, 0x21); @@ -684,6 +731,22 @@ s3Init(mode) } } + if (OFLG_ISSET(OPTION_STB_PEGASUS, &s3InfoRec.options) && + !OFLG_ISSET(OPTION_NOLINEAR_MODE, &s3InfoRec.options) && + s3Mmio928) { + /* + Set bit 7 of CRTC register 5C to map video memory with + LAW31-26 = 011111 rather than 000000. Note that this remaps + all addresses seen by the 928, including the VGA Base Address. + */ + int CR5C; + outb(vgaCRIndex, 0x5C); + CR5C = inb(vgaCRReg); + outb(vgaCRIndex, 0x5C); + outb(vgaCRReg, CR5C | 0x80); + vgaBase = vgaBaseHigh; + } + /* Don't change the clock bits when using an external clock program */ if (new->NoClock < 0) { @@ -794,7 +857,7 @@ s3Init(mode) tmp2 = inb(0x3C5); outb(0x3C5, tmp2 | 0x20); /* blank the screen */ - if (pixel_multiplexing) { /* x64:pixmux */ + if (s3PixelMultiplexing) { /* x64:pixmux */ /* pixmux with 16/32 bpp not possible for 864 ==> only 8bit mode */ int daccomm; tmp = xf86getdaccomm(); @@ -831,7 +894,7 @@ s3Init(mode) /* don't know */ } } - else { /* !pixel_multiplexing */ + else { /* !s3PixelMultiplexing */ outb(vgaCRIndex, 0x33); tmp = inb(vgaCRReg); outb(vgaCRReg, tmp & ~0x08 ); @@ -876,7 +939,7 @@ s3Init(mode) else { /* don't know */ } - } /* end of pixel_multiplexing */ + } /* end of s3PixelMultiplexing */ outb(0x3C4, 1); outb(0x3C5, tmp2); /* unblank the screen */ @@ -890,7 +953,7 @@ s3Init(mode) tmp2 = inb(0x3C5); outb(0x3C5, tmp2 | 0x20); /* blank the screen */ - if (pixel_multiplexing) { + if (s3PixelMultiplexing) { /* x64:pixmux */ /* pixmux with 16/32 bpp not possible for 864 ==> only 8bit mode */ daccomm |= 0x08; /* enable extended pixel modes */ @@ -925,7 +988,7 @@ s3Init(mode) } } else - { /* !pixel_multiplexing */ + { /* !s3PixelMultiplexing */ outb(vgaCRIndex, 0x33); tmp = inb(vgaCRReg); outb(vgaCRReg, tmp & ~0x08 ); @@ -992,7 +1055,7 @@ s3Init(mode) else { /* don't know */ } - } /* end of pixel_multiplexing */ + } /* end of s3PixelMultiplexing */ outb(0x3C4, 1); outb(0x3C5, tmp2); /* unblank the screen */ @@ -1009,7 +1072,7 @@ s3Init(mode) tmp2 = inb(0x3C5); outb(0x3C5, tmp2 | 0x20); /* blank the screen */ - if (pixel_multiplexing) + if (s3PixelMultiplexing) { /* x64:pixmux */ /* pixmux with 16/32 bpp not possible for 864 ==> only 8bit mode */ @@ -1104,10 +1167,25 @@ s3Init(mode) } if (s3Bt485PixMux) { - if (pixel_multiplexing) { + if (s3PixelMultiplexing) { /* fun timing mods for pixel-multiplexing! */ - if (OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options)) + /* + Pixel Multiplexing is selected for 16bpp, 32bpp, or 8bpp + with Width > 1024. Pixel Multiplexing requires we also + Select Parallel VRAM Addressing (CR53.5), and Parallel + VRAM Addressing also requires a line width of 1024 or + 2048, external SID enabled (CR55.3), and split transfers + disabled (CR51.6). + */ + if (OFLG_ISSET(OPTION_STB_PEGASUS, &s3InfoRec.options)) { + outb(vgaCRIndex, 0x53); + tmp = inb(vgaCRReg); + outb(vgaCRReg, tmp | 0x20); + } + + if (OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options) && + S3_928_ONLY(s3ChipId)) { outb(vgaCRIndex, 0x5C); outb(vgaCRReg, 0x20); @@ -1154,13 +1232,22 @@ s3Init(mode) /* blank_delay = 0 (at least for Miro Crystal 20SV) */ outb(vgaCRIndex, 0x6d); - outb(vgaCRReg, 0); + if ((mode->Flags & V_DBLCLK) || s3Bpp > 1) + outb(vgaCRReg, 0); + else + outb(vgaCRReg, 1); /* or 2; needed for 20SV with ATT 20C505 */ } - outb(vgaCRIndex, 0x65); tmp = inb(vgaCRReg); - if (!OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options)) { + if (OFLG_ISSET(OPTION_STB_PEGASUS, &s3InfoRec.options)) + /* + Setting this register non-zero on the Pegasus causes a wrap of + the rightmost pixels back to the left of the display. + */ + outb(vgaCRReg, 0x00); + else if (!(OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options) && + S3_928_ONLY(s3ChipId))) { outb(vgaCRReg, tmp | 0x20); /* set s3 reg65 for some unknown reason */ /* Setting this for the SPEA Mercury affects clocks > 120MHz */ @@ -1192,7 +1279,8 @@ s3Init(mode) } else { - if (OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options)) + if (OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options) && + S3_928_ONLY(s3ChipId)) { outb(vgaCRIndex, 0x5C); outb(vgaCRReg, 0x20); @@ -1202,8 +1290,8 @@ s3Init(mode) /* set s3 reg53 to non-parallel addressing by and'ing 0xDF */ outb(vgaCRIndex, 0x53); tmp = inb(vgaCRReg); - if ((OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options)) && - (s3Bpp != 1)) { + if (OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options) && + S3_928_ONLY(s3ChipId) && (s3Bpp != 1)) { outb(vgaCRReg, tmp | 0x20); } else { outb(vgaCRReg, tmp & 0xDF); @@ -1214,7 +1302,8 @@ s3Init(mode) tmp = inb(vgaCRReg); outb(vgaCRReg, tmp & 0xDF); - if (OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options)) + if (OFLG_ISSET(OPTION_SPEA_MERCURY, &s3InfoRec.options) && + S3_928_ONLY(s3ChipId)) { outb(vgaCRIndex, 0x5C); outb(vgaCRReg, 0x00); @@ -1246,7 +1335,7 @@ s3Init(mode) else s3OutBtReg(BT_COMMAND_REG_2, 0x00, tmp); - } /* end of pixel_multiplexing */ + } /* end of s3PixelMultiplexing */ } /* Set 6/8 bit mode and sync-on-green if required */ @@ -1304,7 +1393,7 @@ s3Init(mode) outb(vgaCRReg, 0x00); } - if (pixel_multiplexing) { + if (s3PixelMultiplexing) { /* fun timing mods for pixel-multiplexing! */ if (OFLG_ISSET(OPTION_ELSA_W2000PRO,&s3InfoRec.options)) { @@ -1537,7 +1626,7 @@ s3Init(mode) s3OutTiIndReg(TI_GENERAL_IO_DATA, 0x00, TI_GID_S3_DAC_8BIT); else s3OutTiIndReg(TI_GENERAL_IO_DATA, 0x00, TI_GID_S3_DAC_6BIT); - } /* end of pixel_multiplexing */ + } /* end of s3PixelMultiplexing */ /* for some reason the bios doesn't set this properly */ s3OutTiIndReg(TI_SENSE_TEST, 0x00, 0x00); @@ -1579,7 +1668,10 @@ s3Init(mode) outb(vgaCRIndex, 0x32); outb(vgaCRReg, 0x00); outb(vgaCRIndex, 0x33); - outb(vgaCRReg, 0x20); + if (OFLG_ISSET(OPTION_STB_PEGASUS, &s3InfoRec.options)) + /* Blank border comes earlier than display enable. */ + outb(vgaCRReg, 0x00); + else outb(vgaCRReg, 0x20); outb(vgaCRIndex, 0x34); outb(vgaCRReg, 0x10); /* 1024 */ outb(vgaCRIndex, 0x35); @@ -1596,7 +1688,7 @@ s3Init(mode) else #endif outb(vgaCRReg, 0xb5); /* was 95 */ - + outb(vgaCRIndex, 0x3b); outb(vgaCRReg, (new->CRTC[0] + new->CRTC[4] + 1) / 2); outb(vgaCRIndex, 0x3c); @@ -1611,7 +1703,10 @@ s3Init(mode) } else { if (s3Localbus) { i = (inb(vgaCRReg) & 0xf2); - s3Port40 = (i | 0x05); + if (OFLG_ISSET(OPTION_STB_PEGASUS, &s3InfoRec.options)) + /* Set no wait states on STB Pegasus. */ + s3Port40 = (i | 0x01); + else s3Port40 = (i | 0x05); outb(vgaCRReg, s3Port40); } else { i = (inb(vgaCRReg) & 0xf6); @@ -1716,6 +1811,16 @@ s3Init(mode) outb(vgaCRIndex, 0x51); s3Port51 = (inb(vgaCRReg) & 0xC0) | ((s3BppDisplayWidth >> 7) & 0x30); + + if (OFLG_ISSET(OPTION_STB_PEGASUS, &s3InfoRec.options)) { + if (s3PixelMultiplexing) + /* In Pixel Multiplexing mode, disable split transfers. */ + s3Port51 |= 0x40; + else + /* In VGA mode, enable split transfers. */ + s3Port51 &= ~0x40; + } + outb(vgaCRReg, s3Port51); outb(vgaCRIndex, 0x53); @@ -1764,7 +1869,9 @@ s3Init(mode) ErrorF("%s %s: adjusting M from %d to %d\n", XCONFIG_GIVEN, s3InfoRec.name, old_m, m); } - s3Port54 = m << 3; + if (OFLG_ISSET(OPTION_STB_PEGASUS, &s3InfoRec.options)) + s3Port54 = 0x7F; + else s3Port54 = m << 3; outb(vgaCRReg, s3Port54); outb(vgaCRIndex, 0x55); @@ -1779,48 +1886,27 @@ s3Init(mode) outb(vgaCRIndex, 0x5A); outb(vgaCRReg, s3Port5A); - i = (((mode->VTotal / interlacedived - 2) & 0x400) >> 10) | - (((mode->VDisplay / interlacedived - 1) & 0x400) >> 9) | - (((mode->VSyncStart / interlacedived) & 0x400) >> 8) | - (((mode->VSyncStart / interlacedived) & 0x400) >> 6) | 0x40; + /* This shouldn't be needed -- they should be set by vgaHWInit() */ + if (!mode->CrtcVAdjusted) { + mode->CrtcVTotal /= interlacedived; + mode->CrtcVDisplay /= interlacedived; + mode->CrtcVSyncStart /= interlacedived; + mode->CrtcVSyncEnd /= interlacedived; + mode->CrtcVAdjusted = TRUE; + } + + i = (((mode->CrtcVTotal - 2) & 0x400) >> 10) | + (((mode->CrtcVDisplay - 1) & 0x400) >> 9) | + (((mode->CrtcVSyncStart) & 0x400) >> 8) | + (((mode->CrtcVSyncStart) & 0x400) >> 6) | 0x40; outb(vgaCRIndex, 0x5e); outb(vgaCRReg, i); - if (pixMuxShift > 0) { - /* now divide the horizontal timing parameters as required */ - mode->HTotal >>= pixMuxShift; - mode->HDisplay >>= pixMuxShift; - mode->HSyncStart >>= pixMuxShift; - mode->HSyncEnd >>= pixMuxShift; - } - else if (pixMuxShift < 0) { - /* now multiply the horizontal timing parameters as required */ - mode->HTotal <<= -pixMuxShift; - mode->HDisplay <<= -pixMuxShift; - mode->HSyncStart <<= -pixMuxShift; - mode->HSyncEnd <<= -pixMuxShift; - } - - i = ((((mode->HTotal >> 3) - 5) & 0x100) >> 8) | - ((((mode->HDisplay >> 3) - 1) & 0x100) >> 7) | - ((((mode->HSyncStart >> 3) - 1) & 0x100) >> 6) | - ((mode->HSyncStart & 0x800) >> 7); - - if (pixMuxShift > 0) { - /* put back the horizontal timing parameters */ - mode->HTotal <<= pixMuxShift; - mode->HDisplay <<= pixMuxShift; - mode->HSyncStart <<= pixMuxShift; - mode->HSyncEnd <<= pixMuxShift; - } - else if (pixMuxShift < 0) { - /* put back the horizontal timing parameters */ - mode->HTotal >>= -pixMuxShift; - mode->HDisplay >>= -pixMuxShift; - mode->HSyncStart >>= -pixMuxShift; - mode->HSyncEnd >>= -pixMuxShift; - } + i = ((((mode->CrtcHTotal >> 3) - 5) & 0x100) >> 8) | + ((((mode->CrtcHDisplay >> 3) - 1) & 0x100) >> 7) | + ((((mode->CrtcHSyncStart >> 3) - 1) & 0x100) >> 6) | + ((mode->CrtcHSyncStart & 0x800) >> 7); outb(vgaCRIndex, 0x3b); itmp = ( new->CRTC[0] + ((i&0x01)<<8) @@ -1863,6 +1949,43 @@ s3Init(mode) outb(vgaCRReg, 0x20 | tmp); } + if (S3_964_SERIES(s3ChipId) && DAC_IS_BT485_SERIES) { + if (OFLG_ISSET(OPTION_S3_964_BT485_VCLK, &s3InfoRec.options)) { + /* + * This is the design alert from S3 with Bt485A and Vision 964. + */ + int i,last,tmp,cr55,cr67; + + outb(vgaCRIndex, 0x55); + cr55 = inb(vgaCRReg); + outb(vgaCRReg, cr55 | 0x04); /* enable rad of general input */ + outb(vgaCRIndex, 0x67); + cr67 = inb(vgaCRReg); + + for(last=i=0; i<20; i++) { + usleep(20*1000); + if ((inb(0x3c8) & 0x04) == 0) { /* if GD2 is low then */ + last = i; + outb(vgaCRIndex, 0x67); + tmp = inb(vgaCRReg); + outb(vgaCRReg, tmp ^ 0x01); /* clock should be inverted */ +#if 0 + ErrorF("inverted VCLK %d to 0x%02x\n",i,tmp ^ 0x01); +#endif + } + if (i-last > 4) break; + } + outb(vgaCRIndex, 0x55); + outb(vgaCRReg, cr55); + outb(vgaCRIndex, 0x67); + tmp = inb(vgaCRReg); +#if 0 + /* if ((cr67 ^ tmp) & 0x01) */ + ErrorF("VCLK has been inverted %d times from 0x%02x to 0x%02x now\n",i,cr67,tmp); +#endif + } + } + #ifdef REG_DEBUG for (i=0; i<10; i++) { outb(vgaCRIndex, i); diff --git a/xc/programs/Xserver/hw/xfree86/accel/s3/s3misc.c b/xc/programs/Xserver/hw/xfree86/accel/s3/s3misc.c index 804bebfaf..57f663e50 100644 --- a/xc/programs/Xserver/hw/xfree86/accel/s3/s3misc.c +++ b/xc/programs/Xserver/hw/xfree86/accel/s3/s3misc.c @@ -1,6 +1,6 @@ -/* $XConsortium: s3misc.c,v 1.2 94/10/12 20:07:37 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/s3/s3misc.c,v 3.17 1994/11/30 20:40:35 dawes Exp $ */ +/* $XConsortium: s3misc.c,v 1.3 94/12/27 11:29:42 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/s3/s3misc.c,v 3.20 1994/12/29 10:07:01 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -61,6 +61,8 @@ extern Bool s3LinearAperture; extern int s3BankSize; extern int s3DisplayWidth; extern pointer vgaBase; +extern pointer vgaBaseLow; +extern pointer vgaBaseHigh; extern pointer s3VideoMem; extern unsigned char s3Port59; extern unsigned char s3Port5A; @@ -103,70 +105,22 @@ s3Initialize(scr_index, pScreen, argc, argv) s3BankSize = 0x10000; s3LinApOpt = 0x14; - /* First, map the vga window -- it is always required */ - vgaBase = xf86MapVidMem(scr_index, VGA_REGION, (pointer)0xA0000, - s3BankSize); - s3Init(s3InfoRec.modes); - /* - * The meaning of NOLINEAR_MODE has changed a little, and was - * used inconsistently here. It now means don't attempt to map - * the framebuffer at high memory. Some code here implied that at - * one stage it meant it was OK to use high memory, but only use a 64k - * aperture. - */ -#ifdef DEBUG - /* This is for debugging probe problem at > 8bpp (DHD) */ - { - long *poker; - unsigned long pVal = 0x12345678; - unsigned char reg53tmp; - - s3InitEnvironment(); - s3ImageWriteNoMem(0, 0, 4 / S3Bpp, 1, (char *) &pVal, 4 / S3Bpp, 0, 0, - (short) s3alu[GXcopy], ~0); - - if (S3_801_928_SERIES (s3ChipId)) { - int j; - - if (s3Mmio928) { /* Due to S3 bugs we must disable mmio */ - outb(vgaCRIndex, 0x53); - reg53tmp = inb(vgaCRReg); - outb(vgaCRReg, reg53tmp & ~0x10); /* save parallel bit */ - } - /* begin 801 sequence for going in to linear mode */ - outb (vgaCRIndex, 0x40); - /* enable fast write buffer and disable 8514/a mode */ - j = (s3Port40 & 0xf6) | 0x0a; - outb (vgaCRReg, (unsigned char) j); - outb(vgaCRIndex, 0x59); - outb(vgaCRReg, 0x00); - outb(vgaCRIndex, 0x5a); - outb(vgaCRReg, 0x0a); - s3LinApOpt = 0x14; - outb (vgaCRReg, s3LinApOpt | s3SAM256); - /* end 801 sequence to go into linear mode */ - } - - /* bank 0 should be selected */ - - poker = (long *)vgaBase; - s3TryAddress(poker, pVal, 0xa0000, 0); - - if (S3_801_928_SERIES (s3ChipId)) { - /* begin 801 sequence to go into enhanced mode */ - outb (vgaCRIndex, 0x58); - outb (vgaCRReg, s3SAM256); - outb (vgaCRIndex, 0x40); - outb (vgaCRReg, s3Port40); - /* end 801 sequence to go into enhanced mode */ - } - if (s3Mmio928) { /* Now re-enable mmio if required */ - outb(vgaCRIndex, 0x53); - outb(vgaCRReg, reg53tmp | 0x10); - } + if (OFLG_ISSET(OPTION_STB_PEGASUS, &s3InfoRec.options) && + !OFLG_ISSET(OPTION_NOLINEAR_MODE, &s3InfoRec.options) && + s3Mmio928) { + vgaBaseLow = xf86MapVidMem(scr_index, VGA_REGION, + (pointer)0xA0000, s3BankSize); + vgaBaseHigh = xf86MapVidMem(scr_index, EXTENDED_REGION, + (pointer)0x7C0A0000, s3BankSize); + vgaBase = vgaBaseLow; + } else { + /* First, map the vga window -- it is always required */ + vgaBase = xf86MapVidMem(scr_index, VGA_REGION, (pointer)0xA0000, + s3BankSize); } -#endif - + + s3Init(s3InfoRec.modes); + if (xf86LinearVidMem() && !OFLG_ISSET(OPTION_NOLINEAR_MODE, &s3InfoRec.options)) { /* Now, see if we can map a high buffer */ @@ -185,22 +139,10 @@ s3Initialize(scr_index, pScreen, argc, argv) 0, 0, (short) s3alu[GXcopy], ~0); if (S3_801_928_SERIES (s3ChipId)) { - int j; - - if (s3Mmio928) { /* Due to S3 bugs we must disable mmio */ - outb(vgaCRIndex, 0x53); - reg53tmp = inb(vgaCRReg); - outb(vgaCRReg, reg53tmp & ~0x10); /* save parallel bit */ - } - /* begin 801 sequence for going in to linear mode */ - outb (vgaCRIndex, 0x40); - /* enable fast write buffer and disable 8514/a mode */ - j = (s3Port40 & 0xf6) | 0x0a; - outb (vgaCRReg, (unsigned char) j); outb(vgaCRIndex, 0x59); if (S3_x64_SERIES(s3ChipId)) if (s3InfoRec.MemBase != 0) - outb(vgaCRReg, 0x03 | (s3InfoRec.MemBase>>24)); + outb(vgaCRReg, s3InfoRec.MemBase>>24); else outb(vgaCRReg, 0x03 | 0xf0); else @@ -216,9 +158,7 @@ s3Initialize(scr_index, pScreen, argc, argv) s3LinApOpt=0x17; } s3BankSize = s3InfoRec.videoRam * 1024; - /* go on to linear mode */ - outb (vgaCRReg, s3LinApOpt | s3SAM256); - /* end 801 sequence to go into linear mode */ + s3EnableLinear(); } /* @@ -249,21 +189,33 @@ s3Initialize(scr_index, pScreen, argc, argv) addr = (s3InfoRec.MemBase & 0xffc00000); s3VideoMem = xf86MapVidMem(scr_index, LINEAR_REGION, (pointer)addr, s3BankSize); + s3DisableLinear(); outb(vgaCRIndex, 0x5a); - outb(vgaCRReg, (addr >> 16) & 0xff); + if (S3_x64_SERIES(s3ChipId)) { + outb(vgaCRReg, (addr >> 16) & 0xff); + outb(vgaCRIndex, 0x59); + outb(vgaCRReg, (addr >> 24) & 0xff); + } + else + outb(vgaCRReg, 0xc0); + s3EnableLinear(); + s3LinearAperture = TRUE; - ErrorF("%s %s: Local bus LAW is 0x%04lXxxxx\n", - XCONFIG_GIVEN, s3InfoRec.name, (addr >> 16) & 0xffff); + ErrorF("%s %s: Local bus LAW is 0x%03lXxxxxx\n", + XCONFIG_GIVEN, s3InfoRec.name, (addr >> 20)); } else { if (S3_x64_SERIES(s3ChipId)) { /* So far, only tested for the PCI ELSA W2000Pro */ unsigned long addr; + s3DisableLinear(); outb(vgaCRIndex, 0x59); addr = inb(vgaCRReg) << 8; outb(vgaCRIndex, 0x5a); addr |= inb(vgaCRReg); addr <<= 16; + s3EnableLinear(); + if (OFLG_ISSET(OPTION_FB_DEBUG, &s3InfoRec.options)) { ErrorF("Read LAW as 0x%08X \n", addr); } @@ -298,9 +250,12 @@ s3Initialize(scr_index, pScreen, argc, argv) if (s3TryAddress(poker, pVal, addr, 1)) { /* We found some ram, but is it ours? */ + s3DisableLinear(); /* move it up by 12MB */ outb(vgaCRIndex, 0x5a); outb(vgaCRReg, 0xC0); + s3EnableLinear(); + if (!s3TryAddress(poker, pVal, addr, 2)) { addr += (0x0C<<20); xf86UnMapVidMem(scr_index, LINEAR_REGION, @@ -311,8 +266,9 @@ s3Initialize(scr_index, pScreen, argc, argv) if (s3TryAddress((long *)s3VideoMem, pVal, addr, 3)) { - ErrorF("%s %s: Local bus LAW31-24 is %X\n", - XCONFIG_PROBED, s3InfoRec.name, i); + ErrorF("%s %s: Local bus LAW is 0x%03Xxxxxx\n", + XCONFIG_PROBED, s3InfoRec.name, + (i << 4 | 0x0c)); s3LinearAperture = TRUE; break; } @@ -330,8 +286,9 @@ s3Initialize(scr_index, pScreen, argc, argv) s3BankSize); if (s3TryAddress((long *)s3VideoMem, pVal, addr, 4)) { - ErrorF("%s %s: Local bus LAW31-24 is %X\n", - XCONFIG_PROBED, s3InfoRec.name, i | 0x24); + ErrorF("%s %s: Local bus LAW is 0x%03Xxxxxx\n", + XCONFIG_PROBED, s3InfoRec.name, + (i | 0x24) << 4); s3LinearAperture = TRUE; break; } @@ -342,8 +299,10 @@ s3Initialize(scr_index, pScreen, argc, argv) ErrorF("\t address range.\n"); CachedFrameBuffer = TRUE; } + s3DisableLinear(); outb(vgaCRIndex, 0x5a); outb(vgaCRReg, 0x00); /* reset for next probe */ + s3EnableLinear(); } xf86UnMapVidMem(scr_index, LINEAR_REGION, s3VideoMem, s3BankSize); @@ -363,18 +322,7 @@ s3Initialize(scr_index, pScreen, argc, argv) s3BankSize = 0x10000; s3VideoMem = NULL; } - if (S3_801_928_SERIES (s3ChipId)) { - /* begin 801 sequence to go into enhanced mode */ - outb (vgaCRIndex, 0x58); - outb (vgaCRReg, s3SAM256); - outb (vgaCRIndex, 0x40); - outb (vgaCRReg, s3Port40); - /* end 801 sequence to go into enhanced mode */ - } - if (s3Mmio928) { /* Now re-enable mmio if required */ - outb(vgaCRIndex, 0x53); - outb(vgaCRReg, reg53tmp | 0x10); - } + s3DisableLinear(); } } diff --git a/xc/programs/Xserver/hw/xfree86/common/Imakefile b/xc/programs/Xserver/hw/xfree86/common/Imakefile index 8606c5b2d..ddf794f2d 100644 --- a/xc/programs/Xserver/hw/xfree86/common/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/common/Imakefile @@ -1,5 +1,5 @@ -XCOMM $XConsortium: Imakefile,v 1.2 94/10/12 20:33:21 kaleb Exp kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.11 1994/11/26 12:45:24 dawes Exp $ +XCOMM $XConsortium: Imakefile,v 1.3 95/01/05 20:39:33 kaleb Exp kaleb $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.13 1994/12/17 10:06:06 dawes Exp $ #include <Server.tmpl> #ifdef i386MachArchitecture @@ -61,8 +61,9 @@ OBJS = \ OSNAME = OSName OSVENDOR = OSVendor OSNAMEDEF = -DOSNAME='"$(OSNAME)"' -DOSVENDOR='"$(OSVENDOR)"' +CONSDEFINES = XFree86ConsoleDefines - DEFINES = $(XCONFIGDEFINES) + DEFINES = $(XCONFIGDEFINES) $(CONSDEFINES) #if XF86MonoServer VGA2BUILD = -DBUILD_VGA2 diff --git a/xc/programs/Xserver/hw/xfree86/common/atKeynames.h b/xc/programs/Xserver/hw/xfree86/common/atKeynames.h index 024b37ed7..776b4b75e 100644 --- a/xc/programs/Xserver/hw/xfree86/common/atKeynames.h +++ b/xc/programs/Xserver/hw/xfree86/common/atKeynames.h @@ -1,5 +1,5 @@ -/* $XConsortium: atKeynames.h,v 1.3 94/12/10 12:12:18 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.0 1994/11/22 02:38:48 dawes Exp $ */ +/* $XConsortium: atKeynames.h,v 1.4 95/01/05 20:39:33 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.1 1994/12/11 10:54:28 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -187,6 +187,28 @@ #define KEY_LMeta /* Left Meta 0x6b */ 107 #define KEY_RMeta /* Right Meta 0x6c */ 108 #define KEY_Menu /* Menu 0x6d */ 109 +#define KEY_SN_KP_7 /* ServerNumLock 7 0x80 */ 128 +#define KEY_SN_KP_8 /* ServerNumLock 8 0x81 */ 129 +#define KEY_SN_KP_9 /* ServerNumLock 9 0x82 */ 130 +#define KEY_SN_KP_4 /* ServerNumLock 4 0x83 */ 131 +#define KEY_SN_KP_5 /* ServerNumLock 5 0x84 */ 132 +#define KEY_SN_KP_6 /* ServerNumLock 6 0x85 */ 133 +#define KEY_SN_KP_1 /* ServerNumLock 1 0x86 */ 134 +#define KEY_SN_KP_2 /* ServerNumLock 2 0x87 */ 135 +#define KEY_SN_KP_3 /* ServerNumLock 4 0x88 */ 136 +#define KEY_SN_KP_0 /* ServerNumLock 0 0x89 */ 137 +#define KEY_SN_KP_Dec /* ServerNumLock Decimal 0x8a */ 138 +#define KEY_SN_KP_Home /* ServerNumLock Home 0x8b */ 139 +#define KEY_SN_KP_Up /* ServerNumLock Up 0x8c */ 140 +#define KEY_SN_KP_Prior /* ServerNumLock Prior 0x8d */ 141 +#define KEY_SN_KP_Left /* ServerNumLock Left 0x8e */ 142 +#define KEY_SN_KP_Begin /* ServerNumLock Begin 0x8f */ 143 +#define KEY_SN_KP_Right /* ServerNumLock Right 0x90 */ 144 +#define KEY_SN_KP_End /* ServerNumLock End 0x91 */ 145 +#define KEY_SN_KP_Down /* ServerNumLock Down 0x92 */ 146 +#define KEY_SN_KP_Next /* ServerNumLock Next 0x93 */ 147 +#define KEY_SN_KP_Ins /* ServerNumLock Ins 0x94 */ 148 +#define KEY_SN_KP_Del /* ServerNumLock Del 0x95 */ 149 #define KEY_LMeta /* Left Meta 0x6b */ 107 #define KEY_RMeta /* Right Meta 0x6c */ 108 #define KEY_Menu /* Menu 0x6d */ 109 diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86.h b/xc/programs/Xserver/hw/xfree86/common/xf86.h index 021cc8e7b..9828bad08 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86.h @@ -1,5 +1,5 @@ -/* $XConsortium: xf86.h,v 1.2 94/10/12 20:33:21 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.10 1994/10/29 22:37:09 dawes Exp $ */ +/* $XConsortium: xf86.h,v 1.3 95/01/05 20:39:33 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.12 1994/12/29 10:07:22 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -38,7 +38,8 @@ typedef struct _DispM { struct _DispM *prev,*next; char *name; /* identifier of this mode */ - int Clock; /* doclock */ + /* These are the values that the user sees/provides */ + int Clock; /* pixel clock */ int HDisplay; /* horizontal timing */ int HSyncStart; int HSyncEnd; @@ -48,7 +49,18 @@ typedef struct _DispM { int VSyncEnd; int VTotal; int Flags; + /* These are the values the hardware uses */ int SynthClock; /* Actual clock freq to be programmed */ + int CrtcHDisplay; + int CrtcHSyncStart; + int CrtcHSyncEnd; + int CrtcHTotal; + int CrtcVDisplay; + int CrtcVSyncStart; + int CrtcVSyncEnd; + int CrtcVTotal; + Bool CrtcHAdjusted; + Bool CrtcVAdjusted; } DisplayModeRec, *DisplayModePtr; #define V_PHSYNC 0x0001 @@ -134,6 +146,7 @@ typedef struct { unsigned int instance; /* AGX - video card instance number */ int s3Madjust; int s3Nadjust; + int s3MClk; } ScrnInfoRec, *ScrnInfoPtr; typedef struct { diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Config.c b/xc/programs/Xserver/hw/xfree86/common/xf86Config.c index fc411dea0..7291c0b28 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Config.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Config.c @@ -1,6 +1,6 @@ /* - * $XConsortium: xf86Config.c,v 1.3 94/10/12 20:33:21 kaleb Exp kaleb $ - * $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.29 1994/11/30 20:41:09 dawes Exp $ + * $XConsortium: xf86Config.c,v 1.4 95/01/05 20:39:33 kaleb Exp kaleb $ + * $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.32 1994/12/29 10:07:25 dawes Exp $ * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -1592,6 +1592,11 @@ configDeviceSection() else pushToken = token; break; + case S3MCLK: + if (getToken(NULL) != NUMBER) configError("MCLK value in MHz expected"); + devp->s3MClk = (int)(val.realnum * 1000.0 + 0.5); + break; + case EOF: FatalError("Unexpected EOF (missing EndSection?)"); break; /* :-) */ @@ -1675,30 +1680,40 @@ configMonitorSection() pNew->prev = NULL; pNew->Flags = 0; pNew->Clock = (int)(val.realnum * 1000.0 + 0.5); + pNew->CrtcHAdjusted = FALSE; + pNew->CrtcVAdjusted = FALSE; - if (getToken(NULL) == NUMBER) pNew->HDisplay = val.num; + if (getToken(NULL) == NUMBER) + pNew->CrtcHDisplay = pNew->HDisplay = val.num; else configError("Horizontal display expected"); - if (getToken(NULL) == NUMBER) pNew->HSyncStart = val.num; + if (getToken(NULL) == NUMBER) + pNew->CrtcHSyncStart = pNew->HSyncStart = val.num; else configError("Horizontal sync start expected"); - if (getToken(NULL) == NUMBER) pNew->HSyncEnd = val.num; + if (getToken(NULL) == NUMBER) + pNew->CrtcHSyncEnd = pNew->HSyncEnd = val.num; else configError("Horizontal sync end expected"); - if (getToken(NULL) == NUMBER) pNew->HTotal = val.num; + if (getToken(NULL) == NUMBER) + pNew->CrtcHTotal = pNew->HTotal = val.num; else configError("Horizontal total expected"); - if (getToken(NULL) == NUMBER) pNew->VDisplay = val.num; + if (getToken(NULL) == NUMBER) + pNew->CrtcVDisplay = pNew->VDisplay = val.num; else configError("Vertical display expected"); - if (getToken(NULL) == NUMBER) pNew->VSyncStart = val.num; + if (getToken(NULL) == NUMBER) + pNew->CrtcVSyncStart = pNew->VSyncStart = val.num; else configError("Vertical sync start expected"); - if (getToken(NULL) == NUMBER) pNew->VSyncEnd = val.num; + if (getToken(NULL) == NUMBER) + pNew->CrtcVSyncEnd = pNew->VSyncEnd = val.num; else configError("Vertical sync end expected"); - if (getToken(NULL) == NUMBER) pNew->VTotal = val.num; + if (getToken(NULL) == NUMBER) + pNew->CrtcVTotal = pNew->VTotal = val.num; else configError("Vertical total expected"); token = getToken(TimingTab); @@ -1883,6 +1898,7 @@ MonPtr monp; pNew->prev = NULL; pNew->Flags = 0; pNew->HDisplay = pNew->VDisplay = 0; /* Uninitialized */ + pNew->CrtcHAdjusted = pNew->CrtcVAdjusted = FALSE; if (monp->Last) monp->Last->next = pNew; @@ -1904,30 +1920,38 @@ MonPtr monp; had_dotclock = 1; break; case HTIMINGS: - if (getToken(NULL) == NUMBER) pNew->HDisplay = val.num; + if (getToken(NULL) == NUMBER) + pNew->CrtcHDisplay = pNew->HDisplay = val.num; else configError("Horizontal display expected"); - if (getToken(NULL) == NUMBER) pNew->HSyncStart = val.num; + if (getToken(NULL) == NUMBER) + pNew->CrtcHSyncStart = pNew->HSyncStart = val.num; else configError("Horizontal sync start expected"); - if (getToken(NULL) == NUMBER) pNew->HSyncEnd = val.num; + if (getToken(NULL) == NUMBER) + pNew->CrtcHSyncEnd = pNew->HSyncEnd = val.num; else configError("Horizontal sync end expected"); - if (getToken(NULL) == NUMBER) pNew->HTotal = val.num; + if (getToken(NULL) == NUMBER) + pNew->CrtcHTotal = pNew->HTotal = val.num; else configError("Horizontal total expected"); had_htimings = 1; break; case VTIMINGS: - if (getToken(NULL) == NUMBER) pNew->VDisplay = val.num; + if (getToken(NULL) == NUMBER) + pNew->CrtcVDisplay = pNew->VDisplay = val.num; else configError("Vertical display expected"); - if (getToken(NULL) == NUMBER) pNew->VSyncStart = val.num; + if (getToken(NULL) == NUMBER) + pNew->CrtcVSyncStart = pNew->VSyncStart = val.num; else configError("Vertical sync start expected"); - if (getToken(NULL) == NUMBER) pNew->VSyncEnd = val.num; + if (getToken(NULL) == NUMBER) + pNew->CrtcVSyncEnd = pNew->VSyncEnd = val.num; else configError("Vertical sync end expected"); - if (getToken(NULL) == NUMBER) pNew->VTotal = val.num; + if (getToken(NULL) == NUMBER) + pNew->CrtcVTotal = pNew->VTotal = val.num; else configError("Vertical total expected"); had_vtimings = 1; break; @@ -2543,15 +2567,33 @@ xf86LookupMode(target, driver) if (best_mode != NULL) { - target->HDisplay = best_mode->HDisplay; - target->HSyncStart = best_mode->HSyncStart; - target->HSyncEnd = best_mode->HSyncEnd; - target->HTotal = best_mode->HTotal; - target->VDisplay = best_mode->VDisplay; - target->VSyncStart = best_mode->VSyncStart; - target->VSyncEnd = best_mode->VSyncEnd; - target->VTotal = best_mode->VTotal; - target->Flags = best_mode->Flags; + target->HDisplay = best_mode->HDisplay; + target->HSyncStart = best_mode->HSyncStart; + target->HSyncEnd = best_mode->HSyncEnd; + target->HTotal = best_mode->HTotal; + target->VDisplay = best_mode->VDisplay; + target->VSyncStart = best_mode->VSyncStart; + target->VSyncEnd = best_mode->VSyncEnd; + target->VTotal = best_mode->VTotal; + target->Flags = best_mode->Flags; + target->CrtcHDisplay = best_mode->CrtcHDisplay; + target->CrtcHSyncStart = best_mode->CrtcHSyncStart; + target->CrtcHSyncEnd = best_mode->CrtcHSyncEnd; + target->CrtcHTotal = best_mode->CrtcHTotal; + target->CrtcVDisplay = best_mode->CrtcVDisplay; + target->CrtcVSyncStart = best_mode->CrtcVSyncStart; + target->CrtcVSyncEnd = best_mode->CrtcVSyncEnd; + target->CrtcVTotal = best_mode->CrtcVTotal; + target->CrtcHAdjusted = best_mode->CrtcHAdjusted; + target->CrtcVAdjusted = best_mode->CrtcVAdjusted; + if (target->Flags & V_DBLSCAN) + { + target->CrtcVDisplay *= 2; + target->CrtcVSyncStart *= 2; + target->CrtcVSyncEnd *= 2; + target->CrtcVTotal *= 2; + target->CrtcVAdjusted = TRUE; + } if (xf86Verbose) { ErrorF("%s %s: Mode \"%s\": mode clock = %7.3f", @@ -2693,6 +2735,7 @@ char *scrname; ((float)(dispmp->HTotal) * (float)(dispmp->VTotal)) ; if ( dispmp->Flags & V_INTERLACE ) vrefreshrate *= 2.0; + if ( dispmp->Flags & V_DBLSCAN ) vrefreshrate /= 2.0; for ( i = 0 ; i < monp->n_vrefresh ; i++ ) { if ( monp->vrefresh[i].hi == monp->vrefresh[i].lo ) { if ( (vrefreshrate > 0.999 * monp->vrefresh[i].hi) && diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c b/xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c index 7952a727b..9eb472c57 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c @@ -1,5 +1,5 @@ -/* $XConsortium: xf86Cursor.c,v 1.1 94/03/28 21:22:57 dpw Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c,v 3.2 1994/11/30 20:41:12 dawes Exp $ */ +/* $XConsortium: xf86Cursor.c,v 1.2 95/01/05 20:39:33 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c,v 3.3 1994/12/11 10:54:36 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -59,22 +59,16 @@ void xf86InitViewport(pScr) ScrnInfoPtr pScr; { - int EVDisplay; - - EVDisplay = pScr->modes->VDisplay; - if (pScr->modes->Flags & V_DBLSCAN) - EVDisplay /= 2; - /* * Compute the initial Viewport if necessary */ if (pScr->frameX0 < 0) { pScr->frameX0 = (pScr->virtualX - pScr->modes->HDisplay) / 2; - pScr->frameY0 = (pScr->virtualY - EVDisplay) / 2; + pScr->frameY0 = (pScr->virtualY - pScr->modes->VDisplay) / 2; } pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1; - pScr->frameY1 = pScr->frameY0 + EVDisplay - 1; + pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1; /* * Now adjust the initial Viewport, so it lies within the virtual area @@ -87,8 +81,8 @@ xf86InitViewport(pScr) if (pScr->frameY1 >= pScr->virtualY) { - pScr->frameY0 = pScr->virtualY - EVDisplay; - pScr->frameY1 = pScr->frameY0 + EVDisplay - 1; + pScr->frameY0 = pScr->virtualY - pScr->modes->VDisplay; + pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1; } } @@ -105,11 +99,6 @@ xf86SetViewport(pScreen, x, y) { Bool frameChanged = FALSE; ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); - int EVDisplay; - - EVDisplay = pScr->modes->VDisplay; - if (pScr->modes->Flags & V_DBLSCAN) - EVDisplay /= 2; /* * check wether (x,y) belongs to the visual part of the screen @@ -129,13 +118,13 @@ xf86SetViewport(pScreen, x, y) if ( pScr->frameY0 > y) { pScr->frameY0 = y; - pScr->frameY1 = y + EVDisplay - 1; + pScr->frameY1 = y + pScr->modes->VDisplay - 1; frameChanged = TRUE; } if ( pScr->frameY1 < y) { pScr->frameY1 = y; - pScr->frameY0 = y - EVDisplay + 1; + pScr->frameY0 = y - pScr->modes->VDisplay + 1; frameChanged = TRUE; } @@ -155,7 +144,6 @@ xf86ZoomViewport (pScreen, zoom) int zoom; { ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); - int EVDisplay; if (pScr->modes != pScr->modes->next) { @@ -163,11 +151,6 @@ xf86ZoomViewport (pScreen, zoom) if ((pScr->SwitchMode)(pScr->modes)) { - - EVDisplay = pScr->modes->VDisplay; - if (pScr->modes->Flags & V_DBLSCAN) - EVDisplay /= 2; - /* * adjust new frame for the displaysize */ @@ -185,18 +168,18 @@ xf86ZoomViewport (pScreen, zoom) pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1; } - pScr->frameY0 = (pScr->frameY1 + pScr->frameY0 - EVDisplay)/2; - pScr->frameY1 = pScr->frameY0 + EVDisplay - 1; + pScr->frameY0 = (pScr->frameY1 + pScr->frameY0 - pScr->modes->VDisplay)/2; + pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1; if (pScr->frameY0 < 0) { pScr->frameY0 = 0; - pScr->frameY1 = pScr->frameY0 + EVDisplay - 1; + pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1; } else if (pScr->frameY1 >= pScr->virtualY) { - pScr->frameY0 = pScr->virtualY - EVDisplay; - pScr->frameY1 = pScr->frameY0 + EVDisplay - 1; + pScr->frameY0 = pScr->virtualY - pScr->modes->VDisplay; + pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1; } } else /* switch failed, so go back to old mode */ diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Events.c b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c index 93cbc6e4c..4976be27c 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Events.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c @@ -1,5 +1,5 @@ -/* $XConsortium: xf86Events.c,v 1.8 94/12/13 15:03:47 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.4 1994/11/30 20:41:14 dawes Exp $ */ +/* $XConsortium: xf86Events.c,v 1.9 95/01/05 20:40:37 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.6 1994/12/17 10:06:08 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Init.c b/xc/programs/Xserver/hw/xfree86/common/xf86Init.c index f66943065..8836b9e11 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Init.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Init.c @@ -1,6 +1,6 @@ /* - * $XConsortium: xf86Init.c,v 1.4 94/12/13 20:12:32 kaleb Exp kaleb $ - * $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.10 1994/10/23 12:58:46 dawes Exp $ + * $XConsortium: xf86Init.c,v 1.5 94/12/14 14:25:59 kaleb Exp kaleb $ + * $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.13 1994/12/29 10:07:29 dawes Exp $ * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -61,7 +61,9 @@ static void xf86PrintConfig(); extern ScrnInfoPtr xf86Screens[]; extern int xf86MaxScreens; extern double pow(); +#ifdef USE_XF86_SERVERLOCK extern void xf86UnlockServer(); +#endif xf86InfoRec xf86Info; int xf86ScreenIndex; @@ -322,6 +324,25 @@ InitInput(argc, argv) } +/* + * OsVendorInit -- + * OS/Vendor-specific initialisations. Called from OsInit(), which + * is called by dix before establishing the well known sockets. + */ + +void +OsVendorInit() +{ +#ifdef USE_XF86_SERVERLOCK + extern void xf86LockServer(); + static Bool been_here = FALSE; + + if (!been_here) { + xf86LockServer(); + been_here = TRUE; + } +#endif +} /* * ddxGiveUp -- @@ -333,7 +354,9 @@ InitInput(argc, argv) void ddxGiveUp() { +#ifdef USE_XF86_SERVERLOCK xf86UnlockServer(); +#endif xf86CloseConsole(); @@ -550,7 +573,7 @@ xf86PrintConfig() { int i; - ErrorF("XFree86 Version%s/ X Window System\n",XF86_VERSION); + ErrorF("\nXFree86 Version%s/ X Window System\n",XF86_VERSION); ErrorF("(protocol Version %d, revision %d, vendor release %d)\n", X_PROTOCOL, X_PROTOCOL_REVISION, VENDOR_RELEASE ); ErrorF("Operating System: %s %s\n", OSNAME, OSVENDOR); diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Io.c b/xc/programs/Xserver/hw/xfree86/common/xf86Io.c index f4146981d..ff7fcc3d2 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Io.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Io.c @@ -1,5 +1,5 @@ -/* $XConsortium: xf86Io.c,v 1.3 94/12/13 20:12:03 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Io.c,v 3.2 1994/09/27 10:29:34 dawes Exp $ */ +/* $XConsortium: xf86Io.c,v 1.4 94/12/14 14:25:59 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Io.c,v 3.3 1994/12/17 10:06:11 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c b/xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c index b292f9771..b34eb52ac 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c @@ -1,5 +1,5 @@ -/* $XConsortium: xf86Kbd.c,v 1.2 94/10/12 20:33:21 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c,v 3.2 1994/11/30 20:41:15 dawes Exp $ */ +/* $XConsortium: xf86Kbd.c,v 1.3 95/01/05 20:40:37 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c,v 3.3 1994/12/11 10:54:39 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -388,4 +388,7 @@ xf86KbdGetMapping (pKeySyms, pModMap) pKeySyms->maxKeyCode = MAX_KEYCODE; else pKeySyms->maxKeyCode = MAX_STD_KEYCODE; + pKeySyms->maxKeyCode = MAX_KEYCODE; + else + pKeySyms->maxKeyCode = MAX_STD_KEYCODE; } diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86KbdMach.c b/xc/programs/Xserver/hw/xfree86/common/xf86KbdMach.c index 9a4707a08..c4ec1758d 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86KbdMach.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86KbdMach.c @@ -1,5 +1,5 @@ -/* $XConsortium: xf86KbdMach.c,v 1.3 94/12/10 12:12:18 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdMach.c,v 3.1 1994/11/30 20:41:17 dawes Exp $ */ +/* $XConsortium: xf86KbdMach.c,v 1.4 95/01/05 20:40:37 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdMach.c,v 3.2 1994/12/11 10:54:40 dawes Exp $ */ /* ***************************************************************************** * HISTORY @@ -310,4 +310,8 @@ xf86KbdGetMapping (pKeySyms, pModMap) else pKeySyms->maxKeyCode = MAX_STD_KEYCODE; + pKeySyms->maxKeyCode = MAX_KEYCODE; + else + pKeySyms->maxKeyCode = MAX_STD_KEYCODE; + } diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h b/xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h index 7ed80b00a..74c90b728 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h @@ -1,5 +1,5 @@ -/* $XConsortium: xf86Keymap.h,v 1.3 94/12/10 12:12:18 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.0 1994/11/22 02:38:53 dawes Exp $ */ +/* $XConsortium: xf86Keymap.h,v 1.4 95/01/05 20:40:37 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.1 1994/12/11 10:54:42 dawes Exp $ */ /* * For Scancodes see notes in atKeynames.h !!!! */ @@ -143,6 +143,31 @@ static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = { /* 0x85 */ XK_KP_6, NoSymbol, NoSymbol, NoSymbol, /* 0x86 */ XK_KP_1, NoSymbol, NoSymbol, NoSymbol, /* 0x87 */ XK_KP_2, NoSymbol, NoSymbol, NoSymbol, + /* 0x88 */ XK_KP_3, NoSymbol, NoSymbol, NoSymbol, + /* 0x89 */ XK_KP_0, NoSymbol, NoSymbol, NoSymbol, + /* 0x8a */ XK_KP_Decimal, NoSymbol, NoSymbol, NoSymbol, + /* 0x8b */ XK_KP_Home, NoSymbol, NoSymbol, NoSymbol, + /* 0x8c */ XK_KP_Up, NoSymbol, NoSymbol, NoSymbol, + /* 0x8d */ XK_KP_Prior, NoSymbol, NoSymbol, NoSymbol, + /* 0x8e */ XK_KP_Left, NoSymbol, NoSymbol, NoSymbol, + /* 0x8f */ XK_KP_Begin, NoSymbol, NoSymbol, NoSymbol, + /* 0x90 */ XK_KP_Right, NoSymbol, NoSymbol, NoSymbol, + /* 0x91 */ XK_KP_End, NoSymbol, NoSymbol, NoSymbol, + /* 0x92 */ XK_KP_Down, NoSymbol, NoSymbol, NoSymbol, + /* 0x93 */ XK_KP_Next, NoSymbol, NoSymbol, NoSymbol, + /* 0x94 */ XK_KP_Insert, NoSymbol, NoSymbol, NoSymbol, + /* 0x95 */ XK_KP_Delete, NoSymbol, NoSymbol, NoSymbol, + /* 0x7f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* These are for ServerNumLock handling */ + /* 0x80 */ XK_KP_7, NoSymbol, NoSymbol, NoSymbol, + /* 0x81 */ XK_KP_8, NoSymbol, NoSymbol, NoSymbol, + /* 0x82 */ XK_KP_9, NoSymbol, NoSymbol, NoSymbol, + /* 0x83 */ XK_KP_4, NoSymbol, NoSymbol, NoSymbol, + /* 0x84 */ XK_KP_5, NoSymbol, NoSymbol, NoSymbol, + /* 0x85 */ XK_KP_6, NoSymbol, NoSymbol, NoSymbol, + /* 0x86 */ XK_KP_1, NoSymbol, NoSymbol, NoSymbol, + /* 0x87 */ XK_KP_2, NoSymbol, NoSymbol, NoSymbol, /* 0x88 */ XK_KP_4, NoSymbol, NoSymbol, NoSymbol, /* 0x89 */ XK_KP_0, NoSymbol, NoSymbol, NoSymbol, /* 0x8a */ XK_KP_Decimal, NoSymbol, NoSymbol, NoSymbol, diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Lock.c b/xc/programs/Xserver/hw/xfree86/common/xf86Lock.c index 111f94152..088b9a570 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Lock.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Lock.c @@ -1,4 +1,5 @@ -/* $XConsortium: xf86Lock.c,v 1.1 94/12/13 16:08:26 kaleb Exp kaleb $ */ +/* $XConsortium: xf86Lock.c,v 1.2 94/12/13 20:12:47 kaleb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Lock.c,v 3.1 1994/12/29 10:07:30 dawes Exp $ */ /* * Explicit support for a server lock file like the ones used for UUCP. @@ -34,6 +35,7 @@ extern int errno; static Bool StillLocking = FALSE; +#ifdef USE_XF86_SERVERLOCK extern char* display; /* @@ -158,3 +160,4 @@ xf86UnlockServer() (void) unlink(buf); #endif } +#endif /* USE_XF86_SERVERLOCK */ diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86_Config.h b/xc/programs/Xserver/hw/xfree86/common/xf86_Config.h index 24a5609ca..1b84f95f7 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86_Config.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86_Config.h @@ -1,5 +1,5 @@ -/* $XConsortium: xf86_Config.h,v 1.2 94/10/12 20:33:21 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86_Config.h,v 3.17 1994/11/30 20:41:19 dawes Exp $ */ +/* $XConsortium: xf86_Config.h,v 1.3 95/01/05 20:40:37 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86_Config.h,v 3.18 1994/12/29 10:07:32 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany * Copyright 1993 by David Dawes <dawes@physics.su.oz.au> @@ -92,6 +92,7 @@ typedef struct { int instance; int s3Madjust; int s3Nadjust; + int s3MClk; } GDevRec, *GDevPtr; typedef struct { @@ -355,6 +356,7 @@ static SymTabRec KeyMapTab[] = { #define MEMBASE 26 #define CLOCKCHIP 27 #define S3MNADJUST 28 +#define S3MCLK 29 #ifdef INIT_CONFIG static SymTabRec DeviceTab[] = { @@ -380,6 +382,7 @@ static SymTabRec DeviceTab[] = { { INSTANCE, "instance" }, { CLOCKCHIP, "clockchip" }, { S3MNADJUST, "s3mnadjust" }, + { S3MCLK, "s3mclk" }, { -1, "" }, }; #endif /* INIT_CONFIG */ diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86_Option.h b/xc/programs/Xserver/hw/xfree86/common/xf86_Option.h index 0e5765665..e360f7587 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86_Option.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86_Option.h @@ -1,5 +1,5 @@ -/* $XConsortium: xf86_Option.h,v 1.2 94/10/12 20:33:21 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86_Option.h,v 3.14 1994/10/20 06:09:17 dawes Exp $ */ +/* $XConsortium: xf86_Option.h,v 1.3 95/01/05 20:40:37 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86_Option.h,v 3.16 1994/12/29 10:07:33 dawes Exp $ */ /* * Copyright 1993 by David Wexelblat <dwex@goblin.org> * @@ -90,6 +90,7 @@ typedef struct { #define OPTION_DAC_8_BIT 53 /* 8-bit DAC operation */ #define OPTION_SYNC_ON_GREEN 54 /* Set Sync-On-Green in RAMDAC */ #define OPTION_BT482_CURS 55 /* Use Bt482 RAMDAC cursor */ +#define OPTION_S3_964_BT485_VCLK 56 /* probe/invert VCLK for 964 + Bt485 */ /* Vendor specific pixmux enabling options */ #define OPTION_SPEA_MERCURY 70 /* pixmux for SPEA Mercury (S3) */ @@ -98,7 +99,6 @@ typedef struct { #define OPTION_ELSA_W1000PRO 73 /* pixmux for ELSA Winner 1000PRO (S3) */ #define OPTION_ELSA_W2000PRO 74 /* pixmux for ELSA Winner 2000PRO (S3) */ #define OPTION_STEALTH64 75 /* pixmux for Diamond Stealth 64 (S3) */ -#define OPTION_MIRO_CRYSTAL20SV 76 /* pixmux for miroCRYSTAL 20SV (S3) */ /* Misc options */ #define OPTION_CSYNC 90 /* Composite sync */ @@ -185,6 +185,7 @@ OptFlagRec xf86_OptionTab[] = { { "dac_8_bit", OPTION_DAC_8_BIT }, { "sync_on_green", OPTION_SYNC_ON_GREEN }, { "bt482_curs", OPTION_BT482_CURS }, + { "s3_964_bt485_vclk",OPTION_S3_964_BT485_VCLK }, { "spea_mercury", OPTION_SPEA_MERCURY }, { "number_nine", OPTION_NUMBER_NINE }, @@ -193,7 +194,6 @@ OptFlagRec xf86_OptionTab[] = { { "elsa_w1000isa", OPTION_ELSA_W1000PRO }, /* These are treated the same */ { "elsa_w2000pro", OPTION_ELSA_W2000PRO }, { "stealth64", OPTION_STEALTH64 }, - { "miro_crystal20sv", OPTION_MIRO_CRYSTAL20SV }, { "composite", OPTION_CSYNC }, { "secondary", OPTION_SECONDARY }, @@ -225,9 +225,13 @@ OptFlagRec xf86_OptionTab[] = { OptFlagRec xf86_ClockOptionTab [] = { { "icd2061a", CLOCK_OPTION_ICD2061A }, /* generic ICD2061A */ + { "ics9161a", CLOCK_OPTION_ICD2061A }, /* ICD2061A compatible */ + { "dcs2824", CLOCK_OPTION_ICD2061A }, /* ICD2061A compatible */ { "sc11412", CLOCK_OPTION_SC11412 }, /* Sierra SC11412 */ { "s3gendac", CLOCK_OPTION_S3GENDAC }, /* S3 gendac */ { "s3_sdac", CLOCK_OPTION_S3GENDAC }, /* S3 SDAC */ + { "ics5300", CLOCK_OPTION_S3GENDAC }, /* S3 gendac compatible */ + { "ics5342", CLOCK_OPTION_S3GENDAC }, /* S3 SDAC compatible */ { "ti3025", CLOCK_OPTION_TI3025 }, /* TI3025 */ { "ics2595", CLOCK_OPTION_ICS2595 }, /* ICS2595 */ { "cirrus", CLOCK_OPTION_CIRRUS }, /* Cirrus built-in */ diff --git a/xc/programs/Xserver/hw/xfree86/common_hw/CirrusClk.c b/xc/programs/Xserver/hw/xfree86/common_hw/CirrusClk.c index e66e4d795..9b89a0f21 100644 --- a/xc/programs/Xserver/hw/xfree86/common_hw/CirrusClk.c +++ b/xc/programs/Xserver/hw/xfree86/common_hw/CirrusClk.c @@ -1,5 +1,5 @@ /* $XConsortium $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common_hw/CirrusClk.c,v 3.2 1994/12/05 03:46:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common_hw/CirrusClk.c,v 3.3 1995/01/04 04:39:57 dawes Exp $ */ /* * Programming of the built-in Cirrus clock generator. @@ -18,11 +18,43 @@ #define CLOCKVAL(n, d) \ ((((n) & 0x7F) * CLOCK_FACTOR / ((d) & 0x3E)) >> ((d) & 1)) +#define NU_FIXED_CLOCKS 19 + +typedef struct { + unsigned char numer; + unsigned char denom; +} cirrusClockRec; + +static cirrusClockRec cirrusClockTab[] = { + { 0x33, 0x3B }, /* 12.588 */ + { 0x4A, 0x2B }, /* 25.227 */ + { 0x5B, 0x2F }, /* 28.325 */ + { 0x45, 0x30 }, /* 41.164 */ + { 0x7E, 0x33 }, /* 36.082 */ + { 0x42, 0x1F }, /* 31.500 */ + { 0x51, 0x3A }, /* 39.992 */ + { 0x55, 0x36 }, /* 45.076 */ + { 0x65, 0x3A }, /* 49.867 */ + { 0x76, 0x34 }, /* 64.983 */ + { 0x7E, 0x32 }, /* 72.163 */ + { 0x6E, 0x2A }, /* 75.000 */ + { 0x5F, 0x22 }, /* 80.013 */ + { 0x7D, 0x2A }, /* 85.226 */ + { 0x58, 0x1C }, /* 89.998 */ + { 0x49, 0x16 }, /* 95.019 */ + { 0x46, 0x14 }, /* 100.226 */ + { 0x53, 0x16 }, /* 108.035 */ + { 0x5C, 0x18 }, /* 110.248 */ +}; + + /* * This function returns the 7-bit numerator and 6-bit denominator/post-scalar * value that corresponds to the closest clock found. If the MCLK is very close * to the requested frequency, it sets a flag so that the MCLK can be used * as VCLK on chips that support it. + * If a frequency close to one of the tested clock values is found, + * use the tested clock since others can be unstable. */ int CirrusFindClock(freq, num_out, den_out, usemclk_out) @@ -31,11 +63,23 @@ int CirrusFindClock(freq, num_out, den_out, usemclk_out) int *den_out; int *usemclk_out; { - int n; + int n, i; int num, den; int ffreq, mindiff; int mclk; + /* Prefer a tested value if it matches within 0.1%. */ + for (i = 0; i < NU_FIXED_CLOCKS; i++) { + int diff; + diff = abs(CLOCKVAL(cirrusClockTab[i].numer, + cirrusClockTab[i].denom) - freq); + if (diff < freq / 1000) { + num = cirrusClockTab[i].numer; + den = cirrusClockTab[i].denom; + goto foundclock; + } + } + mindiff = freq; for (n = 0x10; n < 0x7f; n++) { int d; @@ -55,6 +99,7 @@ int CirrusFindClock(freq, num_out, den_out, usemclk_out) } } +foundclock: *num_out = num; *den_out = den; diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.isc b/xc/programs/Xserver/hw/xfree86/doc/README.isc index c21069a50..e990a0002 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.isc +++ b/xc/programs/Xserver/hw/xfree86/doc/README.isc @@ -1,50 +1,68 @@ -./README.isc -===== -Anpassungen an das System: + Information for ISC Users + Michael Rohleder + 16 December 1994 -/usr/local/lib/gcc-lib/i386-isc4.0/2.6.0/include/sys/limits.h -(besser: /usr/include/sys/limits.h -- wird bei neuen gcc uebernommen) + 1. Information for ISC Users -#ifndef OPEN_MAX -#ifdef ISC -#define OPEN_MAX 256 -#else -#define OPEN_MAX 20 -#endif -#endif + Changes to the system: /usr/local/lib/gcc- + lib/i386-isc4.0/2.6.0/include/sys/limits.h (better: do it also in + /usr/include/sys/limits.h -- will remain with a new gcc.) + #ifndef OPEN_MAX + #ifdef ISC + #define OPEN_MAX 256 + #else + #define OPEN_MAX 20 + #endif + #endif -musste OPEN_MAX erhoehen um zu fruehe Xlib Errors -(max no. of clients reached) zu umgehen + OPEN_MAX had to be increased to prevent Xlib Errors (max no. of + clients reached). ------ + /usr/include/sys/ioctl.h surrounded by ifdef _IOCTL_H endif to prevent + multiple includes. -/usr/include/sys/ioctl.h + BOOTSTRAPCFLAGS="-DISC [-DISC40 | -DISC30] -DSYSV" -surrounded by ifdef _IOCTL_H endif -to prevend multiple includes ------ + -DISC -DISC30 + these two defines are necessary to build the release I don't + know if the build will succeed for ISC Versions prior than 3.x -BOOTSTRAPCFLAGS="-DISC -DISC40 -DISC30 -DSYSV -Di386" --DISC -DISC30 : these two defines are necessary to build the release - I don't know if the build will succeed for ISC Versions - prior than 3.x + -DISC40 + are only for getting the ISC Version and therefore set the + HasSymLinks to Yes ('cause symbolic linking were only supported + from Version 4.x using the S5L Filesystem) A build on ISC 4.x + only needs -DISC40 defines in the BOOTSRAPCFLAGS -- the -DISC30 + will be included automatically. --DISC40 : are only for getting the ISC Version and therefore - set the HasSymLinks to Yes ('cause symbolic linking - were only supported from Version 4.x using the S5L - Filesystem) --DSYSV -Di386 : standard defines for SystemV Release3 on x86 Platform + -DSYSV -Di386 + standard defines for SystemV Release3 on x86 Platform. You + don't need to explicitly define -Di386 because this is pre- + defined in /lib/cpp. -GCC-Versions : I'd tried gcc Version 2.5.8 ,2.6.0 and 2.6.2 -Optimization : using gcc-2.6.0 you got only 1 Problem using -O3 - in libX11.a for building the file lcUTF.o - remake in this directory with CDEBUGFLAGS=-O2 do work. - -===== + GCC-Versions + I'd tried gcc Version 2.5.8, 2.6.0, 2.6.2 and 2.6.3. 2.6.2 and + 2.6.3 had some problems compiling 3.1. 2.6.3 builds 3.1.0A + (beta) without problem. -$XConsortium $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.isc,v 3.1 1994/12/02 05:46:55 dawes Exp $ + + Optimization + using gcc-2.6.0 you got only 1 Problem using -O3 in libX11.a for + building the file lcUTF.o remake in this directory with + CDEBUGFLAGS=-O2 do work. + + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/isc.sgml,v 3.1 1994/12/26 10:43:41 dawes Exp $ + + + + + + + + + + +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.isc,v 3.4 1995/01/02 07:33:01 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile index 6b096fd9a..134f175df 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile @@ -1,5 +1,5 @@ -XCOMM $XConsortium: Imakefile,v 1.1 94/10/05 13:41:29 kaleb Exp $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile,v 3.0 1994/07/24 11:51:35 dawes Exp $ +XCOMM $XConsortium: Imakefile,v 1.2 94/10/12 20:45:13 kaleb Exp kaleb $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile,v 3.1 1994/12/10 02:14:51 dawes Exp $ #include <Server.tmpl> SRCS = bsd_init.c bsd_video.c bsd_io.c bsd_VTsw.c bios_devmem.c mapVT_noop.c \ @@ -13,10 +13,14 @@ OBJS = bsd_init.o bsd_video.o bsd_io.o bsd_VTsw.o bios_devmem.o mapVT_noop.o \ INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(INCLUDESRC) +CONSDEFINES = XFree86ConsoleDefines + #if HasNetBSDApertureDriver -DEFINES = -DHAS_APERTURE_DRV +APDEFINES = -DHAS_APERTURE_DRV #endif +DEFINES = $(CONSDEFINES) $(APDEFINES) + SubdirLibraryRule($(OBJS)) NormalLibraryObjectRule() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c index f15627ebe..fe2128c05 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c @@ -1,4 +1,5 @@ -/* $XConsortium$ */ +/* $XConsortium: bsd_io.c,v 1.1 94/03/28 21:28:06 dpw Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c,v 3.1 1994/12/10 03:03:18 dawes Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Dawes <dawes@physics.su.oz.au> @@ -43,8 +44,12 @@ int duration; { if (loudness && pitch) { +#ifdef CODRV_SUPPORT struct kbd_sound s; +#endif +#ifdef PCCONS_SUPPORT int data[2]; +#endif switch (xf86Info.consType) { diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile index a706b7911..bb760a18e 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile @@ -1,4 +1,5 @@ -XCOMM $XConsortium: Imakefile,v 1.1 94/03/28 21:32:50 dpw Exp kaleb $ +XCOMM $XConsortium: Imakefile,v 1.2 94/12/08 02:30:35 kaleb Exp kaleb $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile,v 3.1 #include <Server.tmpl> #if defined(SVR4Architecture) @@ -19,7 +20,7 @@ INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ SubdirLibraryRule($(OBJS)) NormalLibraryObjectRule() -#if !defined(i386SVR4Architecture) +#if !defined(SVR4Architecture) ObjectFromSpecialSource(bios_devmem,../shared/bios_devmem,/**/) #endif ObjectFromSpecialSource(VTsw_usl,../shared/VTsw_usl,/**/) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h index 92269d7bc..34e15512f 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h @@ -1,5 +1,5 @@ -/* $XConsortium: xf86_OSlib.h,v 1.4 94/12/01 16:57:59 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.8 1994/12/05 03:46:56 dawes Exp $ */ +/* $XConsortium: xf86_OSlib.h,v 1.5 95/01/05 20:43:31 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.11 1994/12/18 11:02:02 dawes Exp $ */ /* * Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany * Copyright 1992 by David Dawes <dawes@physics.su.oz.au> @@ -48,12 +48,16 @@ /* SYSV386 (SVR3, SVR4) */ /**************************************************************************/ #if defined(SYSV) || defined(SVR4) +# if defined(sun) && defined(i386) && defined(SVR4) +# /* Fix for Solaris ANSI compilation */ +# define __EXTENSIONS__ +# endif # include <sys/ioctl.h> # include <signal.h> # include <termio.h> # include <sys/stat.h> # include <sys/types.h> -# ifdef SCO +# if defined(SCO) || defined(ISC) # include <sys/param.h> # endif @@ -208,23 +212,11 @@ extern int errno; # include <errno.h> extern int errno; -/* - * XXXX Note, for 386BSD, FreeBSD and NetBSD, things may not yet work right if - * all of these are not defined - */ -# ifndef __bsdi__ -# define PCCONS_SUPPORT -# define CODRV_SUPPORT -# define SYSCONS_SUPPORT -# define PCVT_SUPPORT -# endif - /* PCVT support requires SYSCONS support */ # if defined(PCVT_SUPPORT) && !defined(SYSCONS_SUPPORT) # define SYSCONS_SUPPORT # endif - # if !defined(LINKKIT) /* Don't need this stuff for the Link Kit */ # if defined(__bsdi__) diff --git a/xc/programs/Xserver/hw/xfree86/vga16/drivers/Imakefile b/xc/programs/Xserver/hw/xfree86/vga16/drivers/Imakefile index 3ca798b8e..72e12e3f7 100644 --- a/xc/programs/Xserver/hw/xfree86/vga16/drivers/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/vga16/drivers/Imakefile @@ -1,5 +1,5 @@ -XCOMM $XConsortium: Imakefile,v 1.1 94/03/28 21:33:46 dpw Exp $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga16/drivers/Imakefile,v 3.2 1994/06/05 05:58:27 dawes Exp $ +XCOMM $XConsortium: Imakefile,v 1.2 94/10/12 20:53:13 kaleb Exp kaleb $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga16/drivers/Imakefile,v 3.3 1994/12/25 12:32:34 dawes Exp $ #include <Server.tmpl> #define IHaveSubdirs @@ -19,6 +19,3 @@ DependSubdirs($(SUBDIRS)) InstallLinkKitNonExecFile(Imakefile,$(LINKKITDIR)/drivers/vga16) -#if XF86LinkKit -#include <LinkKit.tmpl> -#endif diff --git a/xc/programs/Xserver/hw/xfree86/vga16/mfb/Imakefile b/xc/programs/Xserver/hw/xfree86/vga16/mfb/Imakefile index 8fa785d83..4c37c78cc 100644 --- a/xc/programs/Xserver/hw/xfree86/vga16/mfb/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/vga16/mfb/Imakefile @@ -1,5 +1,5 @@ -XCOMM $XConsortium: Imakefile,v 1.1 94/10/05 13:46:42 kaleb Exp $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga16/mfb/Imakefile,v 3.1 1994/05/14 06:57:01 dawes Exp $ +XCOMM $XConsortium: Imakefile,v 1.2 94/10/12 21:08:02 kaleb Exp kaleb $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga16/mfb/Imakefile,v 3.2 1994/12/17 10:07:36 dawes Exp $ #include <Server.tmpl> SRCS1 = mfbgc.c mfbwindow.c mfbfont.c \ @@ -122,4 +122,6 @@ ObjectFromSpecialSource(mfbtileC,mfbtile,-DMROP=Mcopy) ObjectFromSpecialSource(mfbtileG,mfbtile,-DMROP=0) +#ifndef OS2Architecture DependTarget() +#endif diff --git a/xc/programs/Xserver/hw/xfree86/vga16/misc/Imakefile b/xc/programs/Xserver/hw/xfree86/vga16/misc/Imakefile index f9bb74181..4ce15801f 100644 --- a/xc/programs/Xserver/hw/xfree86/vga16/misc/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/vga16/misc/Imakefile @@ -1,5 +1,5 @@ -XCOMM $XConsortium: Imakefile,v 1.1 94/10/05 13:46:51 kaleb Exp $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga16/misc/Imakefile,v 3.0 1994/05/30 08:25:58 dawes Exp $ +XCOMM $XConsortium: Imakefile,v 1.2 94/10/12 21:09:16 kaleb Exp kaleb $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga16/misc/Imakefile,v 3.2 1994/12/26 01:09:31 dawes Exp $ #include <Server.tmpl> SRCS = mibitblt.c mipushpxl.c dixfonts.c @@ -8,6 +8,11 @@ OBJS = mibitblt.o mipushpxl.o dixfonts.o DEFINES = -DXF86VGA16 +/* This is for dixfonts.c */ +#if BuildLBXCompatible +EXTRA_DEFINES = -DLBX +#endif + INCLUDES = -I$(SERVERSRC)/mi -I$(SERVERSRC)/include -I$(INCLUDESRC) \ -I$(FONTINCSRC) diff --git a/xc/programs/Xserver/hw/xfree86/vga2/drivers/Imakefile b/xc/programs/Xserver/hw/xfree86/vga2/drivers/Imakefile index 5839a4007..0f5308ab9 100644 --- a/xc/programs/Xserver/hw/xfree86/vga2/drivers/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/vga2/drivers/Imakefile @@ -1,5 +1,5 @@ -XCOMM $XConsortium: Imakefile,v 1.1 94/10/05 13:48:15 kaleb Exp $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga2/drivers/Imakefile,v 3.2 1994/06/05 05:59:44 dawes Exp $ +XCOMM $XConsortium: Imakefile,v 1.2 94/10/12 21:14:28 kaleb Exp kaleb $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga2/drivers/Imakefile,v 3.3 1994/12/25 12:33:27 dawes Exp $ #include <Server.tmpl> #define IHaveSubdirs @@ -19,6 +19,3 @@ DependSubdirs($(SUBDIRS)) InstallLinkKitNonExecFile(Imakefile,$(LINKKITDIR)/drivers/vga2) -#if XF86LinkKit -#include <LinkKit.tmpl> -#endif diff --git a/xc/programs/Xserver/hw/xfree86/vga2/mfb.banked/Imakefile b/xc/programs/Xserver/hw/xfree86/vga2/mfb.banked/Imakefile index 47971e172..30aba8d74 100644 --- a/xc/programs/Xserver/hw/xfree86/vga2/mfb.banked/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/vga2/mfb.banked/Imakefile @@ -1,5 +1,5 @@ -XCOMM $XConsortium: Imakefile,v 1.1 94/10/05 13:47:43 kaleb Exp $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga2/mfb.banked/Imakefile,v 3.0 1994/05/31 08:13:30 dawes Exp $ +XCOMM $XConsortium: Imakefile,v 1.2 94/10/12 21:20:46 kaleb Exp kaleb $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga2/mfb.banked/Imakefile,v 3.1 1994/12/17 10:08:05 dawes Exp $ #include <Server.tmpl> SRCS1 = mfbgc.c mfbwindow.c mfbfont.c \ @@ -126,4 +126,6 @@ ObjectFromSpecialSource(mfbtileC,mfbtile,-DMROP=Mcopy) ObjectFromSpecialSource(mfbtileG,mfbtile,-DMROP=0) +#ifndef OS2Architecture DependTarget() +#endif diff --git a/xc/programs/Xserver/hw/xfree86/vga2/misc/Imakefile b/xc/programs/Xserver/hw/xfree86/vga2/misc/Imakefile index 4703ee101..dc5186abf 100644 --- a/xc/programs/Xserver/hw/xfree86/vga2/misc/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/vga2/misc/Imakefile @@ -1,5 +1,5 @@ -XCOMM $XConsortium: Imakefile,v 1.1 94/10/05 13:47:56 kaleb Exp $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga2/misc/Imakefile,v 3.0 1994/05/30 08:27:08 dawes Exp $ +XCOMM $XConsortium: Imakefile,v 1.2 94/10/12 21:22:51 kaleb Exp kaleb $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga2/misc/Imakefile,v 3.2 1994/12/26 01:10:43 dawes Exp $ #include <Server.tmpl> SRCS = dixfonts.c mibitblt.c @@ -10,6 +10,11 @@ INCLUDES = -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi -I$(SERVERSRC)/include \ DEFINES = -DXF86MONOVGA +/* This is for dixfonts.c */ +#if BuildLBXCompatible +EXTRA_DEFINES = -DLBX +#endif + NormalLibraryObjectRule() NormalRelocatableTarget(vga2misc, $(OBJS)) diff --git a/xc/programs/Xserver/hw/xfree86/vga256/drivers/Imakefile b/xc/programs/Xserver/hw/xfree86/vga256/drivers/Imakefile index 7d9c1f414..a5a58b5c4 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/drivers/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/vga256/drivers/Imakefile @@ -1,5 +1,5 @@ -XCOMM $XConsortium: Imakefile,v 1.2 94/10/13 13:18:06 kaleb Exp kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/Imakefile,v 3.3 1994/09/25 12:30:38 dawes Exp $ +XCOMM $XConsortium: Imakefile,v 1.3 95/01/05 20:50:11 kaleb Exp kaleb $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/Imakefile,v 3.4 1994/12/25 12:34:25 dawes Exp $ #include <Server.tmpl> #define IHaveSubdirs @@ -20,6 +20,3 @@ DependSubdirs($(SUBDIRS)) InstallLinkKitNonExecFile(Imakefile,$(LINKKITDIR)/drivers/vga256) -#if XF86LinkKit -#include <LinkKit.tmpl> -#endif diff --git a/xc/programs/Xserver/hw/xfree86/vga256/drivers/ali/ali_driver.c b/xc/programs/Xserver/hw/xfree86/vga256/drivers/ali/ali_driver.c index d1b3b0e07..fbf10ef8c 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/drivers/ali/ali_driver.c +++ b/xc/programs/Xserver/hw/xfree86/vga256/drivers/ali/ali_driver.c @@ -1,6 +1,6 @@ /* - * $XConsortium: $ - * $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/ali/ali_driver.c,v 3.0 1994/10/30 04:21:48 dawes Exp $ + * $XConsortium: ali_driver.c,v 1.1 94/12/15 21:06:48 kaleb Exp kaleb $ + * $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/ali/ali_driver.c,v 3.1 1995/01/02 05:01:42 dawes Exp $ */ #include "X.h" @@ -66,6 +66,9 @@ static Bool ALIInit(); /* 2nd most important routine */ static void * ALISave(); static void ALIRestore(); static void ALIAdjust(); +#if 0 +static void ALIFbInit(); +#endif extern void ALISetRead(); extern void ALISetWrite(); extern void ALISetReadWrite(); diff --git a/xc/programs/Xserver/hw/xfree86/vga256/drivers/ati/ati_driver.c b/xc/programs/Xserver/hw/xfree86/vga256/drivers/ati/ati_driver.c index bc80da025..9f2da38f6 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/drivers/ati/ati_driver.c +++ b/xc/programs/Xserver/hw/xfree86/vga256/drivers/ati/ati_driver.c @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/ati/ati_driver.c,v 3.13 1994/11/30 20:43:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/ati/ati_driver.c,v 3.15 1995/01/04 04:41:48 dawes Exp $ */ /* - * Copyright 1994 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1994 and 1995 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -471,7 +471,7 @@ static const char *DACNames[] = }; #define ATI_CLOCK_NONE 0 /* Must be zero */ -#define ATI_CLOCK_CRYSTALS 1 +#define ATI_CLOCK_CRYSTALS 1 /* Must be one */ #define ATI_CLOCK_18810 2 #define ATI_CLOCK_18811_0 3 #define ATI_CLOCK_18811_1 4 @@ -836,14 +836,19 @@ int no; * clock lines. It returns a clock line number (or 0). */ static int -ATIMatchClockLine(Clock_Line, Number_Of_Clocks, Calibration_Clock_Number) -const int **Clock_Line, Number_Of_Clocks, Calibration_Clock_Number; +ATIMatchClockLine(Clock_Line, Number_Of_Clocks, + Calibration_Clock_Number, Clock_Map) +const int **Clock_Line, Number_Of_Clocks, Calibration_Clock_Number, Clock_Map; { - int Clock_Chip = 0, Clock_Chip_Index; + int Clock_Chip = 0, Clock_Chip_Index = 0; int Number_Of_Matching_Clocks = 0; int Minimum_Gap = CLOCK_TOLERANCE + 1; - for (Clock_Chip_Index = 0; Clock_Line[++Clock_Chip_Index]; ) + /* If checking for XF86Config clock order, skip crystals */ + if (Clock_Map) + Clock_Chip_Index++; + + for (; Clock_Line[++Clock_Chip_Index]; ) { int Maximum_Gap = 0, Clock_Count = 0, Clock_Index; @@ -854,7 +859,7 @@ const int **Clock_Line, Number_Of_Clocks, Calibration_Clock_Number; int Gap, XF86Config_Clock, Specification_Clock; Specification_Clock = - Clock_Line[Clock_Chip_Index][Clock_Index]; + Clock_Line[Clock_Chip_Index][Clock_Index ^ Clock_Map]; if (Specification_Clock < 0) break; if (!Specification_Clock || @@ -903,7 +908,7 @@ ATIGetClocks() int Number_Of_Documented_Clocks, Number_Of_Undivided_Clocks; int Number_Of_Dividers, Number_Of_Clocks; int Calibration_Clock_Number, Calibration_Clock_Value; - int Clock_Index, Specification_Clock; + int Clock_Index, Specification_Clock, Clock_Map; /* * Determine the number of clock values the board should be able to @@ -952,7 +957,33 @@ probe_clocks: Calibration_Clock_Number, Calibration_Clock_Value, &vga256InfoRec); + /* Tell user clocks were probed, instead of supplied */ OFLG_CLR(XCONFIG_CLOCKS, &vga256InfoRec.xconfigFlag); + + /* + * Attempt to match probed clocks to a known specification. + */ + ATIClock = + ATIMatchClockLine(ClockLine, + Number_Of_Documented_Clocks, + Calibration_Clock_Number, 0); + + if (ATIBoard <= ATI_BOARD_V4) + { + /* + * V3 and V4 boards don't have clock chips. + */ + if (ATIClock > ATI_CLOCK_CRYSTALS) + ATIClock = ATI_CLOCK_NONE; + } + else + { + /* + * All others don't have crystals. + */ + if (ATIClock == ATI_CLOCK_CRYSTALS) + ATIClock = ATI_CLOCK_NONE; + } } else { @@ -981,22 +1012,64 @@ probe_clocks: * clocks, and clock lines that could have been used with the * pre-2.1.1 ati driver. */ - if (ATIMatchClockLine(InvalidClockLine, Number_Of_Clocks, -1)) + if (ATIMatchClockLine(InvalidClockLine, + Number_Of_Clocks, -1, 0)) + vga256InfoRec.clocks = 0; + else + { + /* + * Attempt to match clocks to a known specification. + */ + ATIClock = + ATIMatchClockLine(ClockLine, + Number_Of_Documented_Clocks, + Calibration_Clock_Number, 0); + + /* + * Ensure crystals are not matched to clock chips, and + * vice versa. + */ + if (ATIBoard <= ATI_BOARD_V4) + { + if (ATIClock > ATI_CLOCK_CRYSTALS) + vga256InfoRec.clocks = 0; + } + else + { + if (ATIClock == ATI_CLOCK_CRYSTALS) + vga256InfoRec.clocks = 0; + } + } + + if (!vga256InfoRec.clocks) { ErrorF("Invalid or obsolete XF86Config clocks line " "rejected.\nClocks will be probed. See " "README.ati for more information.\n"); - vga256InfoRec.clocks = 0; goto probe_clocks; } - } - /* - * Attempt to match clocks line to a known specification. - */ - ATIClock = - ATIMatchClockLine(ClockLine, Number_Of_Documented_Clocks, - Calibration_Clock_Number); + /* + * Now, check for clocks that are specified in the wrong order. + * This is meant to catch people trying to use the clock order + * intended for the accelerated servers. + */ + if (!ATIClock) + for (Clock_Map = 1; + Clock_Map < Number_Of_Documented_Clocks; + Clock_Map++) + if (ATIMatchClockLine(ClockLine, + Number_Of_Documented_Clocks, + -1, Clock_Map)) + { + ErrorF("XF86Config clocks order " + "incorrect. Clocks will be " + "probed.\nSee README.ati for " + "more information.\n"); + vga256InfoRec.clocks = 0; + goto probe_clocks; + } + } switch (ATIClock) { @@ -1368,8 +1441,16 @@ ATIProbe() xf86EnableIOPorts(vga256InfoRec.scrnIndex); /* - * First determine if a Mach64 is present. + * Determine if a Mach64 is present, making sure it's not in some wierd + * state. */ + IO_Value = inl(BUS_CNTL); + outl(BUS_CNTL, (IO_Value & + ~(BUS_ROM_DIS | BUS_FIFO_ERR_INT_EN | BUS_HOST_ERR_INT_EN)) | + BUS_FIFO_ERR_INT | BUS_HOST_ERR_INT); + outl(GEN_TEST_CNTL, 0); + outl(GEN_TEST_CNTL, GEN_GUI_EN); + IO_Value = inl(SCRATCH_REG0); outl(SCRATCH_REG0, 0x55555555); /* Test odd bits */ if (inl(SCRATCH_REG0) == 0x55555555) @@ -1378,18 +1459,6 @@ ATIProbe() if (inl(SCRATCH_REG0) == 0xAAAAAAAA) { /* A Mach64 has been detected */ - if (OFLG_ISSET(OPTION_NOACCEL, &vga256InfoRec.options)) - { - /* Reset Mach64 engine */ - IO_Value2 = inl(BUS_CNTL); - outl(BUS_CNTL, (IO_Value2 & - ~(BUS_ROM_DIS | BUS_FIFO_ERR_INT_EN | - BUS_HOST_ERR_INT_EN)) | - BUS_FIFO_ERR_INT | BUS_HOST_ERR_INT); - outl(GEN_TEST_CNTL, 0); - outl(GEN_TEST_CNTL, GEN_GUI_EN); - } - IO_Value2 = inl(CONFIG_STATUS_0); if ((IO_Value2 & (CFG_VGA_EN | CFG_CHIP_EN)) != (CFG_VGA_EN | CFG_CHIP_EN)) @@ -1440,23 +1509,18 @@ ATIProbe() if (!(BIOS_Data[0x44] & 0x40)) { /* An 8514/A compatible accelerator detected */ - if (OFLG_ISSET(OPTION_NOACCEL, &vga256InfoRec.options)) - { - /* - * Reset the 8514/A and disable all interrupts. - */ - outw(SUBSYS_CNTL, - GPCTRL_RESET | CHPTEST_NORMAL); - outw(SUBSYS_CNTL, - GPCTRL_ENAB | CHPTEST_NORMAL); - /* - * Don't leave any Mach8 or Mach32 in 8514/A - * mode. - */ - IO_Value = inw(CLOCK_SEL); - outw(CLOCK_SEL, IO_Value); - } + /* + * Reset the 8514/A and disable all interrupts. + */ + outw(SUBSYS_CNTL, GPCTRL_RESET | CHPTEST_NORMAL); + outw(SUBSYS_CNTL, GPCTRL_ENAB | CHPTEST_NORMAL); + + /* + * Don't leave any Mach8 or Mach32 in 8514/A mode. + */ + IO_Value = inw(CLOCK_SEL); + outw(CLOCK_SEL, IO_Value); IO_Value = inw(ERR_TERM); outw(ERR_TERM, 0x5A5A); @@ -1669,26 +1733,6 @@ ATIProbe() ErrorF("%s or similar RAMDAC detected.\n", DACNames[ATIDac]); ErrorF("This is a %s video adapter.\n", BoardNames[ATIBoard]); - /* The following is temporary */ - if (ATIBoard >= ATI_BOARD_MACH8) - { - char *Version = XF86_VERSION; - for ( ; *Version; Version++) - if (isalpha(*Version)) - { - if (OFLG_ISSET(OPTION_NOACCEL, - &vga256InfoRec.options)) - ErrorF("Thank you for trying option " - "\"noaccel\"! Good luck!\n"); - else - ErrorF("Please try option \"noaccel\" " - "and report any problems to " - "tsi@ualberta.ca.\n"); - break; - } - } - /* End of temporary code */ - /* From now on, ignore Mach8 accelerator */ if (ATIBoard == ATI_BOARD_MACH8) ATIBoard = ATIVGABoard; @@ -1891,7 +1935,6 @@ ATIProbe() OFLG_SET(OPTION_PROBE_CLKS, &ATI.ChipOptionFlags); OFLG_SET(OPTION_UNDOC_CLKS, &ATI.ChipOptionFlags); OFLG_SET(OPTION_CSYNC, &ATI.ChipOptionFlags); - OFLG_SET(OPTION_NOACCEL, &ATI.ChipOptionFlags); /* Temporary */ /* * Return success. @@ -1921,6 +1964,7 @@ Bool enter; saved_mem_info; static Bool entered = LEAVE; + unsigned char misc; unsigned int tmp; if (enter == entered) @@ -1931,7 +1975,6 @@ Bool enter; { xf86EnableIOPorts(vga256InfoRec.scrnIndex); - if (OFLG_ISSET(OPTION_NOACCEL, &vga256InfoRec.options)) if (Chip_Has_SUBSYS_CNTL) { /* Save register values to be modified */ @@ -1993,8 +2036,10 @@ Bool enter; ~(CTL_MEM_BNDRY | CTL_MEM_BNDRY_EN)); } - vgaIOBase = (inb(R_GENMO) & 0x01) ? - ColourIOBase : MonochromeIOBase; + misc = inb(R_GENMO); + vgaIOBase = (misc & 0x01) ? ColourIOBase : MonochromeIOBase; + + PutReg(SEQX, 0x00, 0x01); /* Start synchonous reset */ /* * Ensure all registers are read/write and disable all non-VGA @@ -2076,9 +2121,15 @@ Bool enter; PutReg(CRTX(vgaIOBase), 0x11, (VSyncEnd & 0x0F) | 0x20); } + + outb(GENMO, misc); /* Restore GENMO */ + PutReg(SEQX, 0x00, 0x03); /* End synchronous reset */ } else { + misc = inb(R_GENMO); /* Save GENMO before reset */ + PutReg(SEQX, 0x00, 0x01); /* Start synchronous reset */ + /* Protect CRTC[0-7] */ tmp = GetReg(CRTX(vgaIOBase), 0x11); outb(CRTD(vgaIOBase), tmp | 0x80); @@ -2107,7 +2158,9 @@ Bool enter; } } - if (OFLG_ISSET(OPTION_NOACCEL, &vga256InfoRec.options)) + outb(GENMO, misc); /* Restore after reset */ + PutReg(SEQX, 0x00, 0x03); /* End synchronous reset */ + if (Chip_Has_SUBSYS_CNTL) { /* Reset the 8514/A and disable all interrupts */ @@ -2611,12 +2664,12 @@ DisplayModePtr mode; /* * Set horizontal display end. */ - mode->HDisplay = (crt01 + 1) << 3; + mode->CrtcHDisplay = mode->HDisplay = (crt01 + 1) << 3; /* * Set horizontal synch pulse start. */ - mode->HSyncStart = crt04 << 3; + mode->CrtcHSyncStart = mode->HSyncStart = crt04 << 3; /* * Set horizontal synch pulse end. @@ -2624,23 +2677,23 @@ DisplayModePtr mode; crt05 = (crt04 & 0xE0) | (crt05 & 0x1F); if (crt05 <= crt04) crt05 += 0x20; - mode->HSyncEnd = crt05 << 3; + mode->CrtcHSyncEnd = mode->HSyncEnd = crt05 << 3; /* * Set horizontal total. */ - mode->HTotal = (crt00 + 5) << 3; + mode->CrtcHTotal = mode->HTotal = (crt00 + 5) << 3; /* * Set vertical display end. */ - mode->VDisplay = + mode->CrtcVDisplay = mode->VDisplay = (((crt07 & 0x40) << 3) | ((crt07 & 0x02) << 7) | crt12) + 1; /* * Set vertical synch pulse start. */ - mode->VSyncStart = + mode->CrtcVSyncStart = mode->VSyncStart = (((crt07 & 0x80) << 2) | ((crt07 & 0x04) << 6) | crt10); /* @@ -2649,13 +2702,15 @@ DisplayModePtr mode; mode->VSyncEnd = (mode->VSyncStart & 0x3F0) | (crt11 & 0x0F); if (mode->VSyncEnd <= mode->VSyncStart) mode->VSyncEnd += 0x10; + mode->CrtcVSyncEnd = mode->VSyncEnd; /* - * Set vertical total. */ - mode->VTotal = + mode->CrtcVTotal = mode->VTotal = (((crt07 & 0x20) << 4) | ((crt07 & 0x01) << 8) | crt06) + 2; + mode->CrtcVAdjusted = TRUE; + /* * Set flags. */ @@ -2689,31 +2744,24 @@ DisplayModePtr mode; */ if (mode->Flags & V_INTERLACE) ShiftCount++; + if (mode->Flags & V_DBLSCAN) + ShiftCount--; if (b1 & 0x40) ShiftCount--; if (crt17 & 0x04) ShiftCount++; - switch (ShiftCount) + if (ShiftCount > 0) { - case -1: - mode->VDisplay >>= 1; - mode->VSyncStart >>= 1; - mode->VSyncEnd >>= 1; - mode->VTotal >>= 1; - break; - case 1: - mode->VDisplay <<= 1; - mode->VSyncStart <<= 1; - mode->VSyncEnd <<= 1; - mode->VTotal <<= 1; - break; - case 2: - mode->VDisplay <<= 2; - mode->VSyncStart <<= 2; - mode->VSyncEnd <<= 2; - mode->VTotal <<= 2; - break; - default: - break; + mode->VDisplay <<= ShiftCount; + mode->VSyncStart <<= ShiftCount; + mode->VSyncEnd <<= ShiftCount; + mode->VTotal <<= ShiftCount; + } + else if (ShiftCount < 0) + { + mode->VDisplay >>= -ShiftCount; + mode->VSyncStart >>= -ShiftCount; + mode->VSyncEnd >>= -ShiftCount; + mode->VTotal >>= -ShiftCount; } } diff --git a/xc/programs/Xserver/hw/xfree86/vga256/drivers/chips/ct_bank.s b/xc/programs/Xserver/hw/xfree86/vga256/drivers/chips/ct_bank.s index 86debf3d6..33d4437d1 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/drivers/chips/ct_bank.s +++ b/xc/programs/Xserver/hw/xfree86/vga256/drivers/chips/ct_bank.s @@ -1,7 +1,7 @@ -/* $XConsortium: $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/chips/ct_bank.s,v 3.0 1994/11/05 23:51:51 dawes Exp $ */ +/* $XConsortium: ct_bank.s,v 1.1 94/12/15 21:08:14 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/chips/ct_bank.s,v 3.1 1995/01/04 04:42:01 dawes Exp $ */ /* - * Copyright 1993 by Jon Block <block@frc.com> + * Copyright 1994 by Régis Cridlig <cridlig@dmi.ens.fr> * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that diff --git a/xc/programs/Xserver/hw/xfree86/vga256/drivers/chips/ct_driver.c b/xc/programs/Xserver/hw/xfree86/vga256/drivers/chips/ct_driver.c index 5fb54081a..e6d863fb7 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/drivers/chips/ct_driver.c +++ b/xc/programs/Xserver/hw/xfree86/vga256/drivers/chips/ct_driver.c @@ -1,7 +1,9 @@ -/* $XConsortium: $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/chips/ct_driver.c,v 3.0 1994/11/05 23:51:53 dawes Exp $ */ +/* $XConsortium: ct_driver.c,v 1.1 94/12/15 21:08:14 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/chips/ct_driver.c,v 3.2 1995/01/04 04:42:03 dawes Exp $ */ /* * Copyright 1993 by Jon Block <block@frc.com> + * Modified by Mike Hollick <hollick@> + * Modified 1994 by Régis Cridlig <cridlig@dmi.ens.fr> * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -36,7 +38,6 @@ * */ - /* * These are X and server generic header files. */ @@ -55,10 +56,49 @@ #include "vga.h" /* + * If the driver makes use of XF86Config 'Option' flags, the following will be + * required + */ +#define XCONFIG_FLAGS_ONLY +#include "xf86_Config.h" + +/* + * In many cases, this is sufficient for VGA16 support when VGA2 support is + * already done + */ + +#ifdef XF86VGA16 +#define MONOVGA +#endif + +/* + * This header is required for drivers that implement STUBFbInit(). + */ +#if !defined(MONOVGA) && !defined(XF86VGA16) +/*#include "vga256.h"*/ +#endif + +/* * Driver data structures. */ typedef struct { + /* + * This structure defines all of the register-level information + * that must be stored to define a video mode for this chipset. + * The 'vgaHWRec' member must be first, and contains all of the + * standard VGA register information, as well as saved text and + * font data. + */ vgaHWRec std; /* good old IBM VGA */ + /* + * Any other registers or other data that the new chipset needs + * to be saved should be defined here. The Init/Save/Restore + * functions will manipulate theses fields. Examples of things + * that would go here are registers that contain bank select + * registers, or extended clock select bits, or extensions to + * the timing registers. Use 'unsigned char' as the type for + * these registers. + */ unsigned char Port_3D6[128]; /* Chips & Technologies Registers */ } vgaCHIPSRec, *vgaCHIPSPtr; @@ -74,6 +114,10 @@ static Bool CHIPSInit(); static void * CHIPSSave(); static void CHIPSRestore(); static void CHIPSAdjust(); +#if 0 +static void CHIPSSaveScreen(); +static void CHIPSGetMode(); +#endif /* * These are the bank select functions. There are defined in chips_bank.s */ @@ -87,6 +131,9 @@ extern void CHIPSSetReadWrite(); * that defines how the driver operates. */ vgaVideoChipRec CHIPS = { + /* + * Function pointers + */ CHIPSProbe, CHIPSIdent, CHIPSEnterLeave, @@ -95,38 +142,118 @@ vgaVideoChipRec CHIPS = { CHIPSRestore, CHIPSAdjust, (void (*)())NoopDDA, /* CHIPSSaveScreen, */ - (void (*)())NoopDDA, - (void (*)())NoopDDA, + (void (*)())NoopDDA, /* CHIPSGetMode */ + (void (*)())NoopDDA, /* ChipsFbInit */ CHIPSSetRead, CHIPSSetWrite, CHIPSSetReadWrite, + /* + * This is the size of the mapped memory window, usually 64k. + */ 0x10000, + /* + * This is the size of a video memory bank for this chipset. + */ 0x08000, + /* + * This is the number of bits by which an address is shifted + * right to determine the bank number for that address. + */ 15, + /* + * This is the bitmask used to determine the address within a + * specific bank. + */ 0x7FFF, + /* + * These are the bottom and top addresses for reads inside a + * given bank. + */ 0x0000, 0x08000, + /* + * And corresponding limits for writes. + */ 0x08000, 0x10000, + /* + * Whether this chipset supports a single bank register or + * seperate read and write bank registers. Almost all chipsets + * support two banks, and two banks are almost always faster + * (Trident 8900C and 9000 are odd exceptions). + */ TRUE, + /* + * If the chipset requires vertical timing numbers to be divided + * by two for interlaced modes, set this to VGA_DIVIDE_VERT. + */ VGA_NO_DIVIDE_VERT, + /* + * This is a dummy initialization for the set of option flags + * that this driver supports. It gets filled in properly in the + * probe function, if the probe succeeds (assuming the driver + * supports any such flags). + */ {0,}, + /* + * This determines the multiple to which the virtual width of + * the display must be rounded for the 256-color server. This + * will normally be 8, but may be 4 or 16 for some servers. + */ 8, - FALSE, - 0, - 0, - FALSE, - FALSE, - NULL, - 1, + /* + * If the driver includes support for a linear-mapped frame buffer + * for the detected configuratio this should be set to TRUE in the + * Probe or FbInit function. In most cases it should be FALSE. + */ + FALSE, + /* + * This is the physical base address of the linear-mapped frame + * buffer (when used). Set it to 0 when not in use. + */ + 0, + /* + * This is the size of the linear-mapped frame buffer (when used). + * Set it to 0 when not in use. + */ + 0, + /* + * This is TRUE if the driver has support for 16bpp for the detected + * configuration. It must be set in the Probe function. + * It most cases it should be FALSE. + */ + FALSE, + /* + * This is TRUE if the driver has support for 32bpp for the detected + * configuration. + */ + FALSE, + /* + * This is a pointer to a list of builtin driver modes. + * This is rarely used, and in must cases, set it to NULL + */ + NULL, + /* + * This is a factor that can be used to scale the raw clocks + * to pixel clocks. This is rarely used, and in most cases, set + * it to 1. + */ + 1, }; -static unsigned CHIPS_IOPorts[] = {0x103, 0x3D6, 0x3D7, 0x46E8}; - /* * This is a convenience macro, so that entries in the driver structure * can simply be dereferenced with 'new->xxx'. */ #define new ((vgaCHIPSPtr)vgaNewVideoState) +/* + * If your chipset uses non-standard I/O ports, you need to define an + * array of ports, and an integer containing the array size. The + * generic VGA ports are defined in vgaHW.c. + */ +static unsigned CHIPS_ExtPorts[] = {0x46E8, 0x103, 0x3D6, 0x3D7 }; +static int Num_CHIPS_ExtPorts = + (sizeof(CHIPS_ExtPorts)/sizeof(CHIPS_ExtPorts[0])); + #define CT_451 0 #define CT_452 1 #define CT_453 2 @@ -135,20 +262,22 @@ static unsigned CHIPS_IOPorts[] = {0x103, 0x3D6, 0x3D7, 0x46E8}; #define CT_457 5 #define CT_520 6 #define CT_530 7 +#define CT_540 8 +#define CT_545 9 static unsigned char CHIPSchipset; /* * CHIPSIdent -- * - * Returns the string name for supported chipset 'n'. Most drivers only + * Returns the string name for supported chipset 'n'. Most drivers only * support one chipset, but multiple version may require that the driver - * identify them individually (e.g. the Trident driver). The Ident function - * should return a string if 'n' is valid, or NULL otherwise. The + * identify them individually (e.g. the Trident driver). The Ident function + * should return a string if 'n' is valid, or NULL otherwise. The * server will call this function when listing supported chipsets, with 'n' - * incrementing from 0, until the function returns NULL. The 'Probe' + * incrementing from 0, until the function returns NULL. The 'Probe' * function should call this function to get the string name for a chipset - * and when comparing against an Xconfig-supplied chipset value. This + * and when comparing against an XF86Config-supplied chipset value. This * cuts down on the number of places errors can creep in. */ static char * @@ -156,8 +285,11 @@ CHIPSIdent(n) int n; { static char *chipsets[] = { "ct451", "ct452", "ct453", "ct455", - "ct456", "ct457", "ct520", "ct530" }; - + "ct456", "ct457", "ct520", "ct530", + "ct540", "ct545" }; +#ifdef DEBUG + ErrorF("CHIPSIdent\n"); +#endif if (n + 1 > sizeof(chipsets) / sizeof(char *)) return(NULL); else @@ -172,6 +304,9 @@ int n; * VGA uses two bits in the Miscellaneous Output Register to select from * 4 clocks). Care must be taken to protect any other bits in these * registers by fetching their values and masking off the other bits. + * + * This function returns FALSE if the passed index is invalid or if the + * clock can't be set for some reason. */ static Bool CHIPSClockSelect(no) @@ -179,15 +314,25 @@ int no; { static unsigned char msr_save, fcr_save; unsigned char temp; - int fcr_clock=no-2; + int fcr_clock=no-4; +#ifdef DEBUG + ErrorF("CHIPSClockSelect\n"); +#endif switch(no) { case CLK_REG_SAVE: + /* + * Here all of the registers that can be affected by + * clock setting should be saved into static variables. + */ msr_save = inb(0x3CC); fcr_save = inb(0x3CA); break; case CLK_REG_RESTORE: + /* + * Here all the previously saved registers are restored. + */ outb(0x3C2, msr_save); outb(0x3DA, fcr_save); break; @@ -195,17 +340,18 @@ int no; /* set MSR */ /* if the requested clock is greater than 2, the other * register does the work */ - if (no>2) + if (no>=4) no=2; if (fcr_clock>3) return FALSE; temp = inb(0x3CC); - /* this also has to mask out the sync polarity bits */ - if (no>=2) + /* this also has to mask out the sync polarity bits: No! */ +/* if (no>=2) outb(0x3C2, ( temp & 0xF3) | ((no << 2) & 0x0C) | 0xE0); else - outb(0x3C2, ( temp & 0x73) | ((no << 2) & 0x0C)); + outb(0x3C2, ( temp & 0x73) | ((no << 2) & 0x0C)); */ + outb(0x3C2, ( temp & 0xF3) | ((no << 2) & 0x0C)); /* set FCR */ if (fcr_clock >= 0) { @@ -241,7 +387,7 @@ int no; * GVGA drivers for the special code that is needed. Note that the BIOS * base should not be assumed to be at 0xC0000 (although most are). Use * 'vga256InfoRec.BIOSbase', which will pick up any changes the user may - * have specified in the Xconfig file. + * have specified in the XF86Config file. * * The preferred mechanism for doing this is via register identification. * It is important not only the chipset is detected, but also to @@ -261,16 +407,19 @@ static Bool CHIPSProbe() { unsigned char temp; - unsigned ports[4]; + +#ifdef DEBUG + ErrorF("CHIPSProbe\n"); +#endif /* - * Set up I/O ports to be used by this card + * Set up I/O ports to be used by this card. Only do the second + * xf86AddIOPorts() if there are non-standard ports for this + * chipset. */ xf86ClearIOPortList(vga256InfoRec.scrnIndex); xf86AddIOPorts(vga256InfoRec.scrnIndex, Num_VGA_IOPorts, VGA_IOPorts); - xf86AddIOPorts(vga256InfoRec.scrnIndex, - sizeof(CHIPS_IOPorts) / sizeof(CHIPS_IOPorts[0]), - CHIPS_IOPorts); + xf86AddIOPorts(vga256InfoRec.scrnIndex,Num_CHIPS_ExtPorts,CHIPS_ExtPorts); /* * First we attempt to figure out if one of the supported chipsets @@ -278,6 +427,15 @@ CHIPSProbe() */ if (vga256InfoRec.chipset) { + /* + * This is the easy case. The user has specified the + * chipset in the XF86Config file. All we need to do here + * is a string comparison against each of the supported + * names available from the Ident() function. If this + * driver supports more than one chipset, there would be + * nested conditionals here (see the Trident and WD drivers + * for examples). + */ if (!StrCaseCmp(vga256InfoRec.chipset, CHIPSIdent(0))) { CHIPSchipset = CT_451; } else if (!StrCaseCmp(vga256InfoRec.chipset, CHIPSIdent(1))) { @@ -294,12 +452,33 @@ CHIPSProbe() CHIPSchipset = CT_520; } else if (!StrCaseCmp(vga256InfoRec.chipset, CHIPSIdent(7))) { CHIPSchipset = CT_530; + } else if (!StrCaseCmp(vga256InfoRec.chipset, CHIPSIdent(8))) { + CHIPSchipset = CT_540; + } else if (!StrCaseCmp(vga256InfoRec.chipset, CHIPSIdent(9))) { + CHIPSchipset = CT_545; } else { +/* ErrorF("bomb 0\n"); */ return (FALSE); } CHIPSEnterLeave(ENTER); } else { - CHIPSEnterLeave(ENTER); + /* + * OK. We have to actually test the hardware. The + * EnterLeave() function (described below) unlocks access + * to registers that may be locked, and for OSs that require + * it, enables I/O access. So we do this before we probe, + * even though we don't know for sure that this chipset + * is present. + */ + CHIPSEnterLeave(ENTER); + + /* + * Here is where all of the probing code should be placed. + * The best advice is to look at what the other drivers are + * doing. If you are lucky, the chipset reference will tell + * how to do this. Other resources include SuperProbe/vgadoc2, + * and the Ferraro book. + */ temp = rdinx(0x3D6,0x00); /* * Reading 0x103 causes segmentation violation, like 46E8 ??? @@ -308,28 +487,41 @@ CHIPSProbe() * Need to look at ioctl(console_fd, PCCONIOCMAPPORT, &ior) * for bsdi! */ - if (temp != 0xA5) { /* success set to CT_520 */ + CHIPSchipset = 99; + if (temp != 0xA5) { + if ((temp&0xF0)==0x70) + CHIPSchipset = CT_520; if ((temp&0xF0)==0x80) CHIPSchipset = CT_530; - else - CHIPSchipset = CT_520; - } else { /* failure, if no good, then leave */ + if ((temp&0xF8)==0xD0) + CHIPSchipset = CT_540; + if ((temp&0xF8)==0xD8) + CHIPSchipset = CT_545; + }; + if (CHIPSchipset==99) + { /* failure, if no good, then leave */ + /* + * Turn things back off if the probe is going to fail. + * Returning FALSE implies failure, and the server + * will go on to the next driver. + */ CHIPSEnterLeave(LEAVE); +#ifdef DEBUG ErrorF("Bombing out!\n"); +#endif return(FALSE); - } + } } - /* configuration information */ outb(0x3D6,0x01); temp = inb(0x3D7); #ifdef DEBUG - ErrorF("configuration byte = %X\n",temp); + ErrorF("configuration register = %X\n",temp); #endif /* - * If the user has specified the amount of memory in the Xconfig + * If the user has specified the amount of memory in the XF86Config * file, we respect that setting. */ if (!vga256InfoRec.videoRam) @@ -341,7 +533,20 @@ CHIPSProbe() */ outb(0x3D6,0x04); temp = inb(0x3D7); - switch (temp&3) + if (CHIPSchipset==CT_540 ||CHIPSchipset==CT_545) + switch (temp&3) + { case 0 : + vga256InfoRec.videoRam = 1024; + break; + case 1 : + vga256InfoRec.videoRam = 512; + break; + case 2 : + vga256InfoRec.videoRam = 1024; + break; + } + else + switch (temp&3) { case 0 : vga256InfoRec.videoRam = 256; break; @@ -355,7 +560,7 @@ CHIPSProbe() } /* - * Again, if the user has specified the clock values in the Xconfig + * Again, if the user has specified the clock values in the XF86Config * file, we respect those choices. */ if (!vga256InfoRec.clocks) @@ -365,11 +570,19 @@ CHIPSProbe() * It is passed the number of supported clocks, and a * pointer to the clock-select function. */ - /* MH - just playing */ - vgaGetClocks(4, CHIPSClockSelect); - /* vgaGetClocks(6, CHIPSClockSelect); */ + + vgaGetClocks(8, CHIPSClockSelect); } + /* + * It is recommended that you fill in the maximum allowable dot-clock + * rate for your chipset. If you don't do this, the default of + * 90MHz will be used; this is likely too high for many chipsets. + * This is specified in KHz, so 90Mhz would be 90000 for this + * setting. + */ + vga256InfoRec.maxClock = 65000; + /* * Last we fill in the remaining data structures. We specify * the chipset name, using the Ident() function and an appropriate @@ -379,6 +592,7 @@ CHIPSProbe() */ vga256InfoRec.chipset = CHIPSIdent(CHIPSchipset); vga256InfoRec.bankedMono = FALSE; +/* OFLG_SET(OPTION_FLG1, &CHIPS.ChipOptionFlags); */ return(TRUE); } @@ -399,10 +613,13 @@ Bool enter; { unsigned char temp; +#ifdef DEBUG + ErrorF("CHIPSEnterLeave\n"); +#endif + if (enter) { - - xf86EnableIOPorts(vga256InfoRec.scrnIndex); + xf86EnableIOPorts(vga256InfoRec.scrnIndex); /* * This is a global. The CRTC base address depends on @@ -441,7 +658,7 @@ Bool enter; outb(vgaIOBase + 4, 0x11); temp = inb(vgaIOBase + 5); outb(vgaIOBase + 5, (temp & 0x7F) | 0x80); - xf86DisableIOPorts(vga256InfoRec.scrnIndex); + xf86DisableIOPorts(vga256InfoRec.scrnIndex); } } @@ -461,7 +678,11 @@ CHIPSRestore(restore) vgaCHIPSPtr restore; { int i; - + +#ifdef DEBUG + ErrorF("CHIPSRestore\n"); +#endif + /* * Whatever code is needed to get things back to bank zero should be * placed here. Things should be in the same state as when the @@ -490,12 +711,9 @@ vgaCHIPSPtr restore; */ for (i=0; i<0x80; i++) { - if ((i>=0x30) && (i<0x50)) - continue; outb(0x3D6, i); outb(0x3D7, restore->Port_3D6[i]); - /* debug */ #ifdef DEBUG ErrorF("XR%X - %X\n",i,restore->Port_3D6[i]); #endif @@ -511,10 +729,8 @@ vgaCHIPSPtr restore; /* debug - dump out all the extended registers... */ #ifdef DEBUG for (i=0; i<0x80; i++) { - if ((i>=0x30) && (i<0x50)) - continue; outb(0x3D6, i); - ErrorF("XR%X - %X\n",i,inb(0x3D7)); + ErrorF"XR%X - %X\n",i,inb(0x3D7)); } #endif @@ -532,7 +748,11 @@ static void * CHIPSSave(save) vgaCHIPSPtr save; { - int i; + int i; + +#ifdef DEBUG + ErrorF("CHIPSSave\n"); +#endif /* * Whatever code is needed to get back to bank zero goes here. @@ -552,8 +772,6 @@ vgaCHIPSPtr save; * into the fields of the vgaCHIPSRec structure goes here. */ for (i=0; i<0x80; i++) { - if ((i>=0x30) && (i<0x50)) - continue; outb(0x3D6, i); save->Port_3D6[i] = inb(0x3D7); } @@ -581,6 +799,10 @@ DisplayModePtr mode; unsigned char tmp; int i; +#ifdef DEBUG + ErrorF("CHIPSInit\n"); +#endif + /* * This will allocate the datastructure and initialize all of the * generic VGA registers. @@ -591,6 +813,19 @@ DisplayModePtr mode; return(FALSE); } + /* + * Here all of the other fields of 'new' get filled in, to + * handle the SVGA extended registers. It is also allowable + * to override generic registers whenever necessary. + * + * A special case - when using an external clock-setting program, + * this function must not change bits associated with the clock + * selection. This condition can be checked by the condition: + * + * if (new->std.NoClock >= 0) + * initialize clock-select bits. + */ + new->std.Attribute[0x10] = 0x01; /* mode */ new->std.Attribute[0x11] = 0x00; /* overscan (border) color */ new->std.Attribute[0x12] = 0x0F; /* enable all color planes */ @@ -609,29 +844,26 @@ DisplayModePtr mode; * C&T Specific Registers */ for (i=0; i<0x80; i++) { - if ((i>=0x30) && (i<0x50)) - continue; outb(0x3D6, i); new->Port_3D6[i] = inb(0x3D7); } -/* new->Port_3D6[0x04]|= 12; */ - new->Port_3D6[0x04] = 0xAD; - new->Port_3D6[0x0B] = 0x07; /* dual pages enabled */ + new->Port_3D6[0x04]|= 4; /* enable addr counter bits 16-17 */ +/* new->Port_3D6[0x04] = 0xAD; */ + new->Port_3D6[0x0B] = 0x07; /* extended mode, dual pages enabled */ new->Port_3D6[0x10] = 0; new->Port_3D6[0x11] = 0; -/* new->Port_3D6[0x28]|= 0x10; */ - new->Port_3D6[0x28] = 0x10; + new->Port_3D6[0x28] = 0x12; /* 256-color video */ /* new->Port_3D6[0x2D] = 0x58; */ /* new->Port_3D6[0x2E] = 0x58; */ /* new->Port_3D6[0x55] = 0xE4; */ /* new->Port_3D6[0x57] = 0x07; */ /* MH - new ones */ - new->Port_3D6[0x0F] = 0x11; - new->Port_3D6[0x63] = 0x41; - new->Port_3D6[0x6C] = 0x00; - new->Port_3D6[0x70] = 0x80; +/* new->Port_3D6[0x0F] = 0x11; */ +/* new->Port_3D6[0x63] = 0x41; */ +/* new->Port_3D6[0x6C] = 0x00; */ +/* new->Port_3D6[0x70] = 0x80; */ return(TRUE); } @@ -680,6 +912,10 @@ int x, y; /* int Base = (y * vga256InfoRec.virtualX + x) >> 3; */ int Base = (y * vga256InfoRec.virtualX + x) >> 2; +#ifdef DEBUG + ErrorF("CHIPSAdjust\n"); +#endif + /* * These are the generic starting address registers. */ @@ -697,4 +933,109 @@ int x, y; } +/* + * CHIPSSaveScreen -- + * + * This function gets called before and after a synchronous reset is + * performed on the SVGA chipset during a mode-changing operation. Some + * chipsets will reset registers that should not be changed during this. + * If your function is one of these, then you can use this function to + * save and restore the registers. + * + * Most chipsets do not require this function, and instead put + * '(void (*)())NoopDDA' in the vgaVideoChipRec structure (NoopDDA is an + * empty function for generic use). + */ +#if 0 +static void +STUBSaveScreen(mode) +int mode; +{ + if (mode == SS_START) + { + /* + * Save an registers that will be destroyed by the reset + * into static variables. + */ + } + else + { + /* + * Now restore those registers. + */ + } +} +#endif + +/* + * CHIPSGetMode -- + * + * This function will read the current SVGA register settings and produce + * a filled-in DisplayModeRec containing the current mode. + * + * Note that the is function is NOT used in XFree86 1.3, hence in a real + * driver you should put 'NoopDDA' in the vgaVideoChipRec structure. At + * some point in the future, this function will be used to implement + * interactive mode setting, and drivers will be required to supply it. + */ +#if 0 +static void +CHIPSGetMode(mode) +DisplayModePtr mode; +{ +#ifdef DEBUG + fprintf(stderr,"CHIPSGetMode\n"); +#endif + + /* + * Fill in the 'mode' stucture based on current register settings. + */ +} +#endif + +/* + * CHIPSFbInit -- + * + * This function is used to initialise chip-specific graphics functions. + * It can be used to make use of the accelerated features of some chipsets. + * For most drivers, this function is not required, and 'NoopDDA' is put + * in the vgaVideoChipRec structure. + */ +#if 0 +static void +CHIPSFbInit() +{ + + /* + * Fill in the fields of cfbLowlevFuncs for which there are + * accelerated versions. This struct is defined in + * xc/programs/Xserver/hw/xfree86/vga256/cfb.banked/cfbfuncs.h. + */ + cfbLowlevFuncs.fillRectSolidCopy = CHIPSFillRectSolidCopy; + cfbLowlevFuncs.doBitbltCopy = CHIPSDoBitbltCopy; + + /* + * Some functions (eg, line drawing) are initialised via the + * cfbTEOps, cfbTEOps1Rect, cfbNonTEOps, cfbNonTEOps1Rect + * structs as well as in cfbLowlevFuncs. These are of type + * 'struct GCFuncs' which is defined in mit/server/include/gcstruct.h. + */ + cfbLowlevFuncs.lineSS = CHIPSLineSS; + cfbTEOps1Rect.Polylines = CHIPSLineSS; + cfbTEOps.Polylines = CHIPSLineSS; + cfbNonTEOps1Rect.Polylines = CHIPSLineSS; + cfbNonTEOps.Polylines = CHIPSLineSS; + + /* + * If hardware cursor is supported, the vgaHWCursor struct should + * be filled in here. + */ + vgaHWCursor.Initialized = TRUE; + vgaHWCursor.Init = CHIPSCursorInit; + vgaHWCursor.Restore = CHIPSCursorRestore; + vgaHWCursor.Warp = CHIPSCursorWarp; + vgaHWCursor.QueryBestSize = CHIPSQueryBestSize; + +} +#endif diff --git a/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/Imakefile b/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/Imakefile index 1c6200d61..506dd273d 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/Imakefile @@ -1,18 +1,20 @@ -XCOMM $XConsortium: Imakefile,v 1.2 94/10/13 13:21:46 kaleb Exp kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/Imakefile,v 3.6 1994/10/30 05:00:03 dawes Exp $ +XCOMM $XConsortium: Imakefile,v 1.3 95/01/05 20:47:57 kaleb Exp kaleb $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/Imakefile,v 3.7 1994/12/25 12:34:44 dawes Exp $ #include <Server.tmpl> SRCS = cir_driver.c cir_fill.c cir_blt.c cir_bltC.c cir_im.c cir_bank.s \ cir_imblt.s cir_colexp.c cir_fillst.c cir_teblt8.c \ cir_fillrct.c cir_blitter.c cir_textblt.s cir_cursor.c \ cir_blitmm.c cir_immm.c cir_tebltmm.c cir_span.s cir_alloc.c \ - cir_blt16.c + cir_blt16.c cir_solid.c cir_line.c cir_seg.c cir_orect.c \ + cir_orect16.c cir_orect32.c linearline.c OBJS = cir_driver.o cir_fill.o cir_blt.o cir_bltC.o cir_im.o cir_bank.o \ cir_imblt.o cir_colexp.o cir_fillst.o cir_teblt8.o \ cir_fillrct.o cir_blitter.o cir_textblt.o cir_cursor.o \ cir_blitmm.o cir_immm.o cir_tebltmm.o cir_span.o cir_alloc.o \ - cir_blt16.o + cir_blt16.o cir_solid.o cir_line.o cir_seg.o cir_orect.o \ + cir_orect16.o cir_orect32.o linearline.o DEFINES = -DPSZ=8 @@ -33,6 +35,9 @@ NormalRelocatableTarget(cir_drv, $(OBJS)) ObjectFromSpecialSource(cir_blitmm, cir_blitter, -DCIRRUS_MMIO) ObjectFromSpecialSource(cir_immm, cir_im, -DCIRRUS_MMIO) ObjectFromSpecialSource(cir_tebltmm, cir_teblt8, -DCIRRUS_MMIO) +ObjectFromSpecialSource(cir_seg, cir_line, -DPOLYSEGMENT) +ObjectFromSpecialSource(cir_orect16, cir_orect, -DPSZ=16) +ObjectFromSpecialSource(cir_orect32, cir_orect, -DPSZ=32) InstallLinkKitNonExecFile(cir_driver.c,$(LINKKITDIR)/drivers/vga256/cirrus) InstallLinkKitNonExecFile(cir_driver.h,$(LINKKITDIR)/drivers/vga256/cirrus) @@ -46,17 +51,22 @@ InstallLinkKitNonExecFile(cir_textblt.s,$(LINKKITDIR)/drivers/vga256/cirrus) InstallLinkKitNonExecFile(cir_span.s,$(LINKKITDIR)/drivers/vga256/cirrus) InstallLinkKitNonExecFile(cir_colexp.c,$(LINKKITDIR)/drivers/vga256/cirrus) InstallLinkKitNonExecFile(cir_fillst.c,$(LINKKITDIR)/drivers/vga256/cirrus) +InstallLinkKitNonExecFile(cir_solid.c,$(LINKKITDIR)/drivers/vga256/cirrus) InstallLinkKitNonExecFile(cir_teblt8.c,$(LINKKITDIR)/drivers/vga256/cirrus) InstallLinkKitNonExecFile(cir_fillrct.c,$(LINKKITDIR)/drivers/vga256/cirrus) InstallLinkKitNonExecFile(cir_cursor.c,$(LINKKITDIR)/drivers/vga256/cirrus) InstallLinkKitNonExecFile(cir_blitter.c,$(LINKKITDIR)/drivers/vga256/cirrus) InstallLinkKitNonExecFile(cir_alloc.c,$(LINKKITDIR)/drivers/vga256/cirrus) InstallLinkKitNonExecFile(cir_blt16.c,$(LINKKITDIR)/drivers/vga256/cirrus) +InstallLinkKitNonExecFile(cir_line.c,$(LINKKITDIR)/drivers/vga256/cirrus) +InstallLinkKitNonExecFile(cir_orect.c,$(LINKKITDIR)/drivers/vga256/cirrus) InstallLinkKitNonExecFile(cir_blitter.h,$(LINKKITDIR)/drivers/vga256/cirrus) InstallLinkKitNonExecFile(cir_span.h,$(LINKKITDIR)/drivers/vga256/cirrus) InstallLinkKitNonExecFile(cir_alloc.h,$(LINKKITDIR)/drivers/vga256/cirrus) InstallLinkKitNonExecFile(cir_blitmm.h,$(LINKKITDIR)/drivers/vga256/cirrus) InstallLinkKitNonExecFile(cir_inline.h,$(LINKKITDIR)/drivers/vga256/cirrus) InstallLinkKitNonExecFile(Imakefile,$(LINKKITDIR)/drivers/vga256/cirrus) +InstallLinkKitNonExecFile(linearline.c,$(LINKKITDIR)/drivers/vga256/cirrus) +InstallLinkKitNonExecFile(linearline.h,$(LINKKITDIR)/drivers/vga256/cirrus) DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_blitter.c b/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_blitter.c index d32f84979..03dfe1188 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_blitter.c +++ b/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_blitter.c @@ -1,5 +1,5 @@ -/* $XConsortium: cir_blitter.c,v 1.1 94/10/05 13:52:22 kaleb Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_blitter.c,v 3.4 1994/08/31 04:44:16 dawes Exp $ */ +/* $XConsortium: cir_blitter.c,v 1.2 94/10/13 13:21:46 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_blitter.c,v 3.6 1995/01/04 04:42:17 dawes Exp $ */ /* * * Copyright 1994 by H. Hanemaayer, Utrecht, The Netherlands @@ -75,10 +75,10 @@ int cirrus_rop[16] = { }; /* - * The BLT functions defined in this file support exiting without waiting - * for the BLT to finish. The calling function must set - * cirrusDoBackgroundBLT, call any BLT functions defined in this file, - * and when the operations are done check whether a BLT is still in + * Some of the BLT functions defined in this file support exiting without + * waiting for the BLT to finish. The calling function must set + * cirrusDoBackgroundBLT, call the BLT functions, and when the + * operations are done check whether a BLT is still in * progress (cirrusBLTisBusy) and if so call WAITUNTILFINISHED(). * If the function does any other video memory access or BLT functions * not defined in this file, it must make sure no BLT is in progress @@ -172,8 +172,8 @@ fillWidth, fillHeight, dstPitch, rop, patternword1, patternword2) int i; pointer pDst; - if (!HAVE543X() && fillHeight > 1024) { - /* Split into two for 5426, 5428 & 5429. */ + if (fillHeight > 1024) { + /* Split into two for 542x/5430/4. */ _CirrusBLTColorExpand8x8PatternFill(dstAddr, fgcolor, bgcolor, fillWidth, 1024, dstPitch, rop, patternword1, patternword2); _CirrusBLTColorExpand8x8PatternFill(dstAddr + dstPitch * 1024, @@ -236,244 +236,6 @@ fillWidth, fillHeight, dstPitch, rop, patternword1, patternword2) /* - * 8x8 pattern fill. - * - * Regular 8x8 byte-per-pixel pattern. - * - */ - -#ifdef CIRRUS_MMIO -#define _CirrusBLT8x8PatternFill CirrusMMIOBLT8x8PatternFill -#else -#define _CirrusBLT8x8PatternFill CirrusBLT8x8PatternFill -#endif - -void _CirrusBLT8x8PatternFill(dstAddr, w, h, pattern, destpitch, rop) - unsigned int dstAddr; - int w, h, destpitch; - int rop; - void *pattern; -{ - unsigned int srcAddr; - int i; - pointer pDst; - - if (!HAVE543X() && h > 1024) { - /* Split into two for 5426, 5428, & 5429. */ - _CirrusBLT8x8PatternFill(dstAddr, w, 1024, pattern, destpitch, rop); - _CirrusBLT8x8PatternFill(dstAddr + destpitch * 1024, w, h - 1024, - pattern, destpitch, rop); - return; - } - - if (cirrusBLTisBusy) - WAITUNTILFINISHED(); - - /* Pattern fill with video memory source. */ - - /* Write 64 byte pattern. */ - /* Because of 16K bank granularity and 32K window, we don't have to */ - /* check for bank boundaries. */ - srcAddr = cirrusBLTPatternAddress; - CIRRUSSETWRITE(srcAddr); - memcpy(CIRRUSWRITEBASE() + srcAddr, pattern, 64); - - SETDESTADDR(dstAddr); - SETSRCADDR(cirrusBLTPatternAddress); - SETDESTPITCH(destpitch); - SETWIDTH(w); - SETHEIGHT(h); - - /* 8x8 Pattern Copy, screen to screen blt, forwards. */ - SETBLTMODE(PATTERNCOPY); - SETROP(rop); - - /* Do it. */ - STARTBLT(); - - if (cirrusDoBackgroundBLT) - cirrusBLTisBusy = TRUE; - else - WAITUNTILFINISHED(); - -#ifdef CIRRUS_MMIO - cirrusMMIOFlag = TRUE; -#endif -} - - -/* - * 16x16 pattern fill. - * - * Uses two 16x8 byte-per-pixel pattern fills (meant for 8x8 16-bit pixel - * fill), vertically interleaved. - * - */ - -#ifdef CIRRUS_MMIO -#define _CirrusBLT16x16PatternFill CirrusMMIOBLT16x16PatternFill -#else -#define _CirrusBLT16x16PatternFill CirrusBLT16x16PatternFill -#endif - -void _CirrusBLT16x16PatternFill(dstAddr, w, h, pattern, destpitch, rop) - unsigned int dstAddr; - int w, h, destpitch; - int rop; - unsigned char *pattern; -{ - unsigned int srcAddr; - int i; - pointer pDst; - int blith, blitpitch; - - if (!HAVE543X() && h > 1024) { - /* Split into two for 5426, 5428 & 5429. */ - _CirrusBLT16x16PatternFill(dstAddr, w, 1024, pattern, destpitch, rop); - _CirrusBLT16x16PatternFill(dstAddr + destpitch * 1024, w, h - 1024, - pattern, destpitch, rop); - return; - } - - if (cirrusBLTisBusy) - WAITUNTILFINISHED(); - - /* Pattern fill with video memory source. */ - - /* Write 128 byte pattern (even lines). */ - /* Because of 16K bank granularity and 32K window, we don't have to */ - /* check for bank boundaries. */ - srcAddr = cirrusBLTPatternAddress; - CIRRUSSETWRITE(srcAddr); - for (i = 0; i < 8; i++) - memcpy(CIRRUSWRITEBASE() + srcAddr + i * 16, - pattern + i * 32, 16); - - blitpitch = destpitch * 2; - blith = (h / 2) + (h & 1); - - SETDESTADDR(dstAddr); - SETSRCADDR(cirrusBLTPatternAddress); - SETDESTPITCH(blitpitch); - SETWIDTH(w); - SETHEIGHT(blith); - - /* 8x8 Pattern Copy, 16-bit pixels, screen to screen blt, forwards. */ - SETBLTMODE(PATTERNCOPY | PIXELWIDTH16); - SETROP(rop); - - /* Do it. */ - STARTBLT(); - - WAITUNTILFINISHED(); - - /* Now do uneven lines. */ - /* Write pattern. */ - for (i = 0; i < 8; i++) - memcpy(CIRRUSWRITEBASE() + srcAddr + i * 16, - pattern + i * 32 + 16, 16); - - dstAddr += destpitch; -/* blitpitch = destpitch * 2; */ - blith = (h / 2); - - SETDESTADDR(dstAddr); - SETSRCADDR(cirrusBLTPatternAddress); -/* SETDESTPITCH(blitpitch); */ - SETWIDTH(w); - SETHEIGHT(blith); - - /* 8x8 Pattern Copy, 16-bit pixels, screen to screen blt, forwards. */ -/* SETBLTMODE(PATTERNCOPY | PIXELWIDTH); */ -/* SETROP(rop); */ - - STARTBLT(); - - if (cirrusDoBackgroundBLT) - cirrusBLTisBusy = TRUE; - else - WAITUNTILFINISHED(); - -#ifdef CIRRUS_MMIO - cirrusMMIOFlag = TRUE; -#endif -} - -/* - * 32x32 pattern fill for 5434. - * - * Uses four 32x8 byte-per-pixel pattern fills (meant for 8x8 32-bit pixel - * fill), vertically interleaved. - * This is untested. - * - * Something like this would also work on the 5426/28 (by filling vertical - * bands 16 pixels wide, 4-way interleaved) if the virtual screen width is - * less than 1024 (i.e. rarely). - */ - -#ifdef CIRRUS_MMIO -#define _CirrusBLT32x32PatternFill CirrusMMIOBLT32x32PatternFill -#else -#define _CirrusBLT32x32PatternFill CirrusBLT32x32PatternFill -#endif - -void _CirrusBLT32x32PatternFill(dstAddr, w, h, pattern, destpitch, rop) - unsigned int dstAddr; - int w, h, destpitch; - int rop; - void *pattern; -{ - unsigned int srcAddr; - int i, k; - int blith, blitpitch; - - if (cirrusBLTisBusy) - WAITUNTILFINISHED(); - - /* No need to split into two for 5434 (handles heights up to 2048). */ - - /* Pattern fill with video memory source. */ - - /* Set up write bank for writing pattern. */ - srcAddr = cirrusBLTPatternAddress; - CIRRUSSETWRITE(srcAddr); - - /* Set up BLT parameters that remain constant. */ - blitpitch = destpitch * 4; /* Four-way interleaving. */ - SETDESTPITCH(blitpitch); - /* 8x8 Pattern Copy, 32-bit pixels, screen to screen blt, forwards. */ - SETBLTMODE(PATTERNCOPY | PIXELWIDTH32); - SETROP(rop); - - for (k = 0; k < 4; k++) { - /* Do the lines for which [index % 4 == k]. */ - /* Write 32x8 pattern. */ - for (i = 0; i < 8; i++) - memcpy(CIRRUSWRITEBASE() + srcAddr + i * 32, - (unsigned char *)pattern + i * 32 * 4 + 32 * k, 32); - blith = h / 4; - if (h & 3 > k) - blith++; - SETDESTADDR(dstAddr); - SETSRCADDR(cirrusBLTPatternAddress); - SETWIDTH(w); - SETHEIGHT(blith); - STARTBLT(); - if (k != 3 || !cirrusDoBackgroundBLT) - WAITUNTILFINISHED(); - else - cirrusBLTisBusy = TRUE; - - dstAddr += destpitch; - } - -#ifdef CIRRUS_MMIO - cirrusMMIOFlag = TRUE; -#endif -} - - -/* * BitBLT. Direction can be forwards or backwards. Can be modified to * support special rops. */ @@ -490,7 +252,7 @@ void _CirrusBLTBitBlt(dstAddr, srcAddr, dstPitch, srcPitch, w, h, dir) int w, h; int dir; /* >0, increase adrresses, <0, decrease */ { - if ((!HAVE543X()) && h > 1024) { + if (h > 1024) { /* Split into two. */ if (dir > 0) { _CirrusBLTBitBlt(dstAddr, srcAddr, dstPitch, srcPitch, w, 1024, dir); @@ -546,8 +308,8 @@ fillHeight, dstPitch) { int size, i; - if (!HAVE543X() && fillHeight > 1024) { - /* Split into two for 5426, 5428 & 5429. */ + if (fillHeight > 1024) { + /* Split into two for 542x/30/34. */ CirrusBLTColorExpandImageWriteFill(dstAddr, fgcolor, fillWidth, 1024, dstPitch); CirrusBLTColorExpandImageWriteFill(dstAddr + dstPitch * 1024, fgcolor, @@ -626,3 +388,312 @@ void _CirrusBLTWaitUntilFinished() { } } } + + +/* + * This function performs a 8x8 tile fill with the BitBLT engine. + */ + +#ifdef CIRRUS_MMIO +#define _CirrusBLT8x8PatternFill CirrusMMIOBLT8x8PatternFill +#else +#define _CirrusBLT8x8PatternFill CirrusBLT8x8PatternFill +#endif + +void _CirrusBLT8x8PatternFill(destaddr, w, h, pattern, patternpitch, +destpitch, rop) + unsigned int destaddr; + int w, h; + unsigned char *pattern; + int patternpitch; + int destpitch, rop; +{ + unsigned char *base; + int srcaddr, busy, i; + + if (h > 1024) { + /* Split into two for 542x/30/34 */ + _CirrusBLT8x8PatternFill(destaddr, w, 1024, pattern, patternpitch, + destpitch, rop); + /* Vertical alignment is correct since 1024 is a multiple of 8. */ + _CirrusBLT8x8PatternFill(destaddr + destpitch * 1024, w, h - 1024, + pattern, patternpitch, destpitch, rop); + return; + } + + srcaddr = cirrusBLTPatternAddress; + CIRRUSSETWRITE(srcaddr); + base = CIRRUSWRITEBASE(); + + if (patternpitch == 8) + memcpy(base + srcaddr, pattern, 64); + else + for (i = 0; i < 8; i++) + memcpy(base + srcaddr + i * 8, (unsigned char *)pattern + + patternpitch * i, 8); + + /* Set up the BitBLT parameters. */ + SETROP(rop); + SETSRCADDR(cirrusBLTPatternAddress); + SETDESTPITCH(destpitch); + SETBLTMODE(PATTERNCOPY); + SETDESTADDR(destaddr); + SETWIDTH(w); + SETHEIGHT(h); + STARTBLT(); + + do { BLTBUSY(busy); } while (busy); + SETFOREGROUNDCOLOR(0); /* Restore VGA Set/Reset register. */ +} + + +/* + * This function performs a 16x16 tile fill with the BitBLT engine, + * using two 16x8 pattern fills, vertically interleaved. + */ + +#ifdef CIRRUS_MMIO +#define _CirrusBLT16x16PatternFill CirrusMMIOBLT16x16PatternFill +#else +#define _CirrusBLT16x16PatternFill CirrusBLT16x16PatternFill +#endif + +void _CirrusBLT16x16PatternFill(destaddr, w, h, pattern, patternpitch, +destpitch, rop) + unsigned int destaddr; + int w, h; + unsigned char *pattern; + int patternpitch; + int destpitch, rop; +{ + unsigned char *base; + int srcaddr, busy, k, i; + + if (h > 1024) { + /* Split into two for 542x/30/34. */ + _CirrusBLT16x16PatternFill(destaddr, w, 1024, pattern, patternpitch, + destpitch, rop); + /* Vertical alignment is correct since 1024 is a multiple of 16. */ + _CirrusBLT16x16PatternFill(destaddr + destpitch * 1024, w, h - 1024, + pattern, patternpitch, destpitch, rop); + return; + } + + srcaddr = cirrusBLTPatternAddress; + CIRRUSSETWRITE(srcaddr); + base = CIRRUSWRITEBASE(); + + /* Set up the invariant BitBLT parameters. */ + SETROP(rop); + SETDESTPITCH(destpitch * 2); /* Two-way interleaving. */ + SETBLTMODE(PATTERNCOPY | PIXELWIDTH16); + + for (k = 0; k < 2; k++) { + /* Do the lines for which [index % 2 == k]. */ + int blitheight; + int width_left; + int i; + + blitheight = h / 2; + if ((h & 1) > k) + blitheight++; + + do { BLTBUSY(busy); } while (busy); + for (i = 0; i < 8; i++) + memcpy(base + srcaddr + i * 16, (unsigned char *)pattern + + patternpitch * (i * 2 + k), 16); + SETDESTADDR(destaddr); + SETSRCADDR(cirrusBLTPatternAddress); + SETWIDTH(w); + SETHEIGHT(blitheight); + STARTBLT(); + + destaddr += destpitch; + } + + do { BLTBUSY(busy); } while (busy); + SETFOREGROUNDCOLOR(0); /* Restore VGA Set/Reset register. */ +} + + +/* + * This function performs a 32x32 tile fill with the BitBLT engine, + * using multiple 16x8 pattern fills in vertical bands, and four-way + * vertically interleaved. For a 256x256 area, it performs 16 * 4 = 64 + * individual BitBLT fills. + * As an extra optimization, it combines the vertical bands if the + * left part of a set of tile lines is identical to the right part. + * This is always possible on chips that support 32x8 tile fill. + */ + +#ifdef CIRRUS_MMIO +#define _CirrusBLT32x32PatternFill CirrusMMIOBLT32x32PatternFill +#else +#define _CirrusBLT32x32PatternFill CirrusBLT32x32PatternFill +#endif + +void _CirrusBLT32x32PatternFill(destaddr, w, h, pattern, patternpitch, +destpitch, rop) + unsigned int destaddr; + int w, h; + unsigned char *pattern; + int patternpitch; + int destpitch, rop; +{ + unsigned char *base; + int srcaddr, saved_destaddr, x, busy, k, chip_supports_32byte_fill; + + if (h > 1024) { + /* Split into two for 542x/30/34. */ + _CirrusBLT32x32PatternFill(destaddr, w, 1024, pattern, patternpitch, + destpitch, rop); + /* Vertical alignment is correct since 1024 is a multiple of 16. */ + _CirrusBLT32x32PatternFill(destaddr + destpitch * 1024, w, h - 1024, + pattern, patternpitch, destpitch, rop); + return; + } + + chip_supports_32byte_fill = 0; + + /* + * We need at most two 16 * 32 fill areas at the same time, so the + * preallocated 256 byte pattern space at cirrusBLTPatternAddress is + * sufficient. + */ + srcaddr = cirrusBLTPatternAddress; + CIRRUSSETWRITE(srcaddr); + base = CIRRUSWRITEBASE(); + + /* Set up the invariant BitBLT parameters. */ + SETROP(rop); + SETDESTPITCH(destpitch * 4); /* Four-way interleaving. */ + if (chip_supports_32byte_fill) + SETBLTMODE(PATTERNCOPY | PIXELWIDTH32) + else + SETBLTMODE(PATTERNCOPY | PIXELWIDTH16); + + saved_destaddr = destaddr; + + for (k = 0; k < 4; k++) { + /* Do the lines for which [index % 4 == k]. */ + int blitheight; + int width_left; + int i, halves_identical; + + blitheight = h / 4; + if ((h & 3) > k) + blitheight++; + + /* + * On chips for which 32-byte wide pattern fill is not broken, + * this code can be used. + */ + if (chip_supports_32byte_fill) { + do { BLTBUSY(busy); } while (busy); + for (i = 0; i < 8; i++) + memcpy(base + srcaddr + i * 32, (unsigned char *)pattern + + patternpitch * (i * 4 + k), 32); + SETDESTADDR(destaddr); + SETSRCADDR(cirrusBLTPatternAddress); + SETWIDTH(w); + SETHEIGHT(blitheight); + STARTBLT(); + goto k_finished; + } + + /* + * Create two 16x8 patterns; one for the left half and one for + * the right half of the 32-byte wide pattern. We take the + * pattern lines for which [index % 4 == k]. + */ + + /* + * First check for the special case: left half of each 32-byte wide + * tile line is identical to right half. + */ + halves_identical = 1; + for (i = 0; i < 8; i++) { + int *p; + p = (int *)((unsigned char *)pattern + patternpitch * (i * 4 + k)); + if (p[0] != p[4] || p[1] != p[5] || p[2] != p[6] || p[3] != p[7]) { + halves_identical = 0; + break; + } + } + + do { BLTBUSY(busy); } while (busy); + + for (i = 0; i < 8; i++) { + /* + * It helps if this gets expanded into unrolled inline + * loads/stores. gcc -O2 does this. + */ + memcpy(base + srcaddr + i * 16, + pattern + patternpitch * (i * 4 + k), 16); + if (!halves_identical) + memcpy(base + srcaddr + i * 16 + 128, + pattern + patternpitch * (i * 4 + k) + 16, 16); + } + + if (halves_identical) { + /* + * Shortcut, no bands necessary. + * Fill over the whole horizontal span with one BitBLT. + */ + SETDESTADDR(destaddr); + SETSRCADDR(cirrusBLTPatternAddress); + SETWIDTH(w); + SETHEIGHT(blitheight); + STARTBLT(); + goto k_finished; + } + + /* + * Draw 16x8 patterns from the left to the right, alternating between + * the two source patterns. + */ + width_left = w; + for (;;) { + if (width_left == 0) + break; + do { BLTBUSY(busy); } while (busy); + SETDESTADDR(destaddr); + SETSRCADDR(cirrusBLTPatternAddress); + if (width_left >= 16) { + SETWIDTH(16); + width_left -= 16; + } + else { + SETWIDTH(width_left); + width_left = 0; + } + SETHEIGHT(blitheight); + STARTBLT(); + destaddr += 16; + + if (width_left == 0) + break; + do { BLTBUSY(busy); } while (busy); + SETDESTADDR(destaddr); + SETSRCADDR(cirrusBLTPatternAddress + 128); + if (width_left >= 16) { + SETWIDTH(16); + width_left -= 16; + } + else { + SETWIDTH(width_left); + width_left = 0; + } +/* SETHEIGHT(blitheight); */ + STARTBLT(); + destaddr += 16; + } + +k_finished: + saved_destaddr += destpitch; + destaddr = saved_destaddr; + } /* for (k = 0; k < 4; k++) */ + + do { BLTBUSY(busy); } while (busy); + SETFOREGROUNDCOLOR(0); /* Restore VGA Set/Reset register. */ +} diff --git a/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_driver.c b/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_driver.c index d14636e57..ba9db855c 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_driver.c +++ b/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_driver.c @@ -1,5 +1,5 @@ -/* $XConsortium: cir_driver.c,v 1.2 94/10/13 13:21:46 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_driver.c,v 3.22 1994/12/05 03:48:02 dawes Exp $ */ +/* $XConsortium: cir_driver.c,v 1.3 95/01/05 20:47:57 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_driver.c,v 3.25 1995/01/04 04:42:21 dawes Exp $ */ /* * cir_driver.c,v 1.10 1994/09/14 13:59:50 scooper Exp * @@ -103,11 +103,13 @@ */ #include "cir_driver.h" +#include "cir_alloc.h" #ifndef MONOVGA #include "vga256.h" #endif int cirrusChip; +int cirrusChipRevision; int cirrusBusType; Bool cirrusUseBLTEngine = FALSE; Bool cirrusUseMMIO = FALSE; @@ -117,6 +119,7 @@ Bool cirrusUseLinear = FALSE; Bool cirrusFavourBLT = FALSE; int cirrusDRAMBandwidth; int cirrusDRAMBandwidthLimit; +int cirrusReprogrammedMCLK = 0; #define CLAVGA2_ID 0x06 #define CLGD5420_ID 0x22 @@ -143,7 +146,7 @@ int cirrusDRAMBandwidthLimit; * The 543x should be compatible. -HH */ -#define Has_HWCursor(x) (((x) >= CLGD5420 && (x) <= CLGD5429) || \ +#define Has_HWCursor(x) (((x) >= CLGD5422 && (x) <= CLGD5429) || \ (x) == CLGD5430 || (x) == CLGD5434) /* Define a structure for the HIDDEN DAC cursor colours */ @@ -289,10 +292,11 @@ static cirrusClockRec cirrusClockTab[] = { /* These are all too high according to the databook. They can be enabled with the "16clocks" option *if* this driver has been compiled with ALLOW_OUT_OF_SPEC_CLOCKS defined. [542x only] */ - { 0x7E, 0x28 }, /* 90.203 */ - { 0x7E, 0x26 }, /* 94.950 */ - { 0x7E, 0x24 }, /* 100.226 */ - { 0x7B, 0x20 }, /* 110.069 */ + { 0x58, 0x1C }, /* 89.998 */ + { 0x49, 0x16 }, /* 95.019 */ + { 0x46, 0x14 }, /* 100.226 */ + { 0x53, 0x16 }, /* 108.035 */ + { 0x5C, 0x18 }, /* 110.248 */ }; /* Doubled clocks for 16-bit clocking mode with pixel clock ~< 45 MHz. */ @@ -352,7 +356,7 @@ static int cirrusClockLimit[] = { * Multiplexing has now been added, but is untested -- HH. */ #if defined(ALLOW_8BPP_MULTIPLEXING) - 110100, /* 5434 */ + 110300, /* 5434 */ #else 85500, /* 5434 */ #endif @@ -589,7 +593,7 @@ cirrusProbe() { int cirrusClockNo, i; unsigned char lockreg,IdentVal; - unsigned char id, rev; + unsigned char id, rev, partstatus; unsigned char temp; /* @@ -660,11 +664,21 @@ cirrusProbe() id = (IdentVal & 0xFc) >> 2; rev = (IdentVal & 0x03); + outb(vgaIOBase + 0x04, 0x25); partstatus = inb(vgaIOBase + 0x05); + cirrusChipRevision = 0x00; + switch( id ) { case CLGD5420_ID: case CLAVGA2_ID: /* AVGA2 uses 5402 */ cirrusChip = CLGD5420; /* 5420 or 5402 */ + /* Check for CL-GD5420-75QC-B */ + /* It has a Hidden-DAC register. */ + outb(0x3C6, 0x00); + outb(0x3C6, 0xFF); + inb(0x3C6); inb(0x3c6); inb(0x3C6); inb(0x3C6); + if (inb(0x3C6) != 0xFF) + cirrusChipRevision = 0x01; /* 5420-75QC-B */ break; case CLGD5422_ID: cirrusChip = CLGD5422; @@ -679,6 +693,8 @@ cirrusProbe() cirrusChip = CLGD5428; break; case CLGD5429_ID: + if (partstatus >= 0x67) + cirrusChipRevision = 0x01; /* >= Rev. B, fixes BLT */ cirrusChip = CLGD5429; break; @@ -709,7 +725,9 @@ cirrusProbe() /* 'Alpine' family. */ case CLGD5434_ID: - cirrusChip = CLGD5434; + if ((partstatus & 0xC0) == 0xC0) + cirrusChipRevision = 0x01; /* Better than rev. D/E. */ + cirrusChip = CLGD5434; /* handles 60 MHz MCLK. */ break; case CLGD5430_ID: @@ -920,23 +938,26 @@ cirrusProbe() #ifndef MONOVGA /* + * Determine the MCLK that will be used (possibly reprogrammed). * Calculate the available DRAM bandwidth from the MCLK setting. - * Take dram options into account (MCLK is set in FbInit). */ { unsigned char MCLK, SRF; outb(0x3c4, 0x0f); SRF = inb(0x3c5); + if (cirrusChip == CLGD5434 && cirrusChipRevision >= 0x01) + /* 5434 rev. E+ supports 60 MHz MCLK in packed-pixel mode. */ + cirrusReprogrammedMCLK = 0x22; if ((cirrusChip >= CLGD5424 && cirrusChip <= CLGD5429) || cirrusChip == CLGD5430 || cirrusChip == CLGD5434) { outb(0x3c4, 0x1f); MCLK = inb(0x3c5) & 0x3f; if (OFLG_ISSET(OPTION_SLOW_DRAM, &vga256InfoRec.options)) - MCLK = 0x1c; + cirrusReprogrammedMCLK = 0x1c; if (OFLG_ISSET(OPTION_MED_DRAM, &vga256InfoRec.options)) - MCLK = 0x1f; + cirrusReprogrammedMCLK = 0x1f; if (OFLG_ISSET(OPTION_FAST_DRAM, &vga256InfoRec.options)) - MCLK = 0x22; + cirrusReprogrammedMCLK = 0x22; } else /* 5420/22/62x5 have fixed MCLK settings. */ @@ -946,9 +967,11 @@ cirrusProbe() case 2 : MCLK = 0x17; break; case 3 : MCLK = 0x15; break; } + if (cirrusReprogrammedMCLK > 0) + MCLK = cirrusReprogrammedMCLK; + /* Approximate DRAM bandwidth in K/s (8-bit page mode accesses), * corresponds with MCLK frequency / 2 (2 cycles per access). */ -/* cirrusDRAMBandwidth = 14.31818 * MCLK * 1000 / 16); */ cirrusDRAMBandwidth = 14318 * MCLK / 16; if (vga256InfoRec.videoRam >= 512) /* At least 16-bit access. */ @@ -1028,6 +1051,11 @@ cirrusProbe() vga256InfoRec.clock[i] = CLOCKVAL(cirrusClockTab[i].numer, cirrusClockTab[i].denom); } + else + if (xf86Verbose) + ErrorF("%s %s: %s: Using programmable clocks\n", + XCONFIG_PROBED, vga256InfoRec.name, + vga256InfoRec.chipset); } else if (vga256InfoRec.clocks > cirrusClockNo) @@ -1068,7 +1096,8 @@ cirrusProbe() OFLG_SET(OPTION_FAVOUR_BITBLT, &CIRRUS.ChipOptionFlags); } #ifdef CIRRUS_SUPPORT_MMIO - if (cirrusChip == CLGD5434 || cirrusChip == CLGD5430) + if (cirrusChip == CLGD5434 || cirrusChip == CLGD5430 || + cirrusChip == CLGD5429) OFLG_SET(OPTION_MMIO, &CIRRUS.ChipOptionFlags); #endif @@ -1137,6 +1166,13 @@ cirrusFbInit() cirrusUseBLTEngine = TRUE; if (OFLG_ISSET(OPTION_NO_BITBLT, &vga256InfoRec.options)) cirrusUseBLTEngine = FALSE; + else { + if (cirrusChip == CLGD5429 && cirrusChipRevision == 0) { + ErrorF("%s %s: %s: CL-GD5429 Rev A detected, BitBLT disabled\n", + XCONFIG_GIVEN, vga256InfoRec.name, vga256InfoRec.chipset); + cirrusUseBLTEngine = FALSE; + } + } } #endif @@ -1160,40 +1196,35 @@ cirrusFbInit() XCONFIG_PROBED, vga256InfoRec.name, vga256InfoRec.chipset, SR1F & 0x3f, (SRF & 4) ? "Standard" : "Extended"); - if (OFLG_ISSET(OPTION_FAST_DRAM, &vga256InfoRec.options)) - { + if (cirrusReprogrammedMCLK > 0) /* - * Change MCLK value to a more aggressive value. The official - * spec for the 542x is 50 MHz, but some cards are overclocked. + * The MCLK will be programmed to a different value. + * + * 0x1c, 51 MHz Option "slow_dram" + * 0x1f, 55 MHz Option "med_dram" + * 0x22, 61 MHz Option "fast_dram" + * + * The official spec for the 542x is 50 MHz, but some cards are + * overclocked. * - * The 5434 is specified for 50 MHz, but may be speced for + * The 5434 is specified for 50 MHz, but new revisions can do * 60 MHz in packed-pixel mode. The 5429 and 5430 are probably * speced for 60 MHz. */ - outb(0x3c4, 0x1f); - outb(0x3c5, (SR1F & 0xc0) | 0x22); /* Set to 0x22 (about 60 MHz). */ - if (xf86Verbose) - ErrorF("%s %s: %s: Internal memory clock register set to 0x22\n", - XCONFIG_GIVEN, vga256InfoRec.name, vga256InfoRec.chipset); + if (xf86Verbose) { + if (cirrusChip == CLGD5434 && cirrusChipRevision >= 0x01) { + ErrorF("%s %s: %s: CL-GD5434 rev. E+, will program 0x22 MCLK\n", + XCONFIG_PROBED, vga256InfoRec.name, vga256InfoRec.chipset); + if (OFLG_ISSET(OPTION_FAST_DRAM, &vga256InfoRec.options) || + OFLG_ISSET(OPTION_MED_DRAM, &vga256InfoRec.options) || + OFLG_ISSET(OPTION_SLOW_DRAM, &vga256InfoRec.options)) + ErrorF("%s %s: %s: Memory clock overridden by option\n", + XCONFIG_GIVEN, vga256InfoRec.name, vga256InfoRec.chipset); + } + ErrorF("%s %s: %s: Internal memory clock register set to 0x%02x\n", + XCONFIG_GIVEN, vga256InfoRec.name, vga256InfoRec.chipset, + cirrusReprogrammedMCLK); } - - if (OFLG_ISSET(OPTION_SLOW_DRAM, &vga256InfoRec.options)) - { - outb(0x3c4, 0x1f); - outb(0x3c5, (SR1F & 0xc0) | 0x1c); /* Set to 0x1c (50.1 MHz). */ - if (xf86Verbose) - ErrorF("%s %s: %s: Internal memory clock register set to 0x1c\n", - XCONFIG_GIVEN, vga256InfoRec.name, vga256InfoRec.chipset); - } - - if (OFLG_ISSET(OPTION_MED_DRAM, &vga256InfoRec.options)) - { - outb(0x3c4, 0x1f); - outb(0x3c5, (SR1F & 0xc0) | 0x1f); /* Set to 0x1f. */ - if (xf86Verbose) - ErrorF("%s %s: %s: Internal memory clock register set to 0x1f\n", - XCONFIG_GIVEN, vga256InfoRec.name, vga256InfoRec.chipset); - } } #ifndef MONOVGA @@ -1307,15 +1338,16 @@ nolinear: } } - if (!OFLG_ISSET(OPTION_NOACCEL, &vga256InfoRec.options)) { + if (!OFLG_ISSET(OPTION_NOACCEL, &vga256InfoRec.options) + && !(cirrusChip == CLGD5420 && cirrusChipRevision == 1)) { if (xf86Verbose) { ErrorF ("%s %s: %s: Using accelerator functions\n", XCONFIG_PROBED, vga256InfoRec.name, vga256InfoRec.chipset); } - /* Accel functions are available on all chips; some use the BitBLT */ - /* engine if available. */ + /* Accel functions are available on all chips except 5420-75QC-B; some + * use the BitBLT engine if available. */ if (vgaBitsPerPixel == 8) { vga256LowlevFuncs.doBitbltCopy = CirrusDoBitbltCopy; @@ -1377,7 +1409,7 @@ nolinear: cirrusFavourBLT = TRUE; } } - if (vga256InfoRec.virtualX & 31 != 0) + if ((vga256InfoRec.virtualX & 31) != 0) ErrorF("%s %s: %s: Warning: virtual screen width not multiple of 32\n", XCONFIG_GIVEN, vga256InfoRec.name, vga256InfoRec.chipset); @@ -1388,7 +1420,7 @@ nolinear: cirrusUseMMIO = TRUE; /* We can't set cirrusMMIOBase, since vgaBase hasn't been */ /* mapped yet. For now we do that in the init function. */ - ErrorF("%s %s: %s: Using Memory-Mapped I/O\n", + ErrorF("%s %s: %s: Using memory-mapped I/O\n", XCONFIG_GIVEN, vga256InfoRec.name, vga256InfoRec.chipset); if (cirrusUseBLTEngine) { if (vgaBitsPerPixel == 8) { @@ -1397,15 +1429,62 @@ nolinear: vga256LowlevFuncs.teGlyphBlt8 = CirrusMMIOImageGlyphBlt; vga256TEOps1Rect.ImageGlyphBlt = CirrusMMIOImageGlyphBlt; vga256TEOps.ImageGlyphBlt = CirrusMMIOImageGlyphBlt; + /* These functions need to be initialized in the GC handling */ + /* of vga256. */ + vga256TEOps1Rect.FillSpans = CirrusFillSolidSpansGeneral; + vga256TEOps.FillSpans = CirrusFillSolidSpansGeneral; + vga256LowlevFuncs.fillSolidSpans = CirrusFillSolidSpansGeneral; + + vga256TEOps1Rect.Polylines = CirrusMMIOLineSS; + vga256NonTEOps1Rect.Polylines = CirrusMMIOLineSS; + vga256TEOps.Polylines = CirrusMMIOLineSS; + vga256NonTEOps.Polylines = CirrusMMIOLineSS; + vga256TEOps1Rect.PolySegment = CirrusMMIOSegmentSS; + vga256NonTEOps1Rect.PolySegment = CirrusMMIOSegmentSS; + vga256TEOps.PolySegment = CirrusMMIOSegmentSS; + vga256TEOps.PolySegment = CirrusMMIOSegmentSS; + + vga256TEOps1Rect.PolyRectangle = Cirrus8PolyRectangle; + vga256NonTEOps1Rect.PolyRectangle = Cirrus8PolyRectangle; + vga256TEOps.PolyRectangle = Cirrus8PolyRectangle; + vga256NonTEOps.PolyRectangle = Cirrus8PolyRectangle; +#if 0 + vga256LowlevFuncs.fillRectSolidCopy = CirrusMMIOFillRectSolid; + vga256LowlevFuncs.fillBoxSolid = CirrusMMIOFillBoxSolid; +#endif } else if (vgaBitsPerPixel == 16) { cfb16TEOps1Rect.ImageGlyphBlt = CirrusMMIOImageGlyphBlt; cfb16TEOps.ImageGlyphBlt = CirrusMMIOImageGlyphBlt; + cfb16TEOps1Rect.FillSpans = CirrusFillSolidSpansGeneral; + cfb16TEOps.FillSpans = CirrusFillSolidSpansGeneral; + cfb16NonTEOps1Rect.FillSpans = CirrusFillSolidSpansGeneral; + cfb16NonTEOps.FillSpans = CirrusFillSolidSpansGeneral; + cfb16TEOps1Rect.PolyFillRect = CirrusPolyFillRect; + cfb16TEOps.PolyFillRect = CirrusPolyFillRect; + cfb16NonTEOps1Rect.PolyFillRect = CirrusPolyFillRect; + cfb16NonTEOps.PolyFillRect = CirrusPolyFillRect; + cfb16TEOps1Rect.PolyRectangle = Cirrus16PolyRectangle; + cfb16TEOps.PolyRectangle = Cirrus16PolyRectangle; + cfb16NonTEOps1Rect.PolyRectangle = Cirrus16PolyRectangle; + cfb16NonTEOps.PolyRectangle = Cirrus16PolyRectangle; } else { /* vgaBitsPerPixel == 32 */ cfb32TEOps1Rect.ImageGlyphBlt = CirrusMMIOImageGlyphBlt; cfb32TEOps.ImageGlyphBlt = CirrusMMIOImageGlyphBlt; + cfb32TEOps1Rect.FillSpans = CirrusFillSolidSpansGeneral; + cfb32TEOps.FillSpans = CirrusFillSolidSpansGeneral; + cfb32NonTEOps1Rect.FillSpans = CirrusFillSolidSpansGeneral; + cfb32NonTEOps.FillSpans = CirrusFillSolidSpansGeneral; + cfb32TEOps1Rect.PolyFillRect = CirrusPolyFillRect; + cfb32TEOps.PolyFillRect = CirrusPolyFillRect; + cfb32NonTEOps1Rect.PolyFillRect = CirrusPolyFillRect; + cfb32NonTEOps.PolyFillRect = CirrusPolyFillRect; + cfb32TEOps1Rect.PolyRectangle = Cirrus32PolyRectangle; + cfb32TEOps.PolyRectangle = Cirrus32PolyRectangle; + cfb32NonTEOps1Rect.PolyRectangle = Cirrus32PolyRectangle; + cfb32NonTEOps.PolyRectangle = Cirrus32PolyRectangle; } } } @@ -1594,10 +1673,13 @@ cirrusRestore(restore) { outb(0x3C4,0x1E); outb(0x3C5,restore->SR1E); - outb(0x3c4, 0x1f); /* Contains 'Use MCLK as VCLK' bit. */ - outb(0x3c5, restore->SR1F); } + if ((cirrusChip >= CLGD5424 && cirrusChip <= CLGD5429) || HAVE543X()) { + outb(0x3c4, 0x1f); /* MCLK register */ + outb(0x3c5, restore->SR1F); + } + outb(vgaIOBase + 4,0x19); outb(vgaIOBase + 5,restore->CR19); @@ -1740,8 +1822,10 @@ cirrusSave(save) outb(0x3C4,0x1E); save->SR1E = inb(0x3C5); - outb(0x3c4, 0x1f); /* Save the MCLK register because the */ - save->SR1F = inb(0x3c5); /* 'Use MCLK as VCLK' bit may be used. */ + if ((cirrusChip >= CLGD5424 && cirrusChip <= CLGD5429) || HAVE543X()) { + outb(0x3c4, 0x1f); /* Save the MCLK register. */ + save->SR1F = inb(0x3c5); + } outb(vgaIOBase + 4,0x19); save->CR19 = inb(vgaIOBase + 5); @@ -1818,10 +1902,13 @@ cirrusInit(mode) /* The actual DAC register value is set later. */ /* The CRTC is clocked at VCLK / 2, so we must half the */ /* horizontal timings. */ - mode->HDisplay >>= 1; - mode->HSyncStart >>= 1; - mode->HTotal >>= 1; - mode->HSyncEnd >>= 1; + if (!mode->CrtcHAdjusted) { + mode->CrtcHDisplay >>= 1; + mode->CrtcHSyncStart >>= 1; + mode->CrtcHTotal >>= 1; + mode->CrtcHSyncEnd >>= 1; + mode->CrtcHAdjusted = TRUE; + } } #endif #endif @@ -1872,8 +1959,12 @@ cirrusInit(mode) if (!cirrusCheckClock(cirrusChip, new->std.NoClock)) return (FALSE); - outb(0x3c4, 0x1f); /* MCLK register. */ - new->SR1F = inb(0x3c5); + if (cirrusReprogrammedMCLK > 0) + new->SR1F = cirrusReprogrammedMCLK; + else { + outb(0x3c4, 0x1f); /* MCLK register. */ + new->SR1F = inb(0x3c5); + } if (OFLG_ISSET(CLOCK_OPTION_PROGRAMABLE, &vga256InfoRec.clockOptions)) { if (vgaBitsPerPixel == 16 && cirrusChip <= CLGD5424) @@ -1985,43 +2076,45 @@ cirrusInit(mode) } else { /* XXXX Is 0 required for interlaced modes on some chips? */ - int pixelrate, bandwidth, threshold; + int pixelrate, bandwidth, percent, threshold; pixelrate = vga256InfoRec.clock[new->std.NoClock]; if (vgaBitsPerPixel == 16) bandwidth = cirrusDRAMBandwidth - pixelrate * 2; else bandwidth = cirrusDRAMBandwidth - pixelrate; + /* Relative amount of bandwidth left for drawing. */ + percent = bandwidth * 100 / cirrusDRAMBandwidth; threshold = 8; if (OFLG_ISSET(OPTION_FIFO_CONSERV, &vga256InfoRec.options)) { /* Conservative FIFO threshold setting. */ - if (bandwidth <= 36000) /* >= 64 MHz at 8bpp */ + if (percent <= 36) /* >= 64 MHz at 8bpp */ threshold = 12; - if (bandwidth <= 29000) /* >= 71 MHz at 8bpp */ + if (percent <= 29) /* >= 71 MHz at 8bpp */ threshold = 14; - if (bandwidth <= 15000) + if (percent <= 15) threshold = 15; /* >= 86 MHz at 8bpp */ } else if (!OFLG_ISSET(OPTION_FIFO_AGGRESSIVE, &vga256InfoRec.options)) { /* Default FIFO threshold setting. */ - if (bandwidth <= 36000) /* >= 64 MHz at 8bpp */ + if (percent <= 36) /* >= 64 MHz at 8bpp */ threshold = 10; - if (bandwidth <= 29000) /* >= 71 MHz at 8bpp */ + if (percent <= 29) /* >= 71 MHz at 8bpp */ threshold = 12; if (cirrusChip < CLGD5428) { - if (bandwidth <= 26000) /* >= 74 MHz at 8bpp */ + if (percent <= 26) /* >= 74 MHz at 8bpp */ threshold = 13; - if (bandwidth <= 16000) /* >= 84 MHz at 8bpp */ + if (percent <= 16) /* >= 84 MHz at 8bpp */ threshold = 14; - if (bandwidth <= 12000) /* >= 44 MHz at 16bpp */ + if (percent <= 12) /* >= 44 MHz at 16bpp */ threshold = 15; } else { /* Based on the observation that the 5428 */ /* BIOS 77 MHz 1024x768 mode uses 12. */ - if (bandwidth <= 16000) /* >= 84 MHz at 8bpp */ + if (percent <= 16) /* >= 84 MHz at 8bpp */ threshold = 13; - if (bandwidth <= 12000) /* >= 44 MHz at 16bpp */ + if (percent <= 12) /* >= 44 MHz at 16bpp */ threshold = 14; } } @@ -2102,25 +2195,25 @@ cirrusInit(mode) /* Fill up all the overflows - ugh! */ #ifdef DEBUG_CIRRUS - fprintf(stderr,"Init: VSyncStart + 1 = %x\n\ -HsyncEnd>>3 = %x\n\ -HDisplay>>3 -1 = %x\n\ + fprintf(stderr,"Init: CrtcVSyncStart + 1 = %x\n\ +CrtcHsyncEnd>>3 = %x\n\ +CrtcHDisplay>>3 -1 = %x\n\ VirtX = %x\n", - mode->VSyncStart + 1, - mode->HSyncEnd >> 3, - (mode->HDisplay >> 3) - 1, + mode->CrtcVSyncStart + 1, + mode->CrtcHSyncEnd >> 3, + (mode->CrtcHDisplay >> 3) - 1, vga256InfoRec.virtualX>>4); #endif - new->CR1A = (((mode->VSyncStart + 1) & 0x300 ) >> 2) - | (((mode->HSyncEnd >> 3) & 0xC0) >> 2); + new->CR1A = (((mode->CrtcVSyncStart + 1) & 0x300 ) >> 2) + | (((mode->CrtcHSyncEnd >> 3) & 0xC0) >> 2); if (mode->Flags & V_INTERLACE) { /* ``Half the Horizontal Total'' which is */ /* really half the value in CR0 */ - new->CR19 = ((mode->HTotal >> 3) - 5) >> 1; + new->CR19 = ((mode->CrtcHTotal >> 3) - 5) >> 1; new->CR1A |= 0x01; } else new->CR19 = 0x00; @@ -2181,11 +2274,7 @@ VirtX = %x\n", #ifdef ALLOW_8BPP_MULTIPLEXING if (multiplexing) { - new->HIDDENDAC = 0x6a; - mode->HDisplay <<= 1; /* Restore horizontal timing values. */ - mode->HSyncStart <<= 1; - mode->HTotal <<= 1; - mode->HSyncEnd <<= 1; + new->HIDDENDAC = 0x4A; } #endif #endif diff --git a/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_driver.h b/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_driver.h index 8d298b891..e521d652e 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_driver.h +++ b/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_driver.h @@ -1,5 +1,5 @@ -/* $XConsortium: cir_driver.h,v 1.2 94/10/13 13:21:46 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_driver.h,v 3.10 1994/12/02 05:48:14 dawes Exp $ */ +/* $XConsortium: cir_driver.h,v 1.3 95/01/05 20:47:57 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_driver.h,v 3.12 1995/01/04 04:42:24 dawes Exp $ */ /* * * Copyright 1993 by Simon P. Cooper, New Brunswick, New Jersey, USA. @@ -118,13 +118,13 @@ extern void CirrusMMIOBLTColorExpand8x8PatternFill( unsigned destaddr, int fg, int bg, int w, int h, int destpitch, int rop, unsigned long pword1, unsigned long pword2 ); extern void CirrusBLT8x8PatternFill( unsigned destaddr, int w, int h, - void *pattern, int destpitch, int rop ); + unsigned char *pattern, int patternpitch, int destpitch, int rop ); extern void CirrusMMIOBLT8x8PatternFill( unsigned destaddr, int w, int h, - void *pattern, int destpitch, int rop ); + unsigned char *pattern, int patternpitch, int destpitch, int rop ); extern void CirrusBLT16x16PatternFill( unsigned destaddr, int w, int h, - unsigned char *pattern, int destpitch, int rop ); + unsigned char *pattern, int patternpitch, int destpitch, int rop ); extern void CirrusMMIOBLT16x16PatternFill( unsigned destaddr, int w, int h, - unsigned char *pattern, int destpitch, int rop ); + unsigned char *pattern, int patternpitch, int destpitch, int rop ); extern void CirrusBLTBitBlt( unsigned dstAddr, unsigned srcAddr, int dstPitch, int srcPitch, int w, int h, int dir ); extern void CirrusMMIOBLTBitBlt( unsigned dstAddr, unsigned srcAddr, @@ -155,6 +155,20 @@ extern void CirrusMMIOBLTWriteBitmap(); extern RegionPtr Cirrus16CopyArea(); extern RegionPtr Cirrus32CopyArea(); extern void CirrusCopyWindow(); +/* cir_fillsp.c */ +extern void CirrusFillSolidSpansGeneral(); +extern void CirrusMMIOFillRectSolid(); +extern void CirrusMMIOFillBoxSolid(); +extern void CirrusMMIOBanded32x32PatternFill(); +extern void CirrusMMIOPoly32x32PatternFill(); +extern void CirrusWriteSolidPattern(); +/* cir_line.c */ +extern void CirrusMMIOLineSS(); +extern void CirrusMMIOSegmentSS(); +/* cir_orect.c */ +extern void Cirrus8PolyRectangle(); +extern void Cirrus16PolyRectangle(); +extern void Cirrus32PolyRectangle(); _XFUNCPROTOEND @@ -249,26 +263,6 @@ typedef struct int skewed; } cirrusCurRec, *cirrusCurRecPtr; -_XFUNCPROTOBEGIN - -/* In cir_alloc.c: */ -#if NeedFunctionPrototypes -extern int CirrusInitializeAllocator ( int base ); -extern int CirrusAllocate ( int size ); -extern int CirrusCursorAllocate ( cirrusCurRecPtr cirrusCur ); -extern void CirrusFree ( int vidaddr ); -extern void CirrusUploadPattern ( unsigned char *pattern, int width, - int height, int vidaddr, int srcpitch ); -#else -extern int CirrusInitializeAllocator (); -extern int CirrusAllocate (); -extern int CirrusCursorAllocate (); -extern void CirrusFree (); -extern void CirrusUploadPattern(); -#endif - -_XFUNCPROTOEND - #define HAVE543X() (cirrusChip == CLGD5434 || cirrusChip == CLGD5430) #define HAVEBITBLTENGINE() (cirrusUseBLTEngine) diff --git a/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_im.c b/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_im.c index b0ec609fe..cf5fa6643 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_im.c +++ b/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_im.c @@ -1,5 +1,5 @@ -/* $XConsortium: cir_im.c,v 1.1 94/10/05 13:52:22 kaleb Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_im.c,v 3.5 1994/09/19 13:45:51 dawes Exp $ */ +/* $XConsortium: cir_im.c,v 1.2 94/10/13 13:21:46 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_im.c,v 3.6 1995/01/04 04:42:27 dawes Exp $ */ /* * * Copyright 1993 by Bill Reynolds, Santa Fe, New Mexico @@ -135,7 +135,7 @@ void _CirrusBLTImageWrite(pdstBase, psrcBase, widthSrc, widthDst, x, y, { int width, height; - if (!HAVE543X() && h > 1024) { + if (h > 1024) { /* Split into two. */ _CirrusBLTImageWrite(pdstBase, psrcBase, widthSrc, widthDst, x, y, x1, y1, w, 1024, xdir, ydir, alu, planemask); @@ -203,7 +203,7 @@ CirrusBLTImageRead (pdstBase, psrcBase, widthSrc, widthDst, x, y, { int width, height; - if (!HAVE543X() && h > 1024) { + if (h > 1024) { /* Split into two. */ CirrusBLTImageRead(pdstBase, psrcBase, widthSrc, widthDst, x, y, x1, y1, w, 1024, xdir, ydir, alu, planemask); @@ -353,7 +353,7 @@ destpitch) unsigned char *srcp; unsigned char *base; - if (!HAVE543X() && h > 1024) { + if (h > 1024) { /* Split into two. */ _CirrusBLTWriteBitmap(x, y, w, 1024, src, bwidth, srcx, srcy, bg, fg, destpitch); diff --git a/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_teblt8.c b/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_teblt8.c index 6ddd7c0df..2f2680eb6 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_teblt8.c +++ b/xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_teblt8.c @@ -1,5 +1,5 @@ -/* $XConsortium: cir_teblt8.c,v 1.3 94/10/13 13:21:46 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_teblt8.c,v 3.10 1994/10/23 13:00:59 dawes Exp $ */ +/* $XConsortium: cir_teblt8.c,v 1.4 95/01/05 20:47:57 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cirrus/cir_teblt8.c,v 3.11 1994/12/25 12:35:12 dawes Exp $ */ /* * TEGblt - ImageText expanded glyph fonts only. For * 8 bit displays, in Copy mode with no clipping. @@ -125,18 +125,12 @@ void CirrusImageGlyphBlt(pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase) glyphWidth = FONTMAXBOUNDS(pfont,characterWidth); glyphWidthBytes = GLYPHWIDTHBYTESPADDED(*ppci); +#if 0 /* This cannot be used in a function used for 8, 16, 32bpp that */ + /* is compiled only once. */ cfbGetLongWidthAndPointer(pDrawable, widthDst, pdstBase) - switch (vgaBitsPerPixel) { - case 16 : - widthDst = vga256InfoRec.virtualX * 2; - break; - case 32 : - widthDst = vga256InfoRec.virtualX * 4; - break; - default : - widthDst *= 4; /* Convert to bytes. */ - break; - } +#else + widthDst = vga256InfoRec.virtualX << (vgaBitsPerPixel >> 4); +#endif /* We only accelerate fonts 32 or less pixels wide. */ /* Let cfb handle writing into offscreen pixmap. */ @@ -233,26 +227,12 @@ void CirrusImageGlyphBlt(pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase) CollectCharacters(glyphp, nglyph, pglyphBase, ppci); - switch (vgaBitsPerPixel) { - case 16 : - destaddr = y * widthDst + x * 2; - break; - case 32 : - destaddr = y * widthDst + x * 4; - break; - default : /* 8 */ - destaddr = y * widthDst + x; - break; - } + destaddr = y * widthDst + (x << (vgaBitsPerPixel >> 4)); SETDESTADDR(destaddr); SETDESTPITCH(widthDst); SETSRCADDR(0); SETSRCPITCH(0); - blitwidth = glyphWidth * nglyph; - if (vgaBitsPerPixel == 16) - blitwidth *= 2; - if (vgaBitsPerPixel == 32) - blitwidth *= 4; + blitwidth = (glyphWidth * nglyph) << (vgaBitsPerPixel >> 4); SETWIDTH(blitwidth); SETHEIGHT(h); @@ -449,9 +429,7 @@ void CirrusPolyGlyphBlt(pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase) * the foreground color. * MMIO implies a 5429 or 543x. */ -#ifndef CIRRUS_MMIO - if (HAVE543X() || cirrusChip == CLGD5429) { -#endif + if (cirrusChip == CLGD5434) { color = (~pGC->fgPixel) & 0xff; color = color | (color << 8) | (color << 16) | (color << 24); @@ -460,8 +438,20 @@ void CirrusPolyGlyphBlt(pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase) color = color | (color << 8) | (color << 16) | (color << 24); SETFOREGROUNDCOLOR32(color); -#ifndef CIRRUS_MMIO } +#ifdef CIRRUS_MMIO + else { +#else + else if (cirrusChip == CLGD5430 || cirrusChip == CLGD5429) { +#endif + color = (~pGC->fgPixel) & 0xff; + color = color | (color << 8); + SETBACKGROUNDCOLOR16(color); + color = pGC->fgPixel; + color = color | (color << 8); + SETFOREGROUNDCOLOR16(color); + } +#ifndef CIRRUS_MMIO else { color = (~pGC->fgPixel) & 0xff; color = color | (color << 8); diff --git a/xc/programs/Xserver/hw/xfree86/vga256/drivers/compaq/cpq_driver.c b/xc/programs/Xserver/hw/xfree86/vga256/drivers/compaq/cpq_driver.c index 627361e4a..a8a2918e2 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/drivers/compaq/cpq_driver.c +++ b/xc/programs/Xserver/hw/xfree86/vga256/drivers/compaq/cpq_driver.c @@ -1,5 +1,5 @@ -/* $XConsortium: cpq_driver.c,v 1.1 94/10/05 13:52:47 kaleb Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/compaq/cpq_driver.c,v 3.3 1994/09/11 00:52:38 dawes Exp $ */ +/* $XConsortium: cpq_driver.c,v 1.2 94/10/13 13:23:01 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/compaq/cpq_driver.c,v 3.4 1994/12/11 10:57:06 dawes Exp $ */ /* * Copyright 1993 Hans Oey <hans@mo.hobby.nl> * @@ -326,23 +326,18 @@ DisplayModePtr mode; { #ifndef MONOVGA /* Double horizontal timings. */ - mode->HTotal <<= 1; - mode->HDisplay <<= 1; - mode->HSyncStart <<= 1; - mode->HSyncEnd <<= 1; + if (!mode->CrtcHAdjusted) { + mode->CrtcHTotal <<= 1; + mode->CrtcHDisplay <<= 1; + mode->CrtcHSyncStart <<= 1; + mode->CrtcHSyncEnd <<= 1; + mode->CrtcHAdjusted = TRUE; + } #endif if (!vgaHWInit(mode,sizeof(vgaCOMPAQRec))) return(FALSE); #ifndef MONOVGA - /* Restore them, they are used elsewhere */ - mode->HTotal >>= 1; - mode->HDisplay >>= 1; - mode->HSyncStart >>= 1; - mode->HSyncEnd >>= 1; -#endif - -#ifndef MONOVGA new->std.Sequencer[0x02] = 0xff; /* write plane mask for 256 colors */ new->std.CRTC[0x13] = vga256InfoRec.virtualX >> 3; new->std.CRTC[0x14] = 0x40; diff --git a/xc/programs/Xserver/hw/xfree86/vga256/drivers/et3000/et3_driver.c b/xc/programs/Xserver/hw/xfree86/vga256/drivers/et3000/et3_driver.c index a0becd617..233d7f167 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/drivers/et3000/et3_driver.c +++ b/xc/programs/Xserver/hw/xfree86/vga256/drivers/et3000/et3_driver.c @@ -1,5 +1,5 @@ -/* $XConsortium: et3_driver.c,v 1.1 94/10/05 13:52:55 kaleb Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/et3000/et3_driver.c,v 3.3 1994/09/11 00:52:41 dawes Exp $ */ +/* $XConsortium: et3_driver.c,v 1.2 94/10/13 13:23:37 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/et3000/et3_driver.c,v 3.4 1994/12/11 10:57:09 dawes Exp $ */ /* * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. @@ -327,20 +327,16 @@ ET3000Init(mode) #ifdef MONOVGA /* weird mode, halve the horizontal timings */ - mode->HTotal /= 2; - mode->HDisplay /= 2; - mode->HSyncStart /= 2; - mode->HSyncEnd /= 2; + if (!mode->CrtcHAdjusted) { + mode->CrtcHTotal /= 2; + mode->CrtcHDisplay /= 2; + mode->CrtcHSyncStart /= 2; + mode->CrtcHSyncEnd /= 2; + mode->CrtcHAdjusted = TRUE; + } #endif if (!vgaHWInit(mode,sizeof(vgaET3000Rec))) return(FALSE); -#ifdef MONOVGA - /* restore... */ - mode->HTotal *= 2; - mode->HDisplay *= 2; - mode->HSyncStart *= 2; - mode->HSyncEnd *= 2; -#endif #ifndef MONOVGA new->std.Sequencer[4] = 0x06; /* use the FAST 256 Color Mode */ @@ -351,10 +347,10 @@ ET3000Init(mode) if (new->std.NoClock >= 0) new->CRTCControl = (int)(new->std.NoClock & 0x04) >> 1 ; new->Overflow = 0x10 - | ((mode->VSyncStart & 0x400) >> 7 ) - | (((mode->VDisplay -1) & 0x400) >> 8 ) - | (((mode->VTotal -2) & 0x400) >> 9 ) - | ((mode->VSyncStart & 0x400) >> 10 ) + | ((mode->CrtcVSyncStart & 0x400) >> 7 ) + | (((mode->CrtcVDisplay -1) & 0x400) >> 8 ) + | (((mode->CrtcVTotal -2) & 0x400) >> 9 ) + | ((mode->CrtcVSyncStart & 0x400) >> 10 ) | (mode->Flags & V_INTERLACE ? 0x80 : 0); #ifdef MONOVGA diff --git a/xc/programs/Xserver/hw/xfree86/vga256/drivers/et4000/et4_driver.c b/xc/programs/Xserver/hw/xfree86/vga256/drivers/et4000/et4_driver.c index d8d678d7b..380df9898 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/drivers/et4000/et4_driver.c +++ b/xc/programs/Xserver/hw/xfree86/vga256/drivers/et4000/et4_driver.c @@ -1,6 +1,6 @@ /* - * $XConsortium: et4_driver.c,v 1.3 94/10/13 13:24:00 kaleb Exp kaleb $ - * $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/et4000/et4_driver.c,v 3.6 1994/11/19 07:58:28 dawes Exp $ + * $XConsortium: et4_driver.c,v 1.4 95/01/05 20:49:40 kaleb Exp kaleb $ + * $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/et4000/et4_driver.c,v 3.7 1994/12/11 10:57:12 dawes Exp $ * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -641,10 +641,10 @@ ET4000Init(mode) new->OverflowHigh = (mode->Flags & V_INTERLACE ? 0x80 : 0x00) | 0x10 - | ((mode->VSyncStart & 0x400) >> 7 ) - | (((mode->VDisplay -1) & 0x400) >> 8 ) - | (((mode->VTotal -2) & 0x400) >> 9 ) - | (((mode->VSyncStart) & 0x400) >> 10 ); + | ((mode->CrtcVSyncStart & 0x400) >> 7 ) + | (((mode->CrtcVDisplay -1) & 0x400) >> 8 ) + | (((mode->CrtcVTotal -2) & 0x400) >> 9 ) + | (((mode->CrtcVSyncStart) & 0x400) >> 10 ); #ifdef MONOVGA new->Misc = 0x00; diff --git a/xc/programs/Xserver/hw/xfree86/vga256/drivers/ncr77c22/ncr_driver.c b/xc/programs/Xserver/hw/xfree86/vga256/drivers/ncr77c22/ncr_driver.c index 4a218245a..0a390e56a 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/drivers/ncr77c22/ncr_driver.c +++ b/xc/programs/Xserver/hw/xfree86/vga256/drivers/ncr77c22/ncr_driver.c @@ -1,5 +1,5 @@ -/* $XConsortium: ncr_driver.c,v 1.1 94/10/05 13:54:34 kaleb Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/ncr77c22/ncr_driver.c,v 3.3 1994/09/11 00:52:57 dawes Exp $ */ +/* $XConsortium: ncr_driver.c,v 1.2 94/10/13 13:25:18 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/ncr77c22/ncr_driver.c,v 3.4 1994/12/11 10:57:20 dawes Exp $ */ /* Copyright 1992 NCR Corporation - Dayton, Ohio, USA */ @@ -492,17 +492,17 @@ NCRInit(mode) /* These value have to be doubled to compensate for the 4 bit character clock */ #if !defined(MONOVGA) && !defined(XF86VGA16) - new->ExtHTime = ((((mode->HTotal>>2)-5)&0x100)>>8) | - ((((mode->HDisplay>>2)-1)&0x100)>>7) | - ((((mode->HSyncStart>>2)-1)&0x100)>>6) | - (((mode->HSyncStart>>2)&0x100)>>5); - new->std.CRTC[0] = (mode->HTotal >> 2) - 5; - new->std.CRTC[1] = (mode->HDisplay >> 2) - 1; - new->std.CRTC[2] = (mode->HSyncStart >> 2) -1; - new->std.CRTC[3] = ((mode->HSyncEnd >> 2) & 0x1F) | 0x80; - new->std.CRTC[4] = (mode->HSyncStart >> 2); - new->std.CRTC[5] = (((mode->HSyncEnd >> 2) & 0x20 ) << 2 ) - | (((mode->HSyncEnd >> 2)) & 0x1F); + new->ExtHTime = ((((mode->CrtcHTotal>>2)-5)&0x100)>>8) | + ((((mode->CrtcHDisplay>>2)-1)&0x100)>>7) | + ((((mode->CrtcHSyncStart>>2)-1)&0x100)>>6) | + (((mode->CrtcHSyncStart>>2)&0x100)>>5); + new->std.CRTC[0] = (mode->CrtcHTotal >> 2) - 5; + new->std.CRTC[1] = (mode->CrtcHDisplay >> 2) - 1; + new->std.CRTC[2] = (mode->CrtcHSyncStart >> 2) -1; + new->std.CRTC[3] = ((mode->CrtcHSyncEnd >> 2) & 0x1F) | 0x80; + new->std.CRTC[4] = (mode->CrtcHSyncStart >> 2); + new->std.CRTC[5] = (((mode->CrtcHSyncEnd >> 2) & 0x20 ) << 2 ) + | (((mode->CrtcHSyncEnd >> 2)) & 0x1F); new->std.CRTC[19] = vga256InfoRec.virtualX >> 3; /* we are in byte-mode */ new->std.CRTC[23] = 0xE3; /* Countbytwo=0 */ #else diff --git a/xc/programs/Xserver/hw/xfree86/vga256/drivers/oak/oak_driver.c b/xc/programs/Xserver/hw/xfree86/vga256/drivers/oak/oak_driver.c index 53d10b4ad..994b6b225 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/drivers/oak/oak_driver.c +++ b/xc/programs/Xserver/hw/xfree86/vga256/drivers/oak/oak_driver.c @@ -1,5 +1,5 @@ -/* $XConsortium: oak_driver.c,v 1.2 94/10/13 13:25:59 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/oak/oak_driver.c,v 3.7 1994/11/19 07:58:51 dawes Exp $ */ +/* $XConsortium: oak_driver.c,v 1.3 95/01/05 20:49:58 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/oak/oak_driver.c,v 3.9 1994/12/25 12:35:45 dawes Exp $ */ /* * Copyright 1994 by Jorge Delgado <ernar@dit.upm.es> * @@ -33,6 +33,9 @@ * 24/10/94 New version by Jorge Delgado with support for * 2MB of DRAM in 087 chipsets with extended bank * switching, and ported to X11R6 structure, adding ALPHA linear + * 24/11/94 At last I managed to fix the linear mode that did not + * work in the previous release, also fixed a typo which + * made impossible to hardcode "oti077" as chipset. * * * This one file can be used for both the color and monochrome servers. @@ -40,7 +43,7 @@ * with only one bitplane active. To distinguish between the two at * compile-time, use '#ifdef MONOVGA', etc. (But there is NO support for * monochrome in the 087, use the 077 driver harcoding chipset oti077 - * and VideoRam 1024 in Xconfig + * and VideoRam 1024 in XF86Config) */ /*************************************************************************/ @@ -385,6 +388,8 @@ vgaVideoChipRec OAK = { static int OTI_chipset; +static Bool OTI_2mb_bank = FALSE; +static Bool OTI_linear = FALSE; static unsigned OAK_ExtPorts[] = { OTI_INDEX, OTI_R_W }; static int Num_OAK_ExtPorts = (sizeof(OAK_ExtPorts)/sizeof(OAK_ExtPorts[0])); @@ -552,21 +557,25 @@ OAKProbe() { /* * This is the easy case. The user has specified the - * chipset in the Xconfig file. All we need to do here + * chipset in the XF86Config file. All we need to do here * is a string comparison against each of the supported * names available from the Ident() function. If this * driver supports more than one chipset, there would be * nested conditionals here (see the Trident and WD drivers * for examples). */ + if (!StrCaseCmp(vga256InfoRec.chipset, OAKIdent(0))) { OTI_chipset = OTI67; } else if (!StrCaseCmp(vga256InfoRec.chipset, OAKIdent(1))) { OTI_chipset = OTI77; } else if (!StrCaseCmp(vga256InfoRec.chipset, OAKIdent(2))) { OTI_chipset = OTI87; - } else - return (FALSE); + } + else + { + return (FALSE); + } OAKEnterLeave(ENTER); } else @@ -590,19 +599,24 @@ OAKProbe() */ /* First we see if the segment register is present */ + outb(OTI_INDEX, OTI_SEGMENT); save = inb(OTI_R_W); + /* I assume that once I set the index I can r/w/r/w to my hearts content */ + outb(OTI_R_W, save ^ 0x11); temp1 = inb(OTI_R_W); outb(OTI_R_W, save); if (temp1 != ( save ^ 0x11 )) { + /* * Turn things back off if the probe is going to fail. * Returning FALSE implies failure, and the server * will go on to the next driver. */ + OAKEnterLeave(LEAVE); return(FALSE); } @@ -612,7 +626,8 @@ OAKProbe() temp1 &= 0xE0; switch (temp1) { case 0xE0 : /* oti 57 don't know it */ - ErrorF("OAK driver: OTI-57 unsupported\n"); + ErrorF("%s %s: oak: OTI-57 unsupported.\n", XCONFIG_PROBED, + vga256InfoRec.name); OAKEnterLeave(LEAVE); return(FALSE); case 0x40 : /* oti 67 */ @@ -624,18 +639,20 @@ OAKProbe() default : /* don't know it by these bits */ outb(OTI_INDEX, OTI87_IDENTIFY ); if (inb(OTI_R_W) != 1 ) { - ErrorF("OAK driver: unknown chipset\n"); + ErrorF("%s %s: oak: unknown chipset.\n", XCONFIG_PROBED, + vga256InfoRec.name); OAKEnterLeave(LEAVE); return(FALSE); } - else { /* oti087 */ - OTI_chipset = OTI87; - } + else + { /* oti087 */ + OTI_chipset = OTI87; + } } } /* - * If the user has specified the amount of memory in the Xconfig + * If the user has specified the amount of memory in the XF86Config * file, we respect that setting. */ if (!vga256InfoRec.videoRam) { @@ -661,12 +678,10 @@ OAKProbe() break; case 6: vga256InfoRec.videoRam = 2048; - ErrorF("OTI87 driver: 2MB supported, but not tested!!!\n"); - ErrorF(" use 'VideoRam 1024' in XF86config file\n"); - ErrorF(" if you find any problem. \n "); break; default: - ErrorF("OTI87 driver: unknown video memory\n"); + ErrorF("%s %s: oti087: unknown video memory\n", + XCONFIG_PROBED, vga256InfoRec.name); OAKEnterLeave(LEAVE); return(FALSE); } @@ -682,20 +697,23 @@ OAKProbe() else if (temp1 == 0x00 ) vga256InfoRec.videoRam = 256; else { - ErrorF("OAK driver: unknown video memory\n"); + ErrorF("%s %s: oak: unknown video memory.\n", + XCONFIG_PROBED, vga256InfoRec.name); OAKEnterLeave(LEAVE); return(FALSE); } } } - else - { - if (vga256InfoRec.videoRam == 2048) { - ErrorF("OTI87 driver: 2MB supported, but not tested!!!\n"); - ErrorF(" use 'VideoRam 1024' in XF86config file\n"); - ErrorF(" if you find any problem. \n"); - } - } + if (vga256InfoRec.videoRam == 2048) { + ErrorF("%s %s: oti087: 2MB supported, but not tested!!!\n", + XCONFIG_PROBED, vga256InfoRec.name); + ErrorF("%s %s: oti087: use 'VideoRam 1024' in XF86Config file\n", + XCONFIG_PROBED, vga256InfoRec.name); + ErrorF("%s %s: oti087: if you find any problem. Or mail me\n", + XCONFIG_PROBED, vga256InfoRec.name); + ErrorF("%s %s: oti087: at ernar@dit.upm.es \n", + XCONFIG_PROBED, vga256InfoRec.name); + } /* HERE WE KNOW THE CHIPSET SO WE CHANGE THE BANKING ROUTINES, AND * THE STRUCTURE, ALLOWING FOR LINEAR FRAMEBUFFER @@ -706,23 +724,25 @@ OAKProbe() OAK.ChipSetRead = OTI87SetRead ; OAK.ChipSetWrite = OTI87SetWrite ; OAK.ChipSetReadWrite = OTI87SetReadWrite ; - ErrorF("%s %s: OTI87 driver: 2MB banking routine enabled \n", - XCONFIG_PROBED, vga256InfoRec.name); + OTI_2mb_bank = TRUE; if (OFLG_ISSET(OPTION_LINEAR, &vga256InfoRec.options)) { OAK.ChipUseLinearAddressing = TRUE ; OAK.ChipLinearBase = 0xF00000 ; - OAK.ChipLinearSize = 1024 ; + OAK.ChipLinearSize = 0x100000 ; + /* OAK.ChipHas16bpp = TRUE ; - OAK.ChipHas32bpp = TRUE ; - */ ErrorF("OTI87 driver: Linear framebuffer enabled \n"); + OAK.ChipHas32bpp = TRUE ; */ + + OTI_linear = TRUE; + /* ErrorF("OTI87 driver: HiColor and TrueColor Enabled \n"); */ } } /* - * Again, if the user has specified the clock values in the Xconfig + * Again, if the user has specified the clock values in the XF86Config * file, we respect those choices. */ if (!vga256InfoRec.clocks) @@ -752,6 +772,7 @@ OAKProbe() * generator of these boards is the OTI068, which gives a maximum clock * of 78Mhz, so I suppose its not necessary to define it. Personally, * I doubt any OEM will be able to use higher dot clocks with 70ns DRAM + * and this chipset. */ vga256InfoRec.maxClock = 80000 ; @@ -875,7 +896,7 @@ OAKRestore(restore) outw(OTI_INDEX, OTI87_XWRITE); outw(OTI_INDEX, OTI87_XREAD); } - /* Ok, to prevent text mode to be absolutely fouled up, oti077-67 + /* Ok. to prevent text mode to be absolutely fouled up, oti077-67 * chipsets needed the extended clock bit set to 0 to avoid * something, as the oti087 text mode is currenlty fouled when * I leave X, I will use his experience ;) that is, I will cut&paste @@ -903,11 +924,6 @@ OAKRestore(restore) } /* - * This function handles restoring the generic VGA registers. - */ - vgaHWRestore((vgaHWPtr)restore); - - /* * Code to restore any SVGA registers that have been saved/modified * goes here. Note that it is allowable, and often correct, to * only modify certain bits in a register by a read/modify/write cycle. @@ -996,7 +1012,12 @@ OAKRestore(restore) outw(OTI_INDEX, OTI87_HC_FORE + (restore->oti87HC11 << 8 )); outw(OTI_INDEX, OTI87_HC_CTRL + (restore->oti87HC12 << 8 )); } - + + /* + * This function handles restoring the generic VGA registers. + */ + vgaHWRestore((vgaHWPtr)restore); + outw(0x3C4, 0x0300); /* now reenable the timing sequencer */ } @@ -1115,7 +1136,8 @@ OAKSave(save) else { save->oakBank = temp; /* this seems silly, leftover from textmode - problems */ + * problems, but it works my friend, it works. + */ outb(OTI_INDEX, OTI_MISC); save->oakMisc = inb(OTI_R_W); @@ -1160,10 +1182,13 @@ OAKInit(mode) Could just set VGA_DIVIDE_VERT but we'd have to test it and do the divides here anyway. */ - mode->VTotal >>= 1; - mode->VDisplay >>= 1; - mode->VSyncStart >>= 1; - mode->VSyncEnd >>= 1; + if (!mode->CrtcVAdjusted) { + mode->CrtcVTotal >>= 1; + mode->CrtcVDisplay >>= 1; + mode->CrtcVSyncStart >>= 1; + mode->CrtcVSyncEnd >>= 1; + mode->CrtcVAdjusted = TRUE; + } } /* * This will allocate the datastructure and initialize all of the @@ -1218,20 +1243,20 @@ OAKInit(mode) new->oakMisc |= (vga256InfoRec.videoRam >= 512 ? 0x80 : 0x00 ); if (mode->Flags & V_INTERLACE ) { new->oakOverflow = 0x80 | - /* V-retrace-start */ (((mode->VSyncStart ) & 0x400) >> 8 ) | - /* V-blank-start */ ((((mode->VDisplay-1) ) & 0x400) >> 9 ) | - /* V-total */ ((((mode->VTotal-2) ) & 0x400) >> 10 ) ; + /* V-retrace-start */ (((mode->CrtcVSyncStart ) & 0x400) >> 8 ) | + /* V-blank-start */ ((((mode->CrtcVDisplay-1) ) & 0x400) >> 9 ) | + /* V-total */ ((((mode->CrtcVTotal-2) ) & 0x400) >> 10 ) ; /* can set overflow2 no matter what here since restore will do the right thing */ new->oakOverflow2 = 0; /* Doc. says this is when vertical retrace will start in every odd frame in interlaced mode in characters. Hmm??? */ - new->oakHsync2 = (mode->VTotal-2) >> 3; + new->oakHsync2 = (mode->CrtcVTotal-2) >> 3; } else { new->oakOverflow = (mode->Flags & V_INTERLACE ? 0x80 : 0x00) | - /* V-retrace-start */ ((mode->VSyncStart & 0x400) >> 8 ) | - /* V-blank-start */ (((mode->VDisplay-1) & 0x400) >> 9 ) | - /* V-total */ (((mode->VTotal-2) & 0x400) >> 10 ) ; + /* V-retrace-start */ ((mode->CrtcVSyncStart & 0x400) >> 8 ) | + /* V-blank-start */ (((mode->CrtcVDisplay-1) & 0x400) >> 9 ) | + /* V-total */ (((mode->CrtcVTotal-2) & 0x400) >> 10 ) ; /* can set overflow2 no matter what here since restore will do the right thing */ new->oakOverflow2 = 0; @@ -1258,22 +1283,22 @@ OAKInit(mode) if (mode->Flags & V_INTERLACE ) { new->oti87Overflow = 0x80 | - /* V-retrace-start */ (((mode->VSyncStart ) & 0x400) >> 8 ) | - /* V-blank-start */ ((((mode->VDisplay-1) ) & 0x400) >> 9 ) | - /* V-total */ ((((mode->VTotal-2) ) & 0x400) >> 10 ) ; + /* V-retrace-start */ (((mode->CrtcVSyncStart ) & 0x400) >> 8 ) | + /* V-blank-start * ((((mode->CrtcVDisplay-1) ) & 0x400) >> 9 ) | + /* V-total */ ((((mode->CrtcVTotal-2) ) & 0x400) >> 10 ) ; /* Doc. says this is when vertical retrace will start in every odd frame in interlaced mode in characters. Hmm??? */ - new->oti87Hsync2 = (mode->VTotal-2) >> 3; + new->oti87Hsync2 = (mode->CrtcVTotal-2) >> 3; } else { new->oti87Overflow = (mode->Flags & V_INTERLACE ? 0x80 : 0x00) | - /* V-retrace-start */ ((mode->VSyncStart & 0x400) >> 8 ) | - /* V-blank-start */ (((mode->VDisplay-1) & 0x400) >> 9 ) | - /* V-total */ (((mode->VTotal-2) & 0x400) >> 10 ) ; + /* V-retrace-start */ ((mode->CrtcVSyncStart & 0x400) >> 8 ) | + /* V-blank-start */ (((mode->CrtcVDisplay-1) & 0x400) >> 9 ) | + /* V-total */ (((mode->CrtcVTotal-2) & 0x400) >> 10 ) ; new->oti87Hsync2 = 0; } @@ -1283,11 +1308,7 @@ OAKInit(mode) } else { new-> oti87VLBControl = 0x10; } - if (OFLG_ISSET(OPTION_LINEAR, &vga256InfoRec.options)) { - new-> oti87Mapping = 0xFA; - } else { - new-> oti87Mapping = 0x0 ; - } + new-> oti87BusControl = 0xC8 ; new-> oti87ColorPalette = 0xf ; @@ -1314,19 +1335,19 @@ OAKInit(mode) */ } - - - /* - * Put vertical numbers back so virtual screen doesn't - * get fooled. - */ - if (mode->Flags & V_INTERLACE ) { - mode->VTotal <<= 1; - mode->VDisplay <<= 1; - mode->VSyncStart <<= 1; - mode->VSyncEnd <<= 1; - } - + /* Explain what it to be done to the stderr messages, just to be sure */ + + if (OTI_linear) + { + new-> oti87Mapping = 0xF9; + ErrorF ("%s %s: oti087: linear framebuffer enabled. \n", XCONFIG_PROBED, + vga256InfoRec.name); + } + if (OTI_2mb_bank) + { + ErrorF ("%s %s: oti087: Using 2 MB banking routines. \n", XCONFIG_PROBED, + vga256InfoRec.name); + } return(TRUE); } @@ -1407,5 +1428,3 @@ OAKAdjust(x, y) } } - - diff --git a/xc/programs/Xserver/hw/xfree86/vga256/drivers/pvga1/pvg_driver.c b/xc/programs/Xserver/hw/xfree86/vga256/drivers/pvga1/pvg_driver.c index 202de9e5e..18e4661fe 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/drivers/pvga1/pvg_driver.c +++ b/xc/programs/Xserver/hw/xfree86/vga256/drivers/pvga1/pvg_driver.c @@ -1,6 +1,6 @@ /* - * $XConsortium: pvg_driver.c,v 1.1 94/10/05 13:54:47 kaleb Exp $ - * $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/pvga1/pvg_driver.c,v 3.10 1994/09/27 10:32:41 dawes Exp $ + * $XConsortium: pvg_driver.c,v 1.3 94/10/13 13:26:38 kaleb Exp kaleb $ + * $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/pvga1/pvg_driver.c,v 3.11 1994/12/11 10:57:28 dawes Exp $ * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -870,9 +870,11 @@ PVGA1Init(mode) /* WD90Cxx */ if (mode->Flags & V_INTERLACE) { - new->InterlaceStart = (mode->HSyncStart >> 3) - (mode->HTotal >> 4); + new->InterlaceStart = (mode->CrtcHSyncStart >> 3) - + (mode->CrtcHTotal >> 4); new->InterlaceEnd = 0x20 | - ((mode->HSyncEnd >> 3) - (mode->HTotal >> 4)) & 0x1F; + ((mode->CrtcHSyncEnd >> 3) - + (mode->CrtcHTotal >> 4)) & 0x1F; } else { diff --git a/xc/programs/Xserver/hw/xfree86/vga256/drivers/tvga8900/t89_driver.c b/xc/programs/Xserver/hw/xfree86/vga256/drivers/tvga8900/t89_driver.c index 4e071e463..3912c14b2 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/drivers/tvga8900/t89_driver.c +++ b/xc/programs/Xserver/hw/xfree86/vga256/drivers/tvga8900/t89_driver.c @@ -1,5 +1,5 @@ -/* $XConsortium: t89_driver.c,v 1.1 94/10/05 13:55:06 kaleb Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/tvga8900/t89_driver.c,v 3.4 1994/09/23 10:26:49 dawes Exp $ */ +/* $XConsortium: t89_driver.c,v 1.2 94/10/13 13:27:09 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/tvga8900/t89_driver.c,v 3.5 1994/12/11 10:57:35 dawes Exp $ */ /* * Copyright 1992 by Alan Hourihane, Wigan, England. * @@ -652,22 +652,18 @@ TVGA8900Init(mode) /* * Double horizontal timings. */ - mode->HTotal <<= 1; - mode->HDisplay <<= 1; - mode->HSyncStart <<= 1; - mode->HSyncEnd <<= 1; + if (!mode->CrtcHAdjusted) + { + mode->CrtcHTotal <<= 1; + mode->CrtcHDisplay <<= 1; + mode->CrtcHSyncStart <<= 1; + mode->CrtcHSyncEnd <<= 1; + mode->CrtcHAdjusted = TRUE; + } /* * Initialize generic VGA registers. */ vgaHWInit(mode, sizeof(vgaTVGA8900Rec)); - /* - * Put horizontal numbers back, so the virtual-screen - * stuff doesn't get screwed up. - */ - mode->HTotal >>= 1; - mode->HDisplay >>= 1; - mode->HSyncStart >>= 1; - mode->HSyncEnd >>= 1; /* * Now do Trident-specific stuff. This one is also diff --git a/xc/programs/Xserver/hw/xfree86/vga256/vga/Imakefile b/xc/programs/Xserver/hw/xfree86/vga256/vga/Imakefile index 9be96e509..4435435ac 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/vga/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/vga256/vga/Imakefile @@ -1,5 +1,5 @@ -XCOMM $XConsortium: Imakefile,v 1.1 94/10/05 13:51:06 kaleb Exp $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga256/vga/Imakefile,v 3.2 1994/09/07 15:56:03 dawes Exp $ +XCOMM $XConsortium: Imakefile,v 1.2 94/10/13 13:04:50 kaleb Exp kaleb $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga256/vga/Imakefile,v 3.3 1994/12/17 10:08:48 dawes Exp $ #include <Server.tmpl> FSRCS = fBitBlt.s fFillCopy.s fFillOr.s fFillAnd.s \ @@ -136,4 +136,6 @@ InstallLinkKitNonExecFile(vga256.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(vgaFasm.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(vgaHW.c,$(LINKKITDIR)/VGADriverDoc) +#ifndef OS2Architecture DependTarget() +#endif diff --git a/xc/programs/Xserver/hw/xfree86/vga256/vga/vga.c b/xc/programs/Xserver/hw/xfree86/vga256/vga/vga.c index 3615e4cb1..0795ae4d5 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/vga/vga.c +++ b/xc/programs/Xserver/hw/xfree86/vga256/vga/vga.c @@ -1,5 +1,5 @@ -/* $XConsortium: vga.c,v 1.3 94/12/06 16:11:26 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/vga/vga.c,v 3.24 1994/10/23 13:01:26 dawes Exp $ */ +/* $XConsortium: vga.c,v 1.4 95/01/05 20:51:07 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/vga/vga.c,v 3.26 1995/01/02 05:02:33 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -152,6 +152,7 @@ ScrnInfoRec vga256InfoRec = { 0, /* int instance */ 0, /* int s3Madjust */ 0, /* int s3Nadjust */ + 0, /* int s3MClk */ }; pointer vgaOrigVideoState = NULL; @@ -232,6 +233,13 @@ static void (* saveSetReadWriteFunc)(); vgaHWCursorRec vgaHWCursor; +#ifdef MONOVGA +static int validDepth = 1; +#endif +#ifdef XF86VGA16 +static int validDepth = 4; +#endif + extern miPointerScreenFuncRec xf86PointerScreenFuncs; extern int defaultColorVisualClass; @@ -375,6 +383,13 @@ vgaProbe() return(FALSE); } } +#else + if (vga256InfoRec.depth != validDepth) { + ErrorF("\n%s %s: Unsupported bpp for %s server (%d)\n", + XCONFIG_GIVEN, vga256InfoRec.name, vga256InfoRec.name, + vga256InfoRec.depth); + return(FALSE); + } #endif for (i=0; Drivers[i]; i++) diff --git a/xc/programs/Xserver/hw/xfree86/vga256/vga/vgaHW.c b/xc/programs/Xserver/hw/xfree86/vga256/vga/vgaHW.c index f555fbf9c..d5d7687be 100644 --- a/xc/programs/Xserver/hw/xfree86/vga256/vga/vgaHW.c +++ b/xc/programs/Xserver/hw/xfree86/vga256/vga/vgaHW.c @@ -1,6 +1,6 @@ /* - * $XConsortium: vgaHW.c,v 1.4 94/10/13 13:04:50 kaleb Exp kaleb $ - * $XFree86: xc/programs/Xserver/hw/xfree86/vga256/vga/vgaHW.c,v 3.12 1994/11/26 12:48:19 dawes Exp $ + * $XConsortium: vgaHW.c,v 1.5 95/01/05 20:51:38 kaleb Exp kaleb $ + * $XFree86: xc/programs/Xserver/hw/xfree86/vga256/vga/vgaHW.c,v 3.15 1994/12/29 10:21:23 dawes Exp $ * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -119,6 +119,7 @@ Bool clgd6225Lcd= FALSE; static int currentGraphicsClock = -1; static int currentExternClock = -1; +int vgaRamdacMask = 0x3F; Bool vgaPowerSaver = FALSE; #define new ((vgaHWPtr)vgaNewVideoState) @@ -640,7 +641,7 @@ vgaHWSave(save, size) for (i=0; i<3; i++) { unsigned char tmp = inb(0x3C9); - if (tmp != (~save->DAC[i]&0x3F)) read_error++; + if (tmp != (~save->DAC[i] & vgaRamdacMask)) read_error++; } if (read_error) @@ -835,9 +836,9 @@ vgaHWInit(mode, size) } else { - if (mode->VDisplay < 400) new->MiscOutReg = 0xA3; - else if (mode->VDisplay < 480) new->MiscOutReg = 0x63; - else if (mode->VDisplay < 768) new->MiscOutReg = 0xE3; + if (mode->CrtcVDisplay < 400) new->MiscOutReg = 0xA3; + else if (mode->CrtcVDisplay < 480) new->MiscOutReg = 0x63; + else if (mode->CrtcVDisplay < 768) new->MiscOutReg = 0xE3; else new->MiscOutReg = 0x23; } if (!vga256InfoRec.clockprog) @@ -864,34 +865,36 @@ vgaHWInit(mode, size) new->Sequencer[4] = 0x0E; /* Misc */ #endif - if (vgaInterlaceType == VGA_DIVIDE_VERT && (mode->Flags & V_INTERLACE)) { - mode->VDisplay >>= 1; - mode->VSyncStart >>= 1; - mode->VSyncEnd >>= 1; - mode->VTotal >>= 1; + if (!mode->CrtcVAdjusted && (mode->Flags & V_INTERLACE) && + vgaInterlaceType == VGA_DIVIDE_VERT) { + mode->CrtcVDisplay >>= 1; + mode->CrtcVSyncStart >>= 1; + mode->CrtcVSyncEnd >>= 1; + mode->CrtcVTotal >>= 1; + mode->CrtcVAdjusted = TRUE; } - + /* * CRTC Controller */ - new->CRTC[0] = (mode->HTotal >> 3) - 5; - new->CRTC[1] = (mode->HDisplay >> 3) - 1; - new->CRTC[2] = (mode->HSyncStart >> 3) -1; - new->CRTC[3] = ((mode->HSyncEnd >> 3) & 0x1F) | 0x80; - new->CRTC[4] = (mode->HSyncStart >> 3); - new->CRTC[5] = (((mode->HSyncEnd >> 3) & 0x20 ) << 2 ) - | (((mode->HSyncEnd >> 3)) & 0x1F); - new->CRTC[6] = (mode->VTotal - 2) & 0xFF; - new->CRTC[7] = (((mode->VTotal -2) & 0x100) >> 8 ) - | (((mode->VDisplay -1) & 0x100) >> 7 ) - | ((mode->VSyncStart & 0x100) >> 6 ) - | (((mode->VSyncStart) & 0x100) >> 5 ) + new->CRTC[0] = (mode->CrtcHTotal >> 3) - 5; + new->CRTC[1] = (mode->CrtcHDisplay >> 3) - 1; + new->CRTC[2] = (mode->CrtcHSyncStart >> 3) -1; + new->CRTC[3] = ((mode->CrtcHSyncEnd >> 3) & 0x1F) | 0x80; + new->CRTC[4] = (mode->CrtcHSyncStart >> 3); + new->CRTC[5] = (((mode->CrtcHSyncEnd >> 3) & 0x20 ) << 2 ) + | (((mode->CrtcHSyncEnd >> 3)) & 0x1F); + new->CRTC[6] = (mode->CrtcVTotal - 2) & 0xFF; + new->CRTC[7] = (((mode->CrtcVTotal -2) & 0x100) >> 8 ) + | (((mode->CrtcVDisplay -1) & 0x100) >> 7 ) + | ((mode->CrtcVSyncStart & 0x100) >> 6 ) + | (((mode->CrtcVSyncStart) & 0x100) >> 5 ) | 0x10 - | (((mode->VTotal -2) & 0x200) >> 4 ) - | (((mode->VDisplay -1) & 0x200) >> 3 ) - | ((mode->VSyncStart & 0x200) >> 2 ); + | (((mode->CrtcVTotal -2) & 0x200) >> 4 ) + | (((mode->CrtcVDisplay -1) & 0x200) >> 3 ) + | ((mode->CrtcVSyncStart & 0x200) >> 2 ); new->CRTC[8] = 0x00; - new->CRTC[9] = ((mode->VSyncStart & 0x200) >>4) | 0x40; + new->CRTC[9] = ((mode->CrtcVSyncStart & 0x200) >>4) | 0x40; if (mode->Flags & V_DBLSCAN) new->CRTC[9] |= 0x80; new->CRTC[10] = 0x00; @@ -900,13 +903,13 @@ vgaHWInit(mode, size) new->CRTC[13] = 0x00; new->CRTC[14] = 0x00; new->CRTC[15] = 0x00; - new->CRTC[16] = mode->VSyncStart & 0xFF; - new->CRTC[17] = (mode->VSyncEnd & 0x0F) | 0x20; - new->CRTC[18] = (mode->VDisplay -1) & 0xFF; + new->CRTC[16] = mode->CrtcVSyncStart & 0xFF; + new->CRTC[17] = (mode->CrtcVSyncEnd & 0x0F) | 0x20; + new->CRTC[18] = (mode->CrtcVDisplay -1) & 0xFF; new->CRTC[19] = vga256InfoRec.displayWidth >> 4; /* just a guess */ new->CRTC[20] = 0x00; - new->CRTC[21] = mode->VSyncStart & 0xFF; - new->CRTC[22] = (mode->VSyncStart +1) & 0xFF; + new->CRTC[21] = mode->CrtcVSyncStart & 0xFF; + new->CRTC[22] = (mode->CrtcVSyncStart +1) & 0xFF; #if defined(MONOVGA) || defined(XF86VGA16) new->CRTC[23] = 0xE3; #else @@ -914,13 +917,6 @@ vgaHWInit(mode, size) #endif new->CRTC[24] = 0xFF; - if (vgaInterlaceType == VGA_DIVIDE_VERT && (mode->Flags & V_INTERLACE)) { - mode->VDisplay <<= 1; - mode->VSyncStart <<= 1; - mode->VSyncEnd <<= 1; - mode->VTotal <<= 1; - } - /* * Graphics Display Controller */ diff --git a/xc/programs/Xserver/hw/xfree86/xf86Version.h b/xc/programs/Xserver/hw/xfree86/xf86Version.h index 5867dc814..33d952733 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86Version.h +++ b/xc/programs/Xserver/hw/xfree86/xf86Version.h @@ -1,4 +1,4 @@ -/* $XConsortium: xf86Version.h,v 1.2 94/10/12 19:40:57 kaleb Exp kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.49 1994/12/03 10:02:33 dawes Exp $ */ +/* $XConsortium: xf86Version.h,v 1.3 95/01/05 20:53:30 kaleb Exp kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.55 1995/01/04 04:38:27 dawes Exp $ */ -#define XF86_VERSION " 3.1.0A " +#define XF86_VERSION " 3.1.0B " diff --git a/xc/programs/Xserver/hw/xfree86/xf86config/Imakefile b/xc/programs/Xserver/hw/xfree86/xf86config/Imakefile index 388ce9939..712124587 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86config/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/xf86config/Imakefile @@ -1,9 +1,13 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Imakefile,v 3.0 1994/10/20 06:12:49 dawes Exp $ +XCOMM $XConsortium: $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Imakefile,v 3.1 1995/01/02 05:02:57 dawes Exp $ - SRCS = xf86config.c - OBJS = xf86config.o + SRCS = xf86config.c cards.c + OBJS = xf86config.o cards.o LOCAL_LIBRARIES = DEPLIBS = + CARDDBFILE = $(LIBDIR)/Cards + DEFINES = -DCARD_DATABASE_FILE='"$(CARDDBFILE)"' +InstallNonExecFile(Cards,$(LIBDIR)) ComplexProgramTarget(xf86config) diff --git a/xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c b/xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c index c1af58587..4b6f47246 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c +++ b/xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c @@ -1,12 +1,11 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c,v 3.1 1994/12/02 05:48:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c,v 3.4 1995/01/02 05:03:01 dawes Exp $ */ /* - * This is a dumb configuration program that will create a base - * XF86Config file based on menu choices. Its main feature is that - * clueless users may be less inclined to select crazy sync rates - * way over monitor spec, by presenting a menu with standard monitor - * types. Also some people don't read docs unless an executable that - * they can run tells them to. + * This is a configuration program that will create a base XF86Config + * file based on menu choices. Its main feature is that clueless users + * may be less inclined to select crazy sync rates way over monitor spec, + * by presenting a menu with standard monitor types. Also some people + * don't read docs unless an executable that they can run tells them to. * * It assumes a 24-line or bigger text console. * @@ -42,13 +41,34 @@ * 18Oct94 Add check for existence of /usr/X11R6. * Add note about ctrl-alt-backspace. * 06Nov94 Add comment above standard mode timings in XF86Config. + * 24Dec94 Add low-resolution modes using doublescan. + * 29Dec94 Add note in horizontal sync range selection. + * Ask about ClearDTR/RTS option for Mouse Systems mice. + * Ask about writing to /etc/XF86Config. + * Allow link to be set in /var/X11R6/bin. + * Note about X -probeonly crashing. + * Add keyboard Alt binding option for non-ASCII characters. + * Add card database selection. + * Write temporary XF86Config for clock probing in /tmp instead + * of /usr/X11R6/lib/X11. + * Add RAMDAC and Clockchip menu. * * Possible enhancements: * - Add more standard mode timings (also applies to README.Config). Missing * are 1024x768 @ 72 Hz, 1152x900 modes, and 1280x1024 @ ~70 Hz. * I suspect there is a VESA standard for 1024x768 @ 72 Hz with 77 MHz dot - * clock, and 1024x768 @ 75 Hz with 78.7 MHz dot clock. + * clock, and 1024x768 @ 75 Hz with 78.7 MHz dot clock. New types of + * monitors probably work better with VESA 75 Hz timings. * - Add option for creation of clear, minimal XF86Config. + * - The card database doesn't include most of the entries in previous + * databases. + * + * Send comments to hhanemaa@cs.ruu.nl. + * + * Things to keep up-to-date: + * - Accelerated server names. + * - Ramdac and Clockchip settings. + * - The card database. * */ @@ -59,6 +79,27 @@ #include <string.h> #include <unistd.h> +#include "cards.h" + + +/* + * Define the following to 310 to remove references to XFree86 features that + * have been added since XFree86 3.1 (e.g. DoubleScan modes). + */ +#define XFREE86_VERSION 311 + +/* + * This is the filename of the temporary XF86Config file that is written + * when the program is told to probe clocks (which can only happen for + * root). + */ +#define TEMPORARY_XF86CONFIG_FILENAME "/tmp/XF86Config.tmp" + +/* + * Define this to have /etc/XF86Config prompted for as the default + * location to write the XF86Config file to. + */ +#define PREFER_XF86CONFIG_IN_ETC /* @@ -70,14 +111,16 @@ int config_mousetype; /* Mouse. */ int config_emulate3buttons; int config_chordmiddle; +int config_cleardtrrts; char *config_pointerdevice; +int config_altmeta; /* Keyboard. */ int config_monitortype; /* Monitor. */ char *config_hsyncrange; char *config_vsyncrange; char *config_monitoridentifier; char *config_monitorvendorname; char *config_monitormodelname; -int config_videomemory; +int config_videomemory; /* Video card. */ int config_screentype; /* mono, vga16, svga, accel */ char *config_deviceidentifier; char *config_devicevendorname; @@ -90,6 +133,18 @@ char *config_modesline32bpp; int config_virtualx8bpp, config_virtualy8bpp; int config_virtualx16bpp, config_virtualy16bpp; int config_virtualx32bpp, config_virtualy32bpp; +char *config_ramdac; +char *config_dacspeed; +char *config_clockchip; + +/* + * These are from the selected card definition. Parameters from the + * definition are offered during the questioning about the video card. + */ + +int card_selected; /* Card selected from database. */ +int card_screentype; +int card_accelserver; void write_XF86Config(); @@ -104,9 +159,10 @@ static char *intro_text = "This program will create a basic XF86Config file, based on menu selections you\n" "make.\n" "\n" -"The XF86Config file usually resides in /usr/X11R6/lib/X11. A sample XF86Config\n" -"file is supplied with XFree86; this program does not use it. The program\n" -"will ask for a pathname when it is ready to write the file.\n" +"The XF86Config file usually resides in /usr/X11R6/lib/X11 or /etc. A sample\n" +"XF86Config 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" "\n" "You can either take the sample XF86Config as a base and edit it for your\n" "configuration, or let this program produce a base XF86Config file for your\n" @@ -185,7 +241,7 @@ static char *mousetype_name[8] = { "Mouse Systems (3-button protocol)", "Bus Mouse", "PS/2 Mouse", - "Logitech Mouse (old type, Logitech protocol)", + "Logitech Mouse (serial, old type, Logitech protocol)", "Logitech MouseMan (Microsoft compatible)", "MM Series", /* XXXX These descriptions should be improved. */ "MM HitTablet" @@ -213,7 +269,7 @@ static char *mousecomment_text = "two main varieties of the latter type: mice with a switch to select the\n" "protocol, and mice that default to 1 and require a button to be held at\n" "boot-time to select protocol 2. Some mice can be convinced to do 2 by sending\n" -"a special sequence to the serial port.\n" +"a special sequence to the serial port (see the ClearDTR/ClearRTS options).\n" "\n"; static char *twobuttonmousecomment_text = @@ -233,6 +289,11 @@ static char *microsoftmousecomment_text = "Logitech, you might want to enable ChordMiddle which could cause the\n" "third button to work.\n"; +static char *mousesystemscomment_text = +"You have selected a Mouse Systems protocol mouse. If your mouse is normally\n" +"in Microsoft-compatible mode, enabling the ClearDTR and ClearRTS options\n" +"may cause it to switch to Mouse Systems mode when the server starts.\n"; + static char *logitechmousecomment_text = "You have selected a Logitech protocol mouse. This is only valid for old\n" "Logitech mice.\n"; @@ -287,6 +348,19 @@ void mouse_configuration() { printf("\n"); } + config_cleardtrrts = 0; + if (config_mousetype == 1) { + /* Mouse Systems. */ + printf("%s", mousesystemscomment_text); + printf("\n"); + printf("Please answer the following question with either 'y' or 'n'.\n"); + printf("Do you want to enable ClearDTR and ClearRTS? "); + getstring(s); + if (answerisyes(s)) + config_cleardtrrts = 1; + printf("\n"); + } + switch (config_mousetype) { case 0 : /* Microsoft compatible */ if (config_chordmiddle) @@ -327,6 +401,32 @@ void mouse_configuration() { /* + * Keyboard configuration. + */ + +/* XXXX Does this make sense? */ + +static char *keyboardalt_text = +"If you want your keyboard to generate non-ASCII characters in X, because\n" +"you want to be able to enter language-specific characters, you can\n" +"set the left Alt key to Meta, and the right Alt key to ModeShift.\n" +"\n"; + +void keyboard_configuration() { + char s[80]; + printf("%s", keyboardalt_text); + + printf("Please answer the following question with either 'y' or 'n'.\n"); + printf("Do you want to enable these bindings for the Alt keys? "); + getstring(s); + config_altmeta = 0; + if (!answerisyes(s)) + config_altmeta = 1; + printf("\n"); +} + + +/* * Monitor configuration. */ @@ -345,6 +445,10 @@ static char *hsyncintro_text = "You must indicate the horizontal sync range of your monitor. You can either\n" "select one of the predefined ranges below that correspond to industry-\n" "standard monitor types, or give a specific range.\n" +"\n" +"It is VERY IMPORTANT that you do not specify a monitor type with a horizontal\n" +"sync range that is beyond the capabilities of your monitor. If in doubt,\n" +"choose a conservative setting.\n" "\n"; static char *customhsync_text = @@ -492,13 +596,142 @@ void monitor_configuration() { /* + * Card database. + */ + +static char *cardintro_text = +"Now we must configure video card specific settings. At this point you can\n" +"choose to make a selection out of a database of video card definitions.\n" +"Because there can be variation in Ramdacs and clock generators even\n" +"between cards of the same model, it is not sensible to blindly copy\n" +"the settings (e.g. a Device section). For this reason, after you make a\n" +"selection, you will still be asked about the components of the card, with\n" +"the settings from the chosen database entry presented as a strong hint.\n" +"\n" +"The database entries include information about the chipset, what server to\n" +"run, the Ramdac and ClockChip, and comments that will be included in the\n" +"Device section. However, a lot of definitions only hint about what server\n" +"to run (based on the chipset the card uses) and are untested.\n" +"\n" +"If you can't find your card in the database, there's nothing to worry about.\n" +"You should only choose a database entry that is exactly the same model as\n" +"your card; choosing one that looks similar is just a bad idea (e.g. a\n" +"GemStone Snail 64 may be as different from a GemStone Snail 64+ in terms of\n" +"hardware as can be).\n" +"\n"; + +static char *cardunsupported_text = +"This is card is basically UNSUPPORTED. It may only work as a generic\n" +"VGA-compatible card. If you have an XFree86 version more recent than what\n" +"this card definition was based on, there's a chance that it is now\n" +"supported.\n"; + +#define NU_ACCELSERVER_IDS 8 + +static char *accelserver_id[NU_ACCELSERVER_IDS] = { + "S3", "Mach32", "Mach8", "8514", "P9000", "AGX", "W32", "Mach64" +}; + +void carddb_configuration() { + int i; + char s[80]; + card_selected = -1; + card_screentype = -1; + printf("%s", cardintro_text); + printf("Do you want to look at the card database? "); + getstring(s); + printf("\n"); + if (!answerisyes(s)) + return; + + /* + * Choose a database entry. + */ + if (parse_database()) { + printf("Couldn't read card database file %s.\n", + CARD_DATABASE_FILE); + keypress(); + return; + } + + i = 0; + for (;;) { + int j; + emptylines(); + for (j = i; j < i + 18 && j <= lastcard; j++) + printf("%3d %-50s%s\n", j, + card[j].name, + card[j].chipset); + printf("\n"); + printf("Enter a number to choose the corresponding card definition.\n"); + printf("Press enter for the next page, q to continue configuration.\n"); + printf("\n"); + getstring(s); + if (s[0] == 'q') + break; + if (strlen(s) == 0) { + i += 18; + if (i > lastcard) + i = 0; + continue; + } + card_selected = atoi(s); + if (card_selected >= 0 && card_selected <= lastcard) + break; + } + + /* + * Look at the selected card. + */ + if (card_selected != -1) { + if (strcmp(card[card_selected].server, "Mono") == 0) + card_screentype = 1; + else + if (strcmp(card[card_selected].server, "VGA16") == 0) + card_screentype = 2; + if (strcmp(card[card_selected].server, "SVGA") == 0) + card_screentype = 3; + for (i = 0; i < NU_ACCELSERVER_IDS; i++) + if (strcmp(card[card_selected].server, + accelserver_id[i]) == 0) { + card_screentype = 4; + card_accelserver = i; + break; + } + + printf("\nYour selected card definition:\n\n"); + printf("Identifier: %s\n", card[card_selected].name); + printf("Chipset: %s\n", card[card_selected].chipset); + printf("Server: XF86_%s\n", card[card_selected].server); + if (card[card_selected].ramdac != NULL) + printf("Ramdac: %s\n", card[card_selected].ramdac); + if (card[card_selected].dacspeed != NULL) + printf("DacSpeed: %s\n", card[card_selected].dacspeed); + if (card[card_selected].clockchip != NULL) + printf("Clockchip: %s\n", card[card_selected].clockchip); + if (card[card_selected].flags & NOCLOCKPROBE) + printf("Do NOT probe clocks or use any Clocks line.\n"); + if (card[card_selected].flags & UNSUPPORTED) + printf("%s", cardunsupported_text); +#if 0 /* Might be confusing. */ + if (strlen(card[card_selected].lines) > 0) + printf("Device section text:\n%s", + card[card_selected].lines); +#endif + printf("\n"); + keypress(); + } +} + + +/* * Screen/video card configuration. */ static char *screenintro_text = -"Now we must configure video card specific settings. The first thing is\n" -"which server to run. Refer to the manpages and other documentation. The\n" -"following servers are available (they may not all be installed on your system):\n" +"Now you must determine which server to run. Refer to the manpages and other\n" +"documentation. The following servers are available (they may not all be\n" +"installed on your system):\n" "\n" " 1 The XF86_Mono server. This a monochrome server that should work on any\n" " VGA-compatible card, in 640x480 (more on some SVGA chipsets).\n" @@ -508,7 +741,11 @@ static char *screenintro_text = " a number of SVGA chipsets. It is accelerated on some Cirrus and WD\n" " chipsets; it supports 16/32-bit color on certain Cirrus configurations.\n" " 4 The accelerated servers. These include XF86_S3, XF86_Mach32, XF86_Mach8,\n" +#if XFREE86_VERSION >= 311 +" XF86_8514, XF86_P9000, XF86_AGX, XF86_W32 and XF86_Mach64.\n" +#else " XF86_8514, XF86_P9000, XF86_AGX, and XF86_W32.\n" +#endif "\n" "These four server types correspond to the four different \"Screen\" sections in\n" "XF86Config (vga2, vga16, svga, accel).\n" @@ -520,6 +757,12 @@ static char *screenlink_text = "the SVGA server.\n" "\n"; +static char *varlink_text = +"The directory /var/X11R6/bin exists. On many Linux systems this is the\n" +"preferred location of the symbolic link 'X'. You can select this location\n" +"when setting the symbolic link.\n" +"\n"; + static char *deviceintro_text = "Now you must give information about your video card. This will be used for\n" "the \"Device\" section of your video card in XF86Config.\n" @@ -528,7 +771,10 @@ static char *deviceintro_text = static char *videomemoryintro_text = "You must indicate how much video memory you have. It is probably a good\n" "idea to use the same approximate amount as that detected by the server you\n" -"intend to use.\n" +"intend to use. If you encounter problems that are due to the used server\n" +"not supporting the amount memory you have (e.g. ATI Mach64 is limited to\n" +"1024K with the SVGA server), specify the maximum amount supported by the\n" +"server.\n" "\n" "How much video memory do you have on your video card:\n" "\n"; @@ -540,24 +786,84 @@ static char *screenaccelservers_text = static char *carddescintro_text = "You must now enter a few identification/description strings, namely an\n" "identifier, a vendor name, and a model name. Just pressing enter will fill\n" -"in default names.\n" +"in default names (possibly from a card definition).\n" "\n"; static char *devicevendornamecomment_text = "You can simply press enter here if you have a generic card, or want to\n" "describe your card with one string.\n"; -static char *devicecomment_text = -"More options and settings can be specified in the Device section. For most\n" -"configurations, a Clocks line is useful since it prevents the slow and nasty\n" -"sounding clock probing at server start-up. Probed clocks are displayed at\n" -"server startup, along with other server and hardware configuration info.\n" -"You can save this information in a file by running\n" +static char *devicesettingscomment_text = +"Especially for accelerated servers, Ramdac, Dacspeed and ClockChip settings\n" +"or special options may be required in the Device section.\n" +"\n"; + +static char *ramdaccomment_text = +"The RAMDAC setting only applies to the S3 and AGX servers. Some RAMDAC's are\n" +"auto-detected by the server. The detection of a RAMDAC is forced by using a\n" +"Ramdac \"identifier\" line in the Device section. The identifiers are shown\n" +"at the right of the following table of RAMDAC types:\n" +"\n"; + +#define NU_RAMDACS 13 + +static char *ramdac_name[NU_RAMDACS] = { + "AT&T 20C490 (S3 server)", + "AT&T 20C498/21C498/22C498 (S3)", + "AT&T 20C505 (S3)", + "BrookTree BT481 (AGX)", + "BrookTree BT482 (AGX)", + "BrookTree BT485/9485 (S3)", + "Sierra SC15025 (S3, AGX)", +#if XFREE86_VERSION >= 311 + "S3 GenDAC (86C708) (autodetected)", + "S3 SDAC (86C716) (autodetected)", +#else + "S3 GenDAC (86C708)", + "S3 SDAC (86C716)", +#endif + "STG-1700 (S3)", + "TI 3020 (S3)", + "TI 3025 (S3)", + "Normal DAC" +}; + +static char *ramdac_id[NU_RAMDACS] = { + "att20c490", "att20c498", "att20c505", "bt481", "bt482", + "bt485", "sc15025", "s3gendac", "s3_sdac", "stg1700", + "ti3020", "ti3025", "normal" +}; + +static char *clockchipcomment_text = +"A Clockchip line in the Device section forces the detection of a\n" +"programmable clock device. With a clockchip enabled, any required\n" +"clock can be programmed without requiring probing of clocks or a\n" +"Clocks line. Most cards don't have a programmable clock chip.\n" +"Choose from the following list:\n" +"\n"; + +#define NU_CLOCKCHIPS 6 + +static char *clockchip_name[] = { + "ICD2061A and compatibles (ICS9161A, DCS2824)", + "ICS2595", + "S3 GenDAC (86C708) and ICS5300 (autodetected)", + "S3 SDAC (86C716) and ICS5342 (autodetected)", + "Sierra SC11412", + "TI 3025", +}; + +static char *clockchip_id[] = { + "icd2061a", "ics2595", "s3gendac", "s3_sdac", "sc11412", "ti3025" +}; + +static char *deviceclockscomment_text = +"For most configurations, a Clocks line is useful since it prevents the slow\n" +"and nasty sounding clock probing at server start-up. Probed clocks are\n" +"displayed at server startup, along with other server and hardware\n" +"configuration info. You can save this information in a file by running\n" "'X -probeonly 2>output_file'. Be warned that clock probing is inherently\n" "imprecise; some clocks may be slightly too high (varies per run).\n" -"\n" -"Especially for accelerated servers, Ramdac and Dacspeed settings or special\n" -"options may be required in the Device section.\n" "\n"; static char *deviceclocksquestion_text = @@ -573,6 +879,14 @@ static char *deviceclocksquestion_text = "You must be root to be able to run X -probeonly now.\n" "\n"; +static char *probeonlywarning_text = +"It is possible that the hardware detection routines in the server somehow\n" +"cause the system to crash and the screen to remain blank. If this is the\n" +"case, do not choose this option the next time. The server may need a\n" +"Ramdac, ClockChip or special option (e.g. \"nolinear\" for S3) to probe\n" +"and start-up correctly.\n" +"\n"; + static char *modesorderintro_text = "For each depth, a list of modes (resolutions) is defined. The default\n" "resolution that the server will start-up with will be the first listed\n" @@ -597,46 +911,96 @@ static char *modeslist_text = "default mode of 1024x768.\n" "\n"; -static char *accelserver_name[7] = { +#if XFREE86_VERSION >= 311 +#define NU_ACCEL_SERVERS 8 +#else +#define NU_ACCEL_SERVERS 7 +#endif + +static char *accelserver_name[NU_ACCEL_SERVERS] = { "XF86_S3", "XF86_Mach32", "XF86_Mach8", "XF86_8514", "XF86_P9000", "XF86_AGX", "XF86_W32" +#if XFREE86_VERSION >= 311 + ,"XF86_Mach64" +#endif }; static int videomemory[5] = { 256, 512, 1024, 2048, 4096 }; +#if XFREE86_VERSION >= 311 +#define NU_MODESTRINGS 8 +#else #define NU_MODESTRINGS 5 +#endif static char *modestring[NU_MODESTRINGS] = { "\"640x400\"", "\"640x480\"", "\"800x600\"", "\"1024x768\"", - "\"1280x1024\"" + "\"1280x1024\"", +#if XFREE86_VERSION >= 311 + "\"320x200\"", + "\"320x240\"", + "\"400x300\"" +#endif }; void screen_configuration() { - int i, c; + int i, c, varlink; + int usecardscreentype; char s[80]; + FILE *f; printf("%s", screenintro_text); - printf("Which one of these four screen types do you intend to run by default (1-4)? "); + if (card_screentype != -1) + printf(" 5 Choose the server from the card definition, XF86_%s.\n\n", + card[card_selected].server); + + printf("Which one of these screen types do you intend to run by default (1-%d)? ", + 4 + (card_screentype != -1 ? 1 : 0)); getstring(s); config_screentype = atoi(s); + usecardscreentype = 0; + if (config_screentype == 5) { + config_screentype = card_screentype; /* From definition. */ + usecardscreentype = 1; + } printf("\n"); printf("%s", screenlink_text); + + f = fopen("/var/X11R6/bin", "r"); + varlink = 0; + if (f != NULL) { + varlink = 1; + printf("%s", varlink_text); + fclose(f); + } + printf("Please answer the following question with either 'y' or 'n'.\n"); printf("Do you want me to set the symbolic link? "); getstring(s); printf("\n"); if (answerisyes(s)) { char *servername; + if (varlink) { + printf("Do you want to set it in /var/X11R6/bin? "); + getstring(s); + printf("\n"); + if (!answerisyes(s)) + varlink = 0; + } + if (config_screentype == 4 && usecardscreentype) + /* Use screen type from card definition. */ + servername = accelserver_name[card_accelserver]; + else if (config_screentype == 4) { /* Accel server. */ printf("%s", screenaccelservers_text); - for (i = 0; i < 7; i++) + for (i = 0; i < NU_ACCEL_SERVERS; i++) printf("%2d %s\n", i + 1, accelserver_name[i]); printf("\n"); @@ -651,9 +1015,16 @@ void screen_configuration() { case 2 : servername = "XF86_VGA16"; break; case 3 : servername = "XF86_SVGA"; break; } - system("rm -f /usr/X11R6/bin/X"); - sprintf(s, "ln -s /usr/X11R6/bin/%s /usr/X11R6/bin/X", - servername); + if (varlink) { + system("rm -f /var/X11R6/bin/X"); + sprintf(s, "ln -s /usr/X11R6/bin/%s /var/X11R6/bin/X", + servername); + } + else { + system("rm -f /usr/X11R6/bin/X"); + sprintf(s, "ln -s /usr/X11R6/bin/%s /usr/X11R6/bin/X", + servername); + } system(s); } @@ -674,7 +1045,7 @@ void screen_configuration() { printf("Enter your choice: "); getstring(s); printf("\n"); - + c = atoi(s) - 1; if (c < 5) config_videomemory = videomemory[c]; @@ -686,11 +1057,17 @@ void screen_configuration() { } printf("%s", carddescintro_text); + if (card_selected != -1) + printf("Your card definition is %s.\n\n", + card[card_selected].name); printf("The strings are free-form, spaces are allowed.\n"); printf("Enter an identifier for your video card definition: "); getstring(s); if (strlen(s) == 0) - config_deviceidentifier = "My Video Card"; + if (card_selected != -1) + config_deviceidentifier = card[card_selected].name; + else + config_deviceidentifier = "My Video Card"; else { config_deviceidentifier = malloc(strlen(s) + 1); strcpy(config_deviceidentifier, s); @@ -717,13 +1094,11 @@ void screen_configuration() { emptylines(); - printf("%s", devicecomment_text); - /* * Initialize screen mode variables for svga and accel * to default values. * XXXX Doesn't leave room for off-screen caching in 16/32bpp modes - * for the accelerated servers. + * for the accelerated servers in some situations. */ config_modesline8bpp = config_modesline16bpp = @@ -799,12 +1174,82 @@ void screen_configuration() { } /* + * Handle the Ramdac/Clockchip setting. + */ + + printf("%s", devicesettingscomment_text); + + if (config_screentype != 4) + goto skipramdacselection; + + printf("%s", ramdaccomment_text); + + for (i = 0; i < NU_RAMDACS; i++) + printf("%2d %-60s%s\n", + i + 1, ramdac_name[i], ramdac_id[i]); + + printf("\n"); + + if (card_selected != -1) + if (card[card_selected].ramdac != NULL) + printf("The card definition has Ramdac \"%s\".\n\n", + card[card_selected].ramdac); + + printf("Just press enter if you don't want a Ramdac setting.\n"); + printf("What Ramdac setting do you want (1-%d)? ", NU_RAMDACS); + + getstring(s); + config_ramdac = NULL; + if (strlen(s) > 0) + config_ramdac = ramdac_id[atoi(s) - 1]; + + printf("\n"); +skipramdacselection: + + printf("%s", clockchipcomment_text); + + for (i = 0; i < NU_CLOCKCHIPS; i++) + printf("%2d %-60s%s\n", + i + 1, clockchip_name[i], clockchip_id[i]); + + printf("\n"); + + if (card_selected != -1) + if (card[card_selected].clockchip != NULL) + printf("The card definition has Clockchip \"%s\"\n\n", + card[card_selected].clockchip); + + printf("Just press enter if you don't want a Clockchip setting.\n"); + printf("What Clockchip setting do you want (1-%d)? ", NU_CLOCKCHIPS); + + getstring(s); + config_clockchip = NULL; + if (strlen(s) > 0) + config_clockchip = clockchip_id[atoi(s) - 1]; + + emptylines(); + + /* * Optionally run X -probeonly to figure out the clocks. */ config_numberofclockslines = 0; + printf("%s", deviceclockscomment_text); + printf("%s", deviceclocksquestion_text); + + if (card_selected != -1) + if (card[card_selected].flags & NOCLOCKPROBE) + printf("The card definition says to NOT probe clocks.\n"); + + if (config_clockchip != NULL) { + printf("Because you have enabled a Clockchip line, there's no need for clock\n" + "probing.\n"); + keypress(); + goto skipclockprobing; + } + printf("Do you want me to run 'X -probeonly' now? "); getstring(s); printf("\n"); @@ -819,9 +1264,14 @@ void screen_configuration() { printf("Sorry, you must be root to do this.\n\n"); goto endofprobeonly; } - printf("Running X -probeonly -pn -xf86config /usr/X11R6/lib/X11/XF86Config.tmp.\n"); - write_XF86Config("/usr/X11R6/lib/X11/XF86Config.tmp"); - if (system("X -probeonly -pn -xf86config /usr/X11R6/lib/X11/XF86Config.tmp 2>/tmp/dumbconfig.2")) { + printf("%s", probeonlywarning_text); + keypress(); + printf("Running X -probeonly -pn -xf86config " + TEMPORARY_XF86CONFIG_FILENAME ".\n"); + write_XF86Config(TEMPORARY_XF86CONFIG_FILENAME); + sync(); + if (system("X -probeonly -pn -xf86config " + TEMPORARY_XF86CONFIG_FILENAME "2>/tmp/dumbconfig.2")) { printf("X -probeonly call failed.\n"); printf("No Clocks line inserted.\n"); goto clocksprobefailed; @@ -856,12 +1306,13 @@ void screen_configuration() { clocksprobefailed: unlink("/tmp/dumbconfig.3"); unlink("/tmp/dumbconfig.2"); - unlink("/usr/X11R6/lib/X11/XF86Config.tmp"); + unlink(TEMPORARY_XF86CONFIG_FILENAME); printf("\n"); endofprobeonly: keypress(); } +skipclockprobing: /* * For the mono and vga16 server, no further configuration is @@ -907,7 +1358,7 @@ endofprobeonly: modes[0] = '\0'; for (i = 0; i < strlen(s); i++) { - if (s[i] < '1' || s[i] > '5') { + if (s[i] < '1' || s[i] > '0' + NU_MODESTRINGS) { printf("Invalid mode skipped.\n"); continue; } @@ -978,6 +1429,10 @@ static char *XF86Config_firstchunk_text = "\n" "Section \"Files\"\n" "\n" +"# The location of the RGB database. Note, this is the name of the\n" +"# file minus the extension (like \".txt\" or \".db\"). There is normally\n" +"# no need to change the default.\n" +"\n" " RgbPath \"/usr/X11R6/lib/X11/rgb\"\n" "\n" "# Multiple FontPath entries are allowed (which are concatenated together),\n" @@ -1028,16 +1483,18 @@ static char *XF86Config_firstchunk_text = "# Protocol \"Xqueue\"\n" "\n" " AutoRepeat 500 5\n" -" ServerNumLock\n" +"# Let the server do the NumLock processing. This should only be required\n" +"# when using pre-R6 clients\n" +"# ServerNumLock\n" "\n" "# Specifiy which keyboard LEDs can be user-controlled (eg, with xset(1))\n" "# Xleds 1 2 3\n" "\n" "# To set the LeftAlt to Meta, RightAlt key to ModeShift, \n" "# RightCtl key to Compose, and ScrollLock key to ModeLock:\n" -"\n" -"# LeftAlt Meta\n" -"# RightAlt ModeShift\n" +"\n"; + +static char *keyboardlastchunk_text = "# RightCtl Compose\n" "# ScrollLock ModeLock\n" "\n" @@ -1118,8 +1575,9 @@ static char *monitorsection_text4 = "\n"; static char *modelines_text = -"# This is a set standard mode timings. Modes that are out of monitor spec\n" -"# are automatically deleted by the server, so there's no immediate need to\n" +"# This is a set of standard mode timings. Modes that are out of monitor spec\n" +"# are automatically deleted by the server (provided the HorizSync and\n" +"# VertRefresh lines are correct), so there's no immediate need to\n" "# delete mode timings (unless particular mode timings don't work on your\n" "# monitor). With these modes, the best standard mode that your monitor\n" "# and video card can support for a given resolution is automatically\n" @@ -1156,7 +1614,35 @@ static char *modelines_text = "\n" "# 1280x1024 @ 74 Hz, 78.85 kHz hsync\n" "Modeline \"1280x1024\" 135 1280 1312 1456 1712 1024 1027 1030 1064\n" -"\n"; +"\n" +#if XFREE86_VERSION >= 311 +"# Low-res Doublescan modes\n" +"# If your chipset does not support doublescan, you get a 'squashed'\n" +"# resolution like 320x400.\n" +"\n" +"# 320x200 @ 70 Hz, 31.5 kHz hsync, 8:5 aspect ratio\n" +"Modeline \"320x200\" 12.588 320 336 384 400 200 204 205 225 Doublescan\n" +"# 320x240 @ 60 Hz, 31.5 kHz hsync, 4:3 aspect ratio\n" +"Modeline \"320x240\" 12.588 320 336 384 400 240 245 246 262 Doublescan\n" +"# 320x240 @ 72 Hz, 36.5 kHz hsync\n" +"Modeline \"320x240\" 15.750 320 336 384 400 240 244 246 262 Doublescan\n" +"# 400x300 @ 56 Hz, 35.2 kHz hsync, 4:3 aspect ratio\n" +"ModeLine \"400x300\" 18 400 416 448 512 300 301 602 312 Doublescan\n" +"# 400x300 @ 60 Hz, 37.8 kHz hsync\n" +"Modeline \"400x300\" 20 400 416 480 528 300 301 303 314 Doublescan\n" +"# 400x300 @ 72 Hz, 48.0 kHz hsync\n" +"Modeline \"400x300\" 25 400 424 488 520 300 319 322 333 Doublescan\n" +"# 480x300 @ 56 Hz, 35.2 kHz hsync, 8:5 aspect ratio\n" +"ModeLine \"480x300\" 21.656 480 496 536 616 300 301 302 312 Doublescan\n" +"# 480x300 @ 60 Hz, 37.8 kHz hsync\n" +"Modeline \"480x300\" 23.890 480 496 576 632 300 301 303 314 Doublescan\n" +"# 480x300 @ 63 Hz, 39.6 kHz hsync\n" +"Modeline \"480x300\" 25 480 496 576 632 300 301 303 314 Doublescan\n" +"# 480x300 @ 72 Hz, 48.0 kHz hsync\n" +"Modeline \"480x300\" 29.952 480 504 584 624 300 319 322 333 Doublescan\n" +"\n" +#endif +; static char *devicesection_text = "# **********************************************************************\n" @@ -1222,6 +1708,19 @@ void write_XF86Config(filename) fprintf(f, "%s", XF86Config_firstchunk_text); /* + * Write keyboard section. + */ + if (config_altmeta) { + fprintf(f, " LeftAlt Meta\n"); + fprintf(f, " RightAlt ModeShift\n"); + } + else { + fprintf(f, "# LeftAlt Meta\n"); + fprintf(f, "# RightAlt ModeShift\n"); + } + fprintf(f, "%s", keyboardlastchunk_text); + + /* * Write pointer section. */ fprintf(f, "%s", pointersection_text1); @@ -1236,6 +1735,10 @@ void write_XF86Config(filename) if (!config_chordmiddle) fprintf(f, "#"); fprintf(f, " ChordMiddle\n\n"); + if (config_cleardtrrts) { + fprintf(f, " ClearDTR\n"); + fprintf(f, " ClearRTS\n\n"); + } fprintf(f, "EndSection\n\n\n"); /* @@ -1265,9 +1768,22 @@ void write_XF86Config(filename) fprintf(f, " Identifier \"%s\"\n", config_deviceidentifier); fprintf(f, " VendorName \"%s\"\n", config_devicevendorname); fprintf(f, " BoardName \"%s\"\n", config_deviceboardname); - fprintf(f, " VideoRam %d\n", config_videomemory); + /* Rely on server to detect video memory. */ + fprintf(f, " #VideoRam %d\n", config_videomemory); + if (card_selected != -1) + /* Add comment lines from card definition. */ + fprintf(f, card[card_selected].lines); + if (config_ramdac != NULL) + fprintf(f, " Ramdac \"%s\"\n", config_ramdac); + if (card_selected != -1) + if (card[card_selected].dacspeed != NULL) + fprintf(f, " Dacspeed \"%s\"\n", + card[card_selected].dacspeed); + if (config_clockchip != NULL) + fprintf(f, " Clockchip \"%s\"\n", config_clockchip); + else if (config_numberofclockslines == 0) - fprintf(f, " # Insert Clocks lines here\n"); + fprintf(f, " # Insert Clocks lines here if appropriate\n"); else { int i; for (i = 0; i < config_numberofclockslines; i++) @@ -1422,7 +1938,11 @@ void write_XF86Config(filename) * The Accel section. */ fprintf(f, +#if XFREE86_VERSION >= 311 + "# The accelerated servers (S3, Mach32, Mach8, 8514, P9000, AGX, W32, Mach64)\n" +#else "# The accelerated servers (S3, Mach32, Mach8, 8514, P9000, AGX, W32)\n" +#endif "\n" "Section \"Screen\"\n" " Driver \"accel\"\n" @@ -1475,12 +1995,28 @@ char *ask_XF86Config_location() { "overwrite a previously configured one.\n\n"); if (getuid() == 0) { +#ifdef PREFER_XF86CONFIG_IN_ETC + printf("Shall I write it to /etc/XF86Config? "); + getstring(s); + printf("\n"); + if (answerisyes(s)) + return "/etc/XF86Config"; +#endif + printf("Please answer the following question with either 'y' or 'n'.\n"); printf("Shall I write it to the default location, /usr/X11R6/lib/X11/XF86Config? "); getstring(s); printf("\n"); if (answerisyes(s)) return "/usr/X11R6/lib/X11/XF86Config"; + +#ifndef PREFER_XF86CONFIG_IN_ETC + printf("Shall I write it to /etc/XF86Config? "); + getstring(s); + printf("\n"); + if (answerisyes(s)) + return "/etc/XF86Config"; +#endif } printf("Do you want it written to the current directory as 'XF86Config'? "); @@ -1489,7 +2025,7 @@ char *ask_XF86Config_location() { if (answerisyes(s)) return "XF86Config"; - printf("Please give a path+filename to write to: "); + printf("Please give a filename to write to: "); getstring(s); printf("\n"); filename = malloc(strlen(s) + 1); @@ -1508,7 +2044,7 @@ static char *oldxfree86_text = "XFree86 installed (XFree86 3.1 installs in '/usr/X11R6' instead of\n" "'/usr/X386').\n" "\n" -"It is imperative that the directory '/usr/X11R6/bin' is present in your\n" +"It is important that the directory '/usr/X11R6/bin' is present in your\n" "search path, *before* any occurrence of '/usr/X386/bin'. If you have installed\n" "X program binaries that are not in the base XFree86 distribution in\n" "'/usr/X386/bin', you can keep the directory in your path as long as it is\n" @@ -1580,10 +2116,18 @@ void main() { emptylines(); + keyboard_configuration(); + + emptylines(); + monitor_configuration(); emptylines(); + carddb_configuration(); + + emptylines(); + screen_configuration(); emptylines(); |